Commit feeef104 authored by Aurel's avatar Aurel

* change security for manual validation

* better message when validation failed

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@14980 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 7df96e31
...@@ -101,27 +101,32 @@ if transaction.getTotalPrice(portal_type = \'Check Operation Line\') != transact ...@@ -101,27 +101,32 @@ if transaction.getTotalPrice(portal_type = \'Check Operation Line\') != transact
for check_operation_line in transaction.contentValues(filter = {\'portal_type\' : \'Check Operation Line\'}):\n for check_operation_line in transaction.contentValues(filter = {\'portal_type\' : \'Check Operation Line\'}):\n
check_number = check_operation_line.getAggregateFreeText()\n check_number = check_operation_line.getAggregateFreeText()\n
if not check_number:\n if not check_number:\n
msg = Message(domain=\'ui\', message=\'Check is not defined.\')\n msg = Message(domain=\'ui\', message=\'Check is not defined on line $line.\'\n
, mapping={"line" : line.getId()})\n
raise ValidationFailed, (msg,)\n raise ValidationFailed, (msg,)\n
\n \n
check_type = check_operation_line.getAggregateResource()\n check_type = check_operation_line.getAggregateResource()\n
if check_type is None:\n if check_type is None:\n
msg = Message(domain=\'ui\', message=\'Check type is not defined.\')\n msg = Message(domain=\'ui\', message=\'Check type is not defined on line $line.\'\n
, mapping={"line" : line.getId()})\n
raise ValidationFailed, (msg,)\n raise ValidationFailed, (msg,)\n
\n \n
\n \n
source_bank_account = check_operation_line.getSourcePaymentValue()\n source_bank_account = check_operation_line.getSourcePaymentValue()\n
if source_bank_account is None:\n if source_bank_account is None:\n
msg = Message(domain=\'ui\', message=\'Source bank account not defined.\')\n msg = Message(domain=\'ui\', message=\'Bank account not defined on line $line.\'\n
, mapping={"line" : line.getId()})\n
raise ValidationFailed, (msg,)\n raise ValidationFailed, (msg,)\n
\n \n
# Test if the account balance is sufficient.\n # Test if the account balance is sufficient.\n
error = context.BankAccount_checkBalance(source_bank_account.getRelativeUrl(), check_operation_line.getPrice())\n error = context.BankAccount_checkBalance(source_bank_account.getRelativeUrl(), check_operation_line.getPrice())\n
if error[\'error_code\'] == 1:\n if error[\'error_code\'] == 1:\n
msg = Message(domain=\'ui\', message="Source bank account is not sufficient.")\n msg = Message(domain=\'ui\', message="Bank account $account is not sufficient on line $line.",\n
mapping={"account": source_bank_account.getInternalBankAccountNumber, "line" : line.getId()})\n
raise ValidationFailed, (msg,)\n raise ValidationFailed, (msg,)\n
elif error[\'error_code\'] == 2:\n elif error[\'error_code\'] == 2:\n
msg = Message(domain=\'ui\', message="source bank account is not valid.")\n msg = Message(domain=\'ui\', message="Bank account $account is not valid on $line.",\n
mapping={"account": source_bank_account.getInternalBankAccountNumber, "line" : line.getId()})\n
raise ValidationFailed, (msg,)\n raise ValidationFailed, (msg,)\n
elif error[\'error_code\'] != 0:\n elif error[\'error_code\'] != 0:\n
msg = Message(domain=\'ui\', message="Unknown error code.")\n msg = Message(domain=\'ui\', message="Unknown error code.")\n
...@@ -209,6 +214,7 @@ if transaction.getSimulationState() == "draft":\n ...@@ -209,6 +214,7 @@ if transaction.getSimulationState() == "draft":\n
<string>_getiter_</string> <string>_getiter_</string>
<string>check_operation_line</string> <string>check_operation_line</string>
<string>check_number</string> <string>check_number</string>
<string>line</string>
<string>check_type</string> <string>check_type</string>
<string>source_bank_account</string> <string>source_bank_account</string>
<string>context</string> <string>context</string>
......
...@@ -43,8 +43,6 @@ ...@@ -43,8 +43,6 @@
<key> <string>transitions</string> </key> <key> <string>transitions</string> </key>
<value> <value>
<tuple> <tuple>
<string>cancel</string>
<string>cancel_action</string>
<string>deliver</string> <string>deliver</string>
<string>deliver_action</string> <string>deliver_action</string>
<string>reject</string> <string>reject</string>
......
...@@ -45,10 +45,8 @@ ...@@ -45,10 +45,8 @@
<tuple> <tuple>
<string>accept</string> <string>accept</string>
<string>accept_action</string> <string>accept_action</string>
<string>cancel</string> <string>refuse_action</string>
<string>cancel_action</string>
<string>reject</string> <string>reject</string>
<string>reject_action</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
...@@ -84,7 +84,6 @@ ...@@ -84,7 +84,6 @@
<value> <value>
<tuple> <tuple>
<string>Manager</string> <string>Manager</string>
<string>DestinationAssignor</string>
<string>DestinationAssignee</string> <string>DestinationAssignee</string>
</tuple> </tuple>
</value> </value>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="TransitionDefinition" module="Products.DCWorkflow.Transitions"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__ac_local_roles__</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_owner</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>actbox_category</string> </key>
<value> <string>workflow</string> </value>
</item>
<item>
<key> <string>actbox_name</string> </key>
<value> <string>Reject</string> </value>
</item>
<item>
<key> <string>actbox_url</string> </key>
<value> <string>%(content_url)s/BaseWorkflow_viewWorkflowActionDialog?field_my_workflow_action=refuse_action</string> </value>
</item>
<item>
<key> <string>after_script_name</string> </key>
<value> <string>reject</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>guard</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>refuse_action</string> </value>
</item>
<item>
<key> <string>new_state_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>script_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Refuse Action</string> </value>
</item>
<item>
<key> <string>trigger_type</string> </key>
<value> <int>1</int> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<tuple>
<global name="Guard" module="Products.DCWorkflow.Guard"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>roles</string> </key>
<value>
<tuple>
<string>Manager</string>
<string>DestinationAssignee</string>
</tuple>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -80,7 +80,6 @@ ...@@ -80,7 +80,6 @@
<string>Manager</string> <string>Manager</string>
<string>Assignee</string> <string>Assignee</string>
<string>DestinationAssignor</string> <string>DestinationAssignor</string>
<string>DestinationAssignee</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
287 289
\ No newline at end of file \ No newline at end of file
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