';
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/oauth.php b/htdocs/admin/oauth.php
index 772055f0809..ec6af9bc4f6 100644
--- a/htdocs/admin/oauth.php
+++ b/htdocs/admin/oauth.php
@@ -36,7 +36,7 @@ $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domai
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
// Load translation files required by the page
-$langs->loadLangs(array('admin', 'oauth'));
+$langs->loadLangs(array('admin', 'oauth', 'modulebuilder'));
// Security check
if (!$user->admin) {
@@ -100,7 +100,7 @@ $form = new Form($db);
$linkback = ''.$langs->trans("BackToModuleList").'';
print load_fiche_titre($langs->trans('ConfigOAuth'), $linkback, 'title_setup');
-print '';
print '
';
print '
';
+print dol_get_fiche_end();
-print '';
-
// End of page
llxFooter();
$db->close();
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/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php
index 539046c593b..0e57bebd922 100644
--- a/htdocs/bom/class/bom.class.php
+++ b/htdocs/bom/class/bom.class.php
@@ -1028,10 +1028,20 @@ class BOM extends CommonObject
*/
public function calculateCosts()
{
+ global $hookmanager;
+
include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
$this->unit_cost = 0;
$this->total_cost = 0;
+ $parameters=array();
+ $reshook = $hookmanager->executeHooks('calculateCostsBom', $parameters, $this); // Note that $action and $object may have been modified by hook
+
+
+ if ($reshook > 0) {
+ return $hookmanager->resPrint;
+ }
+
if (is_array($this->lines) && count($this->lines)) {
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
$productFournisseur = new ProductFournisseur($this->db);
diff --git a/htdocs/bookmarks/bookmarks.lib.php b/htdocs/bookmarks/bookmarks.lib.php
index 54bd7a41282..26d834fb5d9 100644
--- a/htdocs/bookmarks/bookmarks.lib.php
+++ b/htdocs/bookmarks/bookmarks.lib.php
@@ -42,8 +42,12 @@ function printDropdownBookmarksList()
if (!empty($_SERVER["QUERY_STRING"])) {
if (is_array($_GET)) {
foreach ($_GET as $key => $val) {
- if ($val != '') {
- $url_param[$key]=http_build_query(array(dol_escape_htmltag($key) => dol_escape_htmltag($val)));
+ if (is_array($val)) {
+ foreach ($val as $tmpsubval) {
+ $url_param[] = http_build_query(array(dol_escape_htmltag($key).'[]' => dol_escape_htmltag($tmpsubval)));
+ }
+ } elseif ($val != '') {
+ $url_param[$key] = http_build_query(array(dol_escape_htmltag($key) => dol_escape_htmltag($val)));
}
}
}
@@ -61,10 +65,11 @@ function printDropdownBookmarksList()
if ((preg_match('/^search_/', $key) || in_array($key, $authorized_var))
&& $val != ''
&& !array_key_exists($key, $url_param)) {
- $url_param[$key]=http_build_query(array(dol_escape_htmltag($key) => dol_escape_htmltag($val)));
+ $url_param[$key] = http_build_query(array(dol_escape_htmltag($key) => dol_escape_htmltag($val)));
}
}
}
+
$url .= ($tmpurl ? '?'.$tmpurl : '');
if (!empty($url_param)) {
$url .= '&'.implode('&', $url_param);
diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php
index bfce6bab9a8..c459ea7b84a 100644
--- a/htdocs/comm/propal/class/propal.class.php
+++ b/htdocs/comm/propal/class/propal.class.php
@@ -1265,7 +1265,7 @@ class Propal extends CommonObject
break;
}
// Defined the new fk_parent_line
- if ($result > 0) {
+ if ($result > 0 && $line->product_type == 9) {
$fk_parent_line = $result;
}
}
diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php
index bc4d085f8ce..5ad1c7dda24 100644
--- a/htdocs/commande/card.php
+++ b/htdocs/commande/card.php
@@ -424,7 +424,7 @@ if (empty($reshook)) {
}
// Defined the new fk_parent_line
- if ($result > 0) {
+ if ($result > 0 && $lines[$i]->product_type == 9) {
$fk_parent_line = $result;
}
}
diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php
index 0b7da7a5dbc..c2c4eada0b2 100644
--- a/htdocs/commande/class/commande.class.php
+++ b/htdocs/commande/class/commande.class.php
@@ -1073,7 +1073,7 @@ class Commande extends CommonOrder
return -1;
}
// Defined the new fk_parent_line
- if ($result > 0) {
+ if ($result > 0 && $line->product_type == 9) {
$fk_parent_line = $result;
}
}
diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php
index dd322bd8245..c1ce6c3f7ba 100644
--- a/htdocs/compta/facture/card.php
+++ b/htdocs/compta/facture/card.php
@@ -1244,7 +1244,7 @@ if (empty($reshook)) {
$object->lines[] = $line; // insert new line in current object
// Defined the new fk_parent_line
- if ($result > 0) {
+ if ($result > 0 && $line->product_type == 9) {
$fk_parent_line = $result;
}
}
@@ -1765,7 +1765,7 @@ if (empty($reshook)) {
}
// Defined the new fk_parent_line
- if ($result > 0) {
+ if ($result > 0 && $lines[$i]->product_type == 9) {
$fk_parent_line = $result;
}
}
diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php
index 5379de84bef..bdf1192f1a5 100644
--- a/htdocs/compta/facture/class/facture.class.php
+++ b/htdocs/compta/facture/class/facture.class.php
@@ -872,7 +872,7 @@ class Facture extends CommonInvoice
);
// Defined the new fk_parent_line
- if ($result > 0) {
+ if ($result > 0 && $newinvoiceline->product_type == 9) {
$fk_parent_line = $result;
}
}
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/compta/stats/index.php b/htdocs/compta/stats/index.php
index a81c732017f..9d4392c6b17 100644
--- a/htdocs/compta/stats/index.php
+++ b/htdocs/compta/stats/index.php
@@ -269,8 +269,8 @@ if ($result) {
$i = 0;
while ($i < $num) {
$obj = $db->fetch_object($result);
- $cum_ht[$obj->dm] = !empty($obj->amount) ? $obj->amount : 0;
- $cum[$obj->dm] = $obj->amount_ttc;
+ $cum_ht[$obj->dm] = empty($obj->amount) ? 0 : $obj->amount;
+ $cum[$obj->dm] = empty($obj->amount_ttc) ? 0 : $obj->amount_ttc;
if ($obj->amount_ttc) {
$minyearmonth = ($minyearmonth ? min($minyearmonth, $obj->dm) : $obj->dm);
$maxyearmonth = max($maxyearmonth, $obj->dm);
@@ -302,7 +302,11 @@ if ($modecompta == 'RECETTES-DEPENSES') {
$i = 0;
while ($i < $num) {
$obj = $db->fetch_object($result);
- $cum[$obj->dm] += $obj->amount_ttc;
+ if (empty($cum[$obj->dm])) {
+ $cum[$obj->dm] = $obj->amount_ttc;
+ } else {
+ $cum[$obj->dm] += $obj->amount_ttc;
+ }
if ($obj->amount_ttc) {
$minyearmonth = ($minyearmonth ?min($minyearmonth, $obj->dm) : $obj->dm);
$maxyearmonth = max($maxyearmonth, $obj->dm);
@@ -404,12 +408,6 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) {
$case = dol_print_date(dol_mktime(1, 1, 1, $mois_modulo, 1, $annee_decalage), "%Y-%m");
$caseprev = dol_print_date(dol_mktime(1, 1, 1, $mois_modulo, 1, $annee_decalage - 1), "%Y-%m");
- $total_ht[$annee]=0;
- $total[$annee]=0;
- $cum_ht[$case]=0;
- $cum[$case]=0;
-
-
if ($annee >= $year_start) { // We ignore $annee < $year_start, we loop on it to be able to make delta, nothing is output.
if ($modecompta == 'CREANCES-DETTES') {
// Value turnover of month w/o VAT
@@ -452,7 +450,7 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) {
print "";
// Percentage of month
- print '';
+ print ' | ';
//var_dump($annee.' '.$year_end.' '.$mois.' '.$month_end);
if ($annee < $year_end || ($annee == $year_end && $mois <= $month_end)) {
if ($annee_decalage > $minyear && $case <= $casenow) {
@@ -482,7 +480,7 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) {
}
}
}
- print ' | ';
+ print '';
if ($annee_decalage < $year_end || ($annee_decalage == $year_end && $mois > 12 && $annee < $year_end)) {
print ' | ';
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 0107dd8641d..dffde749fbe 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,11 @@ class Form
}
var urljump=pageno + (pageno.indexOf("?") < 0 ? "?" : "") + options;
//alert(urljump);
- if (pageno.length > 0) { location.href = urljump; }
+ if (pageno.length > 0) {
+ '.$jsforcursor.'
+ location.href = urljump;
+ console.log("after location.href");
+ }
$(this).dialog("close");
}
}
diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php
index 32e6912b9ea..341c21e06f0 100644
--- a/htdocs/core/class/html.formticket.class.php
+++ b/htdocs/core/class/html.formticket.class.php
@@ -73,6 +73,8 @@ class FormTicket
public $withfile;
public $withfilereadonly;
+ public $backtopage;
+
public $ispublic; // To show information or not into public form
public $withtitletopic;
@@ -1358,6 +1360,7 @@ class FormTicket
print '';
print '';
print '';
+ print '';
foreach ($this->param as $key => $value) {
print '';
}
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/lib/accounting.lib.php b/htdocs/core/lib/accounting.lib.php
index 21afb5f3490..4dbdd9f5be8 100644
--- a/htdocs/core/lib/accounting.lib.php
+++ b/htdocs/core/lib/accounting.lib.php
@@ -274,6 +274,9 @@ function getDefaultDatesForTransfer()
{
global $db, $conf;
+ $pastmonth = 0;
+ $pastmonthyear = 0;
+
// Period by default on transfer (0: previous month | 1: current month | 2: fiscal year)
$periodbydefaultontransfer = (empty($conf->global->ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER) ? 0 : $conf->global->ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER);
if ($periodbydefaultontransfer == 2) {
diff --git a/htdocs/core/login/functions_dolibarr.php b/htdocs/core/login/functions_dolibarr.php
index 610072aa35a..990390235a7 100644
--- a/htdocs/core/login/functions_dolibarr.php
+++ b/htdocs/core/login/functions_dolibarr.php
@@ -124,7 +124,7 @@ function check_user_password_dolibarr($usertotest, $passwordtotest, $entitytotes
if ($passok) {
$login = $obj->login;
} else {
- sleep(2); // Anti brut force protection
+ sleep(1); // Anti brut force protection
dol_syslog("functions_dolibarr::check_user_password_dolibarr Authentication KO bad password for '".$usertotest."', cryptType=".$cryptType, LOG_NOTICE);
// Load translation files required by the page
diff --git a/htdocs/core/login/functions_ldap.php b/htdocs/core/login/functions_ldap.php
index 022186b8de1..3f217573b18 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) {
@@ -265,7 +267,7 @@ function check_user_password_ldap($usertotest, $passwordtotest, $entitytotest)
$ldap->ldapErrorText = ldap_error($ldap->connection);
dol_syslog("functions_ldap::check_user_password_ldap ".$ldap->ldapErrorCode." ".$ldap->ldapErrorText);
}
- sleep(2); // Anti brut force protection
+ sleep(1); // Anti brut force protection
// Load translation files required by the page
$langs->loadLangs(array('main', 'other', 'errors'));
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/tpl/extrafields_view.tpl.php b/htdocs/core/tpl/extrafields_view.tpl.php
index 3db65e198c5..baf13f77c67 100644
--- a/htdocs/core/tpl/extrafields_view.tpl.php
+++ b/htdocs/core/tpl/extrafields_view.tpl.php
@@ -101,7 +101,7 @@ if (empty($reshook) && isset($extrafields->attributes[$object->table_element]['l
if ($action == 'edit_extras') {
$value = (GETPOSTISSET("options_".$tmpkeyextra) ? GETPOST("options_".$tmpkeyextra) : $object->array_options["options_".$tmpkeyextra]);
} else {
- $value = (!empty($object->array_options["options_".$tmpkeyextra]) ? $object->array_options["options_".$tmpkeyextra] : '');
+ $value = (isset($object->array_options["options_".$tmpkeyextra]) ? $object->array_options["options_".$tmpkeyextra] : '');
//var_dump($tmpkeyextra.' - '.$value);
}
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/main.inc.php b/htdocs/main.inc.php
index e00c1887fa7..98de8c12e5c 100644
--- a/htdocs/main.inc.php
+++ b/htdocs/main.inc.php
@@ -516,7 +516,7 @@ if ((!defined('NOCSRFCHECK') && empty($dolibarr_nocsrfcheck) && getDolGlobalInt(
$sensitiveget = false;
if ((GETPOSTISSET('massaction') || GETPOST('action', 'aZ09')) && getDolGlobalInt('MAIN_SECURITY_CSRF_WITH_TOKEN') >= 3) {
// All GET actions and mass actions are processed as sensitive.
- if (GETPOSTISSET('massaction') || !in_array(GETPOST('action', 'aZ09'), array('create', 'file_manager'))) { // We exclude the case action='create' and action='file_manager' that are legitimate
+ if (GETPOSTISSET('massaction') || !in_array(GETPOST('action', 'aZ09'), array('create', 'file_manager', 'presend', 'presend_addmessage'))) { // We exclude the case action='create' and action='file_manager' that are legitimate
$sensitiveget = true;
}
} elseif (getDolGlobalInt('MAIN_SECURITY_CSRF_WITH_TOKEN') >= 2) {
diff --git a/htdocs/margin/customerMargins.php b/htdocs/margin/customerMargins.php
index 290a94908c0..e5f21b5095f 100644
--- a/htdocs/margin/customerMargins.php
+++ b/htdocs/margin/customerMargins.php
@@ -43,8 +43,6 @@ $result = restrictedArea($user, 'societe', '', '');
$result = restrictedArea($user, 'margins');
-$mesg = '';
-
// Load variable for pagination
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
@@ -64,18 +62,18 @@ if (!$sortorder) {
}
$startdate = $enddate = '';
-
-if (!empty($_POST['startdatemonth'])) {
- $startdate = dol_mktime(0, 0, 0, $_POST['startdatemonth'], $_POST['startdateday'], $_POST['startdateyear']);
+if (GETPOST('startdatemonth')) {
+ $startdate = dol_mktime(0, 0, 0, GETPOST('startdatemonth', 'int'), GETPOST('startdateday', 'int'), GETPOST('startdateyear', 'int'));
}
-if (!empty($_POST['enddatemonth'])) {
- $enddate = dol_mktime(23, 59, 59, $_POST['enddatemonth'], $_POST['enddateday'], $_POST['enddateyear']);
+if (GETPOST('enddatemonth')) {
+ $enddate = dol_mktime(23, 59, 59, GETPOST('enddatemonth', 'int'), GETPOST('enddateday', 'int'), GETPOST('enddateyear'));
}
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$object = new Societe($db);
$hookmanager->initHooks(array('margincustomerlist'));
+
/*
* View
*/
@@ -188,7 +186,7 @@ print '';
// Total Margin
print '| '.$langs->trans("TotalMargin").' | ';
-print ''; // set by jquery (see below)
+print ' '.$langs->getCurrencySymbol($conf->currency).''; // set by jquery (see below)
print ' |
';
// Margin Rate
@@ -271,6 +269,30 @@ $sql .= $db->order($sortfield, $sortorder);
// TODO: calculate total to display then restore pagination
//$sql.= $db->plimit($conf->liste_limit +1, $offset);
+$param = '&socid='.((int) $socid);
+if (GETPOST('startdatemonth', 'int')) {
+ $param .= '&startdateyear='.GETPOST('startdateyear', 'int');
+ $param .= '&startdatemonth='.GETPOST('startdatemonth', 'int');
+ $param .= '&startdateday='.GETPOST('startdateday', 'int');
+}
+if (GETPOST('enddatemonth', 'int')) {
+ $param .= '&enddateyear='.GETPOST('enddateyear', 'int');
+ $param .= '&enddatemonth='.GETPOST('enddatemonth', 'int');
+ $param .= '&enddateday='.GETPOST('enddateday', 'int');
+}
+$listofproducts = GETPOST('products', 'array:int');
+if (is_array($listofproducts)) {
+ foreach ($listofproducts as $val) {
+ $param .= '&products[]='.$val;
+ }
+}
+$listofcateg = GETPOST('categories', 'array:int');
+if (is_array($listofcateg)) {
+ foreach ($listofcateg as $val) {
+ $param .= '&categories[]='.$val;
+ }
+}
+
dol_syslog('margin::customerMargins.php', LOG_DEBUG);
$result = $db->query($sql);
if ($result) {
@@ -293,19 +315,19 @@ if ($result) {
print '';
if (!empty($client)) {
- print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", "&socid=".$socid, '', $sortfield, $sortorder);
- print_liste_field_titre("DateInvoice", $_SERVER["PHP_SELF"], "f.datef", "", "&socid=".$socid, 'align="center"', $sortfield, $sortorder);
+ print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder);
+ print_liste_field_titre("DateInvoice", $_SERVER["PHP_SELF"], "f.datef", "", $param, 'align="center"', $sortfield, $sortorder);
} else {
- print_liste_field_titre("Customer", $_SERVER["PHP_SELF"], "s.nom", "", "&socid=".$socid, '', $sortfield, $sortorder);
+ print_liste_field_titre("Customer", $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder);
}
- print_liste_field_titre("SellingPrice", $_SERVER["PHP_SELF"], "selling_price", "", "&socid=".$socid, 'align="right"', $sortfield, $sortorder);
- print_liste_field_titre($labelcostprice, $_SERVER["PHP_SELF"], "buying_price", "", "&socid=".$socid, 'align="right"', $sortfield, $sortorder);
- print_liste_field_titre("Margin", $_SERVER["PHP_SELF"], "marge", "", "&socid=".$socid, 'align="right"', $sortfield, $sortorder);
+ print_liste_field_titre("SellingPrice", $_SERVER["PHP_SELF"], "selling_price", "", $param, 'align="right"', $sortfield, $sortorder);
+ print_liste_field_titre($labelcostprice, $_SERVER["PHP_SELF"], "buying_price", "", $param, 'align="right"', $sortfield, $sortorder);
+ print_liste_field_titre("Margin", $_SERVER["PHP_SELF"], "marge", "", $param, 'align="right"', $sortfield, $sortorder);
if (!empty($conf->global->DISPLAY_MARGIN_RATES)) {
- print_liste_field_titre("MarginRate", $_SERVER["PHP_SELF"], "", "", "&socid=".$socid, 'align="right"', $sortfield, $sortorder);
+ print_liste_field_titre("MarginRate", $_SERVER["PHP_SELF"], "", "", $param, 'align="right"', $sortfield, $sortorder);
}
if (!empty($conf->global->DISPLAY_MARK_RATES)) {
- print_liste_field_titre("MarkRate", $_SERVER["PHP_SELF"], "", "", "&socid=".$socid, 'align="right"', $sortfield, $sortorder);
+ print_liste_field_titre("MarkRate", $_SERVER["PHP_SELF"], "", "", $param, 'align="right"', $sortfield, $sortorder);
}
print "
\n";
diff --git a/htdocs/margin/productMargins.php b/htdocs/margin/productMargins.php
index ac006c042aa..48e0d50cd4c 100644
--- a/htdocs/margin/productMargins.php
+++ b/htdocs/margin/productMargins.php
@@ -73,18 +73,18 @@ if (!$sortfield) {
}
$startdate = $enddate = '';
-
-if (!empty($_POST['startdatemonth'])) {
- $startdate = dol_mktime(0, 0, 0, $_POST['startdatemonth'], $_POST['startdateday'], $_POST['startdateyear']);
+if (GETPOST('startdatemonth')) {
+ $startdate = dol_mktime(0, 0, 0, GETPOST('startdatemonth', 'int'), GETPOST('startdateday', 'int'), GETPOST('startdateyear', 'int'));
}
-if (!empty($_POST['enddatemonth'])) {
- $enddate = dol_mktime(23, 59, 59, $_POST['enddatemonth'], $_POST['enddateday'], $_POST['enddateyear']);
+if (GETPOST('enddatemonth')) {
+ $enddate = dol_mktime(23, 59, 59, GETPOST('enddatemonth', 'int'), GETPOST('enddateday', 'int'), GETPOST('enddateyear'));
}
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$object = new Product($db);
$hookmanager->initHooks(array('marginproductlist'));
+
/*
* View
*/
@@ -149,7 +149,7 @@ print '';
// Total Margin
print '| '.$langs->trans("TotalMargin").' | ';
-print ''; // set by jquery (see below)
+print ' '.$langs->getCurrencySymbol($conf->currency).''; // set by jquery (see below)
print ' |
';
// Margin Rate
@@ -224,13 +224,31 @@ $sql .= $db->order($sortfield, $sortorder);
// TODO: calculate total to display then restore pagination
//$sql.= $db->plimit($conf->liste_limit +1, $offset);
+$param = '&id='.((int) $id);
+if (GETPOST('startdatemonth', 'int')) {
+ $param .= '&startdateyear='.GETPOST('startdateyear', 'int');
+ $param .= '&startdatemonth='.GETPOST('startdatemonth', 'int');
+ $param .= '&startdateday='.GETPOST('startdateday', 'int');
+}
+if (GETPOST('enddatemonth', 'int')) {
+ $param .= '&enddateyear='.GETPOST('enddateyear', 'int');
+ $param .= '&enddatemonth='.GETPOST('enddatemonth', 'int');
+ $param .= '&enddateday='.GETPOST('enddateday', 'int');
+}
+$listofcateg = GETPOST('categories', 'array:int');
+if (is_array($listofcateg)) {
+ foreach ($listofcateg as $val) {
+ $param .= '&categories[]='.$val;
+ }
+}
+
dol_syslog('margin::productMargins.php', LOG_DEBUG);
$result = $db->query($sql);
if ($result) {
$num = $db->num_rows($result);
print '
';
- print_barre_liste($langs->trans("MarginDetails"), $page, $_SERVER["PHP_SELF"], "&id=".$id, $sortfield, $sortorder, '', $num, $num, '', 0, '', '', 0, 1);
+ print_barre_liste($langs->trans("MarginDetails"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $num, '', 0, '', '', 0, 1);
//var_dump($conf->global->MARGIN_TYPE);
if ($conf->global->MARGIN_TYPE == "1") {
@@ -247,20 +265,20 @@ if ($result) {
print '';
if ($id > 0) {
- print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", "&id=".$id, '', $sortfield, $sortorder);
- print_liste_field_titre("DateInvoice", $_SERVER["PHP_SELF"], "f.datef", "", "&id=".$id, '', $sortfield, $sortorder, 'center ');
+ print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder);
+ print_liste_field_titre("DateInvoice", $_SERVER["PHP_SELF"], "f.datef", "", $param, '', $sortfield, $sortorder, 'center ');
} else {
- print_liste_field_titre("ProductService", $_SERVER["PHP_SELF"], "p.ref", "", "&id=".$id, '', $sortfield, $sortorder);
+ print_liste_field_titre("ProductService", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
}
- print_liste_field_titre("Qty", $_SERVER["PHP_SELF"], "product_qty", "", "&id=".$id, '', $sortfield, $sortorder, 'center ');
- print_liste_field_titre("SellingPrice", $_SERVER["PHP_SELF"], "selling_price", "", "&id=".$id, '', $sortfield, $sortorder, 'right ');
- print_liste_field_titre($labelcostprice, $_SERVER["PHP_SELF"], "buying_price", "", "&id=".$id, '', $sortfield, $sortorder, 'right ');
- print_liste_field_titre("Margin", $_SERVER["PHP_SELF"], "marge", "", "&id=".$id, '', $sortfield, $sortorder, 'right ');
+ print_liste_field_titre("Qty", $_SERVER["PHP_SELF"], "product_qty", "", $param, '', $sortfield, $sortorder, 'center ');
+ print_liste_field_titre("SellingPrice", $_SERVER["PHP_SELF"], "selling_price", "", $param, '', $sortfield, $sortorder, 'right ');
+ print_liste_field_titre($labelcostprice, $_SERVER["PHP_SELF"], "buying_price", "", $param, '', $sortfield, $sortorder, 'right ');
+ print_liste_field_titre("Margin", $_SERVER["PHP_SELF"], "marge", "", $param, '', $sortfield, $sortorder, 'right ');
if (!empty($conf->global->DISPLAY_MARGIN_RATES)) {
- print_liste_field_titre("MarginRate", $_SERVER["PHP_SELF"], "", "", "&id=".$id, '', $sortfield, $sortorder, 'right ');
+ print_liste_field_titre("MarginRate", $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'right ');
}
if (!empty($conf->global->DISPLAY_MARK_RATES)) {
- print_liste_field_titre("MarkRate", $_SERVER["PHP_SELF"], "", "", "&id=".$id, '', $sortfield, $sortorder, 'right ');
+ print_liste_field_titre("MarkRate", $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'right ');
}
print "
\n";
diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php
index d92c595c6ec..fb0930deede 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 "\n";
// End of page
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/recruitment/recruitmentcandidature_card.php b/htdocs/recruitment/recruitmentcandidature_card.php
index f06fc476883..4deced822f4 100644
--- a/htdocs/recruitment/recruitmentcandidature_card.php
+++ b/htdocs/recruitment/recruitmentcandidature_card.php
@@ -601,7 +601,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Cancel
if ($permissiontoadd) {
if ($object->status == $object::STATUS_VALIDATED) {
- print 'id.'&action=close">'.$langs->trans("Cancel").''."\n";
+ print 'id.'&action=close&token='.newToken().'">'.$langs->trans("Cancel").''."\n";
} elseif ($object->status == $object::STATUS_REFUSED || $object->status == $object::STATUS_CANCELED || $object->status == $object::STATUS_CONTRACT_REFUSED) {
print 'id.'&action=confirm_reopen&confirm=yes&token='.newToken().'">'.$langs->trans("Re-Open").''."\n";
}
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/card.php b/htdocs/ticket/card.php
index 589f7ca0590..7c79ab5a780 100644
--- a/htdocs/ticket/card.php
+++ b/htdocs/ticket/card.php
@@ -56,7 +56,7 @@ $ref = GETPOST('ref', 'alpha');
$projectid = GETPOST('projectid', 'int');
$cancel = GETPOST('cancel', 'alpha');
$action = GETPOST('action', 'aZ09');
-$backtopage = GETPOST('$backtopage', 'alpha');
+$backtopage = GETPOST('backtopage', 'alpha');
$contactid = GETPOST('contactid', 'int');
$notifyTiers = GETPOST("notify_tiers_at_create", 'alpha');
@@ -1508,6 +1508,8 @@ if ($action == 'create' || $action == 'presend') {
$formticket->withsubstit = 1;
$formticket->substit = $substitutionarray;
+ $formticket->backtopage = $backtopage;
+
$formticket->showMessageForm('100%');
print '';
}
diff --git a/htdocs/ticket/messaging.php b/htdocs/ticket/messaging.php
index 0abbf568c26..c774c4364e8 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;
@@ -245,12 +245,12 @@ if (!empty($object->id)) {
// Show link to add a message (if read and not closed)
- $btnstatus = $object->fk_statut < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage";
- $url = 'card.php?track_id='.$object->track_id.'&action=presend_addmessage&mode=init';
+ $btnstatus = $object->status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage";
+ $url = 'card.php?track_id='.$object->track_id.'&action=presend_addmessage&mode=init&backtopage='.urlencode($_SERVER["PHP_SELF"].'?track_id='.$object->track_id);
$morehtmlright .= dolGetButtonTitle($langs->trans('TicketAddMessage'), '', 'fa fa-comment-dots', $url, 'add-new-ticket-title-button', $btnstatus);
// Show link to add event (if read and not closed)
- $btnstatus = $object->fk_statut < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage";
+ $btnstatus = $object->status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage";
$url = DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.date('YmdHi').'&origin=ticket&originid='.$object->id.'&projectid='.$object->fk_project.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?track_id='.$object->track_id);
$morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', $url, 'add-new-ticket-even-button', $btnstatus);