From 1dfebd1df7b9bc546fc476830330dd880d9a4eeb Mon Sep 17 00:00:00 2001 From: osaajani Date: Sun, 10 Nov 2019 17:00:21 +0100 Subject: [PATCH] Update received --- controllers/internals/Console.php | 10 +++++----- controllers/internals/Received.php | 12 ++++++------ controllers/publics/Discussion.php | 2 +- controllers/publics/Received.php | 2 +- createDatabase.sql | 2 +- templates/dashboard/show.php | 2 +- templates/received/list.php | 6 +++--- 7 files changed, 18 insertions(+), 18 deletions(-) diff --git a/controllers/internals/Console.php b/controllers/internals/Console.php index 1aca790..f025040 100755 --- a/controllers/internals/Console.php +++ b/controllers/internals/Console.php @@ -332,10 +332,10 @@ class Console extends \descartes\InternalController } //On map les données et on créer le Sms reçu - $send_by = $number; + $origin = $number; $content = $text; $is_command = \count($found_commands); - if ($id_received = $this->internal_received->create($date, $send_by, $content, $is_command)) + if ($id_received = $this->internal_received->create($date, $origin, $content, $is_command)) { echo "Erreur lors de l'enregistrement du Sms\n"; error_log('Unable to process the Sms in file "'.$dir); @@ -385,11 +385,11 @@ class Console extends \descartes\InternalController foreach ($users as $user) { - echo "Transfer d'un Sms du ".$received['send_by']." à l'email ".$user['email']; + echo "Transfer d'un Sms du ".$received['origin']." à l'email ".$user['email']; $to = $user['email']; - $subject = '[RaspiSms] - Transfert d\'un Sms du '.$received['send_by']; - $message = 'Le numéro '.$received['send_by']." vous a envoyé un Sms : \n".$received['content']; + $subject = '[RaspiSms] - Transfert d\'un Sms du '.$received['origin']; + $message = 'Le numéro '.$received['origin']." vous a envoyé un Sms : \n".$received['content']; $success = mail($to, $subject, $message); echo ' ... '.($success ? 'ok' : 'ko')."\n"; diff --git a/controllers/internals/Received.php b/controllers/internals/Received.php index 01fee67..b53c282 100755 --- a/controllers/internals/Received.php +++ b/controllers/internals/Received.php @@ -120,17 +120,17 @@ class Received extends \descartes\InternalController * @param mixed $at * @param mixed $origin * @param mixed $content - * @param mixed $is_command + * @param mixed $command * * @return mixed bool|int : false si echec, sinon l'id de la nouvelle receivede insérée */ - public function create($at, $origin, $content, $is_command) + public function create($at, $origin, $content, $command) { $received = [ 'at' => $at, 'origin' => $origin, 'content' => $content, - 'is_command' => $is_command, + 'command' => $command, ]; return $this->model_received->create($received); @@ -143,17 +143,17 @@ class Received extends \descartes\InternalController * @param mixed $at * @param mixed $origin * @param mixed $content - * @param mixed $is_command + * @param mixed $command * * @return int : le nombre de ligne modifiées */ - public function update($id, $at, $origin, $content, $is_command) + public function update($id, $at, $origin, $content, $command) { $received = [ 'at' => $at, 'origin' => $origin, 'content' => $content, - 'is_command' => $is_command, + 'command' => $command, ]; return $this->model_received->update($id, $received); diff --git a/controllers/publics/Discussion.php b/controllers/publics/Discussion.php index 0d97452..976827d 100755 --- a/controllers/publics/Discussion.php +++ b/controllers/publics/Discussion.php @@ -89,7 +89,7 @@ namespace controllers\publics; $now = $now->format('Y-m-d H:i:s'); $sendeds = $this->internal_sended->get_by_target($number); - $receiveds = $this->internal_received->get_by_send_by($number); + $receiveds = $this->internal_received->get_by_origin($number); $scheduleds = $this->internal_scheduled->get_before_date_for_number($now, $number); $messages = []; diff --git a/controllers/publics/Received.php b/controllers/publics/Received.php index c950be1..acff023 100755 --- a/controllers/publics/Received.php +++ b/controllers/publics/Received.php @@ -53,7 +53,7 @@ namespace controllers\publics; continue; } - $receiveds[$key]['send_by'] = $contact['name'].' ('.$received['origin'].')'; + $receiveds[$key]['origin'] = $contact['name'].' ('.$received['origin'].')'; } $this->render('received/list', ['receiveds' => $receiveds, 'page' => $page, 'limit' => $limit, 'nb_results' => \count($receiveds)]); diff --git a/createDatabase.sql b/createDatabase.sql index e596906..77e879c 100755 --- a/createDatabase.sql +++ b/createDatabase.sql @@ -18,7 +18,7 @@ CREATE TABLE IF NOT EXISTS scheduled ( id INT NOT NULL AUTO_INCREMENT, id_user INT NOT NULL, - send_by VARCHAR(25) DEFAULT NULL, + origin VARCHAR(25) DEFAULT NULL, at DATETIME NOT NULL, text VARCHAR(1000) NOT NULL, flash BOOLEAN NOT NULL DEFAULT 0, diff --git a/templates/dashboard/show.php b/templates/dashboard/show.php index 306dd0b..d1ae4dd 100755 --- a/templates/dashboard/show.php +++ b/templates/dashboard/show.php @@ -188,7 +188,7 @@ - s($received['send_by']); ?> + s($received['origin']); ?> s($received['at']); ?> diff --git a/templates/received/list.php b/templates/received/list.php index f46eb6e..1b5a962 100755 --- a/templates/received/list.php +++ b/templates/received/list.php @@ -54,10 +54,10 @@ s($received['id']); ?> - s($received['send_by']); ?> - s($received['content']); ?> + s($received['origin']); ?> + s($received['text']); ?> s($received['at']); ?> - +