[Erp5-report] r17678 - in /erp5/trunk/bt5/erp5_archive: SkinTemplateItem/portal_skins/erp5_...

nobody at svn.erp5.org nobody at svn.erp5.org
Mon Nov 19 11:30:41 CET 2007


Author: aurel
Date: Mon Nov 19 11:30:40 2007
New Revision: 17678

URL: http://svn.erp5.org?rev=17678&view=rev
Log:
2007-11-19 Aurel
* rewrite workflow script to do more check
* modify sql method to manage case of no node or payment

Modified:
    erp5/trunk/bt5/erp5_archive/SkinTemplateItem/portal_skins/erp5_archive/Archive_getNodeUidList.xml
    erp5/trunk/bt5/erp5_archive/SkinTemplateItem/portal_skins/erp5_archive/Archive_getPaymentUidList.xml
    erp5/trunk/bt5/erp5_archive/WorkflowTemplateItem/portal_workflow/archive_workflow/scripts/checkArchive.xml
    erp5/trunk/bt5/erp5_archive/bt/change_log
    erp5/trunk/bt5/erp5_archive/bt/revision

Modified: erp5/trunk/bt5/erp5_archive/SkinTemplateItem/portal_skins/erp5_archive/Archive_getNodeUidList.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_archive/SkinTemplateItem/portal_skins/erp5_archive/Archive_getNodeUidList.xml?rev=17678&r1=17677&r2=17678&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_archive/SkinTemplateItem/portal_skins/erp5_archive/Archive_getNodeUidList.xml (original)
+++ erp5/trunk/bt5/erp5_archive/SkinTemplateItem/portal_skins/erp5_archive/Archive_getNodeUidList.xml Mon Nov 19 11:30:40 2007
@@ -133,14 +133,18 @@
 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 @@
 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>

Modified: erp5/trunk/bt5/erp5_archive/SkinTemplateItem/portal_skins/erp5_archive/Archive_getPaymentUidList.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_archive/SkinTemplateItem/portal_skins/erp5_archive/Archive_getPaymentUidList.xml?rev=17678&r1=17677&r2=17678&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_archive/SkinTemplateItem/portal_skins/erp5_archive/Archive_getPaymentUidList.xml (original)
+++ erp5/trunk/bt5/erp5_archive/SkinTemplateItem/portal_skins/erp5_archive/Archive_getPaymentUidList.xml Mon Nov 19 11:30:40 2007
@@ -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 @@
 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 != ""
 

Modified: erp5/trunk/bt5/erp5_archive/WorkflowTemplateItem/portal_workflow/archive_workflow/scripts/checkArchive.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_archive/WorkflowTemplateItem/portal_workflow/archive_workflow/scripts/checkArchive.xml?rev=17678&r1=17677&r2=17678&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_archive/WorkflowTemplateItem/portal_workflow/archive_workflow/scripts/checkArchive.xml (original)
+++ erp5/trunk/bt5/erp5_archive/WorkflowTemplateItem/portal_workflow/archive_workflow/scripts/checkArchive.xml Mon Nov 19 11:30:40 2007
@@ -75,33 +75,58 @@
 # 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
+\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
-  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
-      raise ValidationFailed, (msg,)\n
 
 
 ]]></string> </value>
@@ -157,15 +182,15 @@
                             <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>

Modified: erp5/trunk/bt5/erp5_archive/bt/change_log
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_archive/bt/change_log?rev=17678&r1=17677&r2=17678&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_archive/bt/change_log (original)
+++ erp5/trunk/bt5/erp5_archive/bt/change_log Mon Nov 19 11:30:40 2007
@@ -1,3 +1,6 @@
+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
 

Modified: erp5/trunk/bt5/erp5_archive/bt/revision
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_archive/bt/revision?rev=17678&r1=17677&r2=17678&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_archive/bt/revision (original)
+++ erp5/trunk/bt5/erp5_archive/bt/revision Mon Nov 19 11:30:40 2007
@@ -1,1 +1,1 @@
-62
+66




More information about the Erp5-report mailing list