serfreeman1337 / asterlink

Asterisk integration with Bitrix24 and SuiteCRM
MIT License
27 stars 18 forks source link

asterlink date_end not set on update in the calls table #12

Closed f1-outsourcing closed 2 years ago

f1-outsourcing commented 2 years ago

1. The first thing I noticed is that the date_end is set to the date_start, when the record is being created. I do not think this is a correct way to enter data into database. It does not make sense setting by default an incorrect value. Just leave the field null.

2. date_end seems to be not included in the update of the call record

serfreeman1337 commented 2 years ago

SuiteCRM recals date fields whenever date_start and duration_* fields are set. https://github.com/salesagility/SuiteCRM/blob/51e182b29271876a9518bcef0c5c313c4a273954/modules/Calls/Call.php#L176

Setting date_start to null in modules/AsterLink/AsterLinkEntryPoint.php should prevent suitecrm from doing that.

case 'update_call_record':
    $callBean = BeanFactory::getBean('Calls', $_POST['id']);

    foreach ($_POST['data'] as $k => $v) {
        $callBean->{$k} = $v;
    }

+   $callBean->date_start = null; // prevent suitecrm from recalculating dates
    $callBean->save();
 break;
f1-outsourcing commented 2 years ago

I see, why would someone do this.

https://github.com/salesagility/SuiteCRM/blob/51e182b29271876a9518bcef0c5c313c4a273954/modules/Calls/Call.php#L185