Commit f27afe4a authored by Aurel's avatar Aurel

2007-11-19 Aurel

* rewrite workflow script to do more check
* modify sql method to manage case of no node or payment

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@17678 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 7cb77458
...@@ -133,14 +133,18 @@ account_node_uid</string> </value> ...@@ -133,14 +133,18 @@ account_node_uid</string> </value>
select distinct(stock.node_uid) \n select distinct(stock.node_uid) \n
from stock \n from stock \n
where \n where \n
(stock.payment_uid not in (\n (1)\n
<dtml-in account_uid_list>\n <dtml-if account_uid_list>\n
<dtml-unless sequence-start>, </dtml-unless>\n or \n
<dtml-sqlvar sequence-item type="int">\n (stock.payment_uid not in ( \n
</dtml-in>\n <dtml-in account_uid_list>\n
) \n <dtml-unless sequence-start>, </dtml-unless>\n
or stock.payment_uid is NULL\n <dtml-sqlvar sequence-item type="int">\n
or stock.payment_uid = "")\n </dtml-in>\n
) \n
or stock.payment_uid is NULL\n
or stock.payment_uid = "")\n
</dtml-if>\n
<dtml-if account_node_uid>\n <dtml-if account_node_uid>\n
and stock.node_uid != <dtml-sqlvar account_node_uid type="int" >\n and stock.node_uid != <dtml-sqlvar account_node_uid type="int" >\n
</dtml-if> </dtml-if>
...@@ -186,14 +190,18 @@ where \n ...@@ -186,14 +190,18 @@ where \n
select distinct(stock.node_uid) \n select distinct(stock.node_uid) \n
from stock \n from stock \n
where \n where \n
(stock.payment_uid not in (\n (1)\n
<dtml-in account_uid_list>\n <dtml-if account_uid_list>\n
<dtml-unless sequence-start>, </dtml-unless>\n or \n
<dtml-sqlvar sequence-item type="int">\n (stock.payment_uid not in ( \n
</dtml-in>\n <dtml-in account_uid_list>\n
) \n <dtml-unless sequence-start>, </dtml-unless>\n
or stock.payment_uid is NULL\n <dtml-sqlvar sequence-item type="int">\n
or stock.payment_uid = "")\n </dtml-in>\n
) \n
or stock.payment_uid is NULL\n
or stock.payment_uid = "")\n
</dtml-if>\n
<dtml-if account_node_uid>\n <dtml-if account_node_uid>\n
and stock.node_uid != <dtml-sqlvar account_node_uid type="int" >\n and stock.node_uid != <dtml-sqlvar account_node_uid type="int" >\n
</dtml-if> </dtml-if>
......
...@@ -125,12 +125,16 @@ ...@@ -125,12 +125,16 @@
select distinct(stock.payment_uid) \n select distinct(stock.payment_uid) \n
from stock \n from stock \n
where \n where \n
stock.payment_uid in (\n (1)\n
<dtml-in account_uid_list>\n <dtml-if account_uid_list>\n
<dtml-unless sequence-start>, </dtml-unless>\n and\n
<dtml-sqlvar sequence-item type="int">\n stock.payment_uid in (\n
</dtml-in>\n <dtml-in account_uid_list>\n
) \n <dtml-unless sequence-start>, </dtml-unless>\n
<dtml-sqlvar sequence-item type="int">\n
</dtml-in>\n
) \n
</dtml-if>\n
and stock.payment_uid is not NULL \n and stock.payment_uid is not NULL \n
and stock.payment_uid != "" and stock.payment_uid != ""
...@@ -175,12 +179,16 @@ where \n ...@@ -175,12 +179,16 @@ where \n
select distinct(stock.payment_uid) \n select distinct(stock.payment_uid) \n
from stock \n from stock \n
where \n where \n
stock.payment_uid in (\n (1)\n
<dtml-in account_uid_list>\n <dtml-if account_uid_list>\n
<dtml-unless sequence-start>, </dtml-unless>\n and\n
<dtml-sqlvar sequence-item type="int">\n stock.payment_uid in (\n
</dtml-in>\n <dtml-in account_uid_list>\n
) \n <dtml-unless sequence-start>, </dtml-unless>\n
<dtml-sqlvar sequence-item type="int">\n
</dtml-in>\n
) \n
</dtml-if>\n
and stock.payment_uid is not NULL \n and stock.payment_uid is not NULL \n
and stock.payment_uid != "" and stock.payment_uid != ""
......
...@@ -75,33 +75,58 @@ from Products.ERP5Type.Message import Message\n ...@@ -75,33 +75,58 @@ from Products.ERP5Type.Message import Message\n
# Check connection definition\n # Check connection definition\n
\n \n
archive = state_change[\'object\']\n archive = state_change[\'object\']\n
min_stop_date = archive.getStopDateRangeMin()\n min_stop_date = archive.getStopDateRangeMin().Date()\n
catalog_id = archive.getCatalogId()\n catalog_id = archive.getCatalogId()\n
\n \n
if "deferred" not in archive.getDeferredConnectionId():\n if "deferred" not in archive.getDeferredConnectionId():\n
msg = Message(domain=\'ui\', message=\'Deferred connection ID choose is not a deferred connection.\')\n msg = Message(domain=\'ui\', message=\'Deferred connection ID choose is not a deferred connection.\')\n
raise ValidationFailed, (msg,)\n raise ValidationFailed, (msg,)\n
\n \n
previous_archive_list = [x.getObject() for x in archive.portal_catalog(portal_type="Archive", validation_state=\'validated\')]\n
\n
def sort_max_date(a, b):\n def sort_max_date(a, b):\n
return cmp(a.getStopDateRangeMax(), b.getStopDateRangeMax())\n return cmp(a.getStopDateRangeMax(), b.getStopDateRangeMax())\n
previous_archive_list.sort(sort_max_date)\n
\n \n
if len(previous_archive_list) > 0:\n \n
# Check the date\n if archive.getStopDateRangeMax() is not None:\n
previous_archive = previous_archive_list[-1]\n \n
if previous_archive.getStopDateRangeMax() is None:\n previous_archive_list = [x.getObject() for x in archive.portal_catalog(portal_type="Archive",\n
msg = Message(domain=\'ui\', message=\'No max stop date defined in previous archive.\')\n validation_state=\'validated\')]\n
raise ValidationFailed, (msg,)\n previous_archive_list.sort(sort_max_date)\n
if previous_archive.getStopDateRangeMax() + 1 != min_stop_date:\n \n
msg = Message(domain=\'ui\', message=\'Archive are not contiguous.\')\n if len(previous_archive_list) > 0:\n
raise ValidationFailed, (msg,)\n # Check the date\n
# Check the catalog\n for x in len(previous_archive_list):\n
for arch in previous_archive_list:\n previous_archive = previous_archive_list[x]\n
if arch.getCatalogId() == catalog_id and arch is not previous_archive:\n # find a previous archive which was not for current catalog\n
msg = Message(domain=\'ui\', message=\'Use of a former catalog is prohibited.\')\n if previous_archive.getStopDateRangeMax() is not None:\n
break\n
if previous_archive.getStopDateRangeMax().Date() != min_stop_date:\n
msg = Message(domain=\'ui\', message=\'Archive are not contiguous.\')\n
raise ValidationFailed, (msg,)\n
else:\n
previous_archive_list = [x.getObject() for x in archive.portal_catalog(portal_type="Archive",\n
validation_state=\'ready\')]\n
previous_archive_list.sort(sort_max_date)\n
\n
if len(previous_archive_list) > 0:\n
# Check the date\n
for x in len(previous_archive_list):\n
previous_archive = previous_archive_list[x]\n
# find a previous archive which was not for current catalog\n
if previous_archive.getStopDateRangeMax() is not None:\n
break\n
if previous_archive.getStopDateRangeMax().Date() != min_stop_date:\n
msg = Message(domain=\'ui\', message=\'Archive are not contiguous.\')\n
raise ValidationFailed, (msg,)\n raise ValidationFailed, (msg,)\n
\n
\n
# Check the catalog\n
previous_archive_list = [x.getObject() for x in archive.portal_catalog(portal_type="Archive",\n
validation_state=[\'validated\', \'ready\'])]\n
\n
for arch in previous_archive_list:\n
if arch.getCatalogId() == catalog_id and arch is not previous_archive:\n
msg = Message(domain=\'ui\', message=\'Use of a former catalog is prohibited.\')\n
raise ValidationFailed, (msg,)\n
]]></string> </value> ]]></string> </value>
...@@ -157,15 +182,15 @@ if len(previous_archive_list) > 0:\n ...@@ -157,15 +182,15 @@ if len(previous_archive_list) > 0:\n
<string>min_stop_date</string> <string>min_stop_date</string>
<string>catalog_id</string> <string>catalog_id</string>
<string>msg</string> <string>msg</string>
<string>sort_max_date</string>
<string>None</string>
<string>append</string> <string>append</string>
<string>$append0</string> <string>$append0</string>
<string>_getiter_</string> <string>_getiter_</string>
<string>x</string> <string>x</string>
<string>previous_archive_list</string> <string>previous_archive_list</string>
<string>sort_max_date</string>
<string>len</string> <string>len</string>
<string>previous_archive</string> <string>previous_archive</string>
<string>None</string>
<string>arch</string> <string>arch</string>
</tuple> </tuple>
</value> </value>
......
2007-11-19 Aurel
* rewrite workflow script to do more check
2007-11-14 Aurel 2007-11-14 Aurel
* update workflow to defined h:m:s on archive date, many zsql method and script update to take more cases into account * update workflow to defined h:m:s on archive date, many zsql method and script update to take more cases into account
......
62 66
\ 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