automatically add medias as link if phone does not support mms

This commit is contained in:
osaajani 2021-04-16 20:20:19 +02:00
parent 4cd52ae9ec
commit 878d820dc2
7 changed files with 20 additions and 39 deletions

View file

@ -333,31 +333,6 @@ namespace controllers\publics;
return $this->json($return);
}
if ($id_phone && $mms && !$this->internal_phone->support_mms($id_phone, $this->internal_phone::MMS_SENDING))
{
$return = self::DEFAULT_RETURN;
$return['error'] = self::ERROR_CODES['INVALID_PARAMETER'];
$return['message'] = self::ERROR_MESSAGES['INVALID_PARAMETER'] . 'mms : You try to send a mms with a phone that does not support mms.';
$this->auto_http_code(false);
return $this->json($return);
}
//if try to send mms and no available phone support mms, return error
if (!$id_phone && $mms)
{
$phones_supporting_mms = $this->internal_phone->gets_phone_supporting_mms_for_user($this->user['id'], $this->internal_phone::MMS_SENDING);
if (!count($phones_supporting_mms))
{
$return = self::DEFAULT_RETURN;
$return['error'] = self::ERROR_CODES['INVALID_PARAMETER'];
$return['message'] = self::ERROR_MESSAGES['INVALID_PARAMETER'] . 'mms : You try to send a mms but you dont have any phone supporting mms. Please add at least one phone supporting mms before trying to send one.';
$this->auto_http_code(false);
return $this->json($return);
}
}
if ($mms)
{
foreach ($files_arrays as $file)

View file

@ -106,13 +106,6 @@ namespace controllers\publics;
$id_user = $_SESSION['user']['id'];
if ($since && !($since = date('Y-m-d H:i:s', $since)))
{
echo json_encode(['transaction_id' => $transaction_id, 'messages' => [], 'error' => true, 'error_message' => 'Not a valid date.']);
return false;
}
$sendeds = $this->internal_sended->gets_by_destination_and_user($id_user, $number);
$receiveds = $this->internal_received->gets_by_origin_and_user($id_user, $number);
$scheduleds = $this->internal_scheduled->gets_before_date_for_number_and_user($id_user, $now, $number);