예제 #1
0
    def unarchive(self, user_id=None):
        if not self.is_archived:
            return

        from corehq.form_processor.backends.sql.dbaccessors import FormAccessorSQL
        FormAccessorSQL.unarchive_form(self, user_id=user_id)
        xform_unarchived.send(sender="form_processor", xform=self)
예제 #2
0
    def unarchive(self, user_id=None):
        if not self.is_archived:
            return

        from corehq.form_processor.backends.sql.dbaccessors import FormAccessorSQL
        FormAccessorSQL.unarchive_form(self, user_id=user_id)
        xform_unarchived.send(sender="form_processor", xform=self)
예제 #3
0
 def unarchive(self, user_id=None):
     if not self.is_archived:
         return
     self.doc_type = "XFormInstance"
     self.history.append(XFormOperation(user=user_id, operation="unarchive"))
     XFormInstance.save(self)  # subclasses explicitly set the doc type so force regular save
     xform_unarchived.send(sender="couchforms", xform=self)
예제 #4
0
 def unarchive(self, user=None):
     self.doc_type = "XFormInstance"
     self.history.append(XFormOperation(
         user=user,
         operation='unarchive',
     ))
     XFormInstance.save(self) # subclasses explicitly set the doc type so force regular save
     xform_unarchived.send(sender="couchforms", xform=self)
예제 #5
0
 def unarchive(self, user=None):
     self.doc_type = "XFormInstance"
     self.history.append(XFormOperation(
         user=user,
         operation='unarchive',
     ))
     XFormInstance.save(self) # subclasses explicitly set the doc type so force regular save
     xform_unarchived.send(sender="couchforms", xform=self)
예제 #6
0
 def publish_archive_action_to_kafka(self, user_id, archive):
     from couchforms.models import UnfinishedArchiveStub
     from corehq.form_processor.submission_process_tracker import unfinished_archive
     # Delete the original stub
     UnfinishedArchiveStub.objects.filter(xform_id=self.form_id).all().delete()
     with unfinished_archive(instance=self, user_id=user_id, archive=archive):
         if archive:
             xform_archived.send(sender="couchforms", xform=self)
         else:
             xform_unarchived.send(sender="couchforms", xform=self)
예제 #7
0
 def publish_archive_action_to_kafka(self, user_id, archive):
     from couchforms.models import UnfinishedArchiveStub
     from corehq.form_processor.submission_process_tracker import unfinished_archive
     # Delete the original stub
     UnfinishedArchiveStub.objects.filter(xform_id=self.form_id).all().delete()
     with unfinished_archive(instance=self, user_id=user_id, archive=archive):
         if archive:
             xform_archived.send(sender="couchforms", xform=self)
         else:
             xform_unarchived.send(sender="couchforms", xform=self)
예제 #8
0
 def unarchive(self, user_id=None):
     if not self.is_archived:
         return
     # If this unarchive was initiated by a user, delete all other stubs for this action so that this action
     # isn't overridden
     from couchforms.models import UnfinishedArchiveStub
     UnfinishedArchiveStub.objects.filter(xform_id=self.form_id).all().delete()
     from corehq.form_processor.submission_process_tracker import unfinished_archive
     with unfinished_archive(instance=self, user_id=user_id, archive=False) as archive_stub:
         self.doc_type = "XFormInstance"
         self.history.append(XFormOperation(
             user=user_id,
             operation='unarchive',
         ))
         XFormInstance.save(self)  # subclasses explicitly set the doc type so force regular save
         archive_stub.archive_history_updated()
         xform_unarchived.send(sender="couchforms", xform=self)
예제 #9
0
 def unarchive(self, user_id=None):
     if not self.is_archived:
         return
     # If this unarchive was initiated by a user, delete all other stubs for this action so that this action
     # isn't overridden
     from couchforms.models import UnfinishedArchiveStub
     UnfinishedArchiveStub.objects.filter(xform_id=self.form_id).all().delete()
     from corehq.form_processor.submission_process_tracker import unfinished_archive
     with unfinished_archive(instance=self, user_id=user_id, archive=False) as archive_stub:
         self.doc_type = "XFormInstance"
         self.history.append(XFormOperation(
             user=user_id,
             operation='unarchive',
         ))
         XFormInstance.save(self)  # subclasses explicitly set the doc type so force regular save
         archive_stub.archive_history_updated()
         xform_unarchived.send(sender="couchforms", xform=self)