From e71631abe0b64037fa3e749186aa326c53319f4e Mon Sep 17 00:00:00 2001 From: thomas-Ngr Date: Thu, 3 Oct 2024 19:33:33 +0200 Subject: [PATCH 01/28] fix : missing update for extrafields on holidays (#31256) --- htdocs/holiday/class/holiday.class.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index 6271f1d43e8a5..ab1efaa7f9047 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -987,6 +987,13 @@ public function update($user = null, $notrigger = 0) $error++; $this->errors[] = "Error ".$this->db->lasterror(); } + if (!$error) { + $result = $this->insertExtraFields(); + if ($result < 0) { + $error++; + } + } + if (!$error) { if (!$notrigger) { // Call trigger From 336d3ad8e584bdbbf35f7f60c8f452783de2e692 Mon Sep 17 00:00:00 2001 From: thomas-Ngr Date: Thu, 3 Oct 2024 21:03:13 +0200 Subject: [PATCH 02/28] finish fix (#31203) --- htdocs/product/stock/replenish.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index a1a99523d919c..29b02cb0796ea 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -194,17 +194,20 @@ // TODO Get desc in language of thirdparty } + $line->tva_tx = $productsupplier->vatrate_supplier; + $tva = $line->tva_tx / 100; + // If we use multicurrency if (isModEnabled('multicurrency') && !empty($productsupplier->fourn_multicurrency_code) && $productsupplier->fourn_multicurrency_code != $conf->currency) { - $line->multicurrency_code = $productsupplier->fourn_multicurrency_code; - $line->fk_multicurrency = $productsupplier->fourn_multicurrency_id; - $line->multicurrency_subprice = $productsupplier->fourn_multicurrency_unitprice; + $line->multicurrency_code = $productsupplier->fourn_multicurrency_code; + $line->fk_multicurrency = $productsupplier->fourn_multicurrency_id; + $line->multicurrency_subprice = $productsupplier->fourn_multicurrency_unitprice; + $line->multicurrency_total_ht = $line->multicurrency_subprice * $qty; + $line->multicurrency_total_tva = $line->multicurrency_total_ht * $tva; + $line->multicurrency_total_ttc = $line->multicurrency_total_ht + $line->multicurrency_total_tva; } - - $line->tva_tx = $productsupplier->vatrate_supplier; $line->subprice = $productsupplier->fourn_pu; $line->total_ht = $productsupplier->fourn_pu * $qty; - $tva = $line->tva_tx / 100; $line->total_tva = $line->total_ht * $tva; $line->total_ttc = $line->total_ht + $line->total_tva; $line->remise_percent = $productsupplier->remise_percent; From 1e64870a9ec465f090f94e907a4dd3c1a1257305 Mon Sep 17 00:00:00 2001 From: atm-lucas <121817516+atm-lucasmantegari@users.noreply.github.com> Date: Fri, 11 Oct 2024 15:53:43 +0200 Subject: [PATCH 03/28] NEW - Add a new hook on order list (#31315) * Add a new hook on order list * pr correction --- htdocs/commande/list.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index bf39beba029f8..2d80c7afec500 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -2566,6 +2566,21 @@ } } } + + // Call Hook modifyTextInfo + $parameters = array('textinfo' => $text_info); + $reshook = $hookmanager->executeHooks('modifyTextInfo', $parameters, $object, $action); + if ($reshook == 1) { + // for add information + $text_info .= $hookmanager->resPrint; + } elseif ($reshook == 0) { + // for replace information + $text_info = $hookmanager->resPrint; + } elseif ($reshook == -1) { + // for errors + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + } + if ($notshippable == 0) { $text_icon = img_picto('', 'dolly', '', false, 0, 0, '', 'green paddingleft'); $text_info = $text_icon.' '.$langs->trans('Shippable').'
'.$text_info; From 822e3cacd81ce5ba0269200431625f061daeb2b8 Mon Sep 17 00:00:00 2001 From: sonikf <93765174+sonikf@users.noreply.github.com> Date: Sun, 13 Oct 2024 20:39:14 +0300 Subject: [PATCH 04/28] fix translation for non latin languages (#31343) --- htdocs/product/card.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 6c8db41eeb741..05843b55d9011 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -20,7 +20,7 @@ * Copyright (C) 2019-2020 Thibault FOUCART * Copyright (C) 2020 Pierre Ardoin * Copyright (C) 2022 Vincent de Grandpré - * Copyright (C) 2024 MDW + * Copyright (C) 2024 MDW * * 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 @@ -1471,7 +1471,7 @@ // SellBy / EatBy mandatory list if (!empty($sellOrEatByMandatoryList)) { - print ''.$langs->trans('BatchSellOrEatByMandatoryList', $langs->trans('SellByDate'), $langs->trans('EatByDate')).''; + print ''.$langs->trans('BatchSellOrEatByMandatoryList', $langs->transnoentities('SellByDate'), $langs->transnoentities('EatByDate')).''; print $form->selectarray('sell_or_eat_by_mandatory', $sellOrEatByMandatoryList, GETPOSTINT('sell_or_eat_by_mandatory')); print ''; } @@ -2098,7 +2098,7 @@ } else { $sellOrEatByMandatorySelectedId = $object->sell_or_eat_by_mandatory; } - print ''.$langs->trans('BatchSellOrEatByMandatoryList', $langs->trans('SellByDate'), $langs->trans('EatByDate')).''; + print ''.$langs->trans('BatchSellOrEatByMandatoryList', $langs->transnoentities('SellByDate'), $langs->transnoentities('EatByDate')).''; print $form->selectarray('sell_or_eat_by_mandatory', $sellOrEatByMandatoryList, $sellOrEatByMandatorySelectedId); print ''; } @@ -2550,7 +2550,7 @@ } } - print ''.$langs->trans('BatchSellOrEatByMandatoryList', $langs->trans('SellByDate'), $langs->trans('EatByDate')).''; + print ''.$langs->trans('BatchSellOrEatByMandatoryList', $langs->transnoentities('SellByDate'), $langs->transnoentities('EatByDate')).''; print $object->getSellOrEatByMandatoryLabel(); print ''; } From b2c59aa934549b0368be0b104ff3382ae3abdc72 Mon Sep 17 00:00:00 2001 From: Ferran Marcet Date: Sun, 13 Oct 2024 20:31:23 +0200 Subject: [PATCH 05/28] Fix: Does not filter correctly by project contacts (#31340) * Fix: Grand total correction * Fix: Does not filter correctly by project contacts --- htdocs/core/lib/company.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 6ec2b9bb051a9..acedf4e2fbd25 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -10,7 +10,7 @@ * Copyright (C) 2015-2024 Frédéric France * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2017 Rui Strecht - * Copyright (C) 2018 Ferran Marcet + * Copyright (C) 2018-2024 Ferran Marcet * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify @@ -1026,7 +1026,7 @@ function show_projects($conf, $langs, $db, $object, $backtopage = '', $nocreatel $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_type_contact as tc on ec.fk_c_type_contact = tc.rowid"; $sql .= " WHERE sc.fk_soc = ".((int) $object->id); $sql .= " AND p.entity IN (".getEntity('project').")"; - $sql .= " AND tc.element = 'project'"; + $sql .= " AND tc.element = 'project' AND tc.source = 'external'"; $sql .= " ORDER BY p.dateo DESC"; $result = $db->query($sql); From 52a60dc7601dad20a52f7b2aba67a60532634694 Mon Sep 17 00:00:00 2001 From: vladimirdulov Date: Sun, 13 Oct 2024 22:32:12 +0400 Subject: [PATCH 06/28] Undefined stdClass property warnings fixed (#31325) * Undefined stdClass property warnings fixed * execute permissions restored --------- Co-authored-by: Vladimir D --- scripts/user/sync_groups_ldap2dolibarr.php | 4 +-- scripts/user/sync_users_ldap2dolibarr.php | 34 +++++++++++----------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/scripts/user/sync_groups_ldap2dolibarr.php b/scripts/user/sync_groups_ldap2dolibarr.php index 9a91d90ede5f4..f70e362087993 100755 --- a/scripts/user/sync_groups_ldap2dolibarr.php +++ b/scripts/user/sync_groups_ldap2dolibarr.php @@ -142,9 +142,9 @@ foreach ($ldaprecords as $key => $ldapgroup) { $group = new UserGroup($db); $group->fetch('', $ldapgroup[getDolGlobalString('LDAP_KEY_GROUPS')]); - $group->name = $ldapgroup[getDolGlobalString('LDAP_GROUP_FIELD_FULLNAME')]; + $group->name = $ldapgroup[getDolGlobalString('LDAP_GROUP_FIELD_FULLNAME')] ?? null; $group->nom = $group->name; // For backward compatibility - $group->note = $ldapgroup[getDolGlobalString('LDAP_GROUP_FIELD_DESCRIPTION')]; + $group->note = $ldapgroup[getDolGlobalString('LDAP_GROUP_FIELD_DESCRIPTION')] ?? null; $group->entity = $conf->entity; // print_r($ldapgroup); diff --git a/scripts/user/sync_users_ldap2dolibarr.php b/scripts/user/sync_users_ldap2dolibarr.php index 40a88d6bad026..46d836ae28f05 100755 --- a/scripts/user/sync_users_ldap2dolibarr.php +++ b/scripts/user/sync_users_ldap2dolibarr.php @@ -201,30 +201,30 @@ } // Propriete membre - $fuser->firstname = $ldapuser[getDolGlobalString('LDAP_FIELD_FIRSTNAME')]; - $fuser->lastname = $ldapuser[getDolGlobalString('LDAP_FIELD_NAME')]; - $fuser->login = $ldapuser[getDolGlobalString('LDAP_FIELD_LOGIN')]; - $fuser->pass = $ldapuser[getDolGlobalString('LDAP_FIELD_PASSWORD')]; - $fuser->pass_indatabase_crypted = $ldapuser[getDolGlobalString('LDAP_FIELD_PASSWORD_CRYPTED')]; + $fuser->firstname = $ldapuser[getDolGlobalString('LDAP_FIELD_FIRSTNAME')] ?? null; + $fuser->lastname = $ldapuser[getDolGlobalString('LDAP_FIELD_NAME')] ?? null; + $fuser->login = $ldapuser[getDolGlobalString('LDAP_FIELD_LOGIN')] ?? null; + $fuser->pass = $ldapuser[getDolGlobalString('LDAP_FIELD_PASSWORD')] ?? null; + $fuser->pass_indatabase_crypted = $ldapuser[getDolGlobalString('LDAP_FIELD_PASSWORD_CRYPTED')] ?? null; // $user->societe; /* - * $fuser->address=$ldapuser[getDolGlobalString('LDAP_FIELD_ADDRESS')]; - * $fuser->zip=$ldapuser[getDolGlobalString('LDAP_FIELD_ZIP')]; - * $fuser->town=$ldapuser[getDolGlobalString('LDAP_FIELD_TOWN')]; - * $fuser->country=$ldapuser[getDolGlobalString('LDAP_FIELD_COUNTRY')]; + * $fuser->address=$ldapuser[getDolGlobalString('LDAP_FIELD_ADDRESS')] ?? null; + * $fuser->zip=$ldapuser[getDolGlobalString('LDAP_FIELD_ZIP')] ?? null; + * $fuser->town=$ldapuser[getDolGlobalString('LDAP_FIELD_TOWN')] ?? null; + * $fuser->country=$ldapuser[getDolGlobalString('LDAP_FIELD_COUNTRY')] ?? null; * $fuser->country_id=$countries[$hashlib2rowid[strtolower($fuser->country)]]['rowid']; * $fuser->country_code=$countries[$hashlib2rowid[strtolower($fuser->country)]]['code']; */ - $fuser->office_phone = $ldapuser[getDolGlobalString('LDAP_FIELD_PHONE')]; - $fuser->user_mobile = $ldapuser[getDolGlobalString('LDAP_FIELD_MOBILE')]; - $fuser->office_fax = $ldapuser[getDolGlobalString('LDAP_FIELD_FAX')]; - $fuser->email = $ldapuser[getDolGlobalString('LDAP_FIELD_MAIL')]; - $fuser->ldap_sid = $ldapuser[getDolGlobalString('LDAP_FIELD_SID')]; + $fuser->office_phone = $ldapuser[getDolGlobalString('LDAP_FIELD_PHONE')] ?? null; + $fuser->user_mobile = $ldapuser[getDolGlobalString('LDAP_FIELD_MOBILE')] ?? null; + $fuser->office_fax = $ldapuser[getDolGlobalString('LDAP_FIELD_FAX')] ?? null; + $fuser->email = $ldapuser[getDolGlobalString('LDAP_FIELD_MAIL')] ?? null; + $fuser->ldap_sid = $ldapuser[getDolGlobalString('LDAP_FIELD_SID')] ?? null; - $fuser->job = $ldapuser[getDolGlobalString('LDAP_FIELD_TITLE')]; - $fuser->note = $ldapuser[getDolGlobalString('LDAP_FIELD_DESCRIPTION')]; + $fuser->job = $ldapuser[getDolGlobalString('LDAP_FIELD_TITLE')] ?? null; + $fuser->note = $ldapuser[getDolGlobalString('LDAP_FIELD_DESCRIPTION')] ?? null; $fuser->admin = 0; $fuser->socid = 0; $fuser->contact_id = 0; @@ -236,7 +236,7 @@ * if (isset($ldapuser[getDolGlobalString('LDAP_FIELD_MEMBER_STATUS')])) { * $fuser->datec=dol_stringtotime($ldapuser[$conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE]); * $fuser->datevalid=dol_stringtotime($ldapuser[$conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE]); - * $fuser->statut=$ldapuser[getDolGlobalString('LDAP_FIELD_MEMBER_STATUS')]; + * $fuser->statut=$ldapuser[getDolGlobalString('LDAP_FIELD_MEMBER_STATUS')] ?? null; * } */ // if ($fuser->statut > 1) $fuser->statut=1; From ffcc1ee11cca714ce946784d66116c63cca1ea05 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 13 Oct 2024 20:52:55 +0200 Subject: [PATCH 07/28] CSS --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index d1a278d8681e8..d25c4db05cda8 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -6337,7 +6337,7 @@ function print_barre_liste($title, $page, $file, $options = '', $sortfield = '', do { if ($pagenavastextinput) { if ($cpt == $page) { - $pagelist .= ''; + $pagelist .= ''; $pagelist .= '/'; } } else { From 33c6d95b1c4d1b0818bcfefebbcceb2987b90c7b Mon Sep 17 00:00:00 2001 From: UltraViolet33 <93035200+UltraViolet33@users.noreply.github.com> Date: Sun, 13 Oct 2024 21:04:17 +0200 Subject: [PATCH 08/28] Backport Fix wrong invoice status when invoice has discount (#31323) Co-authored-by: Ulysse Valdenaire --- htdocs/compta/facture/card.php | 20 ++++++++++++---- htdocs/compta/facture/list.php | 23 +++++++++++-------- .../facture/tpl/linkedobjectblock.tpl.php | 13 +++++++++++ htdocs/compta/index.php | 7 +++++- .../compta/paiement/class/paiement.class.php | 2 +- htdocs/compta/prelevement/index.php | 11 +++++---- htdocs/compta/recap-compta.php | 6 +++-- htdocs/compta/tva/list.php | 3 ++- htdocs/core/lib/functions.lib.php | 11 ++++++++- 9 files changed, 71 insertions(+), 25 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index b03f36dfbf0dc..804451777b84b 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -4487,6 +4487,9 @@ function setRadioForTypeOfIncoice() { $morehtmlref .= ''; $object->totalpaid = $totalpaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status + $object->totalcreditnotes = $totalcreditnotes; + $object->totaldeposits = $totaldeposits; + $object->remaintopay = price2num($object->total_ttc - $object->totalpaid - $object->totalcreditnotes - $object->totaldeposits, 'MT'); dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', ''); @@ -5039,7 +5042,9 @@ function js_recalculate_revenuestamp(){ $current_situation_counter = array(); foreach ($object->tab_previous_situation_invoice as $prev_invoice) { - $tmptotalpaidforthisinvoice = $prev_invoice->getSommePaiement(); + $tmptotalallpayments = $prev_invoice->getSommePaiement(0); + $tmptotalallpayments += $prev_invoice->getSumDepositsUsed(0); + $tmptotalallpayments += $prev_invoice->getSumCreditNotesUsed(0); $total_prev_ht += $prev_invoice->total_ht; $total_prev_ttc += $prev_invoice->total_ttc; $current_situation_counter[] = (($prev_invoice->type == Facture::TYPE_CREDIT_NOTE) ?-1 : 1) * $prev_invoice->situation_counter; @@ -5052,11 +5057,14 @@ function js_recalculate_revenuestamp(){ } print ''.price($prev_invoice->total_ht).''; print ''.price($prev_invoice->total_ttc).''; - print ''.$prev_invoice->getLibStatut(3, $tmptotalpaidforthisinvoice).''; + print ''.$prev_invoice->getLibStatut(3, $tmptotalallpayments).''; print ''; } } + $totalallpayments = $object->getSommePaiement(0); + $totalallpayments += $object->getSumCreditNotesUsed(0); + $totalallpayments += $object->getSumDepositsUsed(0); $total_global_ht += $total_prev_ht; $total_global_ttc += $total_prev_ttc; @@ -5072,7 +5080,7 @@ function js_recalculate_revenuestamp(){ } print ''.price($object->total_ht).''; print ''.price($object->total_ttc).''; - print ''.$object->getLibStatut(3, $object->getSommePaiement()).''; + print ''.$object->getLibStatut(3, $totalallpayments).''; print ''; @@ -5114,7 +5122,9 @@ function js_recalculate_revenuestamp(){ $total_next_ht = $total_next_ttc = 0; foreach ($object->tab_next_situation_invoice as $next_invoice) { - $totalpaid = $next_invoice->getSommePaiement(); + $totalpaid = $next_invoice->getSommePaiement(0); + $totalcreditnotes = $next_invoice->getSumCreditNotesUsed(0); + $totaldeposits = $next_invoice->getSumDepositsUsed(0); $total_next_ht += $next_invoice->total_ht; $total_next_ttc += $next_invoice->total_ttc; @@ -5127,7 +5137,7 @@ function js_recalculate_revenuestamp(){ } print ''.price($next_invoice->total_ht).''; print ''.price($next_invoice->total_ttc).''; - print ''.$next_invoice->getLibStatut(3, $totalpaid).''; + print ''.$next_invoice->getLibStatut(3, $totalpaid + $totalcreditnotes + $totaldeposits).''; print ''; } diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index a6fa25cfd13a6..d3469f3f74db0 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -422,8 +422,8 @@ $paiementAmount = $facture->getSommePaiement(); $totalcreditnotes = $facture->getSumCreditNotesUsed(); $totaldeposits = $facture->getSumDepositsUsed(); - $totalpay = $paiementAmount + $totalcreditnotes + $totaldeposits; - $remaintopay = price2num($facture->total_ttc - $totalpay); + $totalallpayments = $paiementAmount + $totalcreditnotes + $totaldeposits; + $remaintopay = price2num($facture->total_ttc - $totalallpayments); if ($remaintopay != 0) { $resultBank = $facture->setBankAccount($bankid); if ($resultBank < 0) { @@ -1821,7 +1821,7 @@ $totalarray['val']['f.total_tva'] = 0; $totalarray['val']['f.total_ht'] = 0; $totalarray['val']['f.total_ttc'] = 0; - $totalarray['val']['totalam'] = 0; + $totalarray['val']['dynamount_payed'] = 0; $totalarray['val']['rtp'] = 0; @@ -1910,8 +1910,8 @@ $multicurrency_totalcreditnotes = $facturestatic->getSumCreditNotesUsed(1); $multicurrency_totaldeposits = $facturestatic->getSumDepositsUsed(1); - $totalpay = $paiement + $totalcreditnotes + $totaldeposits; - $remaintopay = price2num($facturestatic->total_ttc - $totalpay); + $totalallpayments = $paiement + $totalcreditnotes + $totaldeposits; + $remaintopay = $obj->total_ttc - $totalallpayments; $multicurrency_totalpay = $multicurrency_paiement + $multicurrency_totalcreditnotes + $multicurrency_totaldeposits; $multicurrency_remaintopay = price2num($facturestatic->multicurrency_total_ttc - $multicurrency_totalpay); @@ -1923,13 +1923,16 @@ 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); + $totalallpayments = price2num($facturestatic->total_ttc - $remaintopay); $multicurrency_remaincreditnote = $discount->getAvailableDiscounts($companystatic, '', 'rc.fk_facture_source='.$facturestatic->id, 0, 0, 1); $multicurrency_remaintopay = -$multicurrency_remaincreditnote; $multicurrency_totalpay = price2num($facturestatic->multicurrency_total_ttc - $multicurrency_remaintopay); } $facturestatic->alreadypaid = $paiement; + $facturestatic->totalpaid = $paiement; + $facturestatic->totalcreditnotes = $totalcreditnotes; + $facturestatic->totaldeposits = $totaldeposits; $marginInfo = array(); if ($with_margin_info === true) { @@ -2382,14 +2385,14 @@ } if (!empty($arrayfields['dynamount_payed']['checked'])) { - print ''.(!empty($totalpay) ? price($totalpay, 0, $langs) : ' ').''; // TODO Use a denormalized field + print ''.(!empty($totalallpayments) ? price($totalallpayments, 0, $langs) : ' ').''; // TODO Use a denormalized field if (!$i) { $totalarray['nbfield']++; } if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'totalam'; + $totalarray['pos'][$totalarray['nbfield']] = 'dynamount_payed'; } - $totalarray['val']['totalam'] += $totalpay; + $totalarray['val']['dynamount_payed'] += $totalallpayments; } // Pending amount @@ -2580,7 +2583,7 @@ // Status if (!empty($arrayfields['f.fk_statut']['checked'])) { print ''; - print $facturestatic->getLibStatut(5, $paiement); + print $facturestatic->getLibStatut(5, $totalallpayments); print ""; if (!$i) { $totalarray['nbfield']++; diff --git a/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php b/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php index 04d7f97baef17..c002e5a7e5fe1 100644 --- a/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php +++ b/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php @@ -86,11 +86,24 @@ print ''; print ''; + $totalallpayments = 0; + $totalcalculated = false; if (method_exists($objectlink, 'getSommePaiement')) { print $objectlink->getLibStatut(3, $objectlink->getSommePaiement()); + $totalcalculated = true; + $totalallpayments += $objectlink->getSommePaiement(); } else { print $objectlink->getLibStatut(3); } + if (method_exists($objectlink, 'getSumDepositsUsed')) { + $totalcalculated = true; + $totalallpayments += $objectlink->getSumDepositsUsed(); + } + if (method_exists($objectlink, 'getSumCreditNotesUsed')) { + $totalcalculated = true; + $totalallpayments += $objectlink->getSumCreditNotesUsed(); + } + print $objectlink->getLibStatut(3, ($totalcalculated ? $totalallpayments : -1)); print ''; print ''.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').''; print "\n"; diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index a340d7ef7c372..e7df99729bb65 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -215,6 +215,9 @@ $thirdpartystatic->code_compta = $obj->code_compta; //$thirdpartystatic->code_compta_fournisseur = $obj->code_compta_fournisseur; + $totalallpayments = $tmpinvoice->getSommePaiement(0); + $totalallpayments += $tmpinvoice->getSumCreditNotesUsed(0); + $totalallpayments += $tmpinvoice->getSumDepositsUsed(0); print ''; print ''; @@ -247,7 +250,7 @@ print 'jdate($obj->tms), 'dayhour', 'tzuserrel')).'">'.dol_print_date($db->jdate($obj->tms), 'day', 'tzuserrel').''; - print ''.$tmpinvoice->getLibStatut(3, $obj->am).''; + print ''.$tmpinvoice->getLibStatut(3, $totalallpayments).''; print ''; @@ -377,6 +380,8 @@ print ''.price($obj->total_ttc).''; print 'jdate($obj->tms), 'dayhour', 'tzuserrel')).'">'.dol_print_date($db->jdate($obj->tms), 'day', 'tzuserrel').''; $alreadypaid = $facstatic->getSommePaiement(); + $alreadypaid += $facstatic->getSumCreditNotesUsed(); + $alreadypaid += $facstatic->getSumDepositsUsed(); print ''.$facstatic->getLibStatut(3, $alreadypaid).''; print ''; $total_ht += $obj->total_ht; diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index 94e2d570fcfa6..307d5a41f2766 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -1269,7 +1269,7 @@ public function getNomUrl($withpicto = 0, $option = '', $mode = 'withlistofinvoi $facturestatic = new Facture($this->db); foreach ($arraybill as $billid) { $facturestatic->fetch($billid); - $label .= '
'.$facturestatic->getNomUrl(1, '', 0, 0, '', 1).' '.$facturestatic->getLibStatut(2, 1); + $label .= '
'.$facturestatic->getNomUrl(1, '', 0, 0, '', 1).' '.$facturestatic->getLibStatut(2, -1); } } } diff --git a/htdocs/compta/prelevement/index.php b/htdocs/compta/prelevement/index.php index 71677f0051c2e..dbe814569f09b 100644 --- a/htdocs/compta/prelevement/index.php +++ b/htdocs/compta/prelevement/index.php @@ -101,7 +101,7 @@ /* * Invoices waiting for withdraw */ -$sql = "SELECT f.ref, f.rowid, f.total_ttc, f.fk_statut, f.paye, f.type,"; +$sql = "SELECT f.ref, f.rowid, f.total_ttc, f.fk_statut as status, f.paye, f.type,"; $sql .= " pfd.date_demande, pfd.amount,"; $sql .= " s.nom as name, s.email, s.rowid as socid, s.tva_intra, s.siren as idprof1, s.siret as idprof2, s.ape as idprof3, s.idprof4, s.idprof5, s.idprof6"; $sql .= " FROM ".MAIN_DB_PREFIX."facture as f,"; @@ -141,10 +141,13 @@ $invoicestatic->id = $obj->rowid; $invoicestatic->ref = $obj->ref; - $invoicestatic->statut = $obj->fk_statut; + $invoicestatic->statut = $obj->status; + $invoicestatic->status = $obj->status; $invoicestatic->paye = $obj->paye; $invoicestatic->type = $obj->type; - $alreadypayed = $invoicestatic->getSommePaiement(); + $totalallpayments = $invoicestatic->getSommePaiement(0); + $totalallpayments += $invoicestatic->getSumCreditNotesUsed(0); + $totalallpayments += $invoicestatic->getSumDepositsUsed(0); $thirdpartystatic->id = $obj->socid; $thirdpartystatic->name = $obj->name; @@ -177,7 +180,7 @@ print ''; print ''; - print $invoicestatic->getLibStatut(3, $alreadypayed); + print $invoicestatic->getLibStatut(3, $totalallpayments); print ''; print ''; $i++; diff --git a/htdocs/compta/recap-compta.php b/htdocs/compta/recap-compta.php index 0808e5a7aab20..73ed206943813 100644 --- a/htdocs/compta/recap-compta.php +++ b/htdocs/compta/recap-compta.php @@ -159,7 +159,9 @@ print $fac->error."
"; continue; } - $totalpaid = $fac->getSommePaiement(); + $alreadypaid = $fac->getSommePaiement(); + $alreadypaid += $fac->getSumDepositsUsed(); + $alreadypaid += $fac->getSumCreditNotesUsed(); $userstatic->id = $objf->userid; $userstatic->login = $objf->login; @@ -169,7 +171,7 @@ 'date' => $fac->date, 'datefieldforsort' => $fac->date.'-'.$fac->ref, 'link' => $fac->getNomUrl(1), - 'status' => $fac->getLibStatut(2, $totalpaid), + 'status' => $fac->getLibStatut(2, $alreadypaid), 'amount' => $fac->total_ttc, 'author' => $userstatic->getLoginUrl(1) ); diff --git a/htdocs/compta/tva/list.php b/htdocs/compta/tva/list.php index 9e5a28b6905a9..ec2ee333490f2 100644 --- a/htdocs/compta/tva/list.php +++ b/htdocs/compta/tva/list.php @@ -719,7 +719,8 @@ } if (!empty($arrayfields['t.status']['checked'])) { - print '' . $tva_static->getLibStatut(5, $obj->alreadypayed) . ''; + $totalallpayments = $obj->alreadypayed; + print '' . $tva_static->getLibStatut(5, $totalallpayments) . ''; if (!$i) { $totalarray['nbfield']++; } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 0218301af7540..d87132dc7a595 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2451,7 +2451,16 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi } else { $morehtmlstatus .= ''.$object->getLibStatut(6, 1).''; } - } elseif (in_array($object->element, array('facture', 'invoice', 'invoice_supplier', 'chargesociales', 'loan', 'tva', 'salary'))) { + } elseif (in_array($object->element, array('facture', 'invoice', 'invoice_supplier'))) { + $totalallpayments = $object->getSommePaiement(0); + $totalallpayments += $object->getSumCreditNotesUsed(0); + $totalallpayments += $object->getSumDepositsUsed(0); + $tmptxt = $object->getLibStatut(6, $totalallpayments); + if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3)) { + $tmptxt = $object->getLibStatut(5, $totalallpayments); + } + $morehtmlstatus .= $tmptxt; + } elseif (in_array($object->element, array('chargesociales', 'loan', 'tva'))) { $tmptxt = $object->getLibStatut(6, $object->totalpaid); if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3)) { $tmptxt = $object->getLibStatut(5, $object->totalpaid); From 9b0186c8ce81a57124d7de5de27b894b65cf82ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 13 Oct 2024 21:04:57 +0200 Subject: [PATCH 09/28] Update makepack-dolibarr.pl (#31320) * Update makepack-dolibarr.pl * Update makepack-dolibarr.pl --- build/makepack-dolibarr.pl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index 8b50a71deb0a7..629672d06c4ae 100755 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -474,7 +474,7 @@ print "Clean $BUILDROOT\n"; $ret=`rm -f $BUILDROOT/$PROJECT/.buildpath`; $ret=`rm -fr $BUILDROOT/$PROJECT/.cache`; - $ret=`rm -fr $BUILDROOT/$PROJECT/.codeclimate`; + $ret=`rm -fr $BUILDROOT/$PROJECT/.codeclimate.yml`; $ret=`rm -fr $BUILDROOT/$PROJECT/.externalToolBuilders`; $ret=`rm -fr $BUILDROOT/$PROJECT/.git*`; $ret=`rm -fr $BUILDROOT/$PROJECT/.project`; @@ -484,8 +484,11 @@ $ret=`rm -fr $BUILDROOT/$PROJECT/.stickler.yml`; $ret=`rm -fr $BUILDROOT/$PROJECT/.travis.yml`; $ret=`rm -fr $BUILDROOT/$PROJECT/.tx`; + $ret=`rm -fr $BUILDROOT/$PROJECT/.pre-commit-config.yaml`; + $ret=`rm -fr $BUILDROOT/$PROJECT/.phan`; $ret=`rm -f $BUILDROOT/$PROJECT/build.xml`; $ret=`rm -f $BUILDROOT/$PROJECT/phpstan.neon`; + $ret=`rm -fr $BUILDROOT/$PROJECT/phpstan.neon.dist`; $ret=`rm -f $BUILDROOT/$PROJECT/pom.xml`; $ret=`rm -f $BUILDROOT/$PROJECT/README-*.md`; From 24722c10cf2d41ade756ce6e23940a732c5327ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 14 Oct 2024 01:36:00 +0200 Subject: [PATCH 10/28] fix sql close #31374 (#31379) --- htdocs/societe/list.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 1764c93a83020..21d4f6bd01418 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -1626,7 +1626,8 @@ $totalarray['nbfield']++; } if (!empty($arrayfields['legalform.code']['checked'])) { - print_liste_field_titre($arrayfields['legalform.code']['label'], $_SERVER["PHP_SELF"], "legalform.code", "", $param, '', $sortfield, $sortorder); + // s.fk_forme_juridique as legalform_code + print_liste_field_titre($arrayfields['legalform.code']['label'], $_SERVER["PHP_SELF"], "legalform_code", "", $param, '', $sortfield, $sortorder); $totalarray['nbfield']++; } if (!empty($arrayfields['s.price_level']['checked'])) { From 70a453a5c2a2ae7dfae7e11b6780947f086bf2d2 Mon Sep 17 00:00:00 2001 From: thomas-Ngr Date: Mon, 14 Oct 2024 11:57:55 +0200 Subject: [PATCH 11/28] FIX: substitutions THIRDPARTY_XXX are not available for actioncomm reminders (#31385) --- htdocs/comm/action/class/actioncomm.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index f5e1fe40b1fdc..9b006c83ab66d 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -2341,6 +2341,7 @@ public function sendEmailsReminder() // Load event $res = $this->fetch($actionCommReminder->fk_actioncomm); + if ($res > 0) $res = $this->fetch_thirdparty(); if ($res > 0) { // PREPARE EMAIL $errormesg = ''; From 80ced1cc221e5601435473e6101d2961c167c61e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 14 Oct 2024 12:53:42 +0200 Subject: [PATCH 12/28] FIX convert amount into text when using numberwords --- htdocs/core/lib/functionsnumtoword.lib.php | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/htdocs/core/lib/functionsnumtoword.lib.php b/htdocs/core/lib/functionsnumtoword.lib.php index 7e16ff46de1d8..f349368078a72 100644 --- a/htdocs/core/lib/functionsnumtoword.lib.php +++ b/htdocs/core/lib/functionsnumtoword.lib.php @@ -36,8 +36,6 @@ */ function dol_convertToWord($num, $langs, $currency = '', $centimes = false) { - global $conf; - //$num = str_replace(array(',', ' '), '', trim($num)); This should be useless since $num MUST be a php numeric value if (!$num) { return false; @@ -48,13 +46,7 @@ function dol_convertToWord($num, $langs, $currency = '', $centimes = false) } if (isModEnabled('numberwords')) { - if ($currency) { - $type = '1'; - } else { - $type = '0'; - } - - $concatWords = $langs->getLabelFromNumber($num, $type); + $concatWords = $langs->getLabelFromNumber($num, $currency); return $concatWords; } else { $TNum = explode('.', (string) $num); From f4a76e5b73d5e38516be80ff3f544853bbe895f1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 14 Oct 2024 16:44:10 +0200 Subject: [PATCH 13/28] Fix translation file header --- .../template/langs/en_US/mymodule.lang | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/htdocs/modulebuilder/template/langs/en_US/mymodule.lang b/htdocs/modulebuilder/template/langs/en_US/mymodule.lang index 8677fa5806964..add75190d914e 100644 --- a/htdocs/modulebuilder/template/langs/en_US/mymodule.lang +++ b/htdocs/modulebuilder/template/langs/en_US/mymodule.lang @@ -1,17 +1,4 @@ -# Copyright (C) ---Put here your own copyright and developer email--- -# -# 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 -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# Translation file # # Generic From 7b81cccc55762a14cc141d9510d52f6b9248f0ef Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 14 Oct 2024 16:45:46 +0200 Subject: [PATCH 14/28] FIX uniformize and check delete contact action (#31384) * FIX uniformize and check delete contact action * FIX syntax error * FIX missing private contact checking * FIX missing show errors * FIX missing "oldcopy" for trigger * FIX missing private contact filter in selectcontact --- htdocs/contact/class/contact.class.php | 4 ++- htdocs/core/boxes/box_contacts.php | 1 + htdocs/core/class/html.form.class.php | 3 +- htdocs/core/lib/company.lib.php | 2 +- htdocs/societe/contact.php | 38 ++++++++++---------------- htdocs/societe/index.php | 3 +- 6 files changed, 24 insertions(+), 27 deletions(-) diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index e2ff9935585d7..57f24b67a4c10 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -999,7 +999,7 @@ public function fetch($id, $user = null, $ref_ext = '', $email = '', $loadalsoro $sql .= " c.priv, c.note_private, c.note_public, c.default_lang, c.canvas,"; $sql .= " c.fk_prospectlevel, c.fk_stcommcontact, st.libelle as stcomm, st.picto as stcomm_picto,"; $sql .= " c.import_key,"; - $sql .= " c.datec as date_creation, c.tms as date_modification,"; + $sql .= " c.datec as date_creation, c.tms as date_modification, c.fk_user_creat, c.fk_user_modif,"; $sql .= " co.label as country, co.code as country_code,"; $sql .= " d.nom as state, d.code_departement as state_code,"; $sql .= " u.rowid as user_id, u.login as user_login,"; @@ -1053,6 +1053,8 @@ public function fetch($id, $user = null, $ref_ext = '', $email = '', $loadalsoro $this->date_creation = $this->db->jdate($obj->date_creation); $this->date_modification = $this->db->jdate($obj->date_modification); + $this->user_creation_id = $obj->fk_user_creat; + $this->user_modification_id = $obj->fk_user_modif; $this->state_id = $obj->state_id; $this->state_code = $obj->state_code; diff --git a/htdocs/core/boxes/box_contacts.php b/htdocs/core/boxes/box_contacts.php index 7ee04c0b2d82c..b9be887b2edfe 100644 --- a/htdocs/core/boxes/box_contacts.php +++ b/htdocs/core/boxes/box_contacts.php @@ -105,6 +105,7 @@ public function loadBox($max = 5) if (!$user->hasRight('societe', 'client', 'voir')) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } + $sql .= " AND ((sp.fk_user_creat = ".((int) $user->id)." AND sp.priv = 1) OR sp.priv = 0)"; // check if this is a private contact // Add where from hooks $parameters = array('socid' => $user->socid, 'boxcode' => $this->boxcode); $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $contactstatic); // Note that $action and $object may have been modified by hook diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 99e94aec30623..d70703a50fc3d 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1752,7 +1752,7 @@ public function select_thirdparty_list($selected = '', $htmlname = 'socid', $fil */ public function selectcontacts($socid, $selected = array(), $htmlname = 'contactid', $showempty = 0, $exclude = '', $limitto = '', $showfunction = 0, $morecss = '', $options_only = 0, $showsoc = 0, $forcecombo = 0, $events = array(), $moreparam = '', $htmlid = '', $multiple = false, $disableifempty = 0, $filter = '') { - global $conf, $langs, $hookmanager, $action; + global $conf, $user, $langs, $hookmanager, $action; $langs->load('companies'); @@ -1812,6 +1812,7 @@ public function selectcontacts($socid, $selected = array(), $htmlname = 'contact $sql .= " LEFT OUTER JOIN " . $this->db->prefix() . "societe as s ON s.rowid=sp.fk_soc"; } $sql .= " WHERE sp.entity IN (" . getEntity('contact') . ")"; + $sql .= " AND ((sp.fk_user_creat = ".((int) $user->id)." AND sp.priv = 1) OR sp.priv = 0)"; // check if this is a private contact if ($socid > 0 || $socid == -1) { $sql .= " AND sp.fk_soc = " . ((int) $socid); } diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index acedf4e2fbd25..6a696ab26deae 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -1667,7 +1667,7 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl // Delete if ($user->hasRight('societe', 'contact', 'delete')) { - print ''; + print ''; print img_delete(); print ''; } diff --git a/htdocs/societe/contact.php b/htdocs/societe/contact.php index 893f21db32944..c499fad5ae988 100644 --- a/htdocs/societe/contact.php +++ b/htdocs/societe/contact.php @@ -138,30 +138,22 @@ if ($action == 'confirm_delete' && $user->hasRight('societe', 'contact', 'delete')) { $id = GETPOST('id', 'int'); if (!empty($id) && $socid > 0) { - $db->begin(); - - $sql = "DELETE FROM ".MAIN_DB_PREFIX."socpeople_extrafields"; - $sql .= " WHERE fk_object = ".((int) $socid); - $sql .= " AND fk_object IN (SELECT rowid FROM ".MAIN_DB_PREFIX."socpeople as sp WHERE sp.rowid = ".((int) $socid); - $sql .= " AND ((sp.fk_user_creat = ".((int) $user->id)." AND sp.priv = 1) OR sp.priv = 0))"; - - $result1 = $db->query($sql); - - $sql = "DELETE FROM ".MAIN_DB_PREFIX."socpeople"; - $sql .= " WHERE fk_soc = ".((int) $socid); - $sql .= " AND rowid = ".((int) $id); - $sql .= " AND ((fk_user_creat = ".((int) $user->id)." AND priv = 1) OR priv = 0)"; - - $result2 = $db->query($sql); - - if (!$result1 || !$result2) { - setEventMessages($db->lasterror(), null, 'errors'); - $db->rollback(); + $contact = new Contact($db); + $ret = $contact->fetch($id); + if ($ret > 0) { + if ($contact->priv == 0 || ($contact->user_modification_id == ((int) $user->id) && $contact->priv == 1)) { + $contact->oldcopy = clone $contact; // @phan-suppress-current-line PhanTypeMismatchProperty + $result = $contact->delete($user); + if ($result > 0) { + setEventMessages('RecordDeleted', null, 'mesgs'); + header("Location: ".$_SERVER['PHP_SELF']."?id=".$socid); + exit(); + } else { + setEventMessages($contact->error, $contact->errors, 'errors'); + } + } } else { - $db->commit(); - setEventMessages('RecordDeleted', null, 'mesgs'); - header("Location: ".$_SERVER['PHP_SELF']."?id=".$socid); - exit(); + setEventMessages($contact->error, $contact->errors, 'errors'); } } } diff --git a/htdocs/societe/index.php b/htdocs/societe/index.php index 83089a617ff12..e1b6c0503471c 100644 --- a/htdocs/societe/index.php +++ b/htdocs/societe/index.php @@ -422,7 +422,8 @@ if (!$user->hasRight('societe', 'client', 'voir')) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } -$sql .= ' WHERE s.entity IN ('.getEntity('societe').') AND sp.fk_soc = s.rowid'; +$sql .= " WHERE s.entity IN (".getEntity('societe').") AND sp.fk_soc = s.rowid"; +$sql .= " AND ((sp.fk_user_creat = ".((int) $user->id)." AND sp.priv = 1) OR sp.priv = 0)"; // check if this is a private contact if (!$user->hasRight('societe', 'client', 'voir')) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } From 3f98aee0a23821181eb25e4675e0700868eeb000 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 14 Oct 2024 17:11:47 +0200 Subject: [PATCH 15/28] Doc --- htdocs/public/onlinesign/newonlinesign.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/public/onlinesign/newonlinesign.php b/htdocs/public/onlinesign/newonlinesign.php index cdf88596f2c03..873a0a02b56bc 100644 --- a/htdocs/public/onlinesign/newonlinesign.php +++ b/htdocs/public/onlinesign/newonlinesign.php @@ -24,6 +24,8 @@ * \ingroup core * \brief File to offer a way to make an online signature for a particular Dolibarr entity * Example of URL: https://localhost/public/onlinesign/newonlinesign.php?ref=PR... + * + * The signature is added by calling the file /htdocs/core/ajax/onlinSign.php */ if (!defined('NOLOGIN')) { From 414a289aae1f0dfad681bbee106459ebd5145c61 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 14 Oct 2024 19:32:48 +0200 Subject: [PATCH 16/28] Doc --- htdocs/blockedlog/class/blockedlog.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php index bc0e4a3bec464..0e4bfa816a677 100644 --- a/htdocs/blockedlog/class/blockedlog.class.php +++ b/htdocs/blockedlog/class/blockedlog.class.php @@ -1228,7 +1228,7 @@ public function alreadyUsed($ignoresystem = 0) dol_print_error($this->db); } - dol_syslog("Module Blockedlog alreadyUsed with ignoresystem=".$ignoresystem." is ".json_encode($result)); + dol_syslog("Module Blockedlog alreadyUsed(ignoresystem=".$ignoresystem.") returns ".json_encode($result)); return $result; } From 7cd1425bc15de65e9f63c89ba2b60f12f63919dc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 14 Oct 2024 20:17:21 +0200 Subject: [PATCH 17/28] Fix css --- htdocs/fourn/commande/list.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 9562017226a93..c9a2ad9ad8f78 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -1831,8 +1831,8 @@ } // Alias if (!empty($arrayfields['s.name_alias']['checked'])) { - print ''; - print $obj->alias; + print ''; + print dol_escape_all($obj->alias); print ''."\n"; if (!$i) { $totalarray['nbfield']++; @@ -1840,8 +1840,8 @@ } // Town if (!empty($arrayfields['s.town']['checked'])) { - print ''; - print $obj->town; + print ''; + print dol_escape_htmltag($obj->town); print ''; if (!$i) { $totalarray['nbfield']++; @@ -1849,8 +1849,8 @@ } // Zip if (!empty($arrayfields['s.zip']['checked'])) { - print ''; - print $obj->zip; + print ''; + print dol_escape_htmltag($obj->zip); print ''; if (!$i) { $totalarray['nbfield']++; @@ -1858,7 +1858,7 @@ } // State if (!empty($arrayfields['state.nom']['checked'])) { - print "".$obj->state_name."\n"; + print ''.dol_escape_htmltag($obj->state_name)."\n"; if (!$i) { $totalarray['nbfield']++; } From 30fd0544f8b85d71c74ae94df2f027f232d66641 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 14 Oct 2024 21:28:15 +0200 Subject: [PATCH 18/28] Fix look and feel v19 --- htdocs/commande/list.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index d9a6876ac1749..7686563199568 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -2213,8 +2213,8 @@ // Alias name if (!empty($arrayfields['s.name_alias']['checked'])) { - print ''; - print $obj->alias; + print ''; + print dol_escape_htmltag($obj->alias); print ''; if (!$i) { $totalarray['nbfield']++; @@ -2244,8 +2244,8 @@ // Town if (!empty($arrayfields['s.town']['checked'])) { - print ''; - print $obj->town; + print ''; + print dol_escape_htmltag($obj->town); print ''; if (!$i) { $totalarray['nbfield']++; @@ -2254,8 +2254,8 @@ // Zip if (!empty($arrayfields['s.zip']['checked'])) { - print ''; - print $obj->zip; + print ''; + print dol_escape_htmltag($obj->zip); print ''; if (!$i) { $totalarray['nbfield']++; @@ -2264,7 +2264,7 @@ // State if (!empty($arrayfields['state.nom']['checked'])) { - print "".$obj->state_name."\n"; + print ''.dol_escape_htmltag($obj->state_name)."\n"; if (!$i) { $totalarray['nbfield']++; } From cd200996dc3286a0522c4d22fb2194afc3e224b0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 14 Oct 2024 21:31:45 +0200 Subject: [PATCH 19/28] Fix duplicate call/output --- htdocs/compta/facture/tpl/linkedobjectblock.tpl.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php b/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php index 56849228e0fe2..e9c6e9ae4e4d2 100644 --- a/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php +++ b/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php @@ -90,11 +90,8 @@ $totalallpayments = 0; $totalcalculated = false; if (method_exists($objectlink, 'getSommePaiement')) { - print $objectlink->getLibStatut(3, $objectlink->getSommePaiement()); $totalcalculated = true; $totalallpayments += $objectlink->getSommePaiement(); - } else { - print $objectlink->getLibStatut(3); } if (method_exists($objectlink, 'getSumDepositsUsed')) { $totalcalculated = true; From 86a90692ef8e02b6d99e72303561b40c32899cae Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 14 Oct 2024 22:38:51 +0200 Subject: [PATCH 20/28] FIX Support for PDF_ADD_POSITION was not complete --- .../expedition/doc/pdf_espadon.modules.php | 41 +++++++++++++++---- 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php index 51405083fe6a4..bc139a07cacac 100644 --- a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php @@ -88,6 +88,7 @@ public function __construct(DoliDB $db) $this->description = $langs->trans("DocumentModelStandardPDF"); $this->update_main_doc_field = 1; // Save the name of generated file as the main doc when generating a doc with this template + // Dimension page $this->type = 'pdf'; $formatarray = pdf_getFormat(); $this->page_largeur = $formatarray['width']; @@ -104,7 +105,7 @@ public function __construct(DoliDB $db) // Get source company $this->emetteur = $mysoc; - if (!$this->emetteur->country_code) { + if (empty($this->emetteur->country_code)) { $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default if not defined } @@ -179,9 +180,9 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $realpath = ''; + $arephoto = false; foreach ($objphoto->liste_photos($dir, 1) as $key => $obj) { - if (!getDolGlobalInt('CAT_HIGH_QUALITY_IMAGES')) { - // If CAT_HIGH_QUALITY_IMAGES not defined, we use thumb if defined and then original photo + if (!getDolGlobalInt('CAT_HIGH_QUALITY_IMAGES')) { // If CAT_HIGH_QUALITY_IMAGES not defined, we use thumb if defined and then original photo if ($obj['photo_vignette']) { $filename = $obj['photo_vignette']; } else { @@ -192,11 +193,12 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede } $realpath = $dir.$filename; + $arephoto = true; $this->atleastonephoto = true; break; } - if ($realpath) { + if ($realpath && $arephoto) { $realpatharray[$i] = $realpath; } } @@ -318,7 +320,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede } } - // Public note and Tracking code + // Displays notes. Here we are still on code executed only for the first page. $notetoshow = empty($object->note_public) ? '' : $object->note_public; // Extrafields in note @@ -572,6 +574,10 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $posYAfterDescription = 0; $heightforsignature = 0; + if ($this->getColumnStatus('position')) { + $this->printStdColumnContent($pdf, $curY, 'position', (string) ($i + 1)); + } + if ($this->getColumnStatus('photo')) { // We start with Photo of product line if (isset($imglinesize['width']) && isset($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforsignature + $heightforinfotot))) { // If photo too high, we moved completely on new page @@ -1271,6 +1277,24 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide */ $rank = 0; // do not use negative rank + $this->cols['position'] = array( + 'rank' => $rank, + 'width' => 10, + 'status' => getDolGlobalInt('PDF_ESPADON_ADD_POSITION') ? true : (getDolGlobalInt('PDF_ADD_POSITION') ? true : false), + 'title' => array( + 'textkey' => '#', // use lang key is useful in somme case with module + 'align' => 'C', + // 'textkey' => 'yourLangKey', // if there is no label, yourLangKey will be translated to replace label + // 'label' => ' ', // the final label + 'padding' => array(0.5, 0.5, 0.5, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left + ), + 'content' => array( + 'align' => 'C', + 'padding' => array(1, 0.5, 1, 1.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left + ), + ); + + $rank = 5; // do not use negative rank $this->cols['desc'] = array( 'rank' => $rank, 'width' => false, // only for desc @@ -1280,15 +1304,16 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide 'align' => 'L', // 'textkey' => 'yourLangKey', // if there is no label, yourLangKey will be translated to replace label // 'label' => ' ', // the final label - 'padding' => array(0.5, 1, 0.5, 1.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left + 'padding' => array(0.5, 0.5, 0.5, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left ), 'content' => array( - 'padding' => array(1, 0.5, 1, 1.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left 'align' => 'L', + 'padding' => array(1, 0.5, 1, 1.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left ), ); - $rank = $rank + 10; + // Image of product + $rank += 10; $this->cols['photo'] = array( 'rank' => $rank, 'width' => getDolGlobalInt('MAIN_DOCUMENTS_WITH_PICTURE_WIDTH', 20), // in mm From 4972c57a8208949a7d23416f95ddc07ea68782af Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 15 Oct 2024 00:26:13 +0200 Subject: [PATCH 21/28] FIX Bad balance of td into setup page of shipments --- htdocs/admin/expedition.php | 46 +++++++++++++++---------------------- 1 file changed, 18 insertions(+), 28 deletions(-) diff --git a/htdocs/admin/expedition.php b/htdocs/admin/expedition.php index 71e457920742e..452bce9619186 100644 --- a/htdocs/admin/expedition.php +++ b/htdocs/admin/expedition.php @@ -418,42 +418,30 @@ } print ''; -print load_fiche_titre($langs->trans('CreationOptions'), '', ''); - -print ''; -print ''; -print ''; -print ''; -print ''; - -print "\n"; - -print ''; -print ''; -print ''; -print ''; - -print '
'.$langs->trans('Name').''.$langs->trans('Status').'
'.$langs->trans('SHIPPING_DISPLAY_STOCK_ENTRY_DATE'); -print ' '; -print ajax_constantonoff('SHIPPING_DISPLAY_STOCK_ENTRY_DATE'); -print '

'; -print '
'; /* * Other options - * */ + print load_fiche_titre($langs->trans("OtherOptions"), '', ''); print '
'; print ''; print ''; -print ""; -print ""; +print '
'; +print ''; print "\n"; -print ""; +print "\n"; +print ''; + +print ''; +print ''; +print ''; $substitutionarray = pdf_getSubstitutionArray($langs, null, null, 2); $substitutionarray['__(AnyTranslationKey)__'] = $langs->trans("Translation"); @@ -463,7 +451,7 @@ } $htmltext .= ''; -print '\n"; print '\n"; // Allow OnLine Sign print ''; -print ''; -print ''; +print ''; From 3c74d67ca56cb4898481b0b1fd40f4cc1441b0d5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 15 Oct 2024 11:27:38 +0200 Subject: [PATCH 22/28] FIX Show twice the technical ID --- htdocs/core/tpl/commonfields_view.tpl.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/tpl/commonfields_view.tpl.php b/htdocs/core/tpl/commonfields_view.tpl.php index 4cb908025f42e..8ee77b5ffb859 100644 --- a/htdocs/core/tpl/commonfields_view.tpl.php +++ b/htdocs/core/tpl/commonfields_view.tpl.php @@ -51,8 +51,8 @@ continue; // We don't want this field } - if (in_array($key, array('ref', 'status'))) { - continue; // Ref and status are already in dol_banner + if (in_array($key, array('rowid', 'ref', 'status'))) { + continue; // rowid, ref and status are already in dol_banner } $value = $object->$key; From e731910edef9cceff944b105aeb5a0283268f211 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 15 Oct 2024 14:14:07 +0200 Subject: [PATCH 23/28] Miscellaneous fix on PDf template (trans, position column, warning) --- .../expedition/doc/pdf_espadon.modules.php | 21 +++++--- .../supplier_order/doc/pdf_cornas.modules.php | 53 ++++++++++++++----- 2 files changed, 54 insertions(+), 20 deletions(-) diff --git a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php index bc139a07cacac..3cc19ec9933bb 100644 --- a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php @@ -981,7 +981,12 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs) { global $conf, $langs, $mysoc; - $langs->load("orders"); + $ltrdirection = 'L'; + if ($outputlangs->trans("DIRECTION") == 'rtl') { + $ltrdirection = 'R'; + } + + $outputlangs->load("orders"); $default_font_size = pdf_getPDFFontSize($outputlangs); @@ -1020,7 +1025,7 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs) } } else { $text = $this->emetteur->name; - $pdf->MultiCell($w, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); + $pdf->MultiCell($w, 4, $outputlangs->convToOutputCharset($text), 0, $ltrdirection); } $pdf->SetDrawColor(128, 128, 128); @@ -1137,7 +1142,7 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs) $pdf->SetTextColor(0, 0, 0); $pdf->SetFont('', '', $default_font_size - 2); $pdf->SetXY($posx, $posy - 5); - $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("Sender"), 0, 'L'); + $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("Sender"), 0, $ltrdirection); $pdf->SetXY($posx, $posy); $pdf->SetFillColor(230, 230, 230); $pdf->MultiCell($widthrecbox, $hautcadre, "", 0, 'R', 1); @@ -1156,7 +1161,7 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs) // Show sender information $pdf->SetXY($posx + 2, $posy); $pdf->SetFont('', '', $default_font_size - 1); - $pdf->MultiCell($widthrecbox - 2, 4, $carac_emetteur, 0, 'L'); + $pdf->MultiCell($widthrecbox - 2, 4, $carac_emetteur, 0, $ltrdirection); // If SHIPPING contact defined, we use it @@ -1194,21 +1199,21 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs) $pdf->SetTextColor(0, 0, 0); $pdf->SetFont('', '', $default_font_size - 2); $pdf->SetXY($posx + 2, $posy - 5); - $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("Recipient"), 0, 'L'); + $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("Recipient"), 0, $ltrdirection); $pdf->Rect($posx, $posy, $widthrecbox, $hautcadre); } // Show recipient name $pdf->SetXY($posx + 2, $posy + 3); $pdf->SetFont('', 'B', $default_font_size); - $pdf->MultiCell($widthrecbox, 2, $carac_client_name, 0, 'L'); + $pdf->MultiCell($widthrecbox, 2, $carac_client_name, 0, $ltrdirection); $posy = $pdf->getY(); // Show recipient information $pdf->SetXY($posx + 2, $posy); $pdf->SetFont('', '', $default_font_size - 1); - $pdf->MultiCell($widthrecbox, 4, $carac_client, 0, 'L'); + $pdf->MultiCell($widthrecbox, 4, $carac_client, 0, $ltrdirection); } $pdf->SetTextColor(0, 0, 0); @@ -1294,7 +1299,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide ), ); - $rank = 5; // do not use negative rank + $rank += 10; // do not use negative rank $this->cols['desc'] = array( 'rank' => $rank, 'width' => false, // only for desc diff --git a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php index a32a6325def9d..7132a4de3ad98 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php @@ -92,7 +92,7 @@ public function __construct($db) $this->description = $langs->trans('SuppliersCommandModel'); $this->update_main_doc_field = 1; // Save the name of generated file as the main doc when generating a doc with this template - // Page size for A4 format + // Dimension page $this->type = 'pdf'; $formatarray = pdf_getFormat(); $this->page_largeur = $formatarray['width']; @@ -116,7 +116,7 @@ public function __construct($db) // Get source company $this->emetteur = $mysoc; if (empty($this->emetteur->country_code)) { - $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default, if was not defined + $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default if not defined } // Define position of columns @@ -196,6 +196,8 @@ public function write_file($object, $outputlangs = null, $srctemplatepath = '', } $realpath = ''; + + $arephoto = false; foreach ($objphoto->liste_photos($dir, 1) as $key => $obj) { if (!getDolGlobalInt('CAT_HIGH_QUALITY_IMAGES')) { // If CAT_HIGH_QUALITY_IMAGES not defined, we use thumb if defined and then original photo if ($obj['photo_vignette']) { @@ -207,10 +209,12 @@ public function write_file($object, $outputlangs = null, $srctemplatepath = '', $filename = $obj['photo']; } $realpath = $dir.$filename; + $arephoto = true; + $this->atleastonephoto = true; break; } - if ($realpath) { + if ($realpath && $arephoto) { $realpatharray[$i] = $realpath; } } @@ -260,7 +264,8 @@ public function write_file($object, $outputlangs = null, $srctemplatepath = '', global $action; $reshook = $hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks - $nblines = count($object->lines); + // Set nblines with the new facture lines content after hook + $nblines = is_array($object->lines) ? count($object->lines) : 0; $pdf = pdf_getInstance($this->format); $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance @@ -278,7 +283,7 @@ public function write_file($object, $outputlangs = null, $srctemplatepath = '', } $pdf->SetFont(pdf_getPDFFont($outputlangs)); // Set path to the background PDF File - if (getDolGlobalString('MAIN_ADD_PDF_BACKGROUND')) { + if (!getDolGlobalString('MAIN_DISABLE_FPDI') && getDolGlobalString('MAIN_ADD_PDF_BACKGROUND')) { $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/' . getDolGlobalString('MAIN_ADD_PDF_BACKGROUND')); $tplidx = $pdf->importPage(1); } @@ -324,6 +329,7 @@ public function write_file($object, $outputlangs = null, $srctemplatepath = '', $tab_height = $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext; // Incoterm + $height_incoterms = 0; if (isModEnabled('incoterm')) { $desc_incoterms = $object->getIncotermsForPDF(); if ($desc_incoterms) { @@ -339,10 +345,11 @@ public function write_file($object, $outputlangs = null, $srctemplatepath = '', $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_incoterms + 1); $tab_top = $nexY + 6; + $height_incoterms += 4; } } - // Affiche notes + // Displays notes. Here we are still on code executed only for the first page. $notetoshow = empty($object->note_public) ? '' : $object->note_public; // Extrafields in note @@ -352,7 +359,7 @@ public function write_file($object, $outputlangs = null, $srctemplatepath = '', } $pagenb = $pdf->getPage(); - if ($notetoshow) { + if (!empty($notetoshow)) { $tab_width = $this->page_largeur - $this->marge_gauche - $this->marge_droite; $pageposbeforenote = $pagenb; @@ -374,7 +381,7 @@ public function write_file($object, $outputlangs = null, $srctemplatepath = '', if ($pageposafternote > $pageposbeforenote) { $pdf->rollbackTransaction(true); - // prepar pages to receive notes + // prepare pages to receive notes while ($pagenb < $pageposafternote) { $pdf->AddPage(); $pagenb++; @@ -444,8 +451,7 @@ public function write_file($object, $outputlangs = null, $srctemplatepath = '', } $height_note = $posyafter - $tab_top_newpage; $pdf->Rect($this->marge_gauche, $tab_top_newpage - 1, $tab_width, $height_note + 1); - } else { - // No pagebreak + } else { // No pagebreak $pdf->commitTransaction(); $posyafter = $pdf->GetY(); $height_note = $posyafter - $tab_top; @@ -513,6 +519,10 @@ public function write_file($object, $outputlangs = null, $srctemplatepath = '', $posYAfterImage = 0; $posYAfterDescription = 0; + if ($this->getColumnStatus('position')) { + $this->printStdColumnContent($pdf, $curY, 'position', (string) ($i + 1)); + } + // We start with Photo of product line if ($this->getColumnStatus('photo')) { // We start with Photo of product line @@ -545,6 +555,7 @@ public function write_file($object, $outputlangs = null, $srctemplatepath = '', if ($this->getColumnStatus('desc')) { $pdf->startTransaction(); + $this->printColDescContent($pdf, $curY, 'desc', $object, $i, $outputlangs, $hideref, $hidedesc, 1); $pageposafter = $pdf->getPage(); @@ -814,11 +825,11 @@ public function write_file($object, $outputlangs = null, $srctemplatepath = '', return 1; // No error } else { - $this->error = $langs->trans("ErrorCanNotCreateDir", $dir); + $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir); return 0; } } else { - $this->error = $langs->trans("ErrorConstantNotDefined", "SUPPLIER_OUTPUTDIR"); + $this->error = $langs->transnoentities("ErrorConstantNotDefined", "SUPPLIER_OUTPUTDIR"); return 0; } } @@ -1514,6 +1525,24 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide */ $rank = 0; // do not use negative rank + $this->cols['position'] = array( + 'rank' => $rank, + 'width' => 10, + 'status' => getDolGlobalInt('PDF_CORNAS_ADD_POSITION') ? true : (getDolGlobalInt('PDF_ADD_POSITION') ? true : false), + 'title' => array( + 'textkey' => '#', // use lang key is useful in somme case with module + 'align' => 'C', + // 'textkey' => 'yourLangKey', // if there is no label, yourLangKey will be translated to replace label + // 'label' => ' ', // the final label + 'padding' => array(0.5, 0.5, 0.5, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left + ), + 'content' => array( + 'align' => 'C', + 'padding' => array(1, 0.5, 1, 1.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left + ), + ); + + $rank += 10; // do not use negative rank $this->cols['desc'] = array( 'rank' => $rank, 'width' => false, // only for desc From 448616d4c5f33f1546c06a83b570a13e5577ac3c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 15 Oct 2024 15:19:12 +0200 Subject: [PATCH 24/28] Translate --- htdocs/langs/en_US/admin.lang | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 2a93e7d181a93..e3d6f60d66626 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -18,8 +18,8 @@ FileIntegrityIsOkButFilesWereAdded=Files integrity check has passed, however som FileIntegritySomeFilesWereRemovedOrModified=Files integrity check has failed. Some files were modified, removed or added. GlobalChecksum=Global checksum MakeIntegrityAnalysisFrom=Make integrity analysis of application files from -LocalSignature=Embedded local signature (less reliable) -RemoteSignature=Remote distant signature (more reliable) +LocalSignature=Embedded local signature +RemoteSignature=Remote distant signature FilesMissing=Missing Files FilesUpdated=Updated Files FilesModified=Modified Files From f3f7b67ce20a05c4c6c3fafc1e2fccddf785440f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 15 Oct 2024 15:39:47 +0200 Subject: [PATCH 25/28] add missing dol_escape_all (#31406) --- htdocs/core/lib/functions.lib.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 65527d810ff11..da19e806fe13b 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1624,6 +1624,17 @@ function dol_escape_php($stringtoescape, $stringforquotes = 2) return 'Bad parameter for stringforquotes in dol_escape_php'; } +/** + * Returns text escaped for all protocols (so only alpha chars and numbers) + * + * @param string $stringtoescape String to escape + * @return string Escaped string for XML content. + */ +function dol_escape_all($stringtoescape) +{ + return preg_replace('/[^a-z0-9_]/i', '', $stringtoescape); +} + /** * Returns text escaped for inclusion into a XML string * From ccc27739d759a0239dd73cebc37490ad37a251d3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 15 Oct 2024 15:40:50 +0200 Subject: [PATCH 26/28] Fix bad escapement --- htdocs/fourn/commande/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index c9a2ad9ad8f78..0a777b7b5a763 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -1832,7 +1832,7 @@ // Alias if (!empty($arrayfields['s.name_alias']['checked'])) { print ''."\n"; if (!$i) { $totalarray['nbfield']++; From 47581442b161f4484ad5ed11b86254678f78f980 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 16 Oct 2024 11:42:54 +0200 Subject: [PATCH 27/28] FIX dol_openinpopup for virtual card --- htdocs/main.inc.php | 6 +++--- htdocs/user/virtualcard.php | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 737053673f032..d5ac34473a52a 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1623,7 +1623,7 @@ function llxHeader($head = '', $title = '', $help_url = '', $target = '', $disab print ''."\n"; // top menu and left menu area - if ((empty($conf->dol_hide_topmenu) || GETPOSTINT('dol_invisible_topmenu')) && !GETPOSTINT('dol_openinpopup')) { + if ((empty($conf->dol_hide_topmenu) || GETPOSTINT('dol_invisible_topmenu')) && !GETPOST('dol_openinpopup', 'aZ09')) { top_menu($head, $title, $target, $disablejs, $disablehead, $arrayofjs, $arrayofcss, $morequerystring, $help_url); } @@ -3536,7 +3536,7 @@ function main_area($title = '') { global $conf, $langs, $hookmanager; - if (empty($conf->dol_hide_leftmenu) && !GETPOST('dol_openinpopup')) { + if (empty($conf->dol_hide_leftmenu) && !GETPOST('dol_openinpopup', 'aZ09')) { print '
'; } @@ -3790,7 +3790,7 @@ function llxFooter($comment = '', $zone = 'private', $disabledoutputofmessages = print '
'."\n"; // End div fiche - if (empty($conf->dol_hide_leftmenu) && !GETPOST('dol_openinpopup')) { + if (empty($conf->dol_hide_leftmenu) && !GETPOST('dol_openinpopup', 'aZ09')) { print ' '."\n"; // End div id-right } diff --git a/htdocs/user/virtualcard.php b/htdocs/user/virtualcard.php index b519b6d67bf26..866f6a2acde66 100644 --- a/htdocs/user/virtualcard.php +++ b/htdocs/user/virtualcard.php @@ -128,7 +128,9 @@ print '
'; $param = '&id='.((int) $object->id); -$param .= '&dol_openinpopup=1'; +if (GETPOSTISSET('dol_openinpopup')) { + $param .= '&dol_openinpopup='.urlencode(GETPOST('dol_openinpopup', 'aZ09')); +} $enabledisablehtml = $langs->trans("EnablePublicVirtualCard").' '; if (!getDolUserInt('USER_ENABLE_PUBLIC', 0, $object)) { From 495a31c8fe679041ae80733f7fb4a3c81343e678 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 16 Oct 2024 12:51:42 +0200 Subject: [PATCH 28/28] FIX CSS and access to media files --- htdocs/core/lib/files.lib.php | 8 ++++++-- htdocs/document.php | 2 +- htdocs/main.inc.php | 3 +++ htdocs/theme/eldy/global.inc.php | 8 ++++---- htdocs/theme/md/style.css.php | 2 +- htdocs/user/virtualcard.php | 2 ++ 6 files changed, 17 insertions(+), 8 deletions(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index e3913c289d56e..e8e347e76471e 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -2799,11 +2799,15 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, $accessallowed = 1; $original_file = DOL_DOCUMENT_ROOT.'/public/theme/common/'.$original_file; } elseif ($modulepart == 'medias' && !empty($dolibarr_main_data_root)) { - if (empty($entity) || empty($conf->medias->multidir_output[$entity])) { + /* the medias directory is by default a public directory accessible online for everybody, so test on permission per entity has no sense + if (isModEnabled('multicompany') && (empty($entity) || empty($conf->medias->multidir_output[$entity]))) { return array('accessallowed' => 0, 'error' => 'Value entity must be provided'); + } */ + if (empty($entity)) { + $entity = 1; } $accessallowed = 1; - $original_file = $conf->medias->multidir_output[$entity].'/'.$original_file; + $original_file = (empty($conf->medias->multidir_output[$entity]) ? $conf->medias->dir_output : $conf->medias->multidir_output[$entity]).'/'.$original_file; } elseif ($modulepart == 'logs' && !empty($dolibarr_main_data_root)) { // Wrapping for *.log files, like when used with url http://.../document.php?modulepart=logs&file=dolibarr.log $accessallowed = ($user->admin && basename($original_file) == $original_file && preg_match('/^dolibarr.*\.(log|json)$/', basename($original_file))); diff --git a/htdocs/document.php b/htdocs/document.php index e204956acd3e4..ede788ab2faed 100644 --- a/htdocs/document.php +++ b/htdocs/document.php @@ -220,7 +220,7 @@ function llxFooter() $accessallowed = $check_access['accessallowed']; $sqlprotectagainstexternals = $check_access['sqlprotectagainstexternals']; $fullpath_original_file = $check_access['original_file']; // $fullpath_original_file is now a full path name -//var_dump($fullpath_original_file.' '.$original_file.' '.$accessallowed);exit; +//var_dump($modulepart.' '.$fullpath_original_file.' '.$original_file.' '.$accessallowed);exit; if (!empty($hashp)) { $accessallowed = 1; // When using hashp, link is public so we force $accessallowed diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index d5ac34473a52a..a748db69ea26f 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1909,6 +1909,9 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr if (GETPOSTISSET('dol_hide_leftmenu')) { $themeparam .= '&dol_hide_leftmenu='.GETPOSTINT('dol_hide_leftmenu'); } + if (GETPOSTISSET('dol_openinpopup')) { + $themeparam .= '&dol_openinpopup='.GETPOST('dol_openinpopup', 'aZ09'); + } if (GETPOSTISSET('dol_optimize_smallscreen')) { $themeparam .= '&dol_optimize_smallscreen='.GETPOSTINT('dol_optimize_smallscreen'); } diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 57ae6d202a19a..5100b3af29250 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -2435,12 +2435,12 @@ div.fiche { margin-: dol_optimize_smallscreen) ? '42' : '6')); ?>px; margin-: dol_optimize_smallscreen) ? '38' : '6')); ?>px; - - + } body.onlinepaymentbody div.fiche { /* For online payment page */ margin: 20px !important; diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 5dd886ecb78f1..bfbef5d2a8ead 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -2552,7 +2552,7 @@ div.fiche { margin-: dol_optimize_smallscreen) ? '35' : '6')); ?>px; margin-: dol_optimize_smallscreen) ? '33' : '6')); ?>px; - margin-bottom: 15px; diff --git a/htdocs/user/virtualcard.php b/htdocs/user/virtualcard.php index 866f6a2acde66..0e7c67735feab 100644 --- a/htdocs/user/virtualcard.php +++ b/htdocs/user/virtualcard.php @@ -109,11 +109,13 @@ //print dol_get_fiche_head($head, 'info', $title, -1, 'user'); +/* $linkback = ''; if ($user->hasRight('user', 'user', 'lire') || $user->admin) { $linkback = ''.$langs->trans("BackToList").''; } +*/ $morehtmlref = ''; $morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"');
".$langs->trans("Parameter")."
'.$langs->trans('SHIPPING_DISPLAY_STOCK_ENTRY_DATE'); +print ''; +print ajax_constantonoff('SHIPPING_DISPLAY_STOCK_ENTRY_DATE'); +print '
'; +print '
'; print $form->textwithpicto($langs->trans("FreeLegalTextOnShippings"), $langs->trans("AddCRIfTooLong").'

'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'
'; $variablename = 'SHIPPING_FREE_TEXT'; if (!getDolGlobalString('PDF_ALLOW_HTML_FOR_FREE_TEXT')) { @@ -476,14 +464,16 @@ print "
'; -print $form->textwithpicto($langs->trans("WatermarkOnDraftContractCards"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'
'; +print $form->textwithpicto($langs->trans("WatermarkOnDraftContractCards"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip'); +print '
'; print ''; print "
'.$langs->trans("AllowOnLineSign").''; +print ''.$langs->trans("AllowOnLineSign"); +print ''; print ajax_constantonoff('EXPEDITION_ALLOW_ONLINESIGN', array(), null, 0, 0, 0, 2, 0, 1); print '
'; - print dol_escape_all($obj->alias); + print dol_escape_htmltag($obj->alias); print '