2011-03-05 12:22:42 +01:00
|
|
|
<?php
|
2011-08-13 15:03:03 +02:00
|
|
|
/* Copyright (C) 2007-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
2018-10-27 14:43:12 +02:00
|
|
|
* Copyright (C) 2009 Regis Houssin <regis.houssin@inodbox.com>
|
2013-08-20 16:50:33 +02:00
|
|
|
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
|
2020-12-05 08:45:58 +01:00
|
|
|
* Copyright (C) 2020 Frédéric France <frederic.france@netlogic.fr>
|
2011-03-05 12:22:42 +01:00
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
2013-01-16 15:36:08 +01:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2011-03-05 12:22:42 +01:00
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2019-09-23 21:55:30 +02:00
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2011-03-05 12:22:42 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* \file htdocs/admin/sms.php
|
|
|
|
|
* \brief Page to setup emails sending
|
|
|
|
|
*/
|
|
|
|
|
|
2022-09-07 20:08:59 +02:00
|
|
|
// Load Dolibarr environment
|
2012-08-22 23:24:21 +02:00
|
|
|
require '../main.inc.php';
|
2012-08-22 23:11:24 +02:00
|
|
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
2011-03-05 12:22:42 +01:00
|
|
|
|
2018-05-26 18:52:14 +02:00
|
|
|
// Load translation files required by the page
|
2019-11-13 19:35:02 +01:00
|
|
|
$langs->loadLangs(array("companies", "admin", "products", "sms", "other", "errors"));
|
2011-03-05 12:22:42 +01:00
|
|
|
|
2020-12-19 15:28:58 +01:00
|
|
|
$action = GETPOST('action', 'aZ09');
|
|
|
|
|
$cancel = GETPOST('cancel', 'aZ09');
|
2020-02-16 19:33:58 +01:00
|
|
|
|
2020-12-05 08:45:58 +01:00
|
|
|
if (!$user->admin) {
|
|
|
|
|
accessforbidden();
|
|
|
|
|
}
|
2011-03-05 12:22:42 +01:00
|
|
|
|
2019-11-13 19:35:02 +01:00
|
|
|
$substitutionarrayfortest = array(
|
2020-12-05 08:45:58 +01:00
|
|
|
'__ID__' => 'TESTIdRecord',
|
|
|
|
|
'__PHONEFROM__' => 'TESTPhoneFrom',
|
|
|
|
|
'__PHONETO__' => 'TESTPhoneTo',
|
|
|
|
|
'__LASTNAME__' => 'TESTLastname',
|
|
|
|
|
'__FIRSTNAME__' => 'TESTFirstname'
|
2011-03-05 12:22:42 +01:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Actions
|
|
|
|
|
*/
|
|
|
|
|
|
2020-12-05 08:45:58 +01:00
|
|
|
if ($action == 'update' && !$cancel) {
|
2020-02-16 19:33:58 +01:00
|
|
|
dolibarr_set_const($db, "MAIN_DISABLE_ALL_SMS", GETPOST("MAIN_DISABLE_ALL_SMS", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
2011-03-05 12:22:42 +01:00
|
|
|
|
2020-08-28 17:41:15 +02:00
|
|
|
dolibarr_set_const($db, "MAIN_SMS_SENDMODE", GETPOST("MAIN_SMS_SENDMODE", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
2011-03-05 12:22:42 +01:00
|
|
|
|
2020-02-16 19:33:58 +01:00
|
|
|
dolibarr_set_const($db, "MAIN_MAIL_SMS_FROM", GETPOST("MAIN_MAIL_SMS_FROM", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
2011-03-05 12:22:42 +01:00
|
|
|
|
2012-08-31 05:58:38 +02:00
|
|
|
header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
|
2011-03-05 12:22:42 +01:00
|
|
|
exit;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2020-12-19 15:28:58 +01:00
|
|
|
// Send sms
|
2022-02-22 23:44:56 +01:00
|
|
|
if ($action == 'send' && !$cancel) {
|
2019-11-13 19:35:02 +01:00
|
|
|
$error = 0;
|
2011-03-05 12:22:42 +01:00
|
|
|
|
2019-11-13 19:35:02 +01:00
|
|
|
$smsfrom = '';
|
2021-03-25 16:59:47 +01:00
|
|
|
if (GETPOST("fromsms", 'alphanohtml')) {
|
2020-12-05 08:45:58 +01:00
|
|
|
$smsfrom = GETPOST("fromsms", 'alphanohtml');
|
|
|
|
|
}
|
|
|
|
|
if (empty($smsfrom)) {
|
|
|
|
|
$smsfrom = GETPOST("fromname", 'alphanohtml');
|
|
|
|
|
}
|
2020-02-16 19:33:58 +01:00
|
|
|
$sendto = GETPOST("sendto", 'alphanohtml');
|
|
|
|
|
$body = GETPOST('message', 'alphanohtml');
|
|
|
|
|
$deliveryreceipt = GETPOST("deliveryreceipt", 'alphanohtml');
|
|
|
|
|
$deferred = GETPOST('deferred', 'alphanohtml');
|
|
|
|
|
$priority = GETPOST('priority', 'alphanohtml');
|
|
|
|
|
$class = GETPOST('class', 'alphanohtml');
|
|
|
|
|
$errors_to = GETPOST("errorstosms", 'alphanohtml');
|
2011-03-05 12:22:42 +01:00
|
|
|
|
|
|
|
|
// Create form object
|
2012-08-23 02:04:35 +02:00
|
|
|
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formsms.class.php';
|
2011-03-05 12:22:42 +01:00
|
|
|
$formsms = new FormSms($db);
|
|
|
|
|
|
2020-12-05 08:45:58 +01:00
|
|
|
if (!empty($formsms->error)) {
|
2015-10-29 13:58:16 +01:00
|
|
|
setEventMessages($formsms->error, $formsms->errors, 'errors');
|
2020-10-31 14:32:18 +01:00
|
|
|
$action = 'test';
|
|
|
|
|
$error++;
|
|
|
|
|
}
|
2020-12-05 08:45:58 +01:00
|
|
|
if (empty($body)) {
|
2020-10-31 14:32:18 +01:00
|
|
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Message")), null, 'errors');
|
|
|
|
|
$action = 'test';
|
|
|
|
|
$error++;
|
2011-10-17 21:08:05 +02:00
|
|
|
}
|
2020-12-05 08:45:58 +01:00
|
|
|
if (empty($smsfrom) || !str_replace('+', '', $smsfrom)) {
|
2015-10-17 16:18:33 +02:00
|
|
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("SmsFrom")), null, 'errors');
|
2020-10-31 14:32:18 +01:00
|
|
|
$action = 'test';
|
2011-03-05 12:22:42 +01:00
|
|
|
$error++;
|
|
|
|
|
}
|
2020-12-05 08:45:58 +01:00
|
|
|
if (empty($sendto) || !str_replace('+', '', $sendto)) {
|
2015-10-17 16:18:33 +02:00
|
|
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("SmsTo")), null, 'errors');
|
2020-10-31 14:32:18 +01:00
|
|
|
$action = 'test';
|
2011-03-05 12:22:42 +01:00
|
|
|
$error++;
|
|
|
|
|
}
|
2020-12-05 08:45:58 +01:00
|
|
|
if (!$error) {
|
2011-03-06 20:41:19 +01:00
|
|
|
// Make substitutions into message
|
2020-10-31 14:32:18 +01:00
|
|
|
complete_substitutions_array($substitutionarrayfortest, $langs);
|
|
|
|
|
$body = make_substitutions($body, $substitutionarrayfortest);
|
2011-03-05 12:22:42 +01:00
|
|
|
|
2012-08-22 23:11:24 +02:00
|
|
|
require_once DOL_DOCUMENT_ROOT.'/core/class/CSMSFile.class.php';
|
2023-07-12 16:34:50 +02:00
|
|
|
try {
|
2023-07-12 16:32:50 +02:00
|
|
|
$smsfile = new CSMSFile($sendto, $smsfrom, $body, $deliveryreceipt, $deferred, $priority, $class); // This define OvhSms->login, pass, session and account
|
2023-07-12 16:34:50 +02:00
|
|
|
} catch (Exception $e) {
|
2023-07-12 16:32:50 +02:00
|
|
|
setEventMessages($e->getMessage(), null, 'error');
|
|
|
|
|
}
|
2019-11-13 19:35:02 +01:00
|
|
|
$result = $smsfile->sendfile(); // This send SMS
|
2011-03-05 12:22:42 +01:00
|
|
|
|
2020-12-05 08:45:58 +01:00
|
|
|
if ($result) {
|
2019-01-27 11:55:16 +01:00
|
|
|
setEventMessages($langs->trans("SmsSuccessfulySent", $smsfrom, $sendto), null, 'mesgs');
|
2015-12-13 21:12:08 +01:00
|
|
|
setEventMessages($smsfile->error, $smsfile->errors, 'mesgs');
|
2020-05-21 09:35:30 +02:00
|
|
|
} else {
|
2015-10-29 13:58:16 +01:00
|
|
|
setEventMessages($langs->trans("ResultKo"), null, 'errors');
|
2015-12-13 21:12:08 +01:00
|
|
|
setEventMessages($smsfile->error, $smsfile->errors, 'errors');
|
2011-03-05 12:22:42 +01:00
|
|
|
}
|
|
|
|
|
|
2019-11-13 19:35:02 +01:00
|
|
|
$action = '';
|
2011-03-05 12:22:42 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* View
|
|
|
|
|
*/
|
|
|
|
|
|
2020-12-19 15:28:58 +01:00
|
|
|
$form = new Form($db);
|
|
|
|
|
|
2019-11-13 19:35:02 +01:00
|
|
|
$linuxlike = 1;
|
2020-12-05 08:45:58 +01:00
|
|
|
if (preg_match('/^win/i', PHP_OS)) {
|
|
|
|
|
$linuxlike = 0;
|
|
|
|
|
}
|
|
|
|
|
if (preg_match('/^mac/i', PHP_OS)) {
|
|
|
|
|
$linuxlike = 0;
|
|
|
|
|
}
|
2011-03-05 12:22:42 +01:00
|
|
|
|
2019-11-13 19:35:02 +01:00
|
|
|
$wikihelp = 'EN:Setup Sms|FR:Paramétrage Sms|ES:Configuración Sms';
|
2019-01-27 11:55:16 +01:00
|
|
|
llxHeader('', $langs->trans("Setup"), $wikihelp);
|
2011-03-05 12:22:42 +01:00
|
|
|
|
2019-01-27 11:55:16 +01:00
|
|
|
print load_fiche_titre($langs->trans("SmsSetup"), '', 'title_setup');
|
2011-03-05 12:22:42 +01:00
|
|
|
|
2019-10-11 14:42:55 +02:00
|
|
|
print '<span class="opacitymedium">'.$langs->trans("SmsDesc")."</span><br>\n";
|
2011-03-05 12:22:42 +01:00
|
|
|
print "<br>\n";
|
|
|
|
|
|
|
|
|
|
// List of sending methods
|
2019-11-13 19:35:02 +01:00
|
|
|
$listofmethods = (is_array($conf->modules_parts['sms']) ? $conf->modules_parts['sms'] : array());
|
2011-03-06 20:41:19 +01:00
|
|
|
asort($listofmethods);
|
2011-03-05 12:22:42 +01:00
|
|
|
|
2020-12-05 08:45:58 +01:00
|
|
|
if (!count($listofmethods)) {
|
|
|
|
|
$descnosms = $langs->trans("NoSmsEngine", '{Dolistore}');
|
2021-03-30 17:42:44 +02:00
|
|
|
$descnosms = str_replace('{Dolistore}', '<a href="https://www.dolistore.com/search.php?orderby=position&orderway=desc&search_query=smsmanager">DoliStore</a>', $descnosms);
|
2020-12-05 08:45:58 +01:00
|
|
|
print '<div class="warning">'.$descnosms.'</div>';
|
|
|
|
|
}
|
2011-03-05 12:22:42 +01:00
|
|
|
|
2020-12-05 08:45:58 +01:00
|
|
|
if ($action == 'edit') {
|
2011-03-05 12:22:42 +01:00
|
|
|
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
|
2019-12-18 23:12:31 +01:00
|
|
|
print '<input type="hidden" name="token" value="'.newToken().'">';
|
2011-03-05 12:22:42 +01:00
|
|
|
print '<input type="hidden" name="action" value="update">';
|
|
|
|
|
|
|
|
|
|
clearstatcache();
|
|
|
|
|
|
2019-11-05 21:24:41 +01:00
|
|
|
print '<table class="noborder centpercent">';
|
2011-03-05 12:22:42 +01:00
|
|
|
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
|
|
|
|
|
2018-07-26 18:22:16 +02:00
|
|
|
// Disable
|
2017-04-14 13:02:29 +02:00
|
|
|
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_DISABLE_ALL_SMS").'</td><td>';
|
2021-04-16 17:10:11 +02:00
|
|
|
print $form->selectyesno('MAIN_DISABLE_ALL_SMS', getDolGlobalString('MAIN_DISABLE_ALL_SMS'), 1);
|
2011-03-05 12:22:42 +01:00
|
|
|
print '</td></tr>';
|
|
|
|
|
|
2018-07-26 18:22:16 +02:00
|
|
|
// Separator
|
2017-04-14 13:02:29 +02:00
|
|
|
print '<tr class="oddeven"><td colspan="2"> </td></tr>';
|
2011-03-05 12:22:42 +01:00
|
|
|
|
2018-07-26 18:22:16 +02:00
|
|
|
// Method
|
2017-04-14 13:02:29 +02:00
|
|
|
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_SMS_SENDMODE").'</td><td>';
|
2020-12-05 08:45:58 +01:00
|
|
|
if (count($listofmethods)) {
|
2023-08-26 12:02:19 +02:00
|
|
|
print $form->selectarray('MAIN_SMS_SENDMODE', $listofmethods, getDolGlobalString('MAIN_SMS_SENDMODE'), 1);
|
2020-12-05 08:45:58 +01:00
|
|
|
} else {
|
2021-10-05 06:25:53 +02:00
|
|
|
print '<span class="error">'.$langs->trans("None").'</span>';
|
2020-12-05 08:45:58 +01:00
|
|
|
}
|
2020-10-31 14:32:18 +01:00
|
|
|
print '</td></tr>';
|
2011-03-05 12:22:42 +01:00
|
|
|
|
2018-07-26 18:22:16 +02:00
|
|
|
// From
|
2019-01-27 11:55:16 +01:00
|
|
|
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SMS_FROM", $langs->transnoentities("Undefined")).'</td>';
|
2021-04-16 17:10:11 +02:00
|
|
|
print '<td><input class="flat" name="MAIN_MAIL_SMS_FROM" size="32" value="'.getDolGlobalString('MAIN_MAIL_SMS_FROM');
|
2011-03-05 12:22:42 +01:00
|
|
|
print '"></td></tr>';
|
|
|
|
|
|
|
|
|
|
// Autocopy to
|
2017-04-14 11:22:48 +02:00
|
|
|
/*
|
2017-04-14 13:02:29 +02:00
|
|
|
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_AUTOCOPY_TO").'</td>';
|
2011-03-05 12:22:42 +01:00
|
|
|
print '<td><input class="flat" name="MAIN_MAIL_AUTOCOPY_TO" size="32" value="' . $conf->global->MAIN_MAIL_AUTOCOPY_TO;
|
|
|
|
|
print '"></td></tr>';
|
|
|
|
|
*/
|
|
|
|
|
print '</table>';
|
|
|
|
|
|
2014-11-25 20:13:43 +01:00
|
|
|
print '<br><div class="center">';
|
2020-11-19 20:23:38 +01:00
|
|
|
print '<input class="button button-save" type="submit" name="save" value="'.$langs->trans("Save").'"'.(!count($listofmethods) ? ' disabled' : '').'>';
|
2014-11-25 20:13:43 +01:00
|
|
|
print ' ';
|
2020-11-23 15:12:52 +01:00
|
|
|
print '<input class="button button-cancel" type="submit" name="cancel" value="'.$langs->trans("Cancel").'">';
|
2014-11-25 20:13:43 +01:00
|
|
|
print '</div>';
|
2011-03-05 12:22:42 +01:00
|
|
|
|
|
|
|
|
print '</form>';
|
|
|
|
|
print '<br>';
|
2020-05-21 09:35:30 +02:00
|
|
|
} else {
|
2019-11-05 21:24:41 +01:00
|
|
|
print '<table class="noborder centpercent">';
|
2011-03-05 12:22:42 +01:00
|
|
|
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
|
|
|
|
|
2018-07-26 18:22:16 +02:00
|
|
|
// Disable
|
2021-04-16 17:10:11 +02:00
|
|
|
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_DISABLE_ALL_SMS").'</td><td>'.yn(getDolGlobalString('MAIN_DISABLE_ALL_SMS')).'</td></tr>';
|
2011-03-05 12:22:42 +01:00
|
|
|
|
2018-07-26 18:22:16 +02:00
|
|
|
// Separator
|
2017-04-14 13:02:29 +02:00
|
|
|
print '<tr class="oddeven"><td colspan="2"> </td></tr>';
|
2011-03-05 12:22:42 +01:00
|
|
|
|
2018-07-26 18:22:16 +02:00
|
|
|
// Method
|
2017-04-14 13:02:29 +02:00
|
|
|
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_SMS_SENDMODE").'</td><td>';
|
2023-08-26 12:02:19 +02:00
|
|
|
$text = getDolGlobalString('MAIN_SMS_SENDMODE') ? $listofmethods[getDolGlobalString('MAIN_SMS_SENDMODE')] : '';
|
2020-12-05 08:45:58 +01:00
|
|
|
if (empty($text)) {
|
|
|
|
|
$text = $langs->trans("Undefined").' '.img_warning();
|
|
|
|
|
}
|
2011-03-05 12:22:42 +01:00
|
|
|
print $text;
|
|
|
|
|
print '</td></tr>';
|
|
|
|
|
|
2018-07-26 18:22:16 +02:00
|
|
|
// From
|
2019-01-27 11:55:16 +01:00
|
|
|
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SMS_FROM", $langs->transnoentities("Undefined")).'</td>';
|
2021-04-16 17:10:11 +02:00
|
|
|
print '<td>'.getDolGlobalString('MAIN_MAIL_SMS_FROM');
|
2023-10-24 17:00:13 +02:00
|
|
|
if (getDolGlobalString('MAIN_MAIL_SMS_FROM') && !isValidPhone($conf->global->MAIN_MAIL_SMS_FROM)) {
|
2020-12-05 08:45:58 +01:00
|
|
|
print ' '.img_warning($langs->trans("ErrorBadPhone"));
|
|
|
|
|
}
|
2011-03-05 12:22:42 +01:00
|
|
|
print '</td></tr>';
|
|
|
|
|
|
|
|
|
|
// Autocopy to
|
2017-04-14 11:22:48 +02:00
|
|
|
/*
|
2017-04-14 13:02:29 +02:00
|
|
|
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_AUTOCOPY_TO").'</td>';
|
2011-03-05 12:22:42 +01:00
|
|
|
print '<td>'.$conf->global->MAIN_MAIL_AUTOCOPY_TO;
|
|
|
|
|
if (!empty($conf->global->MAIN_MAIL_AUTOCOPY_TO) && ! isValidEmail($conf->global->MAIN_MAIL_AUTOCOPY_TO)) print img_warning($langs->trans("ErrorBadEMail"));
|
|
|
|
|
print '</td></tr>';
|
2020-12-05 08:45:58 +01:00
|
|
|
*/
|
2011-03-05 12:22:42 +01:00
|
|
|
|
|
|
|
|
print '</table>';
|
|
|
|
|
|
|
|
|
|
|
2019-06-17 17:53:43 +02:00
|
|
|
// Buttons for actions
|
2011-03-05 12:22:42 +01:00
|
|
|
|
|
|
|
|
print '<div class="tabsAction">';
|
|
|
|
|
|
|
|
|
|
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit">'.$langs->trans("Modify").'</a>';
|
|
|
|
|
|
2023-08-26 12:02:19 +02:00
|
|
|
if (count($listofmethods) && getDolGlobalString('MAIN_SMS_SENDMODE')) {
|
2020-10-31 14:32:18 +01:00
|
|
|
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=test&mode=init">'.$langs->trans("DoTestSend").'</a>';
|
2020-05-21 09:35:30 +02:00
|
|
|
} else {
|
2020-10-31 14:32:18 +01:00
|
|
|
print '<a class="butActionRefused classfortooltip" href="#">'.$langs->trans("DoTestSend").'</a>';
|
2011-03-06 20:41:19 +01:00
|
|
|
}
|
2011-03-05 12:22:42 +01:00
|
|
|
print '</div>';
|
|
|
|
|
|
|
|
|
|
// Affichage formulaire de TEST simple
|
2020-12-05 08:45:58 +01:00
|
|
|
if ($action == 'test') {
|
2011-03-05 12:22:42 +01:00
|
|
|
print '<br>';
|
2015-09-24 18:27:13 +02:00
|
|
|
print load_fiche_titre($langs->trans("DoTestSend"));
|
2011-03-05 12:22:42 +01:00
|
|
|
|
|
|
|
|
// Cree l'objet formulaire mail
|
2012-08-23 02:04:35 +02:00
|
|
|
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formsms.class.php';
|
2011-03-05 12:22:42 +01:00
|
|
|
$formsms = new FormSms($db);
|
2020-10-31 14:32:18 +01:00
|
|
|
$formsms->fromtype = 'user';
|
|
|
|
|
$formsms->fromid = $user->id;
|
2020-12-19 15:28:58 +01:00
|
|
|
$formsms->fromsms = (GETPOSTISSET('fromsms') ? GETPOST('fromsms') : ($conf->global->MAIN_MAIL_SMS_FROM ? $conf->global->MAIN_MAIL_SMS_FROM : $user->user_mobile));
|
2020-04-10 10:59:32 +02:00
|
|
|
$formsms->withfromreadonly = 0;
|
|
|
|
|
$formsms->withsubstit = 0;
|
|
|
|
|
$formsms->withfrom = 1;
|
2020-12-19 15:28:58 +01:00
|
|
|
$formsms->withto = (GETPOSTISSET('sendto') ? GETPOST('sendto') : ($user->user_mobile ? $user->user_mobile : 1));
|
|
|
|
|
$formsms->withbody = (GETPOSTISSET('message') ? (!GETPOST('message') ? 1 : GETPOST('message')) : $langs->trans("ThisIsATestMessage"));
|
2020-04-10 10:59:32 +02:00
|
|
|
$formsms->withbodyreadonly = 0;
|
|
|
|
|
$formsms->withcancel = 1;
|
2011-03-05 12:22:42 +01:00
|
|
|
// Tableau des substitutions
|
2020-04-10 10:59:32 +02:00
|
|
|
$formsms->substit = $substitutionarrayfortest;
|
2024-01-11 09:59:52 +01:00
|
|
|
// Tableau des parameters complementaires du post
|
2020-04-10 10:59:32 +02:00
|
|
|
$formsms->param["action"] = "send";
|
|
|
|
|
$formsms->param["models"] = "body";
|
|
|
|
|
$formsms->param["smsid"] = 0;
|
|
|
|
|
$formsms->param["returnurl"] = $_SERVER["PHP_SELF"];
|
2011-03-05 12:22:42 +01:00
|
|
|
|
2011-03-05 17:27:26 +01:00
|
|
|
$formsms->show_form();
|
2011-03-05 12:22:42 +01:00
|
|
|
|
|
|
|
|
print '<br>';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-07-28 18:03:14 +02:00
|
|
|
// End of page
|
2011-08-27 16:24:16 +02:00
|
|
|
llxFooter();
|
2012-03-07 14:27:17 +01:00
|
|
|
$db->close();
|