Compare commits
No commits in common. "eef74f1e9cf54265830a77aef63b59f15fc8e31b" and "4430d95d4089991d3664a11a941691ae53f9802f" have entirely different histories.
eef74f1e9c
...
4430d95d40
|
@ -306,37 +306,32 @@ namespace controllers\internals;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Cut received messages by 1000 chars max
|
$received_id = $this->create($id_user, $id_phone, $at, $text, $origin, $status, $is_command, $mms, $media_ids);
|
||||||
$text_parts = mb_str_split($text, 1000);
|
if (!$received_id)
|
||||||
foreach ($text_parts as $text)
|
|
||||||
{
|
{
|
||||||
$received_id = $this->create($id_user, $id_phone, $at, $text, $origin, $status, $is_command, $mms, $media_ids);
|
$return['error'] = true;
|
||||||
if (!$received_id)
|
$return['error_message'] = 'Impossible to insert the sms in database.';
|
||||||
{
|
|
||||||
$return['error'] = true;
|
|
||||||
$return['error_message'] = 'Impossible to insert the sms in database.';
|
|
||||||
|
|
||||||
return $return;
|
return $return;
|
||||||
}
|
|
||||||
|
|
||||||
$received = [
|
|
||||||
'id' => $received_id,
|
|
||||||
'at' => $at,
|
|
||||||
'text' => $text,
|
|
||||||
'destination' => $id_phone,
|
|
||||||
'origin' => $origin,
|
|
||||||
'command' => $is_command,
|
|
||||||
'mms' => $mms,
|
|
||||||
'medias' => $internal_media->gets_in_for_user($id_user, $media_ids),
|
|
||||||
];
|
|
||||||
|
|
||||||
$internal_webhook = new Webhook($this->bdd);
|
|
||||||
$internal_webhook->trigger($id_user, \models\Webhook::TYPE_RECEIVE_SMS, $received);
|
|
||||||
|
|
||||||
$internal_user = new User($this->bdd);
|
|
||||||
$internal_user->transfer_received($id_user, $received);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$received = [
|
||||||
|
'id' => $received_id,
|
||||||
|
'at' => $at,
|
||||||
|
'text' => $text,
|
||||||
|
'destination' => $id_phone,
|
||||||
|
'origin' => $origin,
|
||||||
|
'command' => $is_command,
|
||||||
|
'mms' => $mms,
|
||||||
|
'medias' => $internal_media->gets_in_for_user($id_user, $media_ids),
|
||||||
|
];
|
||||||
|
|
||||||
|
$internal_webhook = new Webhook($this->bdd);
|
||||||
|
$internal_webhook->trigger($id_user, \models\Webhook::TYPE_RECEIVE_SMS, $received);
|
||||||
|
|
||||||
|
$internal_user = new User($this->bdd);
|
||||||
|
$internal_user->transfer_received($id_user, $received);
|
||||||
|
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue