ajoute une fonction d'envoi de SMS à tout le répertoire

This commit is contained in:
Romain Guerrero 2016-03-24 14:03:15 +01:00
parent a03787bc53
commit 5007156562
2 changed files with 26 additions and 3 deletions

View file

@ -146,6 +146,7 @@
$numbers = (isset($_POST['numbers'])) ? $_POST['numbers'] : array();
$contacts = (isset($_POST['contacts'])) ? $_POST['contacts'] : array();
$groups = (isset($_POST['groups'])) ? $_POST['groups'] : array();
$allContacts = (isset($_POST['all-contacts'])) ? $_POST['all-contacts'] : false;
//Si pas de contenu dans le SMS
if (!$content)
@ -159,7 +160,7 @@
}
//Si pas numéros, contacts, ou groupes cibles
if (!$numbers && !$contacts && !$groups)
if (!$numbers && !$contacts && !$groups && !$allContacts)
{
if (!$api)
{
@ -215,6 +216,13 @@
}
}
if ($allContacts) {
$contacts = $db->getFromTableWhere('contacts');
foreach ($contacts as $key => $contact) {
$contacts[$key] = $contact['id'];
}
}
foreach ($contacts as $id_contact)
{
if (!$db->insertIntoTable('scheduleds_contacts', ['id_scheduled' => $id_scheduled, 'id_contact' => $id_contact]))

View file

@ -57,6 +57,11 @@
<div class="add-number-button fa fa-plus-circle"></div>
</div>
</div>
<div class="checkbox">
<label>
<input type="checkbox" id="all-contacts" name="all-contacts" value=1> <strong>Envoyer à tout le répertoire</strong>
</label>
</div>
<div class="form-group">
<label>Contacts cibles</label>
<input class="add-contacts form-control" name="contacts[]"/>
@ -100,7 +105,7 @@
// Affiche plus d'infos que le nom du contact si on est en mode infos contacts
jQuery('.add-contacts').each(function()
{
jQuery(this).magicSuggest({
magicContacts = jQuery(this).magicSuggest({
data: '<?php echo $this->generateUrl('contacts', 'jsonGetContacts'); ?>',
valueField: '<?php echo RASPISMS_SETTINGS_EXTENDED_CONTACTS_INFOS ? 'contacts.' : ''; ?>id',
displayField: '<?php echo RASPISMS_SETTINGS_EXTENDED_CONTACTS_INFOS ? 'contacts.' : ''; ?>name',
@ -121,7 +126,7 @@
jQuery('.add-groups').each(function()
{
jQuery(this).magicSuggest({
magicGroups = jQuery(this).magicSuggest({
data: '<?php echo $this->generateUrl('groups', 'jsonGetGroups'); ?>',
valueField: 'id',
displayField: 'name',
@ -181,6 +186,16 @@
this.submit();
});
$("#all-contacts").on('change', function() {
if ($(this).is(':checked')) {
magicContacts.disable();
magicGroups.disable();
} else {
magicContacts.enable();
magicGroups.enable();
}
})
});
</script>
<?php