Update received
This commit is contained in:
parent
29cd7edd5d
commit
1dfebd1df7
|
@ -332,10 +332,10 @@ class Console extends \descartes\InternalController
|
||||||
}
|
}
|
||||||
|
|
||||||
//On map les données et on créer le Sms reçu
|
//On map les données et on créer le Sms reçu
|
||||||
$send_by = $number;
|
$origin = $number;
|
||||||
$content = $text;
|
$content = $text;
|
||||||
$is_command = \count($found_commands);
|
$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";
|
echo "Erreur lors de l'enregistrement du Sms\n";
|
||||||
error_log('Unable to process the Sms in file "'.$dir);
|
error_log('Unable to process the Sms in file "'.$dir);
|
||||||
|
@ -385,11 +385,11 @@ class Console extends \descartes\InternalController
|
||||||
|
|
||||||
foreach ($users as $user)
|
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'];
|
$to = $user['email'];
|
||||||
$subject = '[RaspiSms] - Transfert d\'un Sms du '.$received['send_by'];
|
$subject = '[RaspiSms] - Transfert d\'un Sms du '.$received['origin'];
|
||||||
$message = 'Le numéro '.$received['send_by']." vous a envoyé un Sms : \n".$received['content'];
|
$message = 'Le numéro '.$received['origin']." vous a envoyé un Sms : \n".$received['content'];
|
||||||
|
|
||||||
$success = mail($to, $subject, $message);
|
$success = mail($to, $subject, $message);
|
||||||
echo ' ... '.($success ? 'ok' : 'ko')."\n";
|
echo ' ... '.($success ? 'ok' : 'ko')."\n";
|
||||||
|
|
|
@ -120,17 +120,17 @@ class Received extends \descartes\InternalController
|
||||||
* @param mixed $at
|
* @param mixed $at
|
||||||
* @param mixed $origin
|
* @param mixed $origin
|
||||||
* @param mixed $content
|
* @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
|
* @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 = [
|
$received = [
|
||||||
'at' => $at,
|
'at' => $at,
|
||||||
'origin' => $origin,
|
'origin' => $origin,
|
||||||
'content' => $content,
|
'content' => $content,
|
||||||
'is_command' => $is_command,
|
'command' => $command,
|
||||||
];
|
];
|
||||||
|
|
||||||
return $this->model_received->create($received);
|
return $this->model_received->create($received);
|
||||||
|
@ -143,17 +143,17 @@ class Received extends \descartes\InternalController
|
||||||
* @param mixed $at
|
* @param mixed $at
|
||||||
* @param mixed $origin
|
* @param mixed $origin
|
||||||
* @param mixed $content
|
* @param mixed $content
|
||||||
* @param mixed $is_command
|
* @param mixed $command
|
||||||
*
|
*
|
||||||
* @return int : le nombre de ligne modifiées
|
* @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 = [
|
$received = [
|
||||||
'at' => $at,
|
'at' => $at,
|
||||||
'origin' => $origin,
|
'origin' => $origin,
|
||||||
'content' => $content,
|
'content' => $content,
|
||||||
'is_command' => $is_command,
|
'command' => $command,
|
||||||
];
|
];
|
||||||
|
|
||||||
return $this->model_received->update($id, $received);
|
return $this->model_received->update($id, $received);
|
||||||
|
|
|
@ -89,7 +89,7 @@ namespace controllers\publics;
|
||||||
$now = $now->format('Y-m-d H:i:s');
|
$now = $now->format('Y-m-d H:i:s');
|
||||||
|
|
||||||
$sendeds = $this->internal_sended->get_by_target($number);
|
$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);
|
$scheduleds = $this->internal_scheduled->get_before_date_for_number($now, $number);
|
||||||
|
|
||||||
$messages = [];
|
$messages = [];
|
||||||
|
|
|
@ -53,7 +53,7 @@ namespace controllers\publics;
|
||||||
continue;
|
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)]);
|
$this->render('received/list', ['receiveds' => $receiveds, 'page' => $page, 'limit' => $limit, 'nb_results' => \count($receiveds)]);
|
||||||
|
|
|
@ -18,7 +18,7 @@ CREATE TABLE IF NOT EXISTS scheduled
|
||||||
(
|
(
|
||||||
id INT NOT NULL AUTO_INCREMENT,
|
id INT NOT NULL AUTO_INCREMENT,
|
||||||
id_user INT NOT NULL,
|
id_user INT NOT NULL,
|
||||||
send_by VARCHAR(25) DEFAULT NULL,
|
origin VARCHAR(25) DEFAULT NULL,
|
||||||
at DATETIME NOT NULL,
|
at DATETIME NOT NULL,
|
||||||
text VARCHAR(1000) NOT NULL,
|
text VARCHAR(1000) NOT NULL,
|
||||||
flash BOOLEAN NOT NULL DEFAULT 0,
|
flash BOOLEAN NOT NULL DEFAULT 0,
|
||||||
|
|
|
@ -188,7 +188,7 @@
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php foreach ($receiveds as $received) { ?>
|
<?php foreach ($receiveds as $received) { ?>
|
||||||
<tr>
|
<tr>
|
||||||
<td><?php $this->s($received['send_by']); ?></td>
|
<td><?php $this->s($received['origin']); ?></td>
|
||||||
<td><?php $this->s($received['at']); ?></td>
|
<td><?php $this->s($received['at']); ?></td>
|
||||||
<td><?php echo ($received['is_command']) ? 'Oui' : 'Non'; ?></td>
|
<td><?php echo ($received['is_command']) ? 'Oui' : 'Non'; ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
@ -54,10 +54,10 @@
|
||||||
<?php foreach ($receiveds as $received) { ?>
|
<?php foreach ($receiveds as $received) { ?>
|
||||||
<tr>
|
<tr>
|
||||||
<td><?php $this->s($received['id']); ?></td>
|
<td><?php $this->s($received['id']); ?></td>
|
||||||
<td><?php $this->s($received['send_by']); ?></td>
|
<td><?php $this->s($received['origin']); ?></td>
|
||||||
<td><?php $this->s($received['content']); ?></td>
|
<td><?php $this->s($received['text']); ?></td>
|
||||||
<td><?php $this->s($received['at']); ?></td>
|
<td><?php $this->s($received['at']); ?></td>
|
||||||
<td><?php echo $received['is_command'] ? 'Oui' : 'Non'; ?></td>
|
<td><?php echo $received['command'] ? 'Oui' : 'Non'; ?></td>
|
||||||
<?php if ($_SESSION['user']['admin']) { ?><td><input name="ids[]" type="checkbox" value="<?php $this->s($received['id']); ?>"></td><?php } ?>
|
<?php if ($_SESSION['user']['admin']) { ?><td><input name="ids[]" type="checkbox" value="<?php $this->s($received['id']); ?>"></td><?php } ?>
|
||||||
</tr>
|
</tr>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
Loading…
Reference in New Issue