28require
'../main.inc.php';
29require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
49$action =
GETPOST(
'action',
'aZ09');
51if (!isModEnabled(
'clicktodial')) {
52 accessforbidden($langs->transnoentitiesnoconv(
"WarningModuleNotActive", $langs->transnoentitiesnoconv(
"Module58Name")));
60if ($action ==
'setvalue') {
61 $result1 =
dolibarr_set_const($db,
"CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS",
GETPOST(
"CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS"),
'chaine', 0,
'',
$conf->entity);
65 if ($result1 >= 0 && $result2 >= 0 && $result3 >= 0) {
79$user->fetch_clicktodial();
81$wikihelp =
'EN:Module_ClickToDial_En|FR:Module_ClickToDial|ES:Módulo_ClickTodial_Es';
82llxHeader(
'', $langs->trans(
"ClickToDialSetup"), $wikihelp,
'', 0, 0,
'',
'',
'',
'mod-admin page-clicktodial');
84$linkback =
'<a href="'.DOL_URL_ROOT.
'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToModuleList").
'</a>';
85print
load_fiche_titre($langs->trans(
"ClickToDialSetup"), $linkback,
'title_setup');
87print
'<span class="opacitymedium">'.$langs->trans(
"ClickToDialDesc").
"</span><br>\n";
90print
'<form method="post" action="clicktodial.php">';
91print
'<input type="hidden" name="token" value="'.newToken().
'">';
92print
'<input type="hidden" name="action" value="setvalue">';
94print
'<div class="div-table-responsive-no-min">';
95print
'<table class="noborder centpercent">';
96print
'<tr class="liste_titre">';
97print
'<td class="minwidth200">'.$langs->trans(
"Parameter").
'</td>';
102print
'<tr class="oddeven"><td>';
103print $langs->trans(
"ClickToDialUseTelLink").
'</td><td>';
104print $form->selectyesno(
"CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS",
getDolGlobalString(
'CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS'), 1).
'<br>';
106print
'<span class="opacitymedium small">'.$langs->trans(
"ClickToDialUseTelLinkDesc").
'</span>';
110print
'<tr class="oddeven"><td>';
111print $langs->trans(
"DefaultLink").
'</td><td>';
112print
'<input class="quatrevingtpercent" type="text" id="CLICKTODIAL_URL" name="CLICKTODIAL_URL"'.(getDolGlobalString(
'CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS') ?
' disabled="disabled"' :
'').
' value="'.
getDolGlobalString(
'CLICKTODIAL_URL').
'"><br>';
115print $langs->trans(
"ClickToDialUrlDesc").
'<br>';
117print
'<span class="opacitymedium">';
118print $langs->trans(
"Examples").
':<br>';
119print
'* https://myphoneserver/phoneurl?login=__LOGIN__&password=__PASS__&caller=__PHONEFROM__&called=__PHONETO__<br>';
120print
'* sip:__PHONETO__@my.sip.server';
126 print
info_admin($langs->trans(
"ValueOverwrittenByUserSetup"));
131print
'<tr class="oddeven">';
132print
'<td>'.$langs->trans(
"SecurityKey").
'</td>';
139$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
144$url = $urlwithroot.
'/public/clicktodial/cidlookup.php?securitykey='.
getDolGlobalString(
'CLICKTODIAL_KEY_FOR_CIDLOOKUP',
'ValueToDefine').
'&phone=...';
150print
'<span class="opacitymedium">'.$langs->trans(
"CIDLookupURL").
'</span>';
154print
'<input type="text" class="flat minwidth300" id="CLICKTODIAL_KEY_FOR_CIDLOOKUP" name="CLICKTODIAL_KEY_FOR_CIDLOOKUP" value="'.(GETPOST(
'CLICKTODIAL_KEY_FOR_CIDLOOKUP') ?
GETPOST(
'CLICKTODIAL_KEY_FOR_CIDLOOKUP') : (
getDolGlobalString(
'CLICKTODIAL_KEY_FOR_CIDLOOKUP') ?
$conf->global->CLICKTODIAL_KEY_FOR_CIDLOOKUP :
'')).
'">';
155if (!empty(
$conf->use_javascript_ajax)) {
156 print
' '.img_picto($langs->trans(
'Generate'),
'refresh',
'id="generate_token" class="linkobject"');
164print $form->buttonsSaveCancel(
"Modify",
'');
166print
'</form><br><br>';
170 $user->fetch_clicktodial();
172 $phonefortest = $mysoc->phone ??
'';
174 $phonefortest =
GETPOST(
'phonefortest');
177 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'">';
178 print
'<input type="hidden" name="token" value="'.newToken().
'">';
179 print $langs->trans(
"LinkToTestClickToDial", $user->login).
' : ';
180 print
'<input class="flat" type="text" name="phonefortest" value="'.dol_escape_htmltag($phonefortest).
'">';
181 print
'<input type="submit" class="button small" value="'.dol_escape_htmltag($langs->trans(
"RefreshPhoneLink")).
'">';
185 if (preg_match(
'/__LOGIN__/',
$conf->global->CLICKTODIAL_URL) && empty($user->clicktodial_login)) {
188 if (preg_match(
'/__PASSWORD__/',
$conf->global->CLICKTODIAL_URL) && empty($user->clicktodial_password)) {
191 if (preg_match(
'/__PHONEFROM__/',
$conf->global->CLICKTODIAL_URL) && empty($user->clicktodial_poste)) {
195 if ($setupcomplete) {
196 print $langs->trans(
"LinkToTest", $user->login).
': '.
dol_print_phone($phonefortest,
'', 0, 0,
'AC_TEL',
'',
'mobile');
198 $langs->load(
"errors");
199 print
'<div class="warning">'.$langs->trans(
"WarningClickToDialUserSetupNotComplete").
'</div>';
204include_once DOL_DOCUMENT_ROOT.
'/core/lib/security2.lib.php';
global $dolibarr_main_url_root
dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='', $entity=1)
Insert a parameter (key,value) into database (delete old key then insert it again).
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
dol_print_phone($phone, $countrycode='', $cid=0, $socid=0, $addlink='', $separ=" ", $withpicto='', $titlealt='', $adddivfloat=0, $morecss='paddingright')
Format phone numbers according to country.
ajax_autoselect($htmlname, $addlink='', $textonlink='Link')
Make content of an input box selected when we click into input field.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='')
Show information in HTML for admin users or standard users.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
dolJSToSetRandomPassword($htmlname, $htmlnameofbutton='generate_token', $generic=1)
Output javascript to autoset a generated password using default module into a HTML element.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.