';
diff --git a/htdocs/admin/ldap_members_types.php b/htdocs/admin/ldap_members_types.php
index 7933b59d5e0..3c6ef9f5aa9 100644
--- a/htdocs/admin/ldap_members_types.php
+++ b/htdocs/admin/ldap_members_types.php
@@ -108,7 +108,7 @@ if (!function_exists("ldap_connect")) {
print dol_get_fiche_head($head, 'memberstypes', $langs->trans("LDAPSetup"), -1);
-print $langs->trans("LDAPDescMembersTypes").'
';
+print ''.$langs->trans("LDAPDescMembersTypes").'
';
print '
';
diff --git a/htdocs/admin/ldap_users.php b/htdocs/admin/ldap_users.php
index f395eb88fb4..53e142cf900 100644
--- a/htdocs/admin/ldap_users.php
+++ b/htdocs/admin/ldap_users.php
@@ -179,7 +179,7 @@ print '';
print dol_get_fiche_head($head, 'users', $langs->trans("LDAPSetup"), -1);
-print $langs->trans("LDAPDescUsers").'
';
+print ''.$langs->trans("LDAPDescUsers").'
';
print '
';
diff --git a/htdocs/admin/system/perf.php b/htdocs/admin/system/perf.php
index f43bc3bf49a..fba5f9efb75 100644
--- a/htdocs/admin/system/perf.php
+++ b/htdocs/admin/system/perf.php
@@ -27,7 +27,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
// Load translation files required by the page
-$langs->loadLangs(array("install", "other", "admin"));
+$langs->loadLangs(array("install", "other", "admin", "products"));
if (!$user->admin) {
accessforbidden();
diff --git a/htdocs/compta/sociales/list.php b/htdocs/compta/sociales/list.php
index 365cdf93a2f..4772b9c45bd 100644
--- a/htdocs/compta/sociales/list.php
+++ b/htdocs/compta/sociales/list.php
@@ -451,7 +451,8 @@ if (!empty($arrayfields['p.ref']['checked'])) {
if (!empty($arrayfields['cs.fk_user']['checked'])) {
// Employee
print '';
- print $form->select_dolusers($search_users, 'search_users', 1, null, 0, '', '', '0', '0', 0, '', 0, '', '', 0, 0, true);
+ print $form->select_dolusers($search_users, 'search_users', 1, null, 0, '', '', '0', 0, 0, '', 0, '', 'maxwidth150', 0, 0, true);
+ print ' | ';
}
// Filter: Type
@@ -592,7 +593,7 @@ while ($i < min($num, $limit)) {
if (isModEnabled('accounting')) {
$typelabelpopup .= ' - '.$langs->trans("AccountancyCode").': '.$obj->type_accountancy_code;
}
- print ''.dol_escape_htmltag($typelabeltoshow).' | ';
+ print ''.dol_escape_htmltag($typelabeltoshow).' | ';
if (!$i) {
$totalarray['nbfield']++;
}
@@ -600,7 +601,7 @@ while ($i < min($num, $limit)) {
// Date
if (!empty($arrayfields['cs.date_ech']['checked'])) {
- print ''.dol_print_date($db->jdate($obj->date_ech), 'day').' | ';
+ print ''.dol_print_date($db->jdate($obj->date_ech), 'day').' | ';
if (!$i) {
$totalarray['nbfield']++;
}
@@ -608,7 +609,7 @@ while ($i < min($num, $limit)) {
// Date end period
if (!empty($arrayfields['cs.periode']['checked'])) {
- print ''.dol_print_date($db->jdate($obj->periode), 'day').' | ';
+ print ''.dol_print_date($db->jdate($obj->periode), 'day').' | ';
if (!$i) {
$totalarray['nbfield']++;
}
@@ -616,7 +617,7 @@ while ($i < min($num, $limit)) {
// Project ref
if (!empty($arrayfields['p.ref']['checked'])) {
- print '';
+ print ' | ';
if ($obj->project_id > 0) {
print $projectstatic->getNomUrl(1);
}
@@ -628,7 +629,7 @@ while ($i < min($num, $limit)) {
if (!empty($arrayfields['cs.fk_user']['checked'])) {
// Employee
- print " | ";
+ print ' | ';
if (!empty($obj->fk_user)) {
if (!empty($TLoadedUsers[$obj->fk_user])) {
$ustatic = $TLoadedUsers[$obj->fk_user];
@@ -647,7 +648,7 @@ while ($i < min($num, $limit)) {
// Type
if (!empty($arrayfields['cs.fk_mode_reglement']['checked'])) {
- print ' | ';
+ print ' | payment_code)).'">';
if (!empty($obj->payment_code)) {
print $langs->trans("PaymentTypeShort".$obj->payment_code);
}
@@ -659,7 +660,7 @@ while ($i < min($num, $limit)) {
// Account
if (!empty($arrayfields['cs.fk_account']['checked'])) {
- print ' | ';
+ print ' | ';
if ($obj->fk_account > 0) {
$bankstatic->id = $obj->fk_account;
$bankstatic->ref = $obj->bref;
@@ -682,7 +683,7 @@ while ($i < min($num, $limit)) {
// Amount
if (!empty($arrayfields['cs.amount']['checked'])) {
- print ' | '.price($obj->amount).' | ';
+ print ''.price($obj->amount).' | ';
if (!$i) {
$totalarray['nbfield']++;
}
@@ -694,7 +695,7 @@ while ($i < min($num, $limit)) {
// Status
if (!empty($arrayfields['cs.paye']['checked'])) {
- print ''.$chargesociale_static->LibStatut($obj->paye, 5, $obj->alreadypayed).' | ';
+ print ''.$chargesociale_static->LibStatut($obj->paye, 5, $obj->alreadypayed).' | ';
if (!$i) {
$totalarray['nbfield']++;
}
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index 7b78d9bbcb9..fd71e78afc6 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -3554,7 +3554,7 @@ abstract class CommonObject
$forcedroundingmode = $roundingadjust;
if ($forcedroundingmode == 'auto' && isset($conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND)) {
- $forcedroundingmode = $conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND;
+ $forcedroundingmode = getDolGlobalString('MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND');
} elseif ($forcedroundingmode == 'auto') {
$forcedroundingmode = '0';
}
@@ -3679,14 +3679,17 @@ abstract class CommonObject
}
$sqlfix = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldtva." = ".price2num($obj->total_tva - $diff).", total_ttc = ".price2num($obj->total_ttc - $diff)." WHERE rowid = ".((int) $obj->rowid);
dol_syslog('We found a difference of '.$diff.' for line rowid = '.$obj->rowid.". We fix the total_vat and total_ttc of line by running sqlfix = ".$sqlfix);
- $resqlfix = $this->db->query($sqlfix);
+
+ $resqlfix = $this->db->query($sqlfix);
+
if (!$resqlfix) {
dol_print_error($this->db, 'Failed to update line');
}
- $this->total_tva -= $diff;
- $this->total_ttc -= $diff;
- $total_tva_by_vats[$obj->vatrate] -= $diff;
- $total_ttc_by_vats[$obj->vatrate] -= $diff;
+
+ $this->total_tva = (float) price2num($this->total_tva - $diff, '', 1);
+ $this->total_ttc = (float) price2num($this->total_ttc - $diff, '', 1);
+ $total_tva_by_vats[$obj->vatrate] = (float) price2num($total_tva_by_vats[$obj->vatrate] - $diff, '', 1);
+ $total_ttc_by_vats[$obj->vatrate] = (float) price2num($total_ttc_by_vats[$obj->vatrate] - $diff, '', 1);
}
}
@@ -3713,6 +3716,13 @@ abstract class CommonObject
}
}
+ // Clean total
+ $this->total_ht = (float) price2num($this->total_ht);
+ $this->total_tva = (float) price2num($this->total_tva);
+ $this->total_localtax1 = (float) price2num($this->total_localtax1);
+ $this->total_localtax2 = (float) price2num($this->total_localtax2);
+ $this->total_ttc = (float) price2num($this->total_ttc);
+
$this->db->free($resql);
// Now update global field total_ht, total_ttc, total_tva, total_localtax1, total_localtax2, multicurrency_total_*
@@ -3746,11 +3756,11 @@ abstract class CommonObject
if (empty($nodatabaseupdate)) {
$sql = "UPDATE ".$this->db->prefix().$this->table_element.' SET';
- $sql .= " ".$fieldht." = ".((float) price2num($this->total_ht)).",";
- $sql .= " ".$fieldtva." = ".((float) price2num($this->total_tva)).",";
- $sql .= " ".$fieldlocaltax1." = ".((float) price2num($this->total_localtax1)).",";
- $sql .= " ".$fieldlocaltax2." = ".((float) price2num($this->total_localtax2)).",";
- $sql .= " ".$fieldttc." = ".((float) price2num($this->total_ttc));
+ $sql .= " ".$fieldht." = ".((float) price2num($this->total_ht, 'MT', 1)).",";
+ $sql .= " ".$fieldtva." = ".((float) price2num($this->total_tva, 'MT', 1)).",";
+ $sql .= " ".$fieldlocaltax1." = ".((float) price2num($this->total_localtax1, 'MT', 1)).",";
+ $sql .= " ".$fieldlocaltax2." = ".((float) price2num($this->total_localtax2, 'MT', 1)).",";
+ $sql .= " ".$fieldttc." = ".((float) price2num($this->total_ttc, 'MT', 1));
$sql .= ", multicurrency_total_ht = ".((float) price2num($this->multicurrency_total_ht, 'MT', 1));
$sql .= ", multicurrency_total_tva = ".((float) price2num($this->multicurrency_total_tva, 'MT', 1));
$sql .= ", multicurrency_total_ttc = ".((float) price2num($this->multicurrency_total_ttc, 'MT', 1));
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 0107dd8641d..f0fceb521da 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -5141,6 +5141,12 @@ class Form
},';
}
+ $jsforcursor = '';
+ if (empty($useajax)) {
+ $jsforcursor = '// The call to urljump can be slow, so we set the wait cursor'."\n";
+ $jsforcursor .= 'jQuery("html,body,#id-container").addClass("cursorwait");'."\n";
+ }
+
$formconfirm .= '
resizable: false,
height: "'.$height.'",
@@ -5152,7 +5158,8 @@ class Form
var options = "&token='.urlencode(newToken()).'";
var inputok = '.json_encode($inputok).'; /* List of fields into form */
var pageyes = "'.dol_escape_js(!empty($pageyes) ? $pageyes : '').'";
- if (inputok.length>0) {
+
+ if (inputok.length > 0) {
$.each(inputok, function(i, inputname) {
var more = "";
var inputvalue;
@@ -5168,14 +5175,18 @@ class Form
});
}
var urljump = pageyes + (pageyes.indexOf("?") < 0 ? "?" : "") + options;
- if (pageyes.length > 0) { location.href = urljump; }
- $(this).dialog("close");
+ if (pageyes.length > 0) {
+ '.$jsforcursor.'
+ location.href = urljump;
+ console.log("after location.href");
+ }
+ $(this).dialog("close");
},
"'.dol_escape_js($langs->transnoentities($labelbuttonno)).'": function() {
var options = "&token='.urlencode(newToken()).'";
var inputko = '.json_encode($inputko).'; /* List of fields into form */
var pageno="'.dol_escape_js(!empty($pageno) ? $pageno : '').'";
- if (inputko.length>0) {
+ if (inputko.length > 0) {
$.each(inputko, function(i, inputname) {
var more = "";
if ($("#" + inputname).attr("type") == "checkbox") { more = ":checked"; }
@@ -5186,7 +5197,10 @@ class Form
}
var urljump=pageno + (pageno.indexOf("?") < 0 ? "?" : "") + options;
//alert(urljump);
- if (pageno.length > 0) { location.href = urljump; }
+ if (pageno.length > 0) {
+ location.href = urljump;
+ console.log("after location.href");
+ }
$(this).dialog("close");
}
}
diff --git a/htdocs/core/class/ldap.class.php b/htdocs/core/class/ldap.class.php
index 6f54229c993..689fbe6845e 100644
--- a/htdocs/core/class/ldap.class.php
+++ b/htdocs/core/class/ldap.class.php
@@ -263,6 +263,7 @@ class Ldap
if ($this->result) {
$this->bind = $this->result;
$connected = 2;
+ $this->connectedServer = $host;
break;
} else {
$this->error = ldap_errno($this->connection).' '.ldap_error($this->connection);
@@ -275,6 +276,7 @@ class Ldap
if ($this->result) {
$this->bind = $this->result;
$connected = 2;
+ $this->connectedServer = $host;
break;
} else {
$this->error = ldap_errno($this->connection).' '.ldap_error($this->connection);
@@ -287,6 +289,7 @@ class Ldap
if ($result) {
$this->bind = $this->result;
$connected = 1;
+ $this->connectedServer = $host;
break;
} else {
$this->error = ldap_errno($this->connection).' '.ldap_error($this->connection);
@@ -297,10 +300,8 @@ class Ldap
if (!$connected) {
$this->unbind();
- } else {
- $this->connectedServer = $host;
}
- }
+ } // End loop on each server
}
if ($connected) {
diff --git a/htdocs/core/db/Database.interface.php b/htdocs/core/db/Database.interface.php
index 1d24b058614..faff7ff5172 100644
--- a/htdocs/core/db/Database.interface.php
+++ b/htdocs/core/db/Database.interface.php
@@ -182,9 +182,18 @@ interface Database
*
* @param string $stringtoencode String to escape
* @return string String escaped
+ * @deprecated
*/
public function escapeunderscore($stringtoencode);
+ /**
+ * Escape a string to insert data into a like
+ *
+ * @param string $stringtoencode String to escape
+ * @return string String escaped
+ */
+ public function escapeforlike($stringtoencode);
+
/**
* Sanitize a string for SQL forging
*
diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php
index 29c2d30df2f..f2c5f9f3a03 100644
--- a/htdocs/core/db/mysqli.class.php
+++ b/htdocs/core/db/mysqli.class.php
@@ -479,12 +479,24 @@ class DoliDBMysqli extends DoliDB
*
* @param string $stringtoencode String to escape
* @return string String escaped
+ * @deprecated
*/
public function escapeunderscore($stringtoencode)
{
return str_replace('_', '\_', (string) $stringtoencode);
}
+ /**
+ * Escape a string to insert data into a like
+ *
+ * @param string $stringtoencode String to escape
+ * @return string String escaped
+ */
+ public function escapeforlike($stringtoencode)
+ {
+ return str_replace(array('_', '\\', '%'), array('\_', '\\\\', '\%'), (string) $stringtoencode);
+ }
+
/**
* Return generic error code of last operation.
*
diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php
index fe3269867a9..e259933cd07 100644
--- a/htdocs/core/db/pgsql.class.php
+++ b/htdocs/core/db/pgsql.class.php
@@ -726,10 +726,22 @@ class DoliDBPgsql extends DoliDB
*
* @param string $stringtoencode String to escape
* @return string String escaped
+ * @deprecated
*/
public function escapeunderscore($stringtoencode)
{
- return str_replace('_', '\_', $stringtoencode);
+ return str_replace('_', '\_', (string) $stringtoencode);
+ }
+
+ /**
+ * Escape a string to insert data into a like
+ *
+ * @param string $stringtoencode String to escape
+ * @return string String escaped
+ */
+ public function escapeforlike($stringtoencode)
+ {
+ return str_replace(array('_', '\\', '%'), array('\_', '\\\\', '\%'), (string) $stringtoencode);
}
/**
diff --git a/htdocs/core/db/sqlite3.class.php b/htdocs/core/db/sqlite3.class.php
index 8d0141e8ca6..e31eeffe457 100644
--- a/htdocs/core/db/sqlite3.class.php
+++ b/htdocs/core/db/sqlite3.class.php
@@ -654,10 +654,22 @@ class DoliDBSqlite3 extends DoliDB
*
* @param string $stringtoencode String to escape
* @return string String escaped
+ * @deprecated
*/
public function escapeunderscore($stringtoencode)
{
- return str_replace('_', '\_', $stringtoencode);
+ return str_replace('_', '\_', (string) $stringtoencode);
+ }
+
+ /**
+ * Escape a string to insert data into a like
+ *
+ * @param string $stringtoencode String to escape
+ * @return string String escaped
+ */
+ public function escapeforlike($stringtoencode)
+ {
+ return str_replace(array('_', '\\', '%'), array('\_', '\\\\', '\%'), (string) $stringtoencode);
}
/**
diff --git a/htdocs/core/lib/price.lib.php b/htdocs/core/lib/price.lib.php
index 6b85e837b07..f85e78865ed 100644
--- a/htdocs/core/lib/price.lib.php
+++ b/htdocs/core/lib/price.lib.php
@@ -372,16 +372,16 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt
// If rounding is not using base 10 (rare)
if (!empty($conf->global->MAIN_ROUNDING_RULE_TOT)) {
if ($price_base_type == 'HT') {
- $result[0] = round($result[0] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT;
- $result[1] = round($result[1] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT;
- $result[9] = round($result[9] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT;
- $result[10] = round($result[10] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT;
+ $result[0] = price2num(round($result[0] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT, 'MT');
+ $result[1] = price2num(round($result[1] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT, 'MT');
+ $result[9] = price2num(round($result[9] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT, 'MT');
+ $result[10] = price2num(round($result[10] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT, 'MT');
$result[2] = price2num($result[0] + $result[1] + $result[9] + $result[10], 'MT');
} else {
- $result[1] = round($result[1] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT;
- $result[2] = round($result[2] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT;
- $result[9] = round($result[9] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT;
- $result[10] = round($result[10] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT;
+ $result[1] = price2num(round($result[1] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT, 'MT');
+ $result[2] = price2num(round($result[2] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT, 'MT');
+ $result[9] = price2num(round($result[9] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT, 'MT');
+ $result[10] = price2num(round($result[10] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT, 'MT');
$result[0] = price2num($result[2] - $result[1] - $result[9] - $result[10], 'MT');
}
}
diff --git a/htdocs/core/lib/website.lib.php b/htdocs/core/lib/website.lib.php
index e9de957e4a8..e9ea4dbcf09 100644
--- a/htdocs/core/lib/website.lib.php
+++ b/htdocs/core/lib/website.lib.php
@@ -947,11 +947,11 @@ function getPagesFromSearchCriterias($type, $algo, $searchstring, $max = 25, $so
$sql .= " AND (";
$searchalgo = '';
if (preg_match('/meta/', $algo)) {
- $searchalgo .= ($searchalgo ? ' OR ' : '')."wp.title LIKE '%".$db->escapeunderscore($db->escape($searchstring))."%' OR wp.description LIKE '%".$db->escapeunderscore($db->escape($searchstring))."%'";
- $searchalgo .= ($searchalgo ? ' OR ' : '')."wp.keywords LIKE '".$db->escapeunderscore($db->escape($searchstring)).",%' OR wp.keywords LIKE '% ".$db->escapeunderscore($db->escape($searchstring))."%'"; // TODO Use a better way to scan keywords
+ $searchalgo .= ($searchalgo ? ' OR ' : '')."wp.title LIKE '%".$db->escapeforlike($db->escape($searchstring))."%' OR wp.description LIKE '%".$db->escapeforlike($db->escape($searchstring))."%'";
+ $searchalgo .= ($searchalgo ? ' OR ' : '')."wp.keywords LIKE '".$db->escapeforlike($db->escape($searchstring)).",%' OR wp.keywords LIKE '% ".$db->escapeforlike($db->escape($searchstring))."%'"; // TODO Use a better way to scan keywords
}
if (preg_match('/content/', $algo)) {
- $searchalgo .= ($searchalgo ? ' OR ' : '')."wp.content LIKE '%".$db->escapeunderscore($db->escape($searchstring))."%'";
+ $searchalgo .= ($searchalgo ? ' OR ' : '')."wp.content LIKE '%".$db->escapeforlike($db->escape($searchstring))."%'";
}
$sql .= $searchalgo;
if (is_array($otherfilters) && !empty($otherfilters['category'])) {
diff --git a/htdocs/core/login/functions_ldap.php b/htdocs/core/login/functions_ldap.php
index 022186b8de1..e9785ce82a8 100644
--- a/htdocs/core/login/functions_ldap.php
+++ b/htdocs/core/login/functions_ldap.php
@@ -233,12 +233,14 @@ function check_user_password_ldap($usertotest, $passwordtotest, $entitytotest)
$usertmp = new User($db);
$usertmp->fetch('', $login);
- $ret = $mc->checkRight($usertmp->id, $entitytotest);
- if ($ret < 0) {
- dol_syslog("functions_ldap::check_user_password_ldap Authentication KO entity '".$entitytotest."' not allowed for user id '".$usertmp->id."'", LOG_NOTICE);
- $login = ''; // force authentication failure
+ if (is_object($mc)) {
+ $ret = $mc->checkRight($usertmp->id, $entitytotest);
+ if ($ret < 0) {
+ dol_syslog("functions_ldap::check_user_password_ldap Authentication KO entity '".$entitytotest."' not allowed for user id '".$usertmp->id."'", LOG_NOTICE);
+ $login = ''; // force authentication failure
+ }
+ unset($usertmp);
}
- unset($usertmp);
}
}
if ($result == 1) {
diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php
index 46ac4ffde37..81a601b2e45 100644
--- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php
+++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php
@@ -1269,7 +1269,7 @@ class pdf_sponge extends ModelePDFFactures
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
global $langs;
- $langs->loadLangs(array('payment', 'paybox'));
+ $langs->loadLangs(array('payment', 'paybox', 'stripe'));
$servicename = $langs->transnoentities('Online');
$paiement_url = getOnlinePaymentUrl('', 'invoice', $object->ref, '', '', '');
$linktopay = $langs->trans("ToOfferALinkForOnlinePayment", $servicename).' '.$outputlangs->transnoentities("ClickHere").'';
diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php
index 32284a2cbd1..0bea7d1d739 100644
--- a/htdocs/core/modules/import/import_csv.modules.php
+++ b/htdocs/core/modules/import/import_csv.modules.php
@@ -835,8 +835,8 @@ class ImportCsv extends ModeleImports
$sqlSelect = "SELECT ".$fname." FROM ".$tablename;
$data = array_combine($listfields, $listvalues);
- $where = array();
- $filters = array();
+ $where = array(); // filters to forge SQL request
+ $filters = array(); // filters to forge output error message
foreach ($updatekeys as $key) {
$col = $objimport->array_import_updatekeys[0][$key];
$key = preg_replace('/^.*\./i', '', $key);
@@ -846,8 +846,12 @@ class ImportCsv extends ModeleImports
$socialnetwork = $tmp[1];
$jsondata = $data[$key];
$json = json_decode($jsondata);
- $where[] = $key." LIKE '%\"".$socialnetwork."\":\"".$this->db->escape($json->$socialnetwork)."\"%'";
- $filters[] = $col." LIKE '%\"".$socialnetwork."\":\"".$this->db->escape($json->$socialnetwork)."\"%'";
+ $stringtosearch = json_encode($socialnetwork).':'.json_encode($json->$socialnetwork);
+ //var_dump($stringtosearch);
+ //var_dump($this->db->escape($stringtosearch)); // This provide a value for sql string (but not for a like)
+ $where[] = $key." LIKE '%".$this->db->escapeforlike($this->db->escape($stringtosearch))."%'";
+ $filters[] = $col." LIKE '%".$this->db->escapeforlike($this->db->escape($stringtosearch))."%'";
+ //var_dump($where[1]); // This provide a value for sql string inside a like
} else {
$where[] = $key.' = '.$data[$key];
$filters[] = $col.' = '.$data[$key];
diff --git a/htdocs/core/modules/import/import_xlsx.modules.php b/htdocs/core/modules/import/import_xlsx.modules.php
index d8a9d77a98e..8652f106ca2 100644
--- a/htdocs/core/modules/import/import_xlsx.modules.php
+++ b/htdocs/core/modules/import/import_xlsx.modules.php
@@ -891,8 +891,12 @@ class ImportXlsx extends ModeleImports
$socialnetwork = $tmp[1];
$jsondata = $data[$key];
$json = json_decode($jsondata);
- $where[] = $key." LIKE '%\"".$socialnetwork."\":\"".$this->db->escape($json->$socialnetwork)."\"%'";
- $filters[] = $col." LIKE '%\"".$socialnetwork."\":\"".$this->db->escape($json->$socialnetwork)."\"%'";
+ $stringtosearch = json_encode($socialnetwork).':'.json_encode($json->$socialnetwork);
+ //var_dump($stringtosearch);
+ //var_dump($this->db->escape($stringtosearch)); // This provide a value for sql string (but not for a like)
+ $where[] = $key." LIKE '%".$this->db->escapeforlike($this->db->escape($stringtosearch))."%'";
+ $filters[] = $col." LIKE '%".$this->db->escapeforlike($this->db->escape($stringtosearch))."%'";
+ //var_dump($where[1]); // This provide a value for sql string inside a like
} else {
$where[] = $key.' = '.$data[$key];
$filters[] = $col.' = '.$data[$key];
diff --git a/htdocs/core/modules/modAccounting.class.php b/htdocs/core/modules/modAccounting.class.php
index 5e30978693e..737d2831db6 100644
--- a/htdocs/core/modules/modAccounting.class.php
+++ b/htdocs/core/modules/modAccounting.class.php
@@ -272,6 +272,24 @@ class modAccounting extends DolibarrModules
//--------
$r = 0;
+ // Chart of accounts
+ $r++;
+ $this->import_code[$r] = $this->rights_class.'_'.$r;
+ $this->import_label[$r] = "Chartofaccounts"; // Translation key
+ $this->import_icon[$r] = $this->picto;
+ $this->import_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into import_icon
+ $this->import_tables_array[$r] = array('aa'=>MAIN_DB_PREFIX.'accounting_account');
+ $this->import_tables_creator_array[$r] = array('aa'=>'fk_user_author'); // Fields to store import user id
+ $this->import_fields_array[$r] = array('aa.fk_pcg_version'=>"Chartofaccounts*", 'aa.account_number'=>"AccountAccounting*", 'aa.label'=>"Label*", 'aa.account_parent'=>"Accountparent", "aa.fk_accounting_category"=>"AccountingCategory", "aa.pcg_type"=>"Pcgtype*", 'aa.active'=>'Status*', 'aa.datec'=>"DateCreation");
+ $this->import_regex_array[$r] = array('aa.fk_pcg_version'=>'pcg_version@'.MAIN_DB_PREFIX.'accounting_system', 'aa.account_number'=>'^.{1,32}$', 'aa.label'=>'^.{1,255}$', 'aa.account_parent'=>'^.{0,32}$', 'aa.fk_accounting_category'=>'rowid@'.MAIN_DB_PREFIX.'c_accounting_category', 'aa.pcg_type'=>'^.{1,20}$', 'aa.active'=>'^0|1$', 'aa.datec'=>'^\d{4}-\d{2}-\d{2}$');
+ $this->import_convertvalue_array[$r] = array(
+ 'aa.account_number'=>array('rule'=>'accountingaccount'),
+ 'aa.account_parent'=>array('rule'=>'fetchidfromref', 'classfile'=>'/accountancy/class/accountingaccount.class.php', 'class'=>'AccountingAccount', 'method'=>'fetch', 'element'=>'AccountingAccount'),
+ 'aa.fk_accounting_category'=>array('rule'=>'fetchidfromcodeorlabel', 'classfile'=>'/accountancy/class/accountancycategory.class.php', 'class'=>'AccountancyCategory', 'method'=>'fetch', 'dict'=>'DictionaryAccountancyCategory'),
+ );
+ $this->import_examplevalues_array[$r] = array('aa.fk_pcg_version'=>"PCG99-ABREGE", 'aa.account_number'=>"707", 'aa.label'=>"Product sales", 'aa.account_parent'=>"ref:7 or id:1407", "aa.fk_accounting_category"=>"", "aa.pcg_type"=>"PROD", 'aa.active'=>'1', 'aa.datec'=>"2017-04-28");
+ $this->import_updatekeys_array[$r] = array('aa.fk_pcg_version'=>'Chartofaccounts', 'aa.account_number'=>'AccountAccounting');
+
// General ledger
$r++;
$this->import_code[$r] = $this->rights_class.'_'.$r;
@@ -393,23 +411,5 @@ class modAccounting extends DolibarrModules
'b.multicurrency_amount'=>"90 (Necessary if devise is different than EUR)",
'b.multicurrency_code'=>"US (Necessary if devise is different than EUR)",
);
-
- // Chart of accounts
- $r++;
- $this->import_code[$r] = $this->rights_class.'_'.$r;
- $this->import_label[$r] = "Chartofaccounts"; // Translation key
- $this->import_icon[$r] = $this->picto;
- $this->import_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into import_icon
- $this->import_tables_array[$r] = array('aa'=>MAIN_DB_PREFIX.'accounting_account');
- $this->import_tables_creator_array[$r] = array('aa'=>'fk_user_author'); // Fields to store import user id
- $this->import_fields_array[$r] = array('aa.fk_pcg_version'=>"Chartofaccounts*", 'aa.account_number'=>"AccountAccounting*", 'aa.label'=>"Label*", 'aa.account_parent'=>"Accountparent", "aa.fk_accounting_category"=>"AccountingCategory", "aa.pcg_type"=>"Pcgtype*", 'aa.active'=>'Status*', 'aa.datec'=>"DateCreation");
- $this->import_regex_array[$r] = array('aa.fk_pcg_version'=>'pcg_version@'.MAIN_DB_PREFIX.'accounting_system', 'aa.account_number'=>'^.{1,32}$', 'aa.label'=>'^.{1,255}$', 'aa.account_parent'=>'^.{0,32}$', 'aa.fk_accounting_category'=>'rowid@'.MAIN_DB_PREFIX.'c_accounting_category', 'aa.pcg_type'=>'^.{1,20}$', 'aa.active'=>'^0|1$', 'aa.datec'=>'^\d{4}-\d{2}-\d{2}$');
- $this->import_convertvalue_array[$r] = array(
- 'aa.account_number'=>array('rule'=>'accountingaccount'),
- 'aa.account_parent'=>array('rule'=>'fetchidfromref', 'classfile'=>'/accountancy/class/accountingaccount.class.php', 'class'=>'AccountingAccount', 'method'=>'fetch', 'element'=>'AccountingAccount'),
- 'aa.fk_accounting_category'=>array('rule'=>'fetchidfromcodeorlabel', 'classfile'=>'/accountancy/class/accountancycategory.class.php', 'class'=>'AccountancyCategory', 'method'=>'fetch', 'dict'=>'DictionaryAccountancyCategory'),
- );
- $this->import_examplevalues_array[$r] = array('aa.fk_pcg_version'=>"PCG99-ABREGE", 'aa.account_number'=>"707", 'aa.label'=>"Product sales", 'aa.account_parent'=>"ref:7 or id:1407", "aa.fk_accounting_category"=>"", "aa.pcg_type"=>"PROD", 'aa.active'=>'1', 'aa.datec'=>"2017-04-28");
- $this->import_updatekeys_array[$r] = array('aa.fk_pcg_version'=>'Chartofaccounts', 'aa.account_number'=>'AccountAccounting');
}
}
diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php
index 327262ce39f..7f7624b167f 100644
--- a/htdocs/core/modules/modSociete.class.php
+++ b/htdocs/core/modules/modSociete.class.php
@@ -747,7 +747,7 @@ class modSociete extends DolibarrModules
's.fk_departement' => "StateCode",
's.fk_pays' => "CountryCode",
's.birthday' => "DateOfBirth",
- 's.poste' => "Role",
+ 's.poste' => "PostOrFunction",
's.phone' => "Phone",
's.phone_perso' => "PhonePerso",
's.phone_mobile' => "PhoneMobile",
diff --git a/htdocs/core/modules/societe/mod_codeclient_elephant.php b/htdocs/core/modules/societe/mod_codeclient_elephant.php
index 820dfafdc7e..100799dff95 100644
--- a/htdocs/core/modules/societe/mod_codeclient_elephant.php
+++ b/htdocs/core/modules/societe/mod_codeclient_elephant.php
@@ -172,27 +172,32 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode
"ErrorBadMaskBadRazMonth",
"ErrorCantUseRazWithYearOnOneDigit",
);
+
+ $cssforerror = (getDolGlobalString('SOCIETE_CODECLIENT_ADDON') == 'mod_codeclient_elephant' ? 'error' : 'opacitymedium');
+
if ($type != 1) {
$examplecust = $this->getNextValue($objsoc, 0);
- if (!$examplecust) {
- $examplecust = ''.$langs->trans('NotConfigured').'
';
+ if (!$examplecust && ($cssforerror == 'error' || $this->error != 'NotConfigured')) {
+ $langs->load("errors");
+ $examplecust = ''.$langs->trans('ErrorBadMask').'';
$error = 1;
}
if (in_array($examplecust, $errmsg)) {
$langs->load("errors");
- $examplecust = ''.$langs->trans($examplecust).'
';
+ $examplecust = ''.$langs->trans($examplecust).'';
$error = 1;
}
}
if ($type != 0) {
$examplesup = $this->getNextValue($objsoc, 1);
- if (!$examplesup) {
- $examplesup = ''.$langs->trans('NotConfigured').'
';
+ if (!$examplesup && ($cssforerror == 'error' || $this->error != 'NotConfigured')) {
+ $langs->load("errors");
+ $examplesup = ''.$langs->trans('ErrorBadMask').'';
$error = 1;
}
if (in_array($examplesup, $errmsg)) {
$langs->load("errors");
- $examplesup = ''.$langs->trans($examplesup).'
';
+ $examplesup = ''.$langs->trans($examplesup).'';
$error = 1;
}
}
@@ -202,11 +207,7 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode
} elseif ($type == 1) {
return $examplesup;
} else {
- if ($error == 1) {
- return $examplecust.' '.$examplesup;
- } else {
- return $examplecust.'
'.$examplesup;
- }
+ return $examplecust.'
'.$examplesup;
}
}
diff --git a/htdocs/debugbar/class/TraceableDB.php b/htdocs/debugbar/class/TraceableDB.php
index 082e45e4f43..785af37fc94 100644
--- a/htdocs/debugbar/class/TraceableDB.php
+++ b/htdocs/debugbar/class/TraceableDB.php
@@ -255,12 +255,24 @@ class TraceableDB extends DoliDB
*
* @param string $stringtoencode String to escape
* @return string String escaped
+ * @deprecated
*/
public function escapeunderscore($stringtoencode)
{
return $this->db->escapeunderscore($stringtoencode);
}
+ /**
+ * Escape a string to insert data into a like
+ *
+ * @param string $stringtoencode String to escape
+ * @return string String escaped
+ */
+ public function escapeforlike($stringtoencode)
+ {
+ return str_replace(array('_', '\\', '%'), array('\_', '\\\\', '\%'), (string) $stringtoencode);
+ }
+
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Get last ID after an insert INSERT
diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php
index b7be9662a12..b9120f1fceb 100644
--- a/htdocs/fourn/class/fournisseur.commande.class.php
+++ b/htdocs/fourn/class/fournisseur.commande.class.php
@@ -2054,6 +2054,8 @@ class CommandeFournisseur extends CommonOrder
$now = dol_now();
+ $inventorycode = dol_print_date(dol_now(), 'dayhourlog');
+
if (($this->statut == self::STATUS_ORDERSENT || $this->statut == self::STATUS_RECEIVED_PARTIALLY || $this->statut == self::STATUS_RECEIVED_COMPLETELY)) {
$this->db->begin();
@@ -2087,12 +2089,14 @@ class CommandeFournisseur extends CommonOrder
// $price should take into account discount (except if option STOCK_EXCLUDE_DISCOUNT_FOR_PMP is on)
$mouv->origin = &$this;
$mouv->setOrigin($this->element, $this->id);
+
// Method change if qty < 0
if (!empty($conf->global->SUPPLIER_ORDER_ALLOW_NEGATIVE_QTY_FOR_SUPPLIER_ORDER_RETURN) && $qty < 0) {
$result = $mouv->livraison($user, $product, $entrepot, $qty*(-1), $price, $comment, $now, $eatby, $sellby, $batch);
} else {
- $result = $mouv->reception($user, $product, $entrepot, $qty, $price, $comment, $eatby, $sellby, $batch);
+ $result = $mouv->reception($user, $product, $entrepot, $qty, $price, $comment, $eatby, $sellby, $batch, $inventorycode);
}
+
if ($result < 0) {
$this->error = $mouv->error;
$this->errors = $mouv->errors;
diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php
index e2ed6adfdbe..c419e10b3b1 100644
--- a/htdocs/fourn/commande/dispatch.php
+++ b/htdocs/fourn/commande/dispatch.php
@@ -221,6 +221,7 @@ if ($action == 'denydispatchline' && $permissiontocontrol) {
if ($action == 'dispatch' && $permissiontoreceive) {
$error = 0;
+ $notrigger = 0;
$db->begin();
diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php
index a66814ce1b1..8916041520d 100644
--- a/htdocs/imports/import.php
+++ b/htdocs/imports/import.php
@@ -235,6 +235,7 @@ if ($action == 'add_import_model') {
$result = $objimport->create($user);
if ($result >= 0) {
setEventMessages($langs->trans("ImportModelSaved", $objimport->model_name), null, 'mesgs');
+ $import_name = '';
} else {
$langs->load("errors");
if ($objimport->errno == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
@@ -1286,7 +1287,7 @@ if ($step == 4 && $datatoimport) {
print '';
// Lines for remark
- print '| '.$langs->trans("Remark").' |
';
+ print '| '.$langs->trans("Note").' |
';
print ' |
';
print '
';
@@ -1470,8 +1471,8 @@ if ($step == 4 && $datatoimport) {
print '';
$nameofimportprofile = str_replace(' ', '-', $langs->trans("ImportProfile").' '.$titleofmodule.' '.dol_print_date(dol_now('gmt'), 'dayxcard'));
- if (is_object($objimport) && !empty($objimport->model_name)) {
- $nameofimportprofile = $objimport->model_name;
+ if (GETPOST('import_name')) { // If we have submited a form, we take value used fot the update try
+ $nameofimportprofile = $import_name;
}
print '';
@@ -1966,9 +1967,9 @@ if ($step == 5 && $datatoimport) {
print '';
print ''.$langs->trans("NowClickToRunTheImport", $langs->transnoentitiesnoconv("RunImportFile")).'
';
- if (empty($nboferrors)) {
+ /*if (empty($nboferrors)) {
print $langs->trans("DataLoadedWithId", $importid).'
';
- }
+ }*/
print '
';
print '
';
diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php
index d92c595c6ec..bfa091a1400 100644
--- a/htdocs/mrp/mo_production.php
+++ b/htdocs/mrp/mo_production.php
@@ -662,8 +662,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
if (in_array($action, array('consumeorproduce', 'consumeandproduceall'))) {
$defaultstockmovementlabel = GETPOST('inventorylabel', 'alphanohtml') ? GETPOST('inventorylabel', 'alphanohtml') : $langs->trans("ProductionForRef", $object->ref);
- //$defaultstockmovementcode = GETPOST('inventorycode', 'alphanohtml') ? GETPOST('inventorycode', 'alphanohtml') : $object->ref.'_'.dol_print_date(dol_now(), 'dayhourlog');
- $defaultstockmovementcode = GETPOST('inventorycode', 'alphanohtml') ? GETPOST('inventorycode', 'alphanohtml') : $langs->trans("ProductionForRef", $object->ref);
+ $defaultstockmovementcode = GETPOST('inventorycode', 'alphanohtml') ? GETPOST('inventorycode', 'alphanohtml') : dol_print_date(dol_now(), 'dayhourlog');
print '';
print '
'.$langs->trans("ConfirmProductionDesc", $langs->transnoentitiesnoconv("Confirm")).'
';
diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php
index 7ee71bc1569..849c1c53398 100644
--- a/htdocs/projet/class/project.class.php
+++ b/htdocs/projet/class/project.class.php
@@ -345,6 +345,7 @@ class Project extends CommonObject
$this->fields['accept_booth_suggestions']['enabled'] = 0;
$this->fields['price_registration']['enabled'] = 0;
$this->fields['price_booth']['enabled'] = 0;
+ $this->fields['max_attendees']['enabled'] = 0;
}
}
diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php
index 65c4ab49da4..d15d5797dd6 100644
--- a/htdocs/projet/tasks/list.php
+++ b/htdocs/projet/tasks/list.php
@@ -1052,7 +1052,7 @@ while ($i < $imaxinloop) {
// Description
if (!empty($arrayfields['t.description']['checked'])) {
print '
';
- print dol_escape_htmltag($object->description);
+ print dolGetFirstLineOfText($object->description, 5);
print ' | ';
if (!$i) {
$totalarray['nbfield']++;
diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php
index 137ddd1c7cb..18999ed9a1f 100644
--- a/htdocs/societe/list.php
+++ b/htdocs/societe/list.php
@@ -1445,24 +1445,19 @@ while ($i < min($num, $limit)) {
}
}
if (!empty($arrayfields['s.nom']['checked'])) {
- $savalias = $obj->name_alias;
- if (!empty($arrayfields['s.name_alias']['checked'])) {
- $companystatic->name_alias = '';
- }
print '
global->MAIN_SOCIETE_SHOW_COMPLETE_NAME) ? ' class="tdoverflowmax200"' : '').' data-key="ref">';
if ($contextpage == 'poslist') {
- print $obj->name;
+ print dol_escape_htmltag($obj->name);
} else {
- print $companystatic->getNomUrl(1, '', 100, 0, 1);
+ print $companystatic->getNomUrl(1, '', 100, 0, 1, empty($arrayfields['s.name_alias']['checked']) ? 0 : 1);
}
print " | \n";
- $companystatic->name_alias = $savalias;
if (!$i) {
$totalarray['nbfield']++;
}
}
if (!empty($arrayfields['s.name_alias']['checked'])) {
- print '
';
+ print ' | ';
print dol_escape_htmltag($companystatic->name_alias);
print " | \n";
if (!$i) {
@@ -1471,7 +1466,7 @@ while ($i < min($num, $limit)) {
}
// Barcode
if (!empty($arrayfields['s.barcode']['checked'])) {
- print '
'.dol_escape_htmltag($obj->barcode).' | ';
+ print '
'.dol_escape_htmltag($obj->barcode).' | ';
if (!$i) {
$totalarray['nbfield']++;
}
diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php
index 90cc6b420f8..fc4fafc60af 100644
--- a/htdocs/theme/eldy/global.inc.php
+++ b/htdocs/theme/eldy/global.inc.php
@@ -887,6 +887,9 @@ textarea.centpercent {
.cursornotallowed {
cursor: not-allowed;
}
+.cursorwait {
+ cursor: wait;
+}
.backgroundblank {
background-color: #fff;
}
diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php
index f1c314426a2..7521172121f 100644
--- a/htdocs/theme/md/style.css.php
+++ b/htdocs/theme/md/style.css.php
@@ -1032,6 +1032,9 @@ textarea.centpercent {
.cursormove {
cursor: move;
}
+.cursorwait {
+ cursor: wait;
+}
.cursornotallowed {
cursor: not-allowed;
}
diff --git a/htdocs/ticket/agenda.php b/htdocs/ticket/agenda.php
index e0d06759d77..fd82269a08f 100644
--- a/htdocs/ticket/agenda.php
+++ b/htdocs/ticket/agenda.php
@@ -81,14 +81,14 @@ if (!$action) {
// Security check
$id = GETPOST("id", 'int');
if ($user->socid > 0) $socid = $user->socid;
-$result = restrictedArea($user, 'ticket', $id, '');
+$result = restrictedArea($user, 'ticket', $object->id, '');
// restrict access for externals users
if ($user->socid > 0 && ($object->fk_soc != $user->socid)) {
accessforbidden();
}
// or for unauthorized internals users
-if (!$user->socid && ($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY && $object->fk_user_assign != $user->id) && !$user->rights->ticket->manage) {
+if (!$user->socid && (!empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) && $object->fk_user_assign != $user->id) && !$user->rights->ticket->manage) {
accessforbidden();
}
@@ -144,7 +144,7 @@ if ($socid > 0) {
print dol_get_fiche_end();
}
-if (!$user->socid && $conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) {
+if (!$user->socid && !empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY)) {
$object->next_prev_filter = "te.fk_user_assign = '".$user->id."'";
} elseif ($user->socid > 0) {
$object->next_prev_filter = "te.fk_soc = '".$user->socid."'";
@@ -162,11 +162,15 @@ if ($object->fk_user_create > 0) {
$langs->load("users");
$fuser = new User($db);
$fuser->fetch($object->fk_user_create);
- $morehtmlref .= $fuser->getNomUrl(0);
-}
-if (!empty($object->origin_email)) {
+ $morehtmlref .= $fuser->getNomUrl(-1);
+} elseif (!empty($object->email_msgid)) {
$morehtmlref .= '
'.$langs->trans("CreatedBy").' : ';
- $morehtmlref .= $object->origin_email.'
('.$langs->trans("TicketEmailOriginIssuer").')';
+ $morehtmlref .= img_picto('', 'email', 'class="paddingrightonly"');
+ $morehtmlref .= dol_escape_htmltag($object->origin_email).'
('.$form->textwithpicto($langs->trans("CreatedByEmailCollector"), $langs->trans("EmailMsgID").': '.$object->email_msgid).')';
+} elseif (!empty($object->origin_email)) {
+ $morehtmlref .= '
'.$langs->trans("CreatedBy").' : ';
+ $morehtmlref .= img_picto('', 'email', 'class="paddingrightonly"');
+ $morehtmlref .= dol_escape_htmltag($object->origin_email).'
('.$langs->trans("CreatedByPublicPortal").')';
}
// Thirdparty
diff --git a/htdocs/ticket/messaging.php b/htdocs/ticket/messaging.php
index 0abbf568c26..91904a97dab 100644
--- a/htdocs/ticket/messaging.php
+++ b/htdocs/ticket/messaging.php
@@ -50,7 +50,7 @@ if (!$sortfield) {
$sortfield = "a.datep,a.id";
}
if (!$sortorder) {
- $sortorder = "desc";
+ $sortorder = "DESC";
}
$offset = $limit * $page;
$pageprev = $page - 1;