all basic functionnalities working fine
This commit is contained in:
parent
1dfebd1df7
commit
bb6f755ef2
|
@ -28,7 +28,7 @@ function verifReceived()
|
|||
jQuery('.popup-alert').fadeOut('slow');
|
||||
jQuery.getJSON(HTTP_PWD + "/received/popup", function( data ) {
|
||||
$.each(data, function(key, val) {
|
||||
showMessage('SMS reçu du ' + val.send_by.replace(/</g, "<").replace(/>/g, ">") + ' : ' + val.content.replace(/</g, "<").replace(/>/g, ">"), 1);
|
||||
showMessage('SMS reçu du ' + val.origin.replace(/</g, "<").replace(/>/g, ">") + ' : ' + val.text.replace(/</g, "<").replace(/>/g, ">"), 1);
|
||||
playReceptionSound();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -91,10 +91,10 @@ class Console extends \descartes\InternalController
|
|||
$numbers = [];
|
||||
|
||||
//On récupère les numéros pour le Sms et on les ajoute
|
||||
$target_numbers = $this->internal_scheduled->get_numbers($id_scheduled);
|
||||
foreach ($target_numbers as $target_number)
|
||||
$destination_numbers = $this->internal_scheduled->get_numbers($id_scheduled);
|
||||
foreach ($destination_numbers as $destination_number)
|
||||
{
|
||||
$numbers[] = $target_number['number'];
|
||||
$numbers[] = $destination_number['number'];
|
||||
}
|
||||
|
||||
//On récupère les contacts, et on ajoute les numéros
|
||||
|
@ -143,7 +143,7 @@ class Console extends \descartes\InternalController
|
|||
$now = $now->format('Y-m-d H:i:s');
|
||||
|
||||
//On peut maintenant ajouter le Sms
|
||||
if (!$id_sended = $this->model_sended->insert(['at' => $now, 'target' => $number, 'content' => $scheduled['content'], 'before_delivered' => ceil(mb_strlen($scheduled['content']) / 160)]))
|
||||
if (!$id_sended = $this->model_sended->insert(['at' => $now, 'destination' => $number, 'content' => $scheduled['content'], 'before_delivered' => ceil(mb_strlen($scheduled['content']) / 160)]))
|
||||
{
|
||||
echo 'Impossible d\'inserer le sms pour le numero '.$number."\n";
|
||||
}
|
||||
|
@ -249,7 +249,7 @@ class Console extends \descartes\InternalController
|
|||
$interval = new \DateInterval('PT12H');
|
||||
$sinceDate = $now->sub($interval)->format('Y-m-d H:i:s');
|
||||
|
||||
if (!$sendeds = $this->model_sended->_select('sendeds', ['target' => $number, 'delivered' => false, 'failed' => false, '>at' => $sinceDate], 'at', false, 1))
|
||||
if (!$sendeds = $this->model_sended->_select('sendeds', ['destination' => $number, 'delivered' => false, 'failed' => false, '>at' => $sinceDate], 'at', false, 1))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -66,14 +66,14 @@ namespace controllers\internals;
|
|||
/**
|
||||
* Cette fonction retourne une liste des receivedes sous forme d'un tableau.
|
||||
*
|
||||
* @param string $target : Le numéro auquel est envoyé le message
|
||||
* @param string $destination : Le numéro auquel est envoyé le message
|
||||
*
|
||||
* @return array : La liste des sendeds
|
||||
*/
|
||||
public function get_by_target($target)
|
||||
public function get_by_destination($destination)
|
||||
{
|
||||
//Recupération des sendeds
|
||||
return $this->model_sended->get_by_target($target);
|
||||
return $this->model_sended->get_by_destination($destination);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -88,7 +88,7 @@ namespace controllers\publics;
|
|||
$now = new \DateTime();
|
||||
$now = $now->format('Y-m-d H:i:s');
|
||||
|
||||
$sendeds = $this->internal_sended->get_by_target($number);
|
||||
$sendeds = $this->internal_sended->get_by_destination($number);
|
||||
$receiveds = $this->internal_received->get_by_origin($number);
|
||||
$scheduleds = $this->internal_scheduled->get_before_date_for_number($now, $number);
|
||||
|
||||
|
@ -98,7 +98,7 @@ namespace controllers\publics;
|
|||
{
|
||||
$messages[] = [
|
||||
'date' => htmlspecialchars($sended['at']),
|
||||
'text' => htmlspecialchars($sended['content']),
|
||||
'text' => htmlspecialchars($sended['text']),
|
||||
'type' => 'sended',
|
||||
'status' => ($sended['delivered'] ? 'delivered' : ($sended['failed'] ? 'failed' : '')),
|
||||
];
|
||||
|
@ -108,9 +108,9 @@ namespace controllers\publics;
|
|||
{
|
||||
$messages[] = [
|
||||
'date' => htmlspecialchars($received['at']),
|
||||
'text' => htmlspecialchars($received['content']),
|
||||
'text' => htmlspecialchars($received['text']),
|
||||
'type' => 'received',
|
||||
'md5' => md5($received['at'].$received['content']),
|
||||
'md5' => md5($received['at'].$received['text']),
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -118,7 +118,7 @@ namespace controllers\publics;
|
|||
{
|
||||
$messages[] = [
|
||||
'date' => htmlspecialchars($scheduled['at']),
|
||||
'text' => htmlspecialchars($scheduled['content']),
|
||||
'text' => htmlspecialchars($scheduled['text']),
|
||||
'type' => 'inprogress',
|
||||
];
|
||||
}
|
||||
|
@ -141,7 +141,7 @@ namespace controllers\publics;
|
|||
* Cette fonction permet d'envoyer facilement un sms à un numéro donné.
|
||||
*
|
||||
* @param string $csrf : Le jeton csrf
|
||||
* @param string $_POST['content'] : Le contenu du Sms
|
||||
* @param string $_POST['text'] : Le contenu du Sms
|
||||
* @param string $_POST['numbers'] : Un tableau avec le numero des gens auxquel envoyer le sms
|
||||
*
|
||||
* @return string : json string Le statut de l'envoi
|
||||
|
@ -163,9 +163,8 @@ namespace controllers\publics;
|
|||
$now = new \DateTime();
|
||||
$now = $now->format('Y-m-d H:i:s');
|
||||
|
||||
$scheduled = [];
|
||||
$scheduled['at'] = $now;
|
||||
$scheduled['content'] = $_POST['content'] ?? '';
|
||||
$at = $now;
|
||||
$text = $_POST['text'] ?? '';
|
||||
$numbers = $_POST['numbers'] ?? false;
|
||||
|
||||
if (!$numbers)
|
||||
|
@ -177,7 +176,7 @@ namespace controllers\publics;
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!$this->internal_scheduled->create($scheduled, $numbers))
|
||||
if (!$this->internal_scheduled->create($at, $text, false, false, $numbers))
|
||||
{
|
||||
$return['success'] = false;
|
||||
$return['message'] = 'Impossible de créer le Sms';
|
||||
|
|
|
@ -109,7 +109,7 @@ namespace models;
|
|||
FROM scheduled_group
|
||||
WHERE id_group IN (
|
||||
SELECT id_group
|
||||
FROM `group`_contact
|
||||
FROM `group_contact`
|
||||
WHERE id_contact IN (
|
||||
SELECT id
|
||||
FROM contact
|
||||
|
|
|
@ -78,13 +78,13 @@ namespace models;
|
|||
/**
|
||||
* Cette fonction retourne une liste des sended sous forme d'un tableau.
|
||||
*
|
||||
* @param string $target : Le numéro auquel est envoyé le message
|
||||
* @param string $destination : Le numéro auquel est envoyé le message
|
||||
*
|
||||
* @return array : La liste des sended
|
||||
*/
|
||||
public function get_by_target($target)
|
||||
public function get_by_destination($destination)
|
||||
{
|
||||
return $this->_select('sended', ['target' => $target]);
|
||||
return $this->_select('sended', ['destination' => $destination]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -128,9 +128,9 @@
|
|||
jQuery('.action-dropdown a').on('click', function (e)
|
||||
{
|
||||
e.preventDefault();
|
||||
var target = jQuery(this).parents('.action-dropdown').attr('target');
|
||||
var destination = jQuery(this).parents('.action-dropdown').attr('destination');
|
||||
var url = jQuery(this).attr('href');
|
||||
jQuery(target).find('input:checked').each(function ()
|
||||
jQuery(destination).find('input:checked').each(function ()
|
||||
{
|
||||
url += '/' + jQuery(this).val();
|
||||
});
|
||||
|
|
|
@ -89,9 +89,9 @@
|
|||
jQuery('.action-dropdown a').on('click', function (e)
|
||||
{
|
||||
e.preventDefault();
|
||||
var target = jQuery(this).parents('.action-dropdown').attr('target');
|
||||
var destination = jQuery(this).parents('.action-dropdown').attr('destination');
|
||||
var url = jQuery(this).attr('href');
|
||||
jQuery(target).find('input:checked').each(function ()
|
||||
jQuery(destination).find('input:checked').each(function ()
|
||||
{
|
||||
url += '/' + jQuery(this).val();
|
||||
});
|
||||
|
|
|
@ -87,9 +87,9 @@
|
|||
jQuery('.action-dropdown a').on('click', function (e)
|
||||
{
|
||||
e.preventDefault();
|
||||
var target = jQuery(this).parents('.action-dropdown').attr('target');
|
||||
var destination = jQuery(this).parents('.action-dropdown').attr('destination');
|
||||
var url = jQuery(this).attr('href');
|
||||
jQuery(target).find('input:checked').each(function ()
|
||||
jQuery(destination).find('input:checked').each(function ()
|
||||
{
|
||||
url += '/' + jQuery(this).val();
|
||||
});
|
||||
|
|
|
@ -153,7 +153,7 @@
|
|||
<tbody>
|
||||
<?php foreach ($sendeds as $sended) { ?>
|
||||
<tr>
|
||||
<td><?php $this->s($sended['target']); ?></td>
|
||||
<td><?php $this->s($sended['destination']); ?></td>
|
||||
<td><?php $this->s($sended['at']); ?></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
|
@ -190,7 +190,7 @@
|
|||
<tr>
|
||||
<td><?php $this->s($received['origin']); ?></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>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($discussions as $discussion) { ?>
|
||||
<tr class="goto" url="<?php $this->s(\Router::url('Discussion', 'show', ['number' => $discussion['number']])); ?>">
|
||||
<tr class="goto" url="<?php $this->s(\descartes\Router::url('Discussion', 'show', ['number' => $discussion['number']])); ?>">
|
||||
<td><?php $this->s($discussion['at']); ?></td>
|
||||
<td><?php $this->s(isset($discussion['contact']) ? $discussion['contact'] . ' (' . $discussion['number'] . ')' : $discussion['number']); ?></td>
|
||||
</tr>
|
||||
|
|
|
@ -36,8 +36,8 @@
|
|||
</div>
|
||||
<div class="col-lg-12 message-input-container">
|
||||
<div class="discussion-message message-input">
|
||||
<form class="send-message-discussion" action="<?php $this->s(\Router::url('Discussion', 'send', ['csrf' => $_SESSION['csrf']])); ?>" method="POST">
|
||||
<textarea name="content" placeholder="Envoyer un message..."></textarea>
|
||||
<form class="send-message-discussion" action="<?php $this->s(\descartes\Router::url('Discussion', 'send', ['csrf' => $_SESSION['csrf']])); ?>" method="POST">
|
||||
<textarea name="text" placeholder="Envoyer un message..."></textarea>
|
||||
<input type="hidden" name="numbers[]" value="<?php $this->s($number); ?>" />
|
||||
<button class="btn" ><span class="fa fa-fw fa-send-o"></span> Envoyer</button>
|
||||
</form>
|
||||
|
@ -58,7 +58,7 @@
|
|||
function getmessages ()
|
||||
{
|
||||
ajaxTransactionId = Date.now();
|
||||
jQuery.getJSON(HTTP_PWD + "/discussions/getmessages/<?php echo htmlspecialchars(urlencode($number)); ?>/" + ajaxTransactionId , function( data ) {
|
||||
jQuery.getJSON(HTTP_PWD + "/discussion/getmessage/<?php echo htmlspecialchars(urlencode($number)); ?>/" + ajaxTransactionId , function( data ) {
|
||||
|
||||
if (data.transaction_id != ajaxTransactionId)
|
||||
{
|
||||
|
|
|
@ -98,9 +98,9 @@
|
|||
jQuery('.action-dropdown a').on('click', function (e)
|
||||
{
|
||||
e.preventDefault();
|
||||
var target = jQuery(this).parents('.action-dropdown').attr('target');
|
||||
var destination = jQuery(this).parents('.action-dropdown').attr('destination');
|
||||
var url = jQuery(this).attr('href');
|
||||
jQuery(target).find('input:checked').each(function ()
|
||||
jQuery(destination).find('input:checked').each(function ()
|
||||
{
|
||||
url += '/' + jQuery(this).val();
|
||||
});
|
||||
|
|
|
@ -87,9 +87,9 @@
|
|||
jQuery('.action-dropdown a').on('click', function (e)
|
||||
{
|
||||
e.preventDefault();
|
||||
var target = jQuery(this).parents('.action-dropdown').attr('target');
|
||||
var destination = jQuery(this).parents('.action-dropdown').attr('destination');
|
||||
var url = jQuery(this).attr('href');
|
||||
jQuery(target).find('input:checked').each(function ()
|
||||
jQuery(destination).find('input:checked').each(function ()
|
||||
{
|
||||
url += '/' + jQuery(this).val();
|
||||
});
|
||||
|
|
|
@ -97,9 +97,9 @@
|
|||
jQuery('.action-dropdown a').on('click', function (e)
|
||||
{
|
||||
e.preventDefault();
|
||||
var target = jQuery(this).parents('.action-dropdown').attr('target');
|
||||
var destination = jQuery(this).parents('.action-dropdown').attr('destination');
|
||||
var url = jQuery(this).attr('href');
|
||||
jQuery(target).find('input:checked').each(function ()
|
||||
jQuery(destination).find('input:checked').each(function ()
|
||||
{
|
||||
url += '/' + jQuery(this).val();
|
||||
});
|
||||
|
|
|
@ -87,9 +87,9 @@
|
|||
jQuery('.action-dropdown a').on('click', function (e)
|
||||
{
|
||||
e.preventDefault();
|
||||
var target = jQuery(this).parents('.action-dropdown').attr('target');
|
||||
var destination = jQuery(this).parents('.action-dropdown').attr('destination');
|
||||
var url = jQuery(this).attr('href');
|
||||
jQuery(target).find('input:checked').each(function ()
|
||||
jQuery(destination).find('input:checked').each(function ()
|
||||
{
|
||||
url += '/' + jQuery(this).val();
|
||||
});
|
||||
|
|
|
@ -110,9 +110,9 @@
|
|||
jQuery('.action-dropdown a').on('click', function (e)
|
||||
{
|
||||
e.preventDefault();
|
||||
var target = jQuery(this).parents('.action-dropdown').attr('target');
|
||||
var destination = jQuery(this).parents('.action-dropdown').attr('destination');
|
||||
var url = jQuery(this).attr('href');
|
||||
jQuery(target).find('input:checked').each(function ()
|
||||
jQuery(destination).find('input:checked').each(function ()
|
||||
{
|
||||
url += '/' + jQuery(this).val();
|
||||
});
|
||||
|
|
|
@ -178,9 +178,9 @@
|
|||
jQuery('.action-dropdown a').on('click', function (e)
|
||||
{
|
||||
e.preventDefault();
|
||||
var target = jQuery(this).parents('.action-dropdown').attr('target');
|
||||
var destination = jQuery(this).parents('.action-dropdown').attr('destination');
|
||||
var url = jQuery(this).attr('href');
|
||||
jQuery(target).find('input:checked').each(function ()
|
||||
jQuery(destination).find('input:checked').each(function ()
|
||||
{
|
||||
url += '/' + jQuery(this).val();
|
||||
});
|
||||
|
|
|
@ -93,9 +93,9 @@
|
|||
jQuery('.action-dropdown a').on('click', function (e)
|
||||
{
|
||||
e.preventDefault();
|
||||
var target = jQuery(this).parents('.action-dropdown').attr('target');
|
||||
var destination = jQuery(this).parents('.action-dropdown').attr('destination');
|
||||
var url = jQuery(this).attr('href');
|
||||
jQuery(target).find('input:checked').each(function ()
|
||||
jQuery(destination).find('input:checked').each(function ()
|
||||
{
|
||||
url += '/' + jQuery(this).val();
|
||||
});
|
||||
|
|
|
@ -81,9 +81,9 @@
|
|||
jQuery('.action-dropdown a').on('click', function (e)
|
||||
{
|
||||
e.preventDefault();
|
||||
var target = jQuery(this).parents('.action-dropdown').attr('target');
|
||||
var destination = jQuery(this).parents('.action-dropdown').attr('destination');
|
||||
var url = jQuery(this).attr('href');
|
||||
jQuery(target).find('input:checked').each(function ()
|
||||
jQuery(destination).find('input:checked').each(function ()
|
||||
{
|
||||
url += '/' + jQuery(this).val();
|
||||
});
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
</div>
|
||||
<div class="text-right col-xs-6 no-padding">
|
||||
<strong>Action pour la séléction :</strong>
|
||||
<div class="btn-groupe action-dropdown" target="#table-webhooks">
|
||||
<div class="btn-groupe action-dropdown" destination="#table-webhooks">
|
||||
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">Action pour la sélection <span class="caret"></span></button>
|
||||
<ul class="dropdown-menu pull-right" role="menu">
|
||||
<li><a href="<?php echo \descartes\Router::url('webhooks', 'edit', [$_SESSION['csrf']]); ?>"><span class="fa fa-edit"></span> Modifier</a></li>
|
||||
|
@ -84,9 +84,9 @@
|
|||
jQuery('.action-dropdown a').on('click', function (e)
|
||||
{
|
||||
e.preventDefault();
|
||||
var target = jQuery(this).parents('.action-dropdown').attr('target');
|
||||
var destination = jQuery(this).parents('.action-dropdown').attr('destination');
|
||||
var url = jQuery(this).attr('href');
|
||||
jQuery(target).find('input:checked').each(function ()
|
||||
jQuery(destination).find('input:checked').each(function ()
|
||||
{
|
||||
url += '/' + jQuery(this).val();
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue