Commit bf4a3980 authored by Florent Guillaume's avatar Florent Guillaume

I added the method 'getSubscriberDocumentVerion'. This method pupose is to...

I added the method 'getSubscriberDocumentVerion'. This method pupose is to replace the method 'getSubscriberDocumentPath'.
The new method takes a docid and create a new version of that document while
the old (and still currently in use) function created a new object in the repository with an invalid docid ('xxxx_conflict_copy' is not a valid docid)


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@900 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 6d545b33
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
# #
############################################################################## ##############################################################################
"""\ """
ERP portal_synchronizations tool. ERP portal_synchronizations tool.
""" """
...@@ -71,6 +71,10 @@ class SynchronizationTool( UniqueObject, SimpleItem, ...@@ -71,6 +71,10 @@ class SynchronizationTool( UniqueObject, SimpleItem,
id = 'portal_synchronizations' id = 'portal_synchronizations'
meta_type = 'ERP5 Synchronizations' meta_type = 'ERP5 Synchronizations'
# On the server, this is use to keep track of the temporary
# copies.
objectsToRemove = []
security = ClassSecurityInfo() security = ClassSecurityInfo()
# #
...@@ -453,6 +457,35 @@ class SynchronizationTool( UniqueObject, SimpleItem, ...@@ -453,6 +457,35 @@ class SynchronizationTool( UniqueObject, SimpleItem,
LOG('getPublisherDocument publisher_object',0,publisher_object) LOG('getPublisherDocument publisher_object',0,publisher_object)
return publisher_object return publisher_object
def getSubscriberDocumentVersion(self, conflict, docid):
"""
Given a 'conflict' and a 'docid' refering to a new version of a
document, applies the conflicting changes to the document's new
version. By so, two differents versions of the same document will be
available.
Thus, the manager will be able to open both version of the document
before selecting which one to keep.
"""
subscriber = conflict.getSubscriber()
publisher_object_path = conflict.getObjectPath()
publisher_object = self.unrestrictedTraverse(publisher_object_path)
publisher_xml = self.getXMLObject(object=publisher_object,xml_mapping\
= subscriber.getXMLMapping())
directory = publisher_object.aq_parent
object_id = docid
if object_id in directory.objectIds():
directory._delObject(object_id)
conduit = ERP5Conduit()
conduit.addNode(xml=publisher_xml,object=directory,object_id=object_id)
subscriber_document = directory._getOb(object_id)
for c in self.getConflictList(conflict.getObjectPath()):
if c.getSubscriber() == subscriber:
c.applySubscriberValue(object=subscriber_document)
return subscriber_document
security.declareProtected(Permissions.AccessContentsInformation, 'getSubscriberDocumentPath') security.declareProtected(Permissions.AccessContentsInformation, 'getSubscriberDocumentPath')
def getSubscriberDocumentPath(self, conflict): def getSubscriberDocumentPath(self, conflict):
""" """
......
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