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,7 +133,10 @@ account_node_uid</string> </value> ...@@ -133,7 +133,10 @@ 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-if account_uid_list>\n
or \n
(stock.payment_uid not in ( \n
<dtml-in account_uid_list>\n <dtml-in account_uid_list>\n
<dtml-unless sequence-start>, </dtml-unless>\n <dtml-unless sequence-start>, </dtml-unless>\n
<dtml-sqlvar sequence-item type="int">\n <dtml-sqlvar sequence-item type="int">\n
...@@ -141,6 +144,7 @@ where \n ...@@ -141,6 +144,7 @@ where \n
) \n ) \n
or stock.payment_uid is NULL\n or stock.payment_uid is NULL\n
or stock.payment_uid = "")\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,7 +190,10 @@ where \n ...@@ -186,7 +190,10 @@ 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-if account_uid_list>\n
or \n
(stock.payment_uid not in ( \n
<dtml-in account_uid_list>\n <dtml-in account_uid_list>\n
<dtml-unless sequence-start>, </dtml-unless>\n <dtml-unless sequence-start>, </dtml-unless>\n
<dtml-sqlvar sequence-item type="int">\n <dtml-sqlvar sequence-item type="int">\n
...@@ -194,6 +201,7 @@ where \n ...@@ -194,6 +201,7 @@ where \n
) \n ) \n
or stock.payment_uid is NULL\n or stock.payment_uid is NULL\n
or stock.payment_uid = "")\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
(1)\n
<dtml-if account_uid_list>\n
and\n
stock.payment_uid in (\n stock.payment_uid in (\n
<dtml-in account_uid_list>\n <dtml-in account_uid_list>\n
<dtml-unless sequence-start>, </dtml-unless>\n <dtml-unless sequence-start>, </dtml-unless>\n
<dtml-sqlvar sequence-item type="int">\n <dtml-sqlvar sequence-item type="int">\n
</dtml-in>\n </dtml-in>\n
) \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
(1)\n
<dtml-if account_uid_list>\n
and\n
stock.payment_uid in (\n stock.payment_uid in (\n
<dtml-in account_uid_list>\n <dtml-in account_uid_list>\n
<dtml-unless sequence-start>, </dtml-unless>\n <dtml-unless sequence-start>, </dtml-unless>\n
<dtml-sqlvar sequence-item type="int">\n <dtml-sqlvar sequence-item type="int">\n
</dtml-in>\n </dtml-in>\n
) \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,30 +75,55 @@ from Products.ERP5Type.Message import Message\n ...@@ -75,30 +75,55 @@ 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
if archive.getStopDateRangeMax() is not None:\n
\n
previous_archive_list = [x.getObject() for x in archive.portal_catalog(portal_type="Archive",\n
validation_state=\'validated\')]\n
previous_archive_list.sort(sort_max_date)\n
\n
if len(previous_archive_list) > 0:\n
# Check the date\n # Check the date\n
previous_archive = previous_archive_list[-1]\n for x in len(previous_archive_list):\n
if previous_archive.getStopDateRangeMax() is None:\n previous_archive = previous_archive_list[x]\n
msg = Message(domain=\'ui\', message=\'No max stop date defined in previous archive.\')\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
if previous_archive.getStopDateRangeMax() + 1 != min_stop_date:\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 msg = Message(domain=\'ui\', message=\'Archive are not contiguous.\')\n
raise ValidationFailed, (msg,)\n raise ValidationFailed, (msg,)\n
# Check the catalog\n \n
for arch in previous_archive_list:\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 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 msg = Message(domain=\'ui\', message=\'Use of a former catalog is prohibited.\')\n
raise ValidationFailed, (msg,)\n raise ValidationFailed, (msg,)\n
...@@ -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