Ejemplo n.º 1
0
            def handleAdd(self, action):
                # create the dossier
                data, errors = self.extractData()
                if errors:
                    self.status = self.formErrorsMessage
                    return
                obj = self.createAndAdd(data)
                if obj is not None:
                    # mark only as finished if we get the new object
                    self._finishedAdd = True

                # Get a properly aq wrapped object
                dossier = self.context.get(obj.id)

                dm = getUtility(IWizardDataStorage)
                oguid = self.request.get('oguid')
                dmkey = 'accept:%s' % oguid

                # forwarding
                if dm.get(dmkey, 'is_forwarding'):
                    if dm.get(dmkey, 'is_only_assign'):
                        task = assign_forwarding_to_dossier(
                            self.context, oguid, dossier, dm.get(
                                dmkey, 'text'))

                        IStatusMessage(self.request).addStatusMessage(
                            _(u'The forwarding is now assigned to the new '
                              'dossier'),
                            'info')

                        self.request.RESPONSE.redirect(
                            '%s/edit' % task.absolute_url())

                    else:
                        task = accept_forwarding_with_successor(
                            self.context,
                            oguid,
                            dm.get(dmkey, 'text'),
                            dossier=dossier)

                        IStatusMessage(self.request).addStatusMessage(
                            _(u'The forwarding has been stored in the '
                              u'local inbox and the succesor task has been'
                              u' created'), 'info')

                        self.request.RESPONSE.redirect(
                            '%s/edit' % task.absolute_url())

                else:
                    # create the successor task, accept the predecessor
                    task = accept_task_with_successor(
                        dossier,
                        oguid,
                        dm.get(dmkey, 'text'))

                    IStatusMessage(self.request).addStatusMessage(
                        _(u'The new dossier has been created and the task '
                          u'has been copied to the new dossier.'), 'info')

                    self.request.RESPONSE.redirect(task.absolute_url())
Ejemplo n.º 2
0
            def handleAdd(self, action):
                # create the dossier
                data, errors = self.extractData()
                if errors:
                    self.status = self.formErrorsMessage
                    return
                obj = self.createAndAdd(data)
                if obj is not None:
                    # mark only as finished if we get the new object
                    self._finishedAdd = True

                # Get a properly aq wrapped object
                dossier = self.context.get(obj.id)

                dm = getUtility(IWizardDataStorage)
                oguid = self.request.get('oguid')
                dmkey = 'accept:%s' % oguid

                # forwarding
                if dm.get(dmkey, 'is_forwarding'):
                    if dm.get(dmkey, 'is_only_assign'):
                        task = assign_forwarding_to_dossier(
                            self.context, oguid, dossier, dm.get(
                                dmkey, 'text'))

                        IStatusMessage(self.request).addStatusMessage(
                            _(u'The forwarding is now assigned to the new '
                              'dossier'),
                            'info')

                        self.request.RESPONSE.redirect(
                            '%s/edit' % task.absolute_url())

                    else:
                        task = accept_forwarding_with_successor(
                            self.context,
                            oguid,
                            dm.get(dmkey, 'text'),
                            dossier=dossier)

                        IStatusMessage(self.request).addStatusMessage(
                            _(u'The forwarding has been stored in the '
                              u'local inbox and the succesor task has been'
                              u' created'), 'info')

                        self.request.RESPONSE.redirect(
                            '%s/edit' % task.absolute_url())

                else:
                    # create the successor task, accept the predecessor
                    task = accept_task_with_successor(
                        dossier,
                        oguid,
                        dm.get(dmkey, 'text'))

                    IStatusMessage(self.request).addStatusMessage(
                        _(u'The new dossier has been created and the task '
                          u'has been copied to the new dossier.'), 'info')

                    self.request.RESPONSE.redirect(task.absolute_url())
    def handle_continue(self, action):
        data, errors = self.extractData()

        if not errors:
            oguid = self.request.get('oguid')
            key = 'accept:%s' % oguid
            dm = getUtility(IWizardDataStorage)
            text = dm.get(key, 'text')

            # forwarding
            if dm.get(key, 'is_forwarding'):
                if dm.get(key, 'is_only_assign'):
                    transition_data = {
                        'text': text,
                        'dossier': IUUID(data['dossier'])}

                    wftool = api.portal.get_tool('portal_workflow')
                    task = wftool.doActionFor(
                        Oguid.parse(oguid).resolve_object(),
                        'forwarding-transition-assign-to-dossier',
                        comment=transition_data['text'],
                        transition_params=transition_data)

                    IStatusMessage(self.request).addStatusMessage(
                        _(u'The forwarding is now assigned to the dossier'),
                        'info')
                    self.request.RESPONSE.redirect(
                        '%s/edit' % task.absolute_url())

                else:
                    task = accept_forwarding_with_successor(
                        self.context, oguid, text, dossier=data['dossier'])
                    IStatusMessage(self.request).addStatusMessage(
                        _(u'The forwarding has been stored in the local inbox '
                          u'and the succesor task has been created'), 'info')
                    self.request.RESPONSE.redirect(
                        '%s/edit' % task.absolute_url())

            # task
            else:
                task = accept_task_with_successor(
                    data['dossier'], oguid, text)

                IStatusMessage(self.request).addStatusMessage(
                    _(u'The task has been copied to the selected dossier and '
                      u'accepted.'), 'info')
                self.request.RESPONSE.redirect(task.absolute_url())
Ejemplo n.º 4
0
    def test_when_accepting_task_with_successor_responsible_watcher_gets_moved_from_predecessor_to_successsor(self):
        successor = accept_task_with_successor(
            self.dossier, self.predecessor.oguid.id, 'Ok.')

        predecessor_resource = self.center.fetch_resource(self.predecessor)
        successor_resource = self.center.fetch_resource(successor)

        self.assertItemsEqual(
            [(u'james.meier', u'task_issuer'),
             (u'hugo.boss', u'regular_watcher')],
            [(subscription.watcher.actorid, subscription.role)
             for subscription in predecessor_resource.subscriptions])

        self.assertItemsEqual(
            [(u'peter.meier', u'task_responsible')],
            [(subscription.watcher.actorid, subscription.role)
             for subscription in successor_resource.subscriptions])
Ejemplo n.º 5
0
    def test_when_accepting_task_with_successor_responsible_watcher_gets_moved_from_predecessor_to_successsor(self):
        successor = accept_task_with_successor(
            self.dossier, self.predecessor.oguid.id, 'Ok.')

        predecessor_resource = self.center.fetch_resource(self.predecessor)
        successor_resource = self.center.fetch_resource(successor)

        self.assertItemsEqual(
            [(u'james.meier', u'task_issuer'),
             (u'hugo.boss', u'regular_watcher')],
            [(subscription.watcher.actorid, subscription.role)
             for subscription in predecessor_resource.subscriptions])

        self.assertItemsEqual(
            [(u'peter.meier', u'task_responsible')],
            [(subscription.watcher.actorid, subscription.role)
             for subscription in successor_resource.subscriptions])
Ejemplo n.º 6
0
    def test_multi_admin_unit_team_task(self):
        self.login(self.regular_user)

        ITask(self.task).responsible = u'team:1'
        self.task.get_sql_object().responsible = u'team:1'
        self.set_workflow_state('task-state-open', self.task)

        successor = accept_task_with_successor(
            self.dossier, self.task.oguid.id, u'Ok.')

        self.assertEquals(self.regular_user.getId(), successor.responsible)
        self.assertEquals(
            self.regular_user.getId(), successor.get_sql_object().responsible)
        self.assertEquals(
            [{'after': 'kathi.barfuss', 'id': 'responsible',
              'name': u'label_responsible', 'before': u'team:1'}],
            IResponseContainer(self.task)[-1].changes)
        self.assertEquals('task-transition-open-in-progress',
                          IResponseContainer(self.task)[-1].transition)
Ejemplo n.º 7
0
    def test_multi_admin_unit_team_task(self):
        self.login(self.regular_user)

        ITask(self.task).responsible = u'team:1'
        self.task.get_sql_object().responsible = u'team:1'
        self.set_workflow_state('task-state-open', self.task)

        successor = accept_task_with_successor(
            self.dossier, self.task.oguid.id, 'Ok.')

        self.assertEquals(self.regular_user.getId(), successor.responsible)
        self.assertEquals(
            self.regular_user.getId(), successor.get_sql_object().responsible)
        self.assertEquals(
            [{'after': 'kathi.barfuss', 'id': 'responsible',
              'name': u'label_responsible', 'before': u'team:1'},
             {'after': 'task-state-in-progress', 'id': 'review_state',
              'name': u'Issue state', 'before': 'task-state-open'}],
            IResponseContainer(self.task)[-1].changes)
Ejemplo n.º 8
0
    def handle_continue(self, action):
        data, errors = self.extractData()

        if not errors:
            oguid = self.request.get('oguid')
            key = 'accept:%s' % oguid
            dm = getUtility(IWizardDataStorage)
            text = dm.get(key, 'text')

            # forwarding
            if dm.get(key, 'is_forwarding'):
                if dm.get(key, 'is_only_assign'):
                    task = assign_forwarding_to_dossier(
                        self.context, oguid, data['dossier'], text)
                    IStatusMessage(self.request).addStatusMessage(
                        _(u'The forwarding is now assigned to the dossier'),
                        'info')
                    self.request.RESPONSE.redirect(
                        '%s/edit' % task.absolute_url())

                else:
                    task = accept_forwarding_with_successor(
                        self.context, oguid, text, dossier=data['dossier'])
                    IStatusMessage(self.request).addStatusMessage(
                        _(u'The forwarding has been stored in the local inbox '
                          u'and the succesor task has been created'), 'info')
                    self.request.RESPONSE.redirect(
                        '%s/edit' % task.absolute_url())

            # task
            else:
                task = accept_task_with_successor(
                    data['dossier'], oguid, text)

                IStatusMessage(self.request).addStatusMessage(
                    _(u'The task has been copied to the selected dossier and '
                      u'accepted.'), 'info')
                self.request.RESPONSE.redirect(task.absolute_url())
Ejemplo n.º 9
0
    def handle_continue(self, action):
        data, errors = self.extractData()

        if not errors:
            oguid = self.request.get('oguid')
            key = 'accept:%s' % oguid
            dm = getUtility(IWizardDataStorage)
            text = dm.get(key, 'text')

            # forwarding
            if dm.get(key, 'is_forwarding'):
                if dm.get(key, 'is_only_assign'):
                    task = assign_forwarding_to_dossier(
                        self.context, oguid, data['dossier'], text)
                    IStatusMessage(self.request).addStatusMessage(
                        _(u'The forwarding is now assigned to the dossier'),
                        'info')
                    self.request.RESPONSE.redirect(
                        '%s/edit' % task.absolute_url())

                else:
                    task = accept_forwarding_with_successor(
                        self.context, oguid, text, dossier=data['dossier'])
                    IStatusMessage(self.request).addStatusMessage(
                        _(u'The forwarding has been stored in the local inbox '
                          u'and the succesor task has been created'), 'info')
                    self.request.RESPONSE.redirect(
                        '%s/edit' % task.absolute_url())

            # task
            else:
                task = accept_task_with_successor(
                    data['dossier'], oguid, text)

                IStatusMessage(self.request).addStatusMessage(
                    _(u'The task has been copied to the selected dossier and '
                      u'accepted.'), 'info')
                self.request.RESPONSE.redirect(task.absolute_url())
Ejemplo n.º 10
0
            def handleAdd(self, action):
                # create the dossier
                data, errors = self.extractData()
                if errors:
                    self.status = self.formErrorsMessage
                    return
                obj = self.createAndAdd(data)
                if obj is not None:
                    # mark only as finished if we get the new object
                    self._finishedAdd = True

                # Get a properly aq wrapped object
                dossier = self.context.get(obj.id)

                dm = getUtility(IWizardDataStorage)
                oguid = self.request.get('oguid')
                dmkey = 'accept:%s' % oguid

                # forwarding
                if dm.get(dmkey, 'is_forwarding'):
                    if dm.get(dmkey, 'is_only_assign'):
                        transition_data = {
                            'text': dm.get(dmkey, 'text'),
                            'dossier': IUUID(dossier)}
                        wftool = api.portal.get_tool('portal_workflow')
                        task = wftool.doActionFor(
                            Oguid.parse(oguid).resolve_object(),
                            'forwarding-transition-assign-to-dossier',
                            comment=transition_data['text'],
                            transition_params=transition_data)

                        IStatusMessage(self.request).addStatusMessage(
                            _(u'The forwarding is now assigned to the new '
                              'dossier'),
                            'info')

                        self.request.RESPONSE.redirect(
                            '%s/edit' % task.absolute_url())

                    else:
                        task = accept_forwarding_with_successor(
                            self.context,
                            oguid,
                            dm.get(dmkey, 'text'),
                            dossier=dossier)

                        IStatusMessage(self.request).addStatusMessage(
                            _(u'The forwarding has been stored in the '
                              u'local inbox and the succesor task has been'
                              u' created'), 'info')

                        self.request.RESPONSE.redirect(
                            '%s/edit' % task.absolute_url())

                else:
                    # create the successor task, accept the predecessor
                    task = accept_task_with_successor(
                        dossier,
                        oguid,
                        dm.get(dmkey, 'text'))

                    IStatusMessage(self.request).addStatusMessage(
                        _(u'The new dossier has been created and the task '
                          u'has been copied to the new dossier.'), 'info')

                    self.request.RESPONSE.redirect(task.absolute_url())