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>
select distinct(stock.node_uid) \n
from stock \n
where \n
(stock.payment_uid not in (\n
<dtml-in account_uid_list>\n
<dtml-unless sequence-start>, </dtml-unless>\n
<dtml-sqlvar sequence-item type="int">\n
</dtml-in>\n
) \n
or stock.payment_uid is NULL\n
or stock.payment_uid = "")\n
(1)\n
<dtml-if account_uid_list>\n
or \n
(stock.payment_uid not in ( \n
<dtml-in account_uid_list>\n
<dtml-unless sequence-start>, </dtml-unless>\n
<dtml-sqlvar sequence-item type="int">\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
and stock.node_uid != <dtml-sqlvar account_node_uid type="int" >\n
</dtml-if>
......@@ -186,14 +190,18 @@ where \n
select distinct(stock.node_uid) \n
from stock \n
where \n
(stock.payment_uid not in (\n
<dtml-in account_uid_list>\n
<dtml-unless sequence-start>, </dtml-unless>\n
<dtml-sqlvar sequence-item type="int">\n
</dtml-in>\n
) \n
or stock.payment_uid is NULL\n
or stock.payment_uid = "")\n
(1)\n
<dtml-if account_uid_list>\n
or \n
(stock.payment_uid not in ( \n
<dtml-in account_uid_list>\n
<dtml-unless sequence-start>, </dtml-unless>\n
<dtml-sqlvar sequence-item type="int">\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
and stock.node_uid != <dtml-sqlvar account_node_uid type="int" >\n
</dtml-if>
......
......@@ -125,12 +125,16 @@
select distinct(stock.payment_uid) \n
from stock \n
where \n
stock.payment_uid in (\n
<dtml-in account_uid_list>\n
<dtml-unless sequence-start>, </dtml-unless>\n
<dtml-sqlvar sequence-item type="int">\n
</dtml-in>\n
) \n
(1)\n
<dtml-if account_uid_list>\n
and\n
stock.payment_uid in (\n
<dtml-in account_uid_list>\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 != ""
......@@ -175,12 +179,16 @@ where \n
select distinct(stock.payment_uid) \n
from stock \n
where \n
stock.payment_uid in (\n
<dtml-in account_uid_list>\n
<dtml-unless sequence-start>, </dtml-unless>\n
<dtml-sqlvar sequence-item type="int">\n
</dtml-in>\n
) \n
(1)\n
<dtml-if account_uid_list>\n
and\n
stock.payment_uid in (\n
<dtml-in account_uid_list>\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 != ""
......
......@@ -75,33 +75,58 @@ from Products.ERP5Type.Message import Message\n
# Check connection definition\n
\n
archive = state_change[\'object\']\n
min_stop_date = archive.getStopDateRangeMin()\n
min_stop_date = archive.getStopDateRangeMin().Date()\n
catalog_id = archive.getCatalogId()\n
\n
if "deferred" not in archive.getDeferredConnectionId():\n
msg = Message(domain=\'ui\', message=\'Deferred connection ID choose is not a deferred connection.\')\n
raise ValidationFailed, (msg,)\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
return cmp(a.getStopDateRangeMax(), b.getStopDateRangeMax())\n
previous_archive_list.sort(sort_max_date)\n
\n
if len(previous_archive_list) > 0:\n
# Check the date\n
previous_archive = previous_archive_list[-1]\n
if previous_archive.getStopDateRangeMax() is None:\n
msg = Message(domain=\'ui\', message=\'No max stop date defined in previous archive.\')\n
raise ValidationFailed, (msg,)\n
if previous_archive.getStopDateRangeMax() + 1 != min_stop_date:\n
msg = Message(domain=\'ui\', message=\'Archive are not contiguous.\')\n
raise ValidationFailed, (msg,)\n
# Check the catalog\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
\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
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
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
\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>
......@@ -157,15 +182,15 @@ if len(previous_archive_list) > 0:\n
<string>min_stop_date</string>
<string>catalog_id</string>
<string>msg</string>
<string>sort_max_date</string>
<string>None</string>
<string>append</string>
<string>$append0</string>
<string>_getiter_</string>
<string>x</string>
<string>previous_archive_list</string>
<string>sort_max_date</string>
<string>len</string>
<string>previous_archive</string>
<string>None</string>
<string>arch</string>
</tuple>
</value>
......
2007-11-19 Aurel
* rewrite workflow script to do more check
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
......
62
\ No newline at end of file
66
\ 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