diff --git a/htdocs/admin/clicktodial.php b/htdocs/admin/clicktodial.php
index 326e7028bbf..a8d33ae5a09 100644
--- a/htdocs/admin/clicktodial.php
+++ b/htdocs/admin/clicktodial.php
@@ -47,8 +47,9 @@ if (!in_array('clicktodial', $conf->modules)) {
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);
$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');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
@@ -80,7 +81,7 @@ print ' ';
print '
';
print ''.$langs->trans("MARGIN_METHODE_FOR_DISCOUNT").' ';
print '';
-print Form::selectarray('MARGIN_METHODE_FOR_DISCOUNT', $methods, $conf->global->MARGIN_METHODE_FOR_DISCOUNT);
+print Form::selectarray('MARGIN_METHODE_FOR_DISCOUNT', $methods, getDolGlobalString('MARGIN_METHODE_FOR_DISCOUNT'));
print ' ';
print '';
print ' ';
@@ -230,7 +230,7 @@ print ' '.$langs->trans("AgentContactType").' ';
print '';
$formcompany = new FormCompany($db);
$facture = new Facture($db);
-print $formcompany->selectTypeContact($facture, $conf->global->AGENT_CONTACT_TYPE, "AGENT_CONTACT_TYPE", "internal", "code", 1, "maxwidth250");
+print $formcompany->selectTypeContact($facture, getDolGlobalString('AGENT_CONTACT_TYPE'), "AGENT_CONTACT_TYPE", "internal", "code", 1, "maxwidth250");
print ' ';
print '';
print ' ';
diff --git a/htdocs/asterisk/cidlookup.php b/htdocs/public/clicktodial/cidlookup.php
similarity index 71%
rename from htdocs/asterisk/cidlookup.php
rename to htdocs/public/clicktodial/cidlookup.php
index 716057198f8..3ec7024855d 100644
--- a/htdocs/asterisk/cidlookup.php
+++ b/htdocs/public/clicktodial/cidlookup.php
@@ -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
- * \remarks To use this script, your Asterisk must be compiled with CURL,
- * and your dialplan must be something like this:
+ * \remarks To use this script, your Asterisk must be compiled with CURL, 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 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');
+$securitykey = GETPOST('securitykey');
+
$notfound = $langs->trans("Unknown");
// Security check
@@ -38,12 +63,27 @@ if (empty($conf->clicktodial->enabled)) {
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
if (empty($phone)) {
print "Error: Url must be called with parameter phone=phone to search\n";
exit;
}
+
$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 .= " WHERE s.entity IN (".getEntity('societe').")";
diff --git a/htdocs/public/cron/cron_run_jobs_by_url.php b/htdocs/public/cron/cron_run_jobs_by_url.php
index 8aa910a2d4f..fea2a2d7f82 100644
--- a/htdocs/public/cron/cron_run_jobs_by_url.php
+++ b/htdocs/public/cron/cron_run_jobs_by_url.php
@@ -93,7 +93,7 @@ if (empty($key)) {
echo 'Securitykey is required. Check setup of cron jobs module.';
exit;
}
-if ($key != $conf->global->CRON_KEY) {
+if ($key != getDolGlobalString('CRON_KEY')) {
echo 'Securitykey is wrong.';
exit;
}
diff --git a/htdocs/recruitment/class/recruitmentcandidature.class.php b/htdocs/recruitment/class/recruitmentcandidature.class.php
index 021ed614a5f..122adbe1ecf 100644
--- a/htdocs/recruitment/class/recruitmentcandidature.class.php
+++ b/htdocs/recruitment/class/recruitmentcandidature.class.php
@@ -127,7 +127,7 @@ class RecruitmentCandidature extends CommonObject
//'fk_recruitment_origin' => array('type'=>'integer:CRecruitmentOrigin:recruitment/class/crecruitmentorigin.class.php', 'label'=>'Origin', 'enabled'=>'1', 'position'=>45, 'visible'=>1, 'index'=>1),
'remuneration_requested' => array('type'=>'integer', 'label'=>'RequestedRemuneration', 'enabled'=>'1', 'position'=>80, 'notnull'=>0, 'visible'=>-1,),
'remuneration_proposed' => array('type'=>'integer', 'label'=>'ProposedRemuneration', 'enabled'=>'1', 'position'=>81, 'notnull'=>0, 'visible'=>-1,),
- 'description' => array('type'=>'html', 'label'=>'Description', 'enabled'=>'1', 'position'=>500, 'notnull'=>0, 'visible'=>3,),
+ 'description' => array('type'=>'html', 'label'=>'Description', 'enabled'=>'1', 'position'=>500, 'notnull'=>0, 'visible'=>3, 'css'=>'wordbreak'),
'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>'1', 'position'=>1000, 'notnull'=>-1, 'visible'=>-2,),
'model_pdf' => array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>'1', 'position'=>1010, 'notnull'=>-1, 'visible'=>0,),
'status' => array('type'=>'smallint', 'label'=>'Status', 'enabled'=>'1', 'position'=>1000, 'notnull'=>1, 'visible'=>1, 'index'=>1, 'default'=>0, 'arrayofkeyval'=>array('0'=>'Draft', '1'=>'Received', '3'=>'ContractProposed', '5'=>'ContractSigned', '8'=>'Refused', '9'=>'Canceled')),