Exemple #1
0
 def archive(self, user_id=None):
     if self.is_archived:
         return
     self.doc_type = "XFormArchived"
     self.history.append(XFormOperation(user=user_id, operation="archive"))
     self.save()
     xform_archived.send(sender="couchforms", xform=self)
Exemple #2
0
 def archive(self, user=None):
     self.doc_type = "XFormArchived"
     self.history.append(XFormOperation(
         user=user,
         operation='archive',
     ))
     self.save()
     xform_archived.send(sender="couchforms", xform=self)
Exemple #3
0
 def archive(self, user=None):
     self.doc_type = "XFormArchived"
     self.history.append(XFormOperation(
         user=user,
         operation='archive',
     ))
     self.save()
     xform_archived.send(sender="couchforms", xform=self)
Exemple #4
0
 def archive(self, user=None):
     if self.is_archived:
         return
     with transaction.atomic():
         self.state = self.ARCHIVED
         self.xformoperationsql_set.create(user=user, operation=XFormOperationSQL.ARCHIVE)
         self.save()
     xform_archived.send(sender="form_processor", xform=self)
Exemple #5
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)
Exemple #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)
Exemple #7
0
    def archive(self, user_id=None):
        if self.is_archived:
            return
        # If this archive 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=True) as archive_stub:
            self.doc_type = "XFormArchived"

            self.history.append(XFormOperation(
                user=user_id,
                operation='archive',
            ))
            self.save()
            archive_stub.archive_history_updated()
            xform_archived.send(sender="couchforms", xform=self)
Exemple #8
0
    def archive(self, user_id=None):
        if self.is_archived:
            return
        # If this archive 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=True) as archive_stub:
            self.doc_type = "XFormArchived"

            self.history.append(XFormOperation(
                user=user_id,
                operation='archive',
            ))
            self.save()
            archive_stub.archive_history_updated()
            xform_archived.send(sender="couchforms", xform=self)
Exemple #9
0
 def archive(self, user_id=None):
     if self.is_archived:
         return
     from corehq.form_processor.backends.sql.dbaccessors import FormAccessorSQL
     FormAccessorSQL.archive_form(self, user_id=user_id)
     xform_archived.send(sender="form_processor", xform=self)
Exemple #10
0
 def archive(self, user_id=None):
     if self.is_archived:
         return
     from corehq.form_processor.backends.sql.dbaccessors import FormAccessorSQL
     FormAccessorSQL.archive_form(self, user_id=user_id)
     xform_archived.send(sender="form_processor", xform=self)
Exemple #11
0
 def archive(self):
     self.doc_type = "XFormArchived"
     self.save()
     xform_archived.send(sender="couchforms", xform=self)