Commit eb218b6e authored by Ivan Tyagov's avatar Ivan Tyagov

Do not archive current document.

parent 4a4db8e0
...@@ -66,19 +66,24 @@ if not reference:\n ...@@ -66,19 +66,24 @@ if not reference:\n
portal = document.getPortalObject()\n portal = document.getPortalObject()\n
portal_catalog = portal.portal_catalog\n portal_catalog = portal.portal_catalog\n
language = document.getLanguage()\n language = document.getLanguage()\n
search_kw = dict(reference=reference,\n
validation_state=validation_state,\n
# exclude current workflow changed document\n
uid=\'NOT %s\' %document.getUid())\n
if not language:\n if not language:\n
# If language is None, we have to check is this document\n # If language is None, we have to check is this document\n
# is language independent. In this case, archival is possible\n # is language independent. In this case, archival is possible\n
# But if a document exists with same reference and defined\n # But if a document exists with same reference and defined\n
# language, we can not do anything\n # language, we can not do anything\n
for old_document in portal_catalog(reference=reference, validation_state=validation_state):\n for old_document in portal_catalog(**search_kw):\n
old_document = old_document.getObject()\n old_document = old_document.getObject()\n
if not old_document.getLanguage():\n if not old_document.getLanguage():\n
old_document.archive()\n old_document.archive()\n
return\n return\n
\n \n
# We can now archive all documents with same reference and language in published state\n # We can now archive all documents with same reference and language in published state\n
for old_document in portal_catalog(reference=reference, language=language, validation_state=validation_state):\n search_kw[\'language\'] = language\n
for old_document in portal_catalog(**search_kw):\n
old_document = old_document.getObject()\n old_document = old_document.getObject()\n
old_document.archive()\n old_document.archive()\n
</string> </value> </string> </value>
......
1262 1263
\ 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