mirror of
https://github.com/RaspbianFrance/raspisms.git
synced 2025-04-20 16:37:48 +02:00
Add a test adapter and add deletion of sendeds scheduled sms
This commit is contained in:
parent
99cdf6516a
commit
9eb701ba98
8 changed files with 134 additions and 12 deletions
|
@ -217,7 +217,7 @@ namespace controllers\internals;
|
|||
|
||||
/**
|
||||
* Get all messages to send and the number to use to send theme
|
||||
* @return array : [['text', 'origin', 'destination', 'flash'], ...]
|
||||
* @return array : [['id_scheduled', 'text', 'origin', 'destination', 'flash'], ...]
|
||||
*/
|
||||
public function get_smss_to_send ()
|
||||
{
|
||||
|
@ -266,6 +266,7 @@ namespace controllers\internals;
|
|||
foreach ($numbers as $number)
|
||||
{
|
||||
$message = [
|
||||
'id_scheduled' => $scheduled['id'],
|
||||
'origin' => $scheduled['origin'],
|
||||
'destination' => $number['number'],
|
||||
'flash' => $scheduled['flash'],
|
||||
|
@ -326,6 +327,7 @@ namespace controllers\internals;
|
|||
$added_contacts[$contact['id']] = true;
|
||||
|
||||
$message = [
|
||||
'id_scheduled' => $scheduled['id'],
|
||||
'origin' => $scheduled['origin'],
|
||||
'destination' => $number['number'],
|
||||
'flash' => $scheduled['flash'],
|
||||
|
@ -373,8 +375,8 @@ namespace controllers\internals;
|
|||
|
||||
return $smss_to_send;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Return numbers for a scheduled message
|
||||
|
|
|
@ -32,10 +32,10 @@ namespace controllers\internals;
|
|||
* @param string $origin : Number of the sender
|
||||
* @param string $destination : Number of the receiver
|
||||
* @param bool $flash : Is the sms a flash
|
||||
* @param ?string $status : Status of a the sms. By default null -> unknown
|
||||
* @param string $status : Status of a the sms. By default 'unknown'
|
||||
* @return bool : false on error, new sended id else
|
||||
*/
|
||||
public function create ($at, string $text, string $origin, string $destination, bool $flash = false, ?string $status = null) : bool
|
||||
public function create ($at, string $text, string $origin, string $destination, bool $flash = false, ?string $status = 'unknown') : bool
|
||||
{
|
||||
$sended = [
|
||||
'at' => $at,
|
||||
|
|
|
@ -93,6 +93,17 @@ namespace controllers\internals;
|
|||
{
|
||||
return $this->get_model()->delete_for_user($id_user, $id);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Delete a entry by his id
|
||||
* @param int $id : Entry id
|
||||
* @return int : Number of removed rows
|
||||
*/
|
||||
public function delete (int $id)
|
||||
{
|
||||
return $this->get_model()->delete($id);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue