diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 33d033f020c..32aefa2af14 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -1013,7 +1013,7 @@ class BookKeeping extends CommonObject $line->multicurrency_amount = $obj->multicurrency_amount; $line->multicurrency_code = $obj->multicurrency_code; $line->lettering_code = $obj->lettering_code; - $line->date_lettering = $obj->date_lettering; + $line->date_lettering = $this->db->jdate($obj->date_lettering); $line->fk_user_author = $obj->fk_user_author; $line->import_key = $obj->import_key; $line->code_journal = $obj->code_journal; @@ -1165,7 +1165,7 @@ class BookKeeping extends CommonObject $line->amount = $obj->amount; $line->sens = $obj->sens; $line->lettering_code = $obj->lettering_code; - $line->date_lettering = $obj->date_lettering; + $line->date_lettering = $this->db->jdate($obj->date_lettering); $line->fk_user_author = $obj->fk_user_author; $line->import_key = $obj->import_key; $line->code_journal = $obj->code_journal; diff --git a/htdocs/api/class/api_documents.class.php b/htdocs/api/class/api_documents.class.php index f0b235b34c0..98e3fb19c2c 100644 --- a/htdocs/api/class/api_documents.class.php +++ b/htdocs/api/class/api_documents.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2016 Laurent Destailleur * Copyright (C) 2016 Jean-François Ferry * Copyright (C) 2023 Romain Neil + * 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 @@ -497,7 +498,7 @@ class Documents extends DolibarrApi } elseif ($modulepart == 'expensereport') { require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; - if (!DolibarrApiAccess::$user->rights->expensereport->read && !DolibarrApiAccess::$user->rights->expensereport->read) { + if (!DolibarrApiAccess::$user->rights->expensereport->lire) { throw new RestException(401); } diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index d7f74b1b4de..0d0a7f2e37a 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -3169,7 +3169,7 @@ if ($action == 'create') { if ($object->statut != Propal::STATUS_DRAFT && $useonlinesignature) { print '
'; require_once DOL_DOCUMENT_ROOT.'/core/lib/signature.lib.php'; - print showOnlineSignatureUrl('proposal', $object->ref).'
'; + print showOnlineSignatureUrl('proposal', $object->ref, $object).'
'; } print '
'; diff --git a/htdocs/compta/cashcontrol/report.php b/htdocs/compta/cashcontrol/report.php index b8a062c0111..de1efc03a77 100644 --- a/htdocs/compta/cashcontrol/report.php +++ b/htdocs/compta/cashcontrol/report.php @@ -253,7 +253,7 @@ if ($resql) { // Date ope print ''; - print ''.dol_print_date($db->jdate($objp->do), "day").""; + print ''.dol_print_date($db->jdate($objp->do), "day").""; print "\n"; if (!$i) { $totalarray['nbfield']++; diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 9f0301f3c06..8f05d5b5fe6 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -96,7 +96,7 @@ $origin = GETPOST('origin', 'alpha'); $originid = (GETPOST('originid', 'int') ? GETPOST('originid', 'int') : GETPOST('origin_id', 'int')); // For backward compatibility $fac_rec = GETPOST('fac_rec', 'int'); $facid = GETPOST('facid', 'int'); -$ref_client = GETPOST('ref_client', 'int'); +$ref_client = GETPOST('ref_client', 'alpha'); $rank = (GETPOST('rank', 'int') > 0) ? GETPOST('rank', 'int') : -1; $projectid = (GETPOST('projectid', 'int') ? GETPOST('projectid', 'int') : 0); $selectedLines = GETPOST('toselect', 'array'); @@ -643,7 +643,7 @@ if (empty($reshook)) { $object->setValueFrom('ref', GETPOST('ref'), '', null, '', '', $user, 'BILL_MODIFY'); } elseif ($action == 'setref_client' && $usercancreate) { $object->fetch($id); - $object->set_ref_client(GETPOST('ref_client')); + $object->set_ref_client(GETPOST('ref_client', 'alpha')); } elseif ($action == 'confirm_valid' && $confirm == 'yes' && $usercanvalidate) { // Classify to validated $idwarehouse = GETPOST('idwarehouse', 'int'); diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 19e40b7b6bf..f25fd193c99 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -2282,7 +2282,7 @@ if ($action == 'create') { print '
'; require_once DOL_DOCUMENT_ROOT.'/core/lib/signature.lib.php'; - print showOnlineSignatureUrl('contract', $object->ref).'
'; + print showOnlineSignatureUrl('contract', $object->ref, $object).'
'; } print '
'; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index c54f9b114b5..10b4ad2f682 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -8613,7 +8613,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, if (is_object($object) && $object->element == 'propal') { $substitutionarray['__URL_PROPOSAL__'] = DOL_MAIN_URL_ROOT."/comm/propal/card.php?id=".$object->id; require_once DOL_DOCUMENT_ROOT.'/core/lib/signature.lib.php'; - $substitutionarray['__ONLINE_SIGN_URL__'] = getOnlineSignatureUrl(0, 'proposal', $object->ref); + $substitutionarray['__ONLINE_SIGN_URL__'] = getOnlineSignatureUrl(0, 'proposal', $object->ref, 1, $object); } if (is_object($object) && $object->element == 'commande') { $substitutionarray['__URL_ORDER__'] = DOL_MAIN_URL_ROOT."/commande/card.php?id=".$object->id; @@ -8624,12 +8624,12 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, if (is_object($object) && $object->element == 'contrat') { $substitutionarray['__URL_CONTRACT__'] = DOL_MAIN_URL_ROOT."/contrat/card.php?id=".$object->id; require_once DOL_DOCUMENT_ROOT.'/core/lib/signature.lib.php'; - $substitutionarray['__ONLINE_SIGN_URL__'] = getOnlineSignatureUrl(0, 'contract', $object->ref); + $substitutionarray['__ONLINE_SIGN_URL__'] = getOnlineSignatureUrl(0, 'contract', $object->ref, 1, $object); } if (is_object($object) && $object->element == 'fichinter') { $substitutionarray['__URL_FICHINTER__'] = DOL_MAIN_URL_ROOT."/fichinter/card.php?id=".$object->id; require_once DOL_DOCUMENT_ROOT.'/core/lib/signature.lib.php'; - $substitutionarray['__ONLINE_SIGN_FICHINTER_URL__'] = getOnlineSignatureUrl(0, 'fichinter', $object->ref); + $substitutionarray['__ONLINE_SIGN_FICHINTER_URL__'] = getOnlineSignatureUrl(0, 'fichinter', $object->ref, 1, $object); } if (is_object($object) && $object->element == 'supplier_proposal') { $substitutionarray['__URL_SUPPLIER_PROPOSAL__'] = DOL_MAIN_URL_ROOT."/supplier_proposal/card.php?id=".$object->id; diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index acd77ac6752..396630bdb6b 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1984,7 +1984,7 @@ function pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails = 0) $tmpresult .= vatrate($object->lines[$i]->tva_tx, 0, $object->lines[$i]->info_bits, -1); if (!getDolGlobalString('MAIN_PDF_MAIN_HIDE_SECOND_TAX')) { - if ($object->lines[$i]->total_localtax1 != 0) { + if (price2num($object->lines[$i]->localtax1_tx)) { if (preg_replace('/[\s0%]/', '', $tmpresult)) { $tmpresult .= '/'; } else { @@ -1994,7 +1994,7 @@ function pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails = 0) } } if (!getDolGlobalString('MAIN_PDF_MAIN_HIDE_THIRD_TAX')) { - if ($object->lines[$i]->total_localtax2 != 0) { + if (price2num($object->lines[$i]->localtax2_tx)) { if (preg_replace('/[\s0%]/', '', $tmpresult)) { $tmpresult .= '/'; } else { diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index 39b8097b267..c2e2f2aefee 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -1766,7 +1766,7 @@ if ($action == 'create') { print '
'; require_once DOL_DOCUMENT_ROOT.'/core/lib/signature.lib.php'; - print showOnlineSignatureUrl('fichinter', $object->ref).'
'; + print showOnlineSignatureUrl('fichinter', $object->ref, $object).'
'; } print '
'; diff --git a/htdocs/fourn/class/fournisseur.facture-rec.class.php b/htdocs/fourn/class/fournisseur.facture-rec.class.php index bb3fdac5eb3..3927fe1ae1d 100644 --- a/htdocs/fourn/class/fournisseur.facture-rec.class.php +++ b/htdocs/fourn/class/fournisseur.facture-rec.class.php @@ -764,8 +764,8 @@ class FactureFournisseurRec extends CommonInvoice $line->total_localtax2 = $objp->total_localtax2; $line->total_ttc = $objp->total_ttc; $line->product_type = $objp->product_type; - $line->date_start = $objp->date_start; - $line->date_end = $objp->date_end; + $line->date_start = $this->db->jdate($objp->date_start); + $line->date_end = $this->db->jdate($objp->date_end); $line->info_bits = $objp->info_bits ; $line->special_code = $objp->special_code; $line->rang = $objp->rang; @@ -2127,8 +2127,8 @@ class FactureFournisseurLigneRec extends CommonObjectLine $this->total_localtax2 = $objp->total_localtax2; $this->total_ttc = $objp->total_ttc; $this->product_type = $objp->product_type; - $this->date_start = $objp->date_start; - $this->date_end = $objp->date_end; + $this->date_start = $this->db->jdate($objp->date_start); + $this->date_end = $this->db->jdate($objp->date_end); $this->info_bits = $objp->info_bits; $this->special_code = $objp->special_code; $this->rang = $objp->rang; diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 6d69b1c0cbc..4bab28785d9 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -238,7 +238,6 @@ class FactureFournisseur extends CommonInvoice /** * Invoice lines - * @var SupplierInvoiceLine[] */ public $lines = array(); @@ -1051,8 +1050,9 @@ class FactureFournisseur extends CommonInvoice $line->id = $obj->rowid; $line->rowid = $obj->rowid; $line->description = $obj->description; - $line->date_start = $obj->date_start; - $line->date_end = $obj->date_end; + $line->date_start = $this->db->jdate($obj->date_start); + $line->date_end = $this->db->jdate($obj->date_end); + $line->product_ref = $obj->product_ref; $line->ref = $obj->product_ref; $line->ref_supplier = $obj->ref_supplier; @@ -3674,8 +3674,8 @@ class SupplierInvoiceLine extends CommonObjectLine $this->rowid = $obj->rowid; $this->fk_facture_fourn = $obj->fk_facture_fourn; $this->description = $obj->description; - $this->date_start = $obj->date_start; - $this->date_end = $obj->date_end; + $this->date_start = $this->db->jdate($obj->date_start); + $this->date_end = $this->db->jdate($obj->date_end); $this->product_ref = $obj->product_ref; $this->ref_supplier = $obj->ref_supplier; $this->product_desc = $obj->product_desc; diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index a4143f10289..dfac8ccd1d6 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -4041,10 +4041,9 @@ class User extends CommonObject if (!empty($user->admin) && empty($user->entity) && $conf->entity == 1) { $sql .= " WHERE t.entity IS NOT NULL"; // Show all users } else { - $sql .= ",".$this->db->prefix()."usergroup_user as ug"; - $sql .= " WHERE ((ug.fk_user = t.rowid"; - $sql .= " AND ug.entity IN (".getEntity('usergroup')."))"; - $sql .= " OR t.entity = 0)"; // Show always superadmin + $sql .= " WHERE t.entity = 0 OR EXISTS ("; + $sql .= " SELECT ug.rowid FROM " . $this->db->prefix() . "usergroup_user as ug"; + $sql .= " WHERE ug.fk_user = t.rowid AND ug.entity IN (" . getEntity('usergroup') . "))"; } } else { $sql .= " WHERE t.entity IN (".getEntity('user').")";