Commit b2c75914 authored by Jérome Perrin's avatar Jérome Perrin Committed by Kazuhiko Shiozaki

payroll_l10n_fr: use Base_redirect to redirect in Make DSN Report script

parent b724a8d1
from erp5.component.module.DateUtils import addToDate
from Products.ERP5Type.Message import translateString
if context.getSourceAdministration() is None \
or context.getEffectiveDate() is None \
or context.getFormat() is None \
or len(context.getAggregateRelatedIdList()) <= 0:
return context.REQUEST.response.redirect("%s?portal_status_message=%s" % (context.absolute_url(), "DSN can't be built if some fields are empty"))
return context.Base_redirect(form_id, keep_items={
'portal_status_message': translateString("DSN can't be built if some fields are empty"),
'portal_status_level': 'error',
})
getDSNblockDict = context.DSNMonthlyReport_getDataDictPhaseTwo
getEventDSNblockDict = context.DSNEarlyRecoveryReport_getDataDictPhaseTwo
......@@ -56,7 +60,10 @@ if leave_period.getExpirationDate() <= leave_period.getStopDate():
else:
if batch_mode:
return
context.REQUEST.response.redirect("%s?portal_status_message=%s" % (context.absolute_url(), "No need to create this DSN event report : return date is not previous to last leaved date."))
return context.Base_redirect(form_id, keep_items={
'portal_status_message': translateString("No need to create this DSN event report : return date is not previous to last leaved date."),
'portal_status_level': 'error',
})
# Print DSN
dsn_report_string = ""
......@@ -76,4 +83,7 @@ context.setTextContent(dsn_report_string.strip())
if batch_mode:
return
context.REQUEST.response.redirect("%s?portal_status_message=%s" % (context.absolute_url(), "Event DSN Record Created."))
return context.Base_redirect(form_id, keep_items={
'portal_status_message': translateString( "Event DSN Record Created."),
'portal_status_level': 'success',
})
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>batch_mode=False</string> </value>
<value> <string>form_id=\'\', batch_mode=False</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
from Products.ERP5Type.Message import translateString
from erp5.component.module.DateUtils import getNumberOfDayInMonth
if context.getSourceAdministration() is None \
......@@ -5,7 +6,10 @@ if context.getSourceAdministration() is None \
or context.getFormat() is None \
or context.getQuantity() is None \
or len(context.getAggregateRelatedIdList()) <= 0:
return context.REQUEST.response.redirect("%s?portal_status_message=%s" % (context.absolute_url(), "DSN can't be built if some fields are empty"))
return context.Base_redirect(form_id, keep_items={
'portal_status_message': translateString("DSN can't be built if some fields are empty"),
'portal_status_level': 'error',
})
portal = context.getPortalObject()
accounting_module = portal.getDefaultModuleValue("Pay Sheet Transaction")
......@@ -317,4 +321,7 @@ if batch_mode:
context.REQUEST.response.setHeader("Content-Type", "text/plain; charset=iso-8859-1")
return
context.REQUEST.response.redirect("%s?portal_status_message=%s" % (context.absolute_url(), "Monthly DSN Record Created."))
return context.Base_redirect(form_id, keep_items={
'portal_status_message': translateString("Monthly DSN Record Created."),
'portal_status_level': 'error',
})
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>batch_mode=False</string> </value>
<value> <string>form_id=\'\', batch_mode=False</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
from Products.ERP5Type.Message import translateString
from erp5.component.module.DateUtils import addToDate, getNumberOfDayInMonth
if context.getSourceAdministration() is None \
or context.getEffectiveDate() is None \
or context.getQuantity() is None:
return context.REQUEST.response.redirect("%s?portal_status_message=%s" % (context.absolute_url(), "DSN can't be built if some fields are empty"))
return context.Base_redirect(form_id, keep_items={
'portal_status_message': translateString("DSN can't be built if some fields are empty"),
'portal_status_level': 'error',
})
portal = context.getPortalObject()
accounting_module = portal.getDefaultModuleValue("Pay Sheet Transaction")
......@@ -39,7 +43,7 @@ else:
establishment = context.getSourceTradeValue()
establishment_registration_code = ''.join(establishment.getCorporateRegistrationCode().split(' '))
# Finds the head office of the comany
# Finds the head office of the company
if len(payment_transaction_list):
organisation = payment_transaction_list[0].getSourceSectionValue()
elif len(paysheet_list):
......@@ -438,4 +442,7 @@ if batch_mode:
context.REQUEST.response.setHeader("Content-Type", "text/plain; charset=iso-8859-1")
return
context.REQUEST.response.redirect("%s?portal_status_message=%s" % (context.absolute_url(), "Monthly DSN Record Created."))
return context.Base_redirect(form_id, keep_items={
'portal_status_message': translateString("Monthly DSN Record Created."),
'portal_status_level': 'success',
})
\ No newline at end of file
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>batch_mode=False</string> </value>
<value> <string>form_id=\'\', batch_mode=False</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment