Compare commits

..

2 Commits

9 changed files with 86 additions and 18 deletions

View File

@ -1 +1 @@
v3.4.3 v3.5.0

View File

@ -154,7 +154,7 @@ class OctopushVirtualNumberAdapter implements AdapterInterface
'title' => 'Numéro de téléphone virtuel', 'title' => 'Numéro de téléphone virtuel',
'description' => 'Numéro de téléphone virtuel Octopush à utiliser.', 'description' => 'Numéro de téléphone virtuel Octopush à utiliser.',
'required' => true, 'required' => true,
'number' => true, 'type' => 'phone_number',
], ],
[ [
'name' => 'sms_type', 'name' => 'sms_type',

View File

@ -144,6 +144,13 @@ namespace adapters;
'description' => 'Paramètre "Consumer Key" obtenu lors de la génération de la clef API OVH.', 'description' => 'Paramètre "Consumer Key" obtenu lors de la génération de la clef API OVH.',
'required' => true, 'required' => true,
], ],
[
'name' => 'no_stop_clause',
'title' => 'Désactiver la clause "STOP SMS" automatique',
'description' => 'En cochant ce paramètre, la clause "STOP SMS" ne sera pas ajoutée automatiquement au SMS par OVH.',
'required' => false,
'type' => 'boolean'
],
]; ];
} }
@ -222,6 +229,7 @@ namespace adapters;
'message' => $text, 'message' => $text,
'receivers' => [$destination], 'receivers' => [$destination],
'senderForResponse' => true, 'senderForResponse' => true,
'noStopClause' => (bool) ($this->data['no_stop_clause'] ?? false),
]; ];
if ($this->data['sender']) if ($this->data['sender'])
@ -325,7 +333,7 @@ namespace adapters;
{ {
$success = true; $success = true;
if ($this->data['sender'] && (mb_strlen($this->data['sender']) < 3 || mb_strlen($this->data['sender'] > 11))) if ($this->data['sender'] && (mb_strlen($this->data['sender']) < 3 || mb_strlen($this->data['sender']) > 11))
{ {
return false; return false;
} }
@ -334,6 +342,7 @@ namespace adapters;
$endpoint = '/sms/' . $this->data['service_name']; $endpoint = '/sms/' . $this->data['service_name'];
$response = $this->api->get($endpoint); $response = $this->api->get($endpoint);
return $success && (bool) $response; return $success && (bool) $response;
} }
catch (\Throwable $t) catch (\Throwable $t)

View File

@ -135,7 +135,7 @@ namespace adapters;
'title' => 'Numéro', 'title' => 'Numéro',
'description' => 'Numéro de téléphone virtuel chez OVH.', 'description' => 'Numéro de téléphone virtuel chez OVH.',
'required' => true, 'required' => true,
'number' => true, 'type' => 'phone_number',
], ],
[ [
'name' => 'app_key', 'name' => 'app_key',

View File

@ -140,7 +140,7 @@ class TwilioVirtualNumberAdapter implements AdapterInterface
'title' => 'Numéro de téléphone virtuel', 'title' => 'Numéro de téléphone virtuel',
'description' => 'Numéro de téléphone virtuel Twilio à utiliser parmis les numéro actifs (format international), <a href="https://www.twilio.com/console/phone-numbers/incoming" target="_blank">voir la liste ici</a>.', 'description' => 'Numéro de téléphone virtuel Twilio à utiliser parmis les numéro actifs (format international), <a href="https://www.twilio.com/console/phone-numbers/incoming" target="_blank">voir la liste ici</a>.',
'required' => true, 'required' => true,
'number' => true, 'type' => 'phone_number',
], ],
[ [
'name' => 'status_change_callback', 'name' => 'status_change_callback',

View File

@ -484,6 +484,54 @@ footer img
padding-left: 15px; padding-left: 15px;
} }
#adapter-data-fields input[type="checkbox"]
{
display: block;
width: auto;
}
#adapter-data-fields input[type=checkbox]{
height: 0;
width: 0;
visibility: hidden;
}
#adapter-data-fields .switch {
cursor: pointer;
text-indent: -9999px;
width: 44px;
height: 24px;
background: #aaa;
display: block;
border-radius: 100px;
position: relative;
}
#adapter-data-fields .switch:after {
content: '';
position: absolute;
top: 2px;
left: 2px;
width: 20px;
height: 20px;
background: #fff;
border-radius: 20px;
transition: 0.3s;
}
#adapter-data-fields input:checked + .switch {
background: #5cb85c;
}
#adapter-data-fields input:checked + .switch:after {
left: calc(100% - 2px);
transform: translateX(-100%);
}
#adapter-data-fields .switch:active:after {
width: 30px;
}
/* DATATABLES */ /* DATATABLES */
.dataTables_paginate .dataTables_paginate
{ {

View File

@ -211,7 +211,7 @@ class Phone extends \descartes\Controller
//If field phone number is invalid //If field phone number is invalid
foreach ($find_adapter['meta_data_fields'] as $field) foreach ($find_adapter['meta_data_fields'] as $field)
{ {
if (false === ($field['number'] ?? false)) if ('phone_number' !== ($field['type'] ?? false))
{ {
continue; continue;
} }

View File

@ -58,7 +58,7 @@ class Phone extends AbstractDaemon
{ {
usleep(0.5 * 1000000); //Micro sleep for perfs usleep(0.5 * 1000000); //Micro sleep for perfs
++$this->read_tick; $this->read_tick += 1;
$this->bdd = \descartes\Model::_connect(DATABASE_HOST, DATABASE_NAME, DATABASE_USER, DATABASE_PASSWORD); $this->bdd = \descartes\Model::_connect(DATABASE_HOST, DATABASE_NAME, DATABASE_USER, DATABASE_PASSWORD);

View File

@ -105,17 +105,7 @@
var html = ''; var html = '';
jQuery.each(data_fields, function (index, field) jQuery.each(data_fields, function (index, field)
{ {
if (!field.number) if (field.type == 'phone_number')
{
html += '<div class="form-group">' +
'<label>' + field.title + '</label>' +
'<p class="italic small help">' + field.description + '</p>' +
'<div class="form-group">' +
'<input name="adapter_data[' + field.name + ']" class="form-control" ' + (field.required ? 'required' : '') + ' ' + (field.default_value ? 'value="' + field.default_value + '"' : '') + '>' +
'</div>' +
'</div>';
}
else
{ {
var random_id = Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15); var random_id = Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
html += '' + html += '' +
@ -133,6 +123,27 @@
}; };
numbers.push(number); numbers.push(number);
}
else if (field.type == 'boolean')
{
html += '<div class="form-group">' +
'<label>' + field.title + '</label>' +
'<p class="italic small help">' + field.description + '</p>' +
'<div class="form-group">' +
'<input type="checkbox" id="adapter_data[' + field.name + ']" name="adapter_data[' + field.name + ']" class="form-control" ' + (field.required ? 'required' : '') + ' ' + (field.default_value ? 'value="' + field.default_value + '" checked' : 'value="1"') + '><label class="switch" for="adapter_data[' + field.name + ']"></label>' +
'</div>' +
'</div>';
}
else
{
html += '<div class="form-group">' +
'<label>' + field.title + '</label>' +
'<p class="italic small help">' + field.description + '</p>' +
'<div class="form-group">' +
'<input name="adapter_data[' + field.name + ']" class="form-control" ' + (field.required ? 'required' : '') + ' ' + (field.default_value ? 'value="' + field.default_value + '"' : '') + '>' +
'</div>' +
'</div>';
} }
}); });