From 9f4182c9243463760f2ca61a08e8260a3b477563 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 2 Dec 2022 11:00:52 +0100 Subject: [PATCH 1/4] fetch entity contact to take the right directory --- htdocs/core/lib/company.lib.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 6be210d507f..86359b22941 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -1079,7 +1079,7 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '') $extrafieldsobjectkey = $contactstatic->table_element; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; - $sql = "SELECT t.rowid, t.lastname, t.firstname, t.fk_pays as country_id, t.civility, t.poste, t.phone as phone_pro, t.phone_mobile, t.phone_perso, t.fax, t.email, t.socialnetworks, t.statut, t.photo,"; + $sql = "SELECT t.rowid, t.entity, t.lastname, t.firstname, t.fk_pays as country_id, t.civility, t.poste, t.phone as phone_pro, t.phone_mobile, t.phone_perso, t.fax, t.email, t.socialnetworks, t.statut, t.photo,"; $sql .= " t.civility as civility_id, t.address, t.zip, t.town"; $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as t"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople_extrafields as ef on (t.rowid = ef.fk_object)"; @@ -1216,6 +1216,7 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '') $contactstatic->email = $obj->email; $contactstatic->socialnetworks = $obj->socialnetworks; $contactstatic->photo = $obj->photo; + $contactstatic->entity = $obj->entity; $country_code = getCountry($obj->country_id, 2); $contactstatic->country_code = $country_code; From 62e1e85f4598e4a6ece390afa6944340c97baae2 Mon Sep 17 00:00:00 2001 From: pratushraj Date: Tue, 6 Dec 2022 11:36:39 +0530 Subject: [PATCH 2/4] #23115 --- htdocs/core/lib/files.lib.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index aefc89bcc04..d6e30e93b34 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -2434,10 +2434,11 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, // Find the subdirectory name as the reference. For example original_file='10/myfile.pdf' -> refname='10' if (empty($refname)) { $refname = basename(dirname($original_file)."/"); - if ($refname == 'thumbs') { - // If we get the thumbns directory, we must go one step higher. For example original_file='10/thumbs/myfile_small.jpg' -> refname='10' - $refname = basename(dirname(dirname($original_file))."/"); - } + } + + if ($refname == 'thumbs') { + // If we get the thumbns directory, we must go one step higher. For example original_file='10/thumbs/myfile_small.jpg' -> refname='10' + $refname = basename(dirname(dirname($original_file))."/"); } // Define possible keys to use for permission check From ba582963d6b4c33dbe8f0dd248be7c64dd22e160 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 6 Dec 2022 19:56:49 +0100 Subject: [PATCH 3/4] Fix typo --- htdocs/compta/facture/list.php | 2 +- htdocs/core/actions_massactions.inc.php | 2 +- htdocs/core/lib/project.lib.php | 6 +++--- htdocs/holiday/card.php | 4 ++-- htdocs/product/stock/replenish.php | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 6adb73342a2..9e6af61a9f6 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -1789,7 +1789,7 @@ if ($resql) { $remaintopay = 0; $multicurrency_remaintopay = 0; } - if ($facturestatic->type == Facture::TYPE_CREDIT_NOTE && $obj->paye == 1) { // If credit note closed, we take into account the amount not yet consummed + if ($facturestatic->type == Facture::TYPE_CREDIT_NOTE && $obj->paye == 1) { // If credit note closed, we take into account the amount not yet consumed $remaincreditnote = $discount->getAvailableDiscounts($companystatic, '', 'rc.fk_facture_source='.$facturestatic->id); $remaintopay = -$remaincreditnote; $totalpay = price2num($facturestatic->total_ttc - $remaintopay); diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 928ae6ff104..bd8de72ce15 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -1418,7 +1418,7 @@ if (!$error && ($massaction == 'approveleave' || ($action == 'approveleave' && $ // If no SQL error, we redirect to the request form if (!$error) { - // Calculcate number of days consummed + // Calculcate number of days consumed $nbopenedday = num_open_day($objecttmp->date_debut_gmt, $objecttmp->date_fin_gmt, 0, 1, $objecttmp->halfday); $soldeActuel = $objecttmp->getCpforUser($objecttmp->fk_user, $objecttmp->fk_type); $newSolde = ($soldeActuel - $nbopenedday); diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index e32eb092a46..9d82ed8ead8 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -1529,7 +1529,7 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr if (!empty($arrayfields['timeconsumed']['checked'])) { // Time spent by everybody print ''; - // $lines[$i]->duration is a denormalised field = summ of time spent by everybody for task. What we need is time consummed by user + // $lines[$i]->duration is a denormalised field = summ of time spent by everybody for task. What we need is time consumed by user if ($lines[$i]->duration) { print ''; print convertSecondToTime($lines[$i]->duration, 'allhourmin'); @@ -1934,7 +1934,7 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$ if (!empty($arrayfields['timeconsumed']['checked'])) { // Time spent by everybody print ''; - // $lines[$i]->duration is a denormalised field = summ of time spent by everybody for task. What we need is time consummed by user + // $lines[$i]->duration is a denormalised field = summ of time spent by everybody for task. What we need is time consumed by user if ($lines[$i]->duration) { print ''; print convertSecondToTime($lines[$i]->duration, 'allhourmin'); @@ -2228,7 +2228,7 @@ function projectLinesPerMonth(&$inc, $firstdaytoshow, $fuser, $parent, $lines, & // Time spent by everybody print ''; - // $lines[$i]->duration is a denormalised field = summ of time spent by everybody for task. What we need is time consummed by user + // $lines[$i]->duration is a denormalised field = summ of time spent by everybody for task. What we need is time consumed by user if ($lines[$i]->duration) { print ''; print convertSecondToTime($lines[$i]->duration, 'allhourmin'); diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php index 00d534cd8f1..b72f123050f 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -578,7 +578,7 @@ if (empty($reshook)) { // If no SQL error, we redirect to the request form if (!$error) { - // Calculcate number of days consummed + // Calculcate number of days consumed $nbopenedday = num_open_day($object->date_debut_gmt, $object->date_fin_gmt, 0, 1, $object->halfday); $soldeActuel = $object->getCpforUser($object->fk_user, $object->fk_type); $newSolde = ($soldeActuel - $nbopenedday); @@ -799,7 +799,7 @@ if (empty($reshook)) { $error++; } - // Calculcate number of days consummed + // Calculcate number of days consumed $nbopenedday = num_open_day($object->date_debut_gmt, $object->date_fin_gmt, 0, 1, $object->halfday); $soldeActuel = $object->getCpforUser($object->fk_user, $object->fk_type); diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index 91833e95271..e168ef568d4 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -464,7 +464,7 @@ if ($usevirtualstock) { $sqlProductionToConsume .= " ".MAIN_DB_PREFIX."mrp_production as mp5"; $sqlProductionToConsume .= " WHERE mm5.rowid = mp5.fk_mo AND mm5.entity IN (".getEntity(!empty($conf->global->STOCK_CALCULATE_VIRTUAL_STOCK_TRANSVERSE_MODE) ? 'stock' : 'mo').")"; $sqlProductionToConsume .= " AND mp5.fk_product = p.rowid"; - $sqlProductionToConsume .= " AND mp5.role IN ('toconsume', 'consummed')"; + $sqlProductionToConsume .= " AND mp5.role IN ('toconsume', 'consumed')"; $sqlProductionToConsume .= " AND mm5.status IN (1,2))"; $sqlProductionToProduce = "(SELECT GREATEST(0, ".$db->ifsql("SUM(".$db->ifsql("mp5.role = 'toproduce'", 'mp5.qty', '- mp5.qty').") IS NULL", "0", "SUM(".$db->ifsql("mp5.role = 'toconsume'", 'mp5.qty', '- mp5.qty').")").") as qty"; // We need the ifsql because if result is 0 for product p.rowid, we must return 0 and not NULL From f6289297dac16af4d1ed7749249a817d05b933ec Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 7 Dec 2022 12:35:54 +0100 Subject: [PATCH 4/4] FIX #21280 FIX #23008 --- htdocs/contrat/card.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index a4a270f5227..b10517c58a9 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -491,6 +491,8 @@ if (empty($reshook)) { $tmpvat = price2num(preg_replace('/\s*\(.*\)/', '', $tva_tx)); $tmpprodvat = price2num(preg_replace('/\s*\(.*\)/', '', $prod->tva_tx)); + $pu_ht = price2num($price_ht, 'MU'); + // On reevalue prix selon taux tva car taux tva transaction peut etre different // de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur). if ($tmpvat != $tmpprodvat) { @@ -516,7 +518,7 @@ if (empty($reshook)) { $fk_unit = $prod->fk_unit; } else { - $pu_ht = GETPOST('price_ht'); + $pu_ht = price2num($price_ht, 'MU'); $price_base_type = 'HT'; $tva_tx = GETPOST('tva_tx') ?str_replace('*', '', GETPOST('tva_tx')) : 0; // tva_tx field may be disabled, so we use vat rate 0 $tva_npr = preg_match('/\*/', GETPOST('tva_tx')) ? 1 : 0;