call duration in db always set to default value?

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

    call duration in db always set to default value?

    after creating a call and saving it; in the db, keep showing the default value, 300 = 5min. no matter what duration I change it to, the db still shows 300 in the duration column. from the user side, it shows what duration I set it to, but duration in the db always to default value. where can I rectify that?
  • yuri
    Member
    • Mar 2014
    • 8627

    #2
    date end - date start = duration.
    If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

    Comment

    • elbowprogrammer
      Member
      • Jan 2016
      • 58

      #3
      date end - date start does equal the duration, but in the db, it's still showing the default value in the duration column. the value of duration is not setting in the db. The, 1h 30m is not translating into the db. in the db, does show the correct date_end and date_start, but not the correct duration.

      Comment

      • worldmiros
        Senior Member
        • Dec 2015
        • 120

        #4
        The duration for Meeting entity does the same. In the db, date_end and date_start is correct, but duration only shows the default value, not the subtraction of date_end - date_start.

        Comment

        • yuri
          Member
          • Mar 2014
          • 8627

          #5
          Duration column is not used and will be removed in 4.0.0
          If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

          Comment

          • elbowprogrammer
            Member
            • Jan 2016
            • 58

            #6
            yuri I created a directory, application/espo/modules/crm/repositories/custom/call.php along with the code below:
            PHP Code:
            
            
            namespace Espo\Modules\Crm\Repositories;     use Espo\ORM\Entity;     class Call extends \Espo\Core\ORM\Repositories\RDB  {  protected function beforeSave(Entity $entity, array $options){  parent::beforeSave($entity,$options);     if($entity->isFieldChanged('status')){  if($entity->get('status') == 'Held'){  $entity->set('dateCompleted',date('Y-m-d H:i:s'));  }  else{  $entity->set('dateCompleted',null);  }  }  }  } 
            
            I cleared cache, but I'm not able to save the date when status has been changed to Held. What could I be doing wrong?
            Last edited by elbowprogrammer; 02-25-2016, 05:55 PM.

            Comment

            • elbowprogrammer
              Member
              • Jan 2016
              • 58

              #7
              if I want to set datecompleted to a date when status has been changed to a specific status, which file would I implement that code? it would be similar to file, application/espo/modules/crm/repositories/task.php. there is a php call file in that same directory, but that class extends meeting.

              Comment

              • elbowprogrammer
                Member
                • Jan 2016
                • 58

                #8
                issue resolve. I found where to implement my algorithm

                Comment

                Working...