Can't find the trigger for task status, completed

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • elbowprogrammer
    Member
    • Jan 2016
    • 58

    Can't find the trigger for task status, completed

    I'm trying to find the trigger that displays, Date Completed {{time}}, when user changes status to completed. I've looked, but I seem to can't find it. I want to input an algorithm to when status change from completed to billed, to not remove those fields from view, only when status change from completed to billed.
  • alasdaircr
    Active Community Member
    • Aug 2014
    • 525

    #2
    Code:
    application/Espo/Modules/Crm/Repositories/Task.php
    
    protected function beforeSave(Entity $entity, array $options)
        {
            parent::beforeSave($entity, $options);
    
            if ($entity->isFieldChanged('status')) {
                if ($entity->get('status') == 'Completed') {
                    $entity->set('dateCompleted', date('Y-m-d H:i:s'));
                } else {
                    $entity->set('dateCompleted', null);
                }
            }

    Comment

    • elbowprogrammer
      Member
      • Jan 2016
      • 58

      #3
      When I change the one line of code to, $entity->get('status') == 'Billed', to see if from the user side will display the label of DATE COMPLETED and the time, it doesn't show. I know I can keep the field, datecompleted, in the db to still have to the time it completed it's task, but for the user's visual comfort, I want the label of DATE COMPLETED and time still be visible when status has been changed from completed to billed. I can write the algorithm on the server to do that, but from the client side, when user changes status to completed, there is some trigger to display the label of DATE COMPLETED and the time. I'm looking for that.

      Comment

      • alasdaircr
        Active Community Member
        • Aug 2014
        • 525

        #4
        Code:
        application/Espo/Modules/Crm/Resources/metadata/clientDefs/Task.json
        It's in the formDependency section.

        Comment

        • elbowprogrammer
          Member
          • Jan 2016
          • 58

          #5
          For testing purposes, changing the formDepency->status->map to "Billed", as well as $entity->get('status') == 'Billed', and even filterCompleted to 'Billed' in the SelectManagers, no change to the label DATE COMPLETED and the time doesn't display.

          Comment

          • worldmiros
            Senior Member
            • Dec 2015
            • 120

            #6
            Think the file client/src/views/fields/datetime.js is responsible for displaying, Date Completed Today 8:01.

            Comment

            • alasdaircr
              Active Community Member
              • Aug 2014
              • 525

              #7
              Did you rebuild metadata / refresh your browser etc? If you change the form dependency the label DATE COMPLETED WILL SHOW

              Comment

              • alasdaircr
                Active Community Member
                • Aug 2014
                • 525

                #8
                OK but did you go to Admin -> Rebuild, because the metadata including the clientDef's formDependencies won't be updated until you do that.

                Anyway.. good luck! Form Dependencies work great for me.

                Comment

                Working...