diff --git a/htdocs/accountancy/bookkeeping/export.php b/htdocs/accountancy/bookkeeping/export.php
index 9ae36868f99..f552b5458f4 100644
--- a/htdocs/accountancy/bookkeeping/export.php
+++ b/htdocs/accountancy/bookkeeping/export.php
@@ -364,7 +364,7 @@ if (empty($reshook)) {
$listofaccountsforgroup2 = array();
if (is_array($listofaccountsforgroup)) {
foreach ($listofaccountsforgroup as $tmpval) {
- $listofaccountsforgroup2[] = "'".$db->escape((string) $tmpval['id'])."'";
+ $listofaccountsforgroup2[] = "'".$db->escape((string) $tmpval['account_number'])."'";
}
}
$filter['t.search_accounting_code_in'] = implode(',', $listofaccountsforgroup2);
diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php
index b3bbb88237a..25ae05f9226 100644
--- a/htdocs/accountancy/bookkeeping/list.php
+++ b/htdocs/accountancy/bookkeeping/list.php
@@ -336,7 +336,7 @@ if (empty($reshook)) {
$listofaccountsforgroup2 = array();
if (is_array($listofaccountsforgroup)) {
foreach ($listofaccountsforgroup as $tmpval) {
- $listofaccountsforgroup2[] = "'".$db->escape((string) $tmpval['id'])."'";
+ $listofaccountsforgroup2[] = "'".$db->escape((string) $tmpval['account_number'])."'";
}
}
$filter['t.search_accounting_code_in'] = implode(',', $listofaccountsforgroup2);
diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php
index 305db6a1dee..8f0807c0f1e 100644
--- a/htdocs/accountancy/bookkeeping/listbyaccount.php
+++ b/htdocs/accountancy/bookkeeping/listbyaccount.php
@@ -356,7 +356,7 @@ if (empty($reshook)) {
$listofaccountsforgroup2 = array();
if (is_array($listofaccountsforgroup)) {
foreach ($listofaccountsforgroup as $tmpval) {
- $listofaccountsforgroup2[] = "'".$db->escape((string) $tmpval['id'])."'";
+ $listofaccountsforgroup2[] = "'".$db->escape((string) $tmpval['account_number'])."'";
}
}
$filter['t.search_accounting_code_in'] = implode(',', $listofaccountsforgroup2);
@@ -1245,6 +1245,21 @@ $colspan = 0; // colspan before field 'label of operation'
$colspanend = 0; // colspan after debit/credit
$accountg = '-';
+$colspan = 0; // colspan before field 'label of operation'
+$colspanend = 3; // colspan after debit/credit
+if (!empty($arrayfields['t.piece_num']['checked'])) { $colspan++; }
+if (!empty($arrayfields['t.code_journal']['checked'])) { $colspan++; }
+if (!empty($arrayfields['t.doc_date']['checked'])) { $colspan++; }
+if (!empty($arrayfields['t.doc_ref']['checked'])) { $colspan++; }
+if (!empty($arrayfields['t.label_operation']['checked'])) { $colspan++; }
+if (!empty($arrayfields['t.date_export']['checked'])) { $colspanend++; }
+if (!empty($arrayfields['t.date_validated']['checked'])) { $colspanend++; }
+if (!empty($arrayfields['t.lettering_code']['checked'])) { $colspanend++; }
+if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
+ $colspan++;
+ $colspanend--;
+}
+
while ($i < min($num, $limit)) {
$line = $object->lines[$i];
@@ -1374,8 +1389,6 @@ while ($i < min($num, $limit)) {
//if (empty($displayed_account_number)) $displayed_account_number='-';
$sous_total_debit = 0;
$sous_total_credit = 0;
-
- $colspan = 0;
}
print '
';
diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php
index 7a9617a7c0e..de0c8c77934 100644
--- a/htdocs/accountancy/class/bookkeeping.class.php
+++ b/htdocs/accountancy/class/bookkeeping.class.php
@@ -1185,7 +1185,6 @@ class BookKeeping extends CommonObject
$sql .= " t.date_export,";
$sql .= " t.date_validated as date_validation";
$sql .= ' FROM '.$this->db->prefix().$this->table_element.' as t';
-
$sql .= ' WHERE t.entity = ' . ((int) $conf->entity); // Do not use getEntity for accounting features
if ($showAlreadyExportMovements == 0) {
$sql .= " AND t.date_export IS NULL";
diff --git a/htdocs/api/class/api.class.php b/htdocs/api/class/api.class.php
index 640f07376b1..5781871d098 100644
--- a/htdocs/api/class/api.class.php
+++ b/htdocs/api/class/api.class.php
@@ -1,8 +1,11 @@
* Copyright (C) 2016 Laurent Destailleur
+/* Copyright (C) 2015 Jean-François Ferry
+ * Copyright (C) 2016 Laurent Destailleur
* Copyright (C) 2020-2025 Frédéric France
* Copyright (C) 2024-2025 MDW
+ * Copyright (C) 2025 William Mead
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/htdocs/asset/class/asset.class.php b/htdocs/asset/class/asset.class.php
index e8e1ef40395..84aae9ed724 100644
--- a/htdocs/asset/class/asset.class.php
+++ b/htdocs/asset/class/asset.class.php
@@ -1109,7 +1109,7 @@ class Asset extends CommonObject
//-----------------------------------------------------
$nb_days_in_year = getDolGlobalInt('ASSET_DEPRECIATION_DURATION_PER_YEAR', 360);
$nb_days_in_month = getDolGlobalInt('ASSET_DEPRECIATION_DURATION_PER_MONTH', 30);
- $period_amount = (float) price2num($depreciation_period_amount / $fields['duration'], 'MT');
+ $period_amount = (float) ($fields['duration'] > 0 ? price2num($depreciation_period_amount / $fields['duration'], 'MT') : 0);
$first_period_found = false;
// TODO fix declaration of $begin_period
$first_period_date = isset($begin_period) && $begin_period > $fiscal_period_start ? $begin_period : $fiscal_period_start;
diff --git a/htdocs/asset/class/assetdepreciationoptions.class.php b/htdocs/asset/class/assetdepreciationoptions.class.php
index ea2c287add2..fed82c6b3c9 100644
--- a/htdocs/asset/class/assetdepreciationoptions.class.php
+++ b/htdocs/asset/class/assetdepreciationoptions.class.php
@@ -316,7 +316,7 @@ class AssetDepreciationOptions extends CommonObject
foreach ($this->deprecation_options_fields as $mode_key => $mode_info) {
if (!empty($mode_info['enabled_field'])) {
$info = explode(':', $mode_info['enabled_field']);
- if ($deprecation_options[$info[0]][$info[1]] != $info[2]) {
+ if (!empty($this->deprecation_options[$info[0]][$info[1]]) && $deprecation_options[$info[0]][$info[1]] != $info[2]) {
unset($deprecation_options[$info[0]][$info[1]]);
}
}
@@ -502,7 +502,7 @@ class AssetDepreciationOptions extends CommonObject
if (!$error && !empty($this->deprecation_options[$mode_key])) {
if (!empty($mode_info['enabled_field'])) {
$info = explode(':', $mode_info['enabled_field']);
- if ($this->deprecation_options[$info[0]][$info[1]] != $info[2]) {
+ if (!empty($this->deprecation_options[$info[0]][$info[1]]) && $this->deprecation_options[$info[0]][$info[1]] != $info[2]) {
continue;
}
}
diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php
index eb12144b0dd..0d6679ad307 100644
--- a/htdocs/comm/action/class/actioncomm.class.php
+++ b/htdocs/comm/action/class/actioncomm.class.php
@@ -1245,6 +1245,9 @@ class ActionComm extends CommonObject
if (!is_array($val)) { // For backward compatibility when val=id
$val = array('id' => $val);
}
+ if (!isset($val['id']) || !is_scalar($val['id'])) {
+ continue;
+ }
if (!empty($already_inserted[$val['id']])) {
continue;
}
diff --git a/htdocs/comm/propal/class/propaleligne.class.php b/htdocs/comm/propal/class/propaleligne.class.php
index 53c89ca1900..f3ebf5aab83 100644
--- a/htdocs/comm/propal/class/propaleligne.class.php
+++ b/htdocs/comm/propal/class/propaleligne.class.php
@@ -607,12 +607,21 @@ class PropaleLigne extends CommonObjectLine
// End call triggers
}
- $this->db->commit();
- return (int) $this->id;
+ if (!$error) {
+ $this->db->commit();
+ return (int) $this->id;
+ }
+
+ foreach ($this->errors as $errmsg) {
+ dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
+ $this->error .= ($this->error ? ', '.$errmsg : $errmsg);
+ }
+ $this->db->rollback();
+ return -3;
} else {
$this->error = $this->db->error()." sql=".$sql;
$this->db->rollback();
- return -1;
+ return -2;
}
}
@@ -812,8 +821,17 @@ class PropaleLigne extends CommonObjectLine
// End call triggers
}
- $this->db->commit();
- return 1;
+ if (!$error) {
+ $this->db->commit();
+ return 1;
+ }
+
+ foreach ($this->errors as $errmsg) {
+ dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
+ $this->error .= ($this->error ? ', '.$errmsg : $errmsg);
+ }
+ $this->db->rollback();
+ return -3;
} else {
$this->error = $this->db->error();
$this->db->rollback();
diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php
index 9519da18220..28af6c49164 100644
--- a/htdocs/compta/facture/class/facture.class.php
+++ b/htdocs/compta/facture/class/facture.class.php
@@ -1314,6 +1314,7 @@ class Facture extends CommonInvoice
$object->date_modification = '';
$object->date_validation = '';
$object->ref_client = '';
+ $object->ref_customer = '';
$object->close_code = '';
$object->close_note = '';
if (getDolGlobalInt('MAIN_DONT_KEEP_NOTE_ON_CLONING') == 1) {
diff --git a/htdocs/compta/facture/class/factureligne.class.php b/htdocs/compta/facture/class/factureligne.class.php
index 8e785f086df..ed0a80d3a22 100644
--- a/htdocs/compta/facture/class/factureligne.class.php
+++ b/htdocs/compta/facture/class/factureligne.class.php
@@ -570,7 +570,7 @@ class FactureLigne extends CommonInvoiceLine
// If fk_remise_except is defined, the discount is linked to the invoice
// which flags it as "consumed".
- if ($this->fk_remise_except) {
+ if ($this->fk_remise_except && empty($error)) {
$discount = new DiscountAbsolute($this->db);
$result = $discount->fetch($this->fk_remise_except);
if ($result >= 0) {
@@ -607,7 +607,7 @@ class FactureLigne extends CommonInvoiceLine
}
}
- if (!$notrigger) {
+ if (!$notrigger && empty($error)) {
// Call trigger
$result = $this->call_trigger('LINEBILL_INSERT', $user);
if ($result < 0) {
@@ -617,8 +617,17 @@ class FactureLigne extends CommonInvoiceLine
// End call triggers
}
- $this->db->commit();
- return $this->id;
+ if (!$error) {
+ $this->db->commit();
+ return $this->id;
+ }
+
+ foreach ($this->errors as $errmsg) {
+ dol_syslog(get_class($this)."::insert ".$errmsg, LOG_ERR);
+ $this->error .= ($this->error ? ', '.$errmsg : $errmsg);
+ }
+ $this->db->rollback();
+ return -3;
} else {
$this->error = $this->db->lasterror();
$this->db->rollback();
@@ -635,7 +644,7 @@ class FactureLigne extends CommonInvoiceLine
*/
public function update($user = null, $notrigger = 0)
{
- global $user, $conf;
+ global $user;
$error = 0;
@@ -792,8 +801,19 @@ class FactureLigne extends CommonInvoiceLine
}
// End call triggers
}
- $this->db->commit();
- return 1;
+
+ if (!$error) {
+ $this->db->commit();
+ return 1;
+ }
+
+ foreach ($this->errors as $errmsg) {
+ dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
+ $this->error .= ($this->error ? ', '.$errmsg : $errmsg);
+ }
+
+ $this->db->rollback();
+ return -3;
} else {
$this->error = $this->db->error();
$this->db->rollback();
diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php
index a010bef3f4d..1132ef25da1 100644
--- a/htdocs/compta/paiement/class/paiement.class.php
+++ b/htdocs/compta/paiement/class/paiement.class.php
@@ -426,8 +426,8 @@ class Paiement extends CommonObject
}
}
- $totalamount = (float) price2num($totalamount);
- $totalamount_converted = (float) price2num($totalamount_converted);
+ $totalamount = (float) price2num($totalamount, 'MT');
+ $totalamount_converted = (float) price2num($totalamount_converted, 'MT');
// Check parameters
if (empty($totalamount) && empty($atleastonepaymentnotnull)) { // We accept negative amounts for withdraw reject but not empty arrays
diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php
index 12401ce0a8b..9557282bbad 100644
--- a/htdocs/core/actions_massactions.inc.php
+++ b/htdocs/core/actions_massactions.inc.php
@@ -780,7 +780,7 @@ if (!$error && $massaction == 'cancelorders') {
continue;
}
- if ($cmd->statut != Commande::STATUS_VALIDATED) {
+ if ($cmd->status != Commande::STATUS_VALIDATED) {
$langs->load('errors');
setEventMessages($langs->trans("ErrorObjectMustHaveStatusValidToBeCanceled", $cmd->ref), null, 'errors');
$error++;
@@ -1615,7 +1615,7 @@ if (!$error && $action == 'confirm_edit_value_extrafields' && $confirm == 'yes'
}
}
-if (!$error && ($massaction == 'affectcommercial' || ($action == 'affectcommercial' && $confirm == 'yes')) && $permissiontoadd) {
+if (!$error && ($massaction == 'assignsalerepresentative' || ($action == 'assignsalerepresentative' && $confirm == 'yes')) && $permissiontoadd) {
$db->begin();
$objecttmp = new $objectclass($db);
@@ -1714,6 +1714,8 @@ if (!$error && ($massaction == 'approveleave' || ($action == 'approveleave' && $
$objecttmp->date_valid = dol_now();
$objecttmp->fk_user_valid = $user->id;
+ $objecttmp->date_approval = dol_now();
+ $objecttmp->fk_user_approve = $user->id;
$objecttmp->status = Holiday::STATUS_APPROVED;
$objecttmp->statut = $objecttmp->status; // deprecated
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 0fcf3c316e4..a4d761b3459 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -6104,16 +6104,16 @@ class Form
$formconfirm .= '
resizable: false,
- height: "' . $height . '",
- width: "' . $width . '",
+ height: \'' . ((int) $height) . '\',
+ width: \'' . ((int) $width) . '\',
modal: true,
closeOnEscape: false,
buttons: {
"' . dol_escape_js($langs->transnoentities($labelbuttonyes)) . '": function() {
var options = "token=' . urlencode(newToken()) . '";
var inputok = ' . json_encode($inputok) . '; /* List of fields into form */
- var page = "' . dol_escape_js(!empty($page) ? $page : '') . '";
- var pageyes = "' . dol_escape_js(!empty($pageyes) ? $pageyes : '') . '";
+ var page = \'' . dol_escape_js(!empty($page) ? $page : '') . '\';
+ var pageyes = \'' . dol_escape_js(!empty($pageyes) ? $pageyes : '') . '\';
if (inputok.length > 0) {
$.each(inputok, function(i, inputname) {
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 0826761b6a0..830667258f3 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -2262,7 +2262,7 @@ function dolPrintPassword($s)
function dol_escape_htmltag($stringtoescape, $keepb = 0, $keepn = 0, $noescapetags = '', $escapeonlyhtmltags = 0, $cleanalsojavascript = 0)
{
if ($noescapetags == 'common') {
- $noescapetags = 'html,body,a,b,em,hr,i,u,ul,li,br,div,img,font,p,span,strong,table,tr,td,th,tbody,h1,h2,h3,h4,h5,h6,h7,h8,h9';
+ $noescapetags = 'html,body,a,b,em,hr,i,u,ul,ol,li,br,div,img,font,p,span,strong,table,tr,td,th,tbody,h1,h2,h3,h4,h5,h6,h7,h8,h9';
// Add also html5 tags
$noescapetags .= ',header,footer,nav,section,menu,menuitem';
}
diff --git a/htdocs/core/tpl/document_actions_post_headers.tpl.php b/htdocs/core/tpl/document_actions_post_headers.tpl.php
index d9916046c2d..2831f54f483 100644
--- a/htdocs/core/tpl/document_actions_post_headers.tpl.php
+++ b/htdocs/core/tpl/document_actions_post_headers.tpl.php
@@ -167,8 +167,13 @@ $tmparray = $formfile->form_attach_new_file(
2
);
-$formToUploadAFile = $tmparray['formToUploadAFile'];
-$formToAddALink = $tmparray['formToAddALink'];
+$formToUploadAFile = '';
+$formToAddALink = '';
+
+if (is_array($tmparray) && !empty($tmparray)) {
+ $formToUploadAFile = $tmparray['formToUploadAFile'];
+ $formToAddALink = $tmparray['formToAddALink'];
+}
// List of document
diff --git a/htdocs/core/tpl/massactions_pre.tpl.php b/htdocs/core/tpl/massactions_pre.tpl.php
index d1c4a342205..b4e6fa94386 100644
--- a/htdocs/core/tpl/massactions_pre.tpl.php
+++ b/htdocs/core/tpl/massactions_pre.tpl.php
@@ -53,6 +53,7 @@
* @var string $sendto
* @var string $topicmail
* @var string $trackid
+ * @var ?string $uploaddir
* @var int[] $toselect
* @var int[] $arrayofselected
*/
@@ -435,8 +436,9 @@ if ($massaction == 'presetcommercial') {
$formquestion[] = array('type' => 'other',
'name' => 'affectedcommercial',
'label' => $form->editfieldkey('AllocateCommercial', 'commercial_id', '', $object, 0),
- 'value' => $form->multiselectarray('commercial', $userlist, array(), 0, 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0, '', '', '', 1));
- print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmAllocateCommercial"), $langs->trans("ConfirmAllocateCommercialQuestion", count($toselect)), "affectcommercial", $formquestion, 1, 0, 200, 500, 1);
+ 'value' => $form->multiselectarray('commercial', $userlist, array(), 0, 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0, '', '', '', 1)
+ );
+ print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmAllocateCommercial"), $langs->trans("ConfirmAllocateCommercialQuestion", count($toselect)), "assignsalerepresentative", $formquestion, 1, 0, 200, 500, 1);
}
if ($massaction == 'unsetcommercial') {
$formquestion = array();
@@ -444,7 +446,8 @@ if ($massaction == 'unsetcommercial') {
$formquestion[] = array('type' => 'other',
'name' => 'unassigncommercial',
'label' => $form->editfieldkey('UnallocateCommercial', 'commercial_id', '', $object, 0),
- 'value' => $form->multiselectarray('commercial', $userlist, array(), 0, 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0, '', '', '', 1));
+ 'value' => $form->multiselectarray('commercial', $userlist, array(), 0, 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0, '', '', '', 1)
+ );
print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmUnallocateCommercial"), $langs->trans("ConfirmUnallocateCommercialQuestion", count($toselect)), "unassigncommercial", $formquestion, 1, 0, 200, 500, 1);
}
diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php
index 666d89b9478..5694a0291aa 100644
--- a/htdocs/core/tpl/objectline_view.tpl.php
+++ b/htdocs/core/tpl/objectline_view.tpl.php
@@ -395,10 +395,10 @@ $positiverates = '';
if (price2num($line->tva_tx)) {
$positiverates .= ($positiverates ? '/' : '').price2num($line->tva_tx);
}
-if (price2num($line->total_localtax1)) {
+if (price2num($line->localtax1_tx)) {
$positiverates .= ($positiverates ? '/' : '').price2num($line->localtax1_tx);
}
-if (price2num($line->total_localtax2)) {
+if (price2num($line->localtax2_tx)) {
$positiverates .= ($positiverates ? '/' : '').price2num($line->localtax2_tx);
}
if (empty($positiverates)) {
diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php
index e80815e9347..29d98464862 100644
--- a/htdocs/fourn/class/fournisseur.commande.class.php
+++ b/htdocs/fourn/class/fournisseur.commande.class.php
@@ -3250,6 +3250,8 @@ class CommandeFournisseur extends CommonOrder
$this->db->commit();
return $result;
} else {
+ $this->errors[] = $this->line->error;
+ $this->errors = array_merge($this->errors, $this->line->errors);
$this->error = $this->db->lasterror();
$this->db->rollback();
return -1;
diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php
index 4d942707276..5cc43495297 100644
--- a/htdocs/fourn/class/fournisseur.facture.class.php
+++ b/htdocs/fourn/class/fournisseur.facture.class.php
@@ -2522,6 +2522,7 @@ class FactureFournisseur extends CommonInvoice
if ($res < 1) {
$this->errors[] = $line->error;
+ $this->errors = array_merge($this->errors, $line->errors);
} else {
// Update total price into invoice record
$res = $this->update_price(1, 'auto', 0, $this->thirdparty);
diff --git a/htdocs/fourn/class/fournisseur.facture.ligne.class.php b/htdocs/fourn/class/fournisseur.facture.ligne.class.php
index 9d7b8a9813a..f04658ebd80 100644
--- a/htdocs/fourn/class/fournisseur.facture.ligne.class.php
+++ b/htdocs/fourn/class/fournisseur.facture.ligne.class.php
@@ -458,7 +458,7 @@ class SupplierInvoiceLine extends CommonObjectLine
*/
public function update($notrigger = 0)
{
- global $conf;
+ global $user;
$pu = price2num($this->subprice);
$qty = price2num($this->qty);
@@ -569,8 +569,6 @@ class SupplierInvoiceLine extends CommonObjectLine
}
if (!$error && !$notrigger) {
- global $langs, $user;
-
// Call trigger
if ($this->call_trigger('LINEBILL_SUPPLIER_MODIFY', $user) < 0) {
$this->db->rollback();
@@ -797,8 +795,18 @@ class SupplierInvoiceLine extends CommonObjectLine
// End call triggers
}
- $this->db->commit();
- return $this->id;
+ if (!$error) {
+ $this->db->commit();
+ return $this->id;
+ }
+
+ foreach ($this->errors as $errmsg) {
+ dol_syslog(get_class($this)."::insert ".$errmsg, LOG_ERR);
+ $this->error .= ($this->error ? ', '.$errmsg : $errmsg);
+ }
+
+ $this->db->rollback();
+ return -3;
} else {
$this->error = $this->db->error();
$this->db->rollback();
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index 43e94d30569..f784a83c583 100644
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -2149,7 +2149,7 @@ UserHasNoPermissions=This user has no permissions defined
TypeCdr=Use "None" if the date of payment term is date of invoice plus a delta in days (delta is field "%s")
Use "At end of month", if, after delta, the date must be increased to reach the end of month (+ an optional "%s" in days)
Use "Current/Next" to have payment term date being the first Nth of the month after delta (delta is field "%s", N is stored into field "%s")
BaseCurrency=Reference currency of the company (go into setup of company to change this)
WarningNoteModuleInvoiceForFrenchLaw=This module %s is compliant with French laws (Loi Finance 2016).
-WarningNoteModulePOSForFrenchLaw=This module %s is compliant with French laws (Loi Finance 2016) because module Non Reversible Logs is automatically activated.
+WarningNoteModulePOSForFrenchLaw=This module %s is technically compliant with French laws (Loi Finance 2016) because module Non Reversible Logs is automatically activated. You must however obtain an attestation or a certificate to be allow to us it. Contact your webhosting provider, your integrator or reseller.
WarningInstallationMayBecomeNotCompliantWithLaw=You are trying to install module %s that is an external module. Activating an external module means you trust the publisher of that module and that you are sure that this module does not adversely impact the behavior of your application, and is compliant with laws of your country (%s). If the module introduces an illegal feature, you become responsible for the use of illegal software.
WarningExperimentalFeatureInvoiceSituationNeedToUpgradeToProgressiveMode=If you are using the experimental mode for situation invoices, you will need to update your data to switch from the experimental mode to the official mode. You can contact a partner to help you with this task. A list of preferred partners is available by following this link
MAIN_PDF_MARGIN_LEFT=Left margin on PDF
diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang
index 86bb9115983..f2d8e34edac 100644
--- a/htdocs/langs/en_US/main.lang
+++ b/htdocs/langs/en_US/main.lang
@@ -1255,7 +1255,7 @@ ConfirmAllocateCommercial=Assign sales representative confirmation
ConfirmUnallocateCommercial=Are you sure you want to unassign the sales representative(s) from all selected thirdparties?
ConfirmAllocateCommercialQuestion=Are you sure you want to assign the %s selected record(s)?
ConfirmUnallocateCommercialQuestion=Are you sure you want to unassign the selected %s record(s)?
-CommercialsAffected=Sales representatives assigned
+CommercialsAffected=%s sales representatives assigned
CommercialAffected=Sales representative assigned
CommercialsDisaffected=Sales representatives unlinked
CommercialDisaffected=Sales representative unlinked
diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang
index 4b879a2802f..816997fe84c 100644
--- a/htdocs/langs/fr_FR/admin.lang
+++ b/htdocs/langs/fr_FR/admin.lang
@@ -2131,7 +2131,7 @@ UserHasNoPermissions=Cet utilisateur n'a pas de permission définie
TypeCdr=Utilisez "Aucune" si la date du terme de paiement est la date de la facture plus un delta en jours (delta est le champ "%s")
Utilisez "À la fin du mois", si, après le delta, la date doit être augmentée pour atteindre la fin du mois (+ un optionnel "%s" en jours)
Utilisez "Courant/Suivant" pour que la date du terme de paiement soit la premier Nième jour du mois après le delta (le delta est le champ "%s", N est stocké dans le champ "%s")
BaseCurrency=Devise par défaut de votre société/institution (Voir Accueil > configuration > Société/Institution)
WarningNoteModuleInvoiceForFrenchLaw=Ce module %s permet d'être conforme aux lois françaises (Loi Finance 2016 par exemple).
-WarningNoteModulePOSForFrenchLaw=Le module %s est conforme à la législation française ( Loi Finance 2016 ) car les logs non réversibles sont automatiquement activés.
+WarningNoteModulePOSForFrenchLaw=Le module %s est conforme techniquement à la législation française ( Loi Finance 2016 ) car les logs non réversibles sont automatiquement activés.
WarningInstallationMayBecomeNotCompliantWithLaw=Vous tentez d'installer le module %s qui est un module externe. L'activation d'un module externe signifie que vous faites confiance à l'éditeur du module et que vous êtes sûr que ce module ne modifie pas négativement le comportement de votre application et est conforme aux lois de votre pays (%s). Si le module apporte une fonctionnalité illégale, vous devenez responsable pour l'utilisation d'un logiciel illégal.
WarningExperimentalFeatureInvoiceSituationNeedToUpgradeToProgressiveMode=Si vous utilisez le mode expérimental pour les factures de situation, vous devrez mettre à jour vos données pour passer du mode expérimental au mode officiel. Vous pouvez contacter un partenaire pour vous aider avec cette tâche. Une liste de partenaires privilégiés est disponible en suivant ce lien
MAIN_PDF_MARGIN_LEFT=Marge gauche sur les PDF
diff --git a/htdocs/product/price_suppliers.php b/htdocs/product/price_suppliers.php
index 8915e80df53..6d961fb2c62 100644
--- a/htdocs/product/price_suppliers.php
+++ b/htdocs/product/price_suppliers.php
@@ -975,10 +975,9 @@ if ($id > 0 || $ref) {
'pfp.barcode' => array('label' => $langs->trans("BarcodeValue"), 'enabled' => (string) (int) isModEnabled('barcode'), 'checked' => '0', 'position' => 16),
'pfp.packaging' => array('label' => $langs->trans("PackagingForThisProduct"), 'enabled' => (string) getDolGlobalInt('PRODUCT_USE_SUPPLIER_PACKAGING'), 'checked' => '0', 'position' => 17),
'pfp.status' => array('label' => $langs->trans("Status"), 'enabled' => '1', 'checked' => '0', 'position' => 40),
- 'pfp.tms' => array('label' => $langs->trans("DateModification"), 'enabled' => (string) (int) isModEnabled('barcode'), 'checked' => '1', 'position' => 50),
- 'pfp.price' => array('label' => $langs->trans("PriceQtyMinHT"), 'checked' => '1', 'position' => 60),
+ 'pfp.tms' => array('label' => $langs->trans("DateModification"), 'enabled' => '1', 'checked' => '1', 'position' => 50),
+ 'pfp.price' => array('label' => $langs->trans("PriceQtyMinHT"), 'enabled' => '1', 'checked' => '1', 'position' => 60),
'pfp.multicurrency_price' => array('label' => $langs->trans("PriceQtyMinHTCurrency"), 'enabled' => (string) (int) isModEnabled('multicurrency'), 'checked' => '1', 'position' => 70),
-
);
// fetch optionals attributes and labels
diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php
index 1816331ff56..d39c5a05b95 100644
--- a/htdocs/projet/card.php
+++ b/htdocs/projet/card.php
@@ -553,14 +553,11 @@ if (empty($reshook)) {
// Load new object
$newobject = new Project($db);
$newobject->fetch($result);
- $newobject->fetch_optionals();
- $newobject->fetch_thirdparty(); // Load new object
- $object = $newobject;
- $action = 'view';
- $comefromclone = true;
setEventMessages($langs->trans("ProjectCreatedInDolibarr", $newobject->ref), null, 'mesgs');
- //var_dump($newobject); exit;
+
+ header('Location: '.$_SERVER['PHP_SELF'].'?id='.$result.'&action=edit&comefromclone=1');
+ exit;
}
}
diff --git a/htdocs/public/users/view.php b/htdocs/public/users/view.php
index 20fee171c2f..4b33276e399 100644
--- a/htdocs/public/users/view.php
+++ b/htdocs/public/users/view.php
@@ -302,6 +302,7 @@ if (getDolGlobalString('USER_IMAGE_PUBLIC_INTERFACE')) {
print '';
}
+// url for the download .vcf file link
$urlforqrcode = $object->getOnlineVirtualCardUrl('vcard');
$socialnetworksdict = getArrayOfSocialNetworks();
@@ -314,10 +315,17 @@ if ($showbarcode) {
$filename = $v->buildVCardString($object, $company, $langs, '', $outdir);
+ $encodedsecurekey = dol_hash($conf->file->instance_unique_id.'uservirtualcard'.$object->id.'-'.$object->login, 'md5');
+ if (isModEnabled('multicompany')) {
+ $entity_qr = '&entity='.((int) $conf->entity);
+ } else {
+ $entity_qr = '';
+ }
+
print '
';
print '';
//print '';
- print '
 $conf->entity).'&generator=tcpdfbarcode&encoding=QRCODE&code='.urlencode(basename($filename)).')
';
+ print '
).'&securekey='.$encodedsecurekey.')
';
print '
';
print '
';
}
diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php
index 3444e068eec..c19e8fd3600 100644
--- a/htdocs/societe/list.php
+++ b/htdocs/societe/list.php
@@ -1245,7 +1245,9 @@ if ($optioncss != '') {
}
print '';
print '';
-print '';
+if (empty($massaction)) {
+ print '';
+}
print '';
print '';
//print '';
@@ -1270,6 +1272,7 @@ foreach (array(1, 2, 3, 4, 5, 6) as $key) {
$label = $langs->transnoentities("ProfId".$key.$mysoc->country_code);
$textprofid[$key] = '';
if ($label != "ProfId".$key.$mysoc->country_code) { // Get only text between ()
+ $reg = array();
if (preg_match('/\((.*)\)/i', $label, $reg)) {
$label = $reg[1];
}
diff --git a/htdocs/societe/messaging.php b/htdocs/societe/messaging.php
index 310a844efbd..1d234902fc5 100644
--- a/htdocs/societe/messaging.php
+++ b/htdocs/societe/messaging.php
@@ -169,10 +169,10 @@ $out = '';
$permok = $user->hasRight('agenda', 'myactions', 'create');
if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) {
if (is_object($objthirdparty) && get_class($objthirdparty) == 'Societe') {
- $out .= '&originid='.$objthirdparty->id.($objthirdparty->id > 0 ? '&socid='.$objthirdparty->id : '').'&backtopage='.urlencode($_SERVER['PHP_SELF'].($objthirdparty->id > 0 ? '?socid='.$objthirdparty->id : ''));
+ $out .= '&originid='.$objthirdparty->id.($objthirdparty->id > 0 ? '&socid='.$objthirdparty->id : '').'&backtopage='.urlencode($_SERVER['PHP_SELF'].($objthirdparty->id > 0 ? '?socid='.$objthirdparty->id : ''));
}
- $out .= (!empty($objcon->id) ? '&contactid='.$objcon->id : '');
- $out .= '&datep='.dol_print_date(dol_now(), 'dayhourlog', 'tzuserrel');
+ $out .= (!empty($objcon->id) ? '&contactid='.$objcon->id : '');
+ $out .= '&datep='.dol_print_date(dol_now(), 'dayhourlog', 'tzuserrel');
}
$morehtmlright = '';
diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php
index 5b5009ec497..4ab5039f274 100644
--- a/htdocs/ticket/card.php
+++ b/htdocs/ticket/card.php
@@ -202,7 +202,7 @@ if (empty($reshook)) {
$action = 'view';
}
- if (($action == 'add' || ($action == 'update' && $object->status < Ticket::STATUS_CLOSED)) && $permissiontoadd) {
+ if ((($action == 'add' && GETPOST('save', 'alpha')) || ($action == 'update' && $object->status < Ticket::STATUS_CLOSED)) && $permissiontoadd) {
$ifErrorAction = ($action == 'add' ? 'create' : 'edit'); // Test on permission not required here
if ($action == 'add') { // Test on permission already done
$object->track_id = null;
diff --git a/htdocs/viewimage.php b/htdocs/viewimage.php
index 41d1a43db13..08642790af0 100644
--- a/htdocs/viewimage.php
+++ b/htdocs/viewimage.php
@@ -357,14 +357,32 @@ if ($modulepart == 'barcode') {
$reg = array();
if (preg_match('/^virtualcard_([^_]+)_(\d+)\.vcf$/', $code, $reg)) {
$vcffile = '';
- if ($reg[1] == 'user') {
+ $id = 0;
+ $login = '';
+ if ($reg[1] == 'user' && (int) $reg[2] > 0) {
$vcffile = $conf->user->dir_temp.'/'.$code;
- } elseif ($reg[1] == 'contact') {
+ $id = (int) $reg[2];
+ $tmpuser = new User($db);
+ $tmpuser->fetch($id);
+ $login = $tmpuser->login;
+ } elseif ($reg[1] == 'contact' && (int) $reg[2] > 0) {
$vcffile = $conf->contact->dir_temp.'/'.$code;
+ $id = (int) $reg[2];
}
- if ($vcffile) {
- $code = file_get_contents($vcffile);
+ $code = '';
+ if ($vcffile && $id) {
+ // Case of use of viewimage to get the barcode for user pubic profile,
+ // we must check the securekey that protet against forging url
+ if ($reg[1] == 'user' && (int) $reg[2] > 0) {
+ $encodedsecurekey = dol_hash($conf->file->instance_unique_id.'uservirtualcard'.$id.'-'.$login, 'md5');
+ if ($encodedsecurekey != GETPOST('securekey')) {
+ $code = 'badvalueforsecurekey';
+ }
+ }
+ if (empty($code)) {
+ $code = file_get_contents($vcffile);
+ }
}
}