FIX #yogosha11806
This commit is contained in:
parent
c21c4f36f8
commit
07216577e4
@ -47,8 +47,9 @@ if (!in_array('clicktodial', $conf->modules)) {
|
|||||||
if ($action == 'setvalue' && $user->admin) {
|
if ($action == 'setvalue' && $user->admin) {
|
||||||
$result1 = dolibarr_set_const($db, "CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS", GETPOST("CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS"), 'chaine', 0, '', $conf->entity);
|
$result1 = dolibarr_set_const($db, "CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS", GETPOST("CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS"), 'chaine', 0, '', $conf->entity);
|
||||||
$result2 = dolibarr_set_const($db, "CLICKTODIAL_URL", GETPOST("CLICKTODIAL_URL"), 'chaine', 0, '', $conf->entity);
|
$result2 = dolibarr_set_const($db, "CLICKTODIAL_URL", GETPOST("CLICKTODIAL_URL"), 'chaine', 0, '', $conf->entity);
|
||||||
|
$result3 = dolibarr_set_const($db, "CLICKTODIAL_KEY_FOR_CIDLOOKUP", GETPOST("CLICKTODIAL_KEY_FOR_CIDLOOKUP"), 'chaine', 0, '', $conf->entity);
|
||||||
|
|
||||||
if ($result1 >= 0 && $result2 >= 0) {
|
if ($result1 >= 0 && $result2 >= 0 && $result3 >= 0) {
|
||||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||||
} else {
|
} else {
|
||||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||||
@ -80,7 +81,7 @@ print '<input type="hidden" name="action" value="setvalue">';
|
|||||||
print '<div class="div-table-responsive-no-min">';
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table class="noborder centpercent">';
|
print '<table class="noborder centpercent">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td>'.$langs->trans("Name").'</td>';
|
print '<td class="minwidth200">'.$langs->trans("Name").'</td>';
|
||||||
print '<td>'.$langs->trans("Value").'</td>';
|
print '<td>'.$langs->trans("Value").'</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
@ -89,7 +90,7 @@ print '<tr class="oddeven"><td>';
|
|||||||
print $langs->trans("ClickToDialUseTelLink").'</td><td>';
|
print $langs->trans("ClickToDialUseTelLink").'</td><td>';
|
||||||
print $form->selectyesno("CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS", $conf->global->CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS, 1).'<br>';
|
print $form->selectyesno("CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS", $conf->global->CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS, 1).'<br>';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print $langs->trans("ClickToDialUseTelLinkDesc");
|
print '<span class="opacitymedium small">'.$langs->trans("ClickToDialUseTelLinkDesc").'</span>';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
|
||||||
@ -102,8 +103,8 @@ print $langs->trans("ClickToDialUrlDesc").'<br>';
|
|||||||
print '<br>';
|
print '<br>';
|
||||||
print '<span class="opacitymedium">';
|
print '<span class="opacitymedium">';
|
||||||
print $langs->trans("Examples").':<br>';
|
print $langs->trans("Examples").':<br>';
|
||||||
print 'https://myphoneserver/mypage?login=__LOGIN__&password=__PASS__&caller=__PHONEFROM__&called=__PHONETO__<br>';
|
print '* https://myphoneserver/phoneurl?login=__LOGIN__&password=__PASS__&caller=__PHONEFROM__&called=__PHONETO__<br>';
|
||||||
print 'sip:__PHONETO__@my.sip.server';
|
print '* sip:__PHONETO__@my.sip.server';
|
||||||
print '</span>';
|
print '</span>';
|
||||||
|
|
||||||
//if (! empty($user->clicktodial_url))
|
//if (! empty($user->clicktodial_url))
|
||||||
@ -114,6 +115,37 @@ print '</span>';
|
|||||||
|
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
print '<tr class="oddeven">';
|
||||||
|
print '<td>'.$langs->trans("SecurityKey").'</td>';
|
||||||
|
print '<td>';
|
||||||
|
|
||||||
|
global $dolibarr_main_url_root;
|
||||||
|
|
||||||
|
// Define $urlwithroot
|
||||||
|
$urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
|
||||||
|
$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
|
||||||
|
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
|
||||||
|
|
||||||
|
// Url for CIDLookup
|
||||||
|
//print '<div class="div-table-responsive-no-min">';
|
||||||
|
//print $langs->trans("URLToLaunchCronJobs").':<br>';
|
||||||
|
$url = $urlwithroot.'/public/clicktodial/cidlookup.php?securitykey='.getDolGlobalString('CLICKTODIAL_KEY_FOR_CIDLOOKUP', 'ValueToDefine').'&phone=...';
|
||||||
|
//print img_picto('', 'globe').' <a href="'.$url.'" target="_blank" rel="noopener noreferrer">'.$url."</a><br>\n";
|
||||||
|
//print '</div>';
|
||||||
|
//print '<br>';
|
||||||
|
|
||||||
|
|
||||||
|
print '<span class="opacitymedium">'.$langs->trans("CIDLookupURL").'</span>';
|
||||||
|
print '<br>'.$url;
|
||||||
|
print '<br>';
|
||||||
|
print '<br>';
|
||||||
|
print '<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') : (!empty($conf->global->CLICKTODIAL_KEY_FOR_CIDLOOKUP) ? $conf->global->CLICKTODIAL_KEY_FOR_CIDLOOKUP : '')).'">';
|
||||||
|
if (!empty($conf->use_javascript_ajax)) {
|
||||||
|
print ' '.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_token" class="linkobject"');
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
@ -156,6 +188,23 @@ if (!empty($conf->global->CLICKTODIAL_URL)) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!empty($conf->use_javascript_ajax)) {
|
||||||
|
print "\n".'<script type="text/javascript">';
|
||||||
|
print '$(document).ready(function () {
|
||||||
|
$("#generate_token").click(function() {
|
||||||
|
console.log("Click done");
|
||||||
|
$.get( "'.DOL_URL_ROOT.'/core/ajax/security.php", {
|
||||||
|
action: \'getrandompassword\',
|
||||||
|
generic: true
|
||||||
|
},
|
||||||
|
function(token) {
|
||||||
|
$("#CLICKTODIAL_KEY_FOR_CIDLOOKUP").val(token);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});';
|
||||||
|
print '</script>';
|
||||||
|
}
|
||||||
|
|
||||||
// End of page
|
// End of page
|
||||||
llxFooter();
|
llxFooter();
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|||||||
@ -133,15 +133,16 @@ if (!empty($conf->use_javascript_ajax)) {
|
|||||||
print "\n".'<script type="text/javascript">';
|
print "\n".'<script type="text/javascript">';
|
||||||
print '$(document).ready(function () {
|
print '$(document).ready(function () {
|
||||||
$("#generate_token").click(function() {
|
$("#generate_token").click(function() {
|
||||||
$.get( "'.DOL_URL_ROOT.'/core/ajax/security.php", {
|
console.log("Click done");
|
||||||
action: \'getrandompassword\',
|
$.get( "'.DOL_URL_ROOT.'/core/ajax/security.php", {
|
||||||
generic: true
|
action: \'getrandompassword\',
|
||||||
},
|
generic: true
|
||||||
function(token) {
|
},
|
||||||
$("#CRON_KEY").val(token);
|
function(token) {
|
||||||
});
|
$("#CRON_KEY").val(token);
|
||||||
});
|
});
|
||||||
});';
|
});
|
||||||
|
});';
|
||||||
print '</script>';
|
print '</script>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2278,3 +2278,4 @@ INVOICE_ADD_SWISS_QR_CODE=Show the swiss QR-Bill code on invoices
|
|||||||
UrlSocialNetworksDesc=Url link of social network. Use {socialid} for the variable part that contains the social network ID.
|
UrlSocialNetworksDesc=Url link of social network. Use {socialid} for the variable part that contains the social network ID.
|
||||||
IfThisCategoryIsChildOfAnother=If this category is a child of another one
|
IfThisCategoryIsChildOfAnother=If this category is a child of another one
|
||||||
NoName=No name
|
NoName=No name
|
||||||
|
CIDLookupURL=The module brings an URL that can be used by an external tool to get the name of a thirdparty or contact from its phone number. URL to use is:
|
||||||
@ -16,20 +16,45 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file htdocs/asterisk/cidlookup.php
|
* \file htdocs/public/clicktodial/cidlookup.php
|
||||||
* \brief Script to search companies names based on incoming calls, from caller phone number
|
* \brief Script to search companies names based on incoming calls, from caller phone number
|
||||||
* \remarks To use this script, your Asterisk must be compiled with CURL,
|
* \remarks To use this script, your Asterisk must be compiled with CURL, and your dialplan must be something like this:
|
||||||
* and your dialplan must be something like this:
|
|
||||||
*
|
*
|
||||||
* exten => s,1,Set(CALLERID(name)=${CURL(http://IP-DOLIBARR:80/asterisk/cidlookup.php?phone=${CALLERID(num)})})
|
* exten => s,1,Set(CALLERID(name)=${CURL(http://IP-DOLIBARR:80/asterisk/cidlookup.php?phone=${CALLERID(num)}&securitykey=SECURITYKEY)})
|
||||||
*
|
*
|
||||||
* Change IP-DOLIBARR to the IP address of your dolibarr server
|
* Change IP-DOLIBARR to the IP address of your dolibarr server
|
||||||
|
* Change SECURITYKEY to the value defined into your setup of module ClickToDial
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if (!defined('NOTOKENRENEWAL')) {
|
||||||
|
define('NOTOKENRENEWAL', '1'); // Disables token renewal
|
||||||
|
}
|
||||||
|
if (!defined('NOREQUIREMENU')) {
|
||||||
|
define('NOREQUIREMENU', '1');
|
||||||
|
}
|
||||||
|
if (!defined('NOREQUIREHTML')) {
|
||||||
|
define('NOREQUIREHTML', '1');
|
||||||
|
}
|
||||||
|
if (!defined('NOREQUIREAJAX')) {
|
||||||
|
define('NOREQUIREAJAX', '1');
|
||||||
|
}
|
||||||
|
if (!defined('NOLOGIN')) {
|
||||||
|
define('NOLOGIN', '1');
|
||||||
|
}
|
||||||
|
if (!defined('NOIPCHECK')) {
|
||||||
|
define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
|
||||||
|
}
|
||||||
|
|
||||||
include '../master.inc.php';
|
// So log file will have a suffix
|
||||||
|
if (!defined('USESUFFIXINLOG')) {
|
||||||
|
define('USESUFFIXINLOG', '_cidlookup');
|
||||||
|
}
|
||||||
|
|
||||||
|
include '../../main.inc.php';
|
||||||
|
|
||||||
$phone = GETPOST('phone');
|
$phone = GETPOST('phone');
|
||||||
|
$securitykey = GETPOST('securitykey');
|
||||||
|
|
||||||
$notfound = $langs->trans("Unknown");
|
$notfound = $langs->trans("Unknown");
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
@ -38,12 +63,27 @@ if (empty($conf->clicktodial->enabled)) {
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* View
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (empty($securitykey)) {
|
||||||
|
echo 'Securitykey is required. Check setup of clicktodial module.';
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
if ($securitykey != getDolGlobalString('CLICKTODIAL_KEY_FOR_CIDLOOKUP')) {
|
||||||
|
echo 'Securitykey is wrong.';
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
// Check parameters
|
// Check parameters
|
||||||
if (empty($phone)) {
|
if (empty($phone)) {
|
||||||
print "Error: Url must be called with parameter phone=phone to search\n";
|
print "Error: Url must be called with parameter phone=phone to search\n";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$sql = "SELECT s.nom as name FROM ".MAIN_DB_PREFIX."societe as s";
|
$sql = "SELECT s.nom as name FROM ".MAIN_DB_PREFIX."societe as s";
|
||||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON sp.fk_soc = s.rowid";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON sp.fk_soc = s.rowid";
|
||||||
$sql .= " WHERE s.entity IN (".getEntity('societe').")";
|
$sql .= " WHERE s.entity IN (".getEntity('societe').")";
|
||||||
@ -93,7 +93,7 @@ if (empty($key)) {
|
|||||||
echo 'Securitykey is required. Check setup of cron jobs module.';
|
echo 'Securitykey is required. Check setup of cron jobs module.';
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
if ($key != $conf->global->CRON_KEY) {
|
if ($key != getDolGlobalString('CRON_KEY')) {
|
||||||
echo 'Securitykey is wrong.';
|
echo 'Securitykey is wrong.';
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user