From e212019ddf353b637ba8298a237a8da1dcbb65fd Mon Sep 17 00:00:00 2001 From: atm-florian Date: Fri, 17 Feb 2023 00:10:00 +0100 Subject: [PATCH 01/17] FIX: SQL error "unknown column p.fk_soc" because ANSI-92 joins take precedence over ANSI-89 joins cf. https://stackoverflow.com/questions/4065985/mysql-unknown-column-in-on-clause --- htdocs/comm/propal/class/propalestats.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/propal/class/propalestats.class.php b/htdocs/comm/propal/class/propalestats.class.php index 52956fa46fd..834ecd2bacb 100644 --- a/htdocs/comm/propal/class/propalestats.class.php +++ b/htdocs/comm/propal/class/propalestats.class.php @@ -248,7 +248,7 @@ class PropaleStats extends Stats global $user; $sql = "SELECT product.ref, COUNT(product.ref) as nb, SUM(tl.".$this->field_line.") as total, AVG(tl.".$this->field_line.") as avg"; - $sql .= " FROM ".$this->from.", ".$this->from_line.", ".MAIN_DB_PREFIX."product as product"; + $sql .= " FROM (".$this->from.", ".$this->from_line.", ".MAIN_DB_PREFIX."product as product)"; if (empty($user->rights->societe->client->voir) && !$user->socid) { $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON p.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } From c3e42f1961a4d46d0c1b40553727eebcf7be12de Mon Sep 17 00:00:00 2001 From: atm-florian Date: Fri, 17 Feb 2023 16:12:06 +0100 Subject: [PATCH 02/17] Propale stats: replace old-style joins with inner joins --- .../comm/propal/class/propalestats.class.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/htdocs/comm/propal/class/propalestats.class.php b/htdocs/comm/propal/class/propalestats.class.php index 834ecd2bacb..eb699e01c86 100644 --- a/htdocs/comm/propal/class/propalestats.class.php +++ b/htdocs/comm/propal/class/propalestats.class.php @@ -247,17 +247,19 @@ class PropaleStats extends Stats { global $user; - $sql = "SELECT product.ref, COUNT(product.ref) as nb, SUM(tl.".$this->field_line.") as total, AVG(tl.".$this->field_line.") as avg"; - $sql .= " FROM (".$this->from.", ".$this->from_line.", ".MAIN_DB_PREFIX."product as product)"; - if (empty($user->rights->societe->client->voir) && !$user->socid) { - $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON p.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id); + $sql = 'SELECT product.ref, COUNT(product.ref) as nb, SUM(tl.' . $this->field_line . ') as total, AVG(tl.' . $this->field_line . ') as avg'; + $sql .= ' FROM ' . $this->from; + $sql .= ' INNER JOIN ' . $this->from_line . ' ON p.rowid = tl.fk_propal'; + $sql .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'product as product ON tl.fk_product = product.rowid'; + if (empty($user->rights->societe->client->voir) && ! $user->socid) { + $sql .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'societe_commerciaux as sc ON p.fk_soc = sc.fk_soc AND sc.fk_user = ' . ((int) $user->id); } $sql .= $this->join; - $sql .= " WHERE ".$this->where; - $sql .= " AND p.rowid = tl.fk_propal AND tl.fk_product = product.rowid"; - $sql .= " AND ".$this->field_date." BETWEEN '".$this->db->idate(dol_get_first_day($year, 1, false))."' AND '".$this->db->idate(dol_get_last_day($year, 12, false))."'"; - $sql .= " GROUP BY product.ref"; + $sql .= ' WHERE ' . $this->where; + $sql .= ' AND ' . $this->field_date . " BETWEEN '" . $this->db->idate(dol_get_first_day($year, 1, false)) . "' AND '" . $this->db->idate(dol_get_last_day($year, 12, false)) . "'"; + $sql .= ' GROUP BY product.ref'; $sql .= $this->db->order('nb', 'DESC'); + //$sql.= $this->db->plimit(20); return $this->_getAllByProduct($sql, $limit); From b29ebef05fc8394e65196fc5baf8dcb798b7d1cf Mon Sep 17 00:00:00 2001 From: atm-florian Date: Thu, 23 Feb 2023 18:03:00 +0100 Subject: [PATCH 03/17] Propale stats: reworking of the fix to comply with travis rule for SQL string building --- .../comm/propal/class/propalestats.class.php | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/htdocs/comm/propal/class/propalestats.class.php b/htdocs/comm/propal/class/propalestats.class.php index eb699e01c86..fefc8941970 100644 --- a/htdocs/comm/propal/class/propalestats.class.php +++ b/htdocs/comm/propal/class/propalestats.class.php @@ -247,19 +247,18 @@ class PropaleStats extends Stats { global $user; - $sql = 'SELECT product.ref, COUNT(product.ref) as nb, SUM(tl.' . $this->field_line . ') as total, AVG(tl.' . $this->field_line . ') as avg'; - $sql .= ' FROM ' . $this->from; - $sql .= ' INNER JOIN ' . $this->from_line . ' ON p.rowid = tl.fk_propal'; - $sql .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'product as product ON tl.fk_product = product.rowid'; - if (empty($user->rights->societe->client->voir) && ! $user->socid) { - $sql .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'societe_commerciaux as sc ON p.fk_soc = sc.fk_soc AND sc.fk_user = ' . ((int) $user->id); + $sql = "SELECT product.ref, COUNT(product.ref) as nb, SUM(tl.".$this->field_line.") as total, AVG(tl.".$this->field_line.") as avg"; + $sql .= " FROM ".$this->from; + $sql .= " INNER JOIN ".$this->from_line." ON p.rowid = tl.fk_propal"; + $sql .= " INNER JOIN ".MAIN_DB_PREFIX."product as product ON tl.fk_product = product.rowid"; + if (empty($user->rights->societe->client->voir) && !$user->socid) { + $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON p.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } $sql .= $this->join; - $sql .= ' WHERE ' . $this->where; - $sql .= ' AND ' . $this->field_date . " BETWEEN '" . $this->db->idate(dol_get_first_day($year, 1, false)) . "' AND '" . $this->db->idate(dol_get_last_day($year, 12, false)) . "'"; - $sql .= ' GROUP BY product.ref'; + $sql .= " WHERE ".$this->where; + $sql .= " AND ".$this->field_date." BETWEEN '".$this->db->idate(dol_get_first_day($year, 1, false))."' AND '".$this->db->idate(dol_get_last_day($year, 12, false))."'"; + $sql .= " GROUP BY product.ref"; $sql .= $this->db->order('nb', 'DESC'); - //$sql.= $this->db->plimit(20); return $this->_getAllByProduct($sql, $limit); From fd371cc52b517ea26f50d588cc2c8cf19bc520ce Mon Sep 17 00:00:00 2001 From: Yoan Mollard Date: Fri, 24 Feb 2023 23:31:06 +0100 Subject: [PATCH 04/17] Fix member nature display in new.php --- htdocs/public/members/new.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index d3a2a556b07..aa8498a85a1 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -539,6 +539,8 @@ if (empty($conf->global->MEMBER_NEWFORM_FORCETYPE)) { // Moral/Physic attribute $morphys["phy"] = $langs->trans("Physical"); $morphys["mor"] = $langs->trans("Moral"); +print ''.$langs->trans('MemberNature').' *'."\n"; + if (empty($conf->global->MEMBER_NEWFORM_FORCEMORPHY)) { print ''.$langs->trans('MemberNature').' *'."\n"; print $form->selectarray("morphy", $morphys, GETPOST('morphy'), 1); From a02e88dc281c0545150ecc7e9f2716a0787208a4 Mon Sep 17 00:00:00 2001 From: Yoan Mollard Date: Sun, 26 Feb 2023 22:18:30 +0100 Subject: [PATCH 05/17] Drop the double Must be displayed both in the if and else --- htdocs/public/members/new.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index aa8498a85a1..2df2ec45cbc 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -542,7 +542,6 @@ $morphys["mor"] = $langs->trans("Moral"); print ''.$langs->trans('MemberNature').' *'."\n"; if (empty($conf->global->MEMBER_NEWFORM_FORCEMORPHY)) { - print ''.$langs->trans('MemberNature').' *'."\n"; print $form->selectarray("morphy", $morphys, GETPOST('morphy'), 1); print ''."\n"; } else { From 1c57b755109a29f2dc3353d7b691287c7a090913 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Thu, 2 Mar 2023 15:04:15 +0100 Subject: [PATCH 06/17] FIX: accountancy lettering: better error management --- htdocs/accountancy/journal/bankjournal.php | 6 ++++++ htdocs/accountancy/journal/purchasesjournal.php | 6 ++++++ htdocs/accountancy/journal/sellsjournal.php | 7 +++++++ 3 files changed, 19 insertions(+) diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index a848f8505d8..85c9551b7ec 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -797,6 +797,12 @@ if (!$error && $action == 'writebookkeeping') { require_once DOL_DOCUMENT_ROOT . '/accountancy/class/lettering.class.php'; $lettering_static = new Lettering($db); $nb_lettering = $lettering_static->bookkeepingLetteringAll(array($bookkeeping->id)); + + if ($nb_lettering < 0) { + $error++; + $errorforline++; + setEventMessages($lettering_static->error, $lettering_static->errors, 'errors'); + } } } } diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index c175889357c..5f4182762dc 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -380,6 +380,12 @@ if ($action == 'writebookkeeping') { require_once DOL_DOCUMENT_ROOT . '/accountancy/class/lettering.class.php'; $lettering_static = new Lettering($db); $nb_lettering = $lettering_static->bookkeepingLettering(array($bookkeeping->id), 'supplier_invoice'); + + if ($nb_lettering < 0) { + $error++; + $errorforline++; + setEventMessages($lettering_static->error, $lettering_static->errors, 'errors'); + } } } } diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index b86f138d232..cb6df055740 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -393,6 +393,13 @@ if ($action == 'writebookkeeping') { require_once DOL_DOCUMENT_ROOT . '/accountancy/class/lettering.class.php'; $lettering_static = new Lettering($db); $nb_lettering = $lettering_static->bookkeepingLettering(array($bookkeeping->id), 'customer_invoice'); + + if ($nb_lettering < 0) { + $error++; + $errorforline++; + $errorforinvoice[$key] = 'other'; + setEventMessages($lettering_static->error, $lettering_static->errors, 'errors'); + } } } } From 49afabd440d1db9fc68cc7ea02b285b6b927579e Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Thu, 2 Mar 2023 15:16:04 +0100 Subject: [PATCH 07/17] FIX: accountancy lettering: prevent null results when fetching link with payments --- htdocs/accountancy/class/lettering.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/class/lettering.class.php b/htdocs/accountancy/class/lettering.class.php index 405a630942e..2f86d6e7e3a 100644 --- a/htdocs/accountancy/class/lettering.class.php +++ b/htdocs/accountancy/class/lettering.class.php @@ -655,7 +655,7 @@ class Lettering extends BookKeeping // Get payment lines $sql = "SELECT DISTINCT pe2.$fk_payment_element, pe2.$fk_element"; $sql .= " FROM " . MAIN_DB_PREFIX . "$payment_element AS pe"; - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "$payment_element AS pe2 ON pe2.$fk_element = pe.$fk_element"; + $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "$payment_element AS pe2 ON pe2.$fk_element = pe.$fk_element"; $sql .= " WHERE pe.$fk_payment_element IN (" . $this->db->sanitize(implode(',', $payment_ids)) . ")"; dol_syslog(__METHOD__ . " - Get payment lines", LOG_DEBUG); From d3edbbb51bfead001c9095396a2a8418668f17d2 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Thu, 2 Mar 2023 15:56:10 +0100 Subject: [PATCH 08/17] FIX: accountancy lettering: correctly calculated number of lettering operations done --- htdocs/accountancy/class/lettering.class.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/htdocs/accountancy/class/lettering.class.php b/htdocs/accountancy/class/lettering.class.php index 2f86d6e7e3a..48e4eb56647 100644 --- a/htdocs/accountancy/class/lettering.class.php +++ b/htdocs/accountancy/class/lettering.class.php @@ -297,6 +297,7 @@ class Lettering extends BookKeeping // Update request $now = dol_now(); + $affected_rows = 0; if (!$error) { $sql = "UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping SET"; @@ -309,6 +310,8 @@ class Lettering extends BookKeeping if (!$resql) { $error++; $this->errors[] = "Error ".$this->db->lasterror(); + } else { + $affected_rows = $this->db->affected_rows($resql); } } @@ -320,7 +323,7 @@ class Lettering extends BookKeeping } return -1 * $error; } else { - return 1; + return $affected_rows; } } @@ -355,7 +358,7 @@ class Lettering extends BookKeeping } return -1 * $error; } else { - return 1; + return $this->db->affected_rows($resql); } } @@ -457,7 +460,7 @@ class Lettering extends BookKeeping else $result = $this->updateLettering($bookkeeping_lines); if ($result < 0) { $group_error++; - } else { + } elseif ($result > 0) { $nb_lettering++; } } From 98352d126ed26cdd883b973686ceb93ae8925569 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 5 Mar 2023 14:00:33 +0100 Subject: [PATCH 09/17] Fix warning --- htdocs/accountancy/bookkeeping/list.php | 2 +- htdocs/core/class/html.form.class.php | 2 +- htdocs/core/class/html.formticket.class.php | 2 +- htdocs/index.php | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 609a6923fea..e28d70e8051 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -966,7 +966,7 @@ if (empty($reshook)) { $newcardbutton .= ''.$langs->trans("ClickToHideAlreadyExportedLines").''; $newcardbutton .= ''; } else { - $newcardbutton .= ''.img_picto($langs->trans("DocsAlreadyExportedAreExcluded"), 'switch_on', 'class="warning size15x valignmiddle"').''; + $newcardbutton .= ''.img_picto($langs->trans("DocsAlreadyExportedAreExcluded"), 'switch_on', 'class="warning size15x valignmiddle"'); $newcardbutton .= ''.$langs->trans("DocsAlreadyExportedAreExcluded").''; $newcardbutton .= ''; } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index c6b48649534..3c91de75304 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1487,7 +1487,7 @@ class Form } if (!empty($conf->global->SOCIETE_SHOW_VAT_IN_LIST) && !empty($obj->tva_intra)) { - $label .= ' - '.$obj->tva_intra.''; + $label .= ' - '.$obj->tva_intra; } $labelhtml = $label; diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index 0baa4dd5f8a..1ba3ba27fb5 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -410,7 +410,7 @@ class FormTicket print $langs->trans('SubjectAnswerToTicket').' '.$this->topic_title; } else { if (isset($this->withreadid) && $this->withreadid > 0) { - $subject = $langs->trans('SubjectAnswerToTicket').' '.$this->withreadid.' : '.$this->topic_title.''; + $subject = $langs->trans('SubjectAnswerToTicket').' '.$this->withreadid.' : '.$this->topic_title; } else { $subject = GETPOST('subject', 'alpha'); } diff --git a/htdocs/index.php b/htdocs/index.php index f0fe4a8e4cc..06a829ea4b5 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -683,12 +683,12 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) { if ($board->nbtodolate > 0) { $boxwork .= '
'; $boxwork .= ''; - //$boxwork .= img_picto($textlate, "warning_white", 'class="valigntextbottom"').''; + //$boxwork .= img_picto($textlate, "warning_white", 'class="valigntextbottom"'); $boxwork .= img_picto( $textlate, "warning_white", 'class="inline-block hideonsmartphone valigntextbottom"' - ).''; + ); $boxwork .= ''; $boxwork .= $board->nbtodolate; $boxwork .= ''; From bd1366ab8272facd93a71baa0149c10bc408ec19 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 5 Mar 2023 14:04:36 +0100 Subject: [PATCH 10/17] FIX method dolGetGlobalString not defined with saphir --- .../modules/supplier_proposal/mod_supplier_proposal_saphir.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_saphir.php b/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_saphir.php index 8a984af95f7..879f5a2ffe7 100644 --- a/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_saphir.php +++ b/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_saphir.php @@ -83,7 +83,7 @@ class mod_supplier_proposal_saphir extends ModeleNumRefSupplierProposal $tooltip .= $langs->trans("GenericMaskCodes4a", $langs->transnoentities("CommRequest"), $langs->transnoentities("CommRequest")); $tooltip .= $langs->trans("GenericMaskCodes5"); - $mask = dolGetGlobalString('SUPPLIER_PROPOSAL_SAPHIR_MASK'); + $mask = getDolGlobalString('SUPPLIER_PROPOSAL_SAPHIR_MASK'); // Parametrage du prefix $texte .= ''.$langs->trans("Mask").':'; From d9c47b93df3fbd2e77608899e26f07a75d385d71 Mon Sep 17 00:00:00 2001 From: Yoan Mollard Date: Sun, 5 Mar 2023 16:55:45 +0100 Subject: [PATCH 11/17] Revert "Drop the double " This reverts commit a02e88dc281c0545150ecc7e9f2716a0787208a4. --- htdocs/public/members/new.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index 2df2ec45cbc..aa8498a85a1 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -542,6 +542,7 @@ $morphys["mor"] = $langs->trans("Moral"); print ''.$langs->trans('MemberNature').' *'."\n"; if (empty($conf->global->MEMBER_NEWFORM_FORCEMORPHY)) { + print ''.$langs->trans('MemberNature').' *'."\n"; print $form->selectarray("morphy", $morphys, GETPOST('morphy'), 1); print ''."\n"; } else { From 7a7d1c2fb1d99d74294860efdbe5036b3b98c629 Mon Sep 17 00:00:00 2001 From: Yoan Mollard Date: Sun, 5 Mar 2023 16:58:45 +0100 Subject: [PATCH 12/17] Revert "Fix member nature display in new.php" This reverts commit fd371cc52b517ea26f50d588cc2c8cf19bc520ce. --- htdocs/public/members/new.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index aa8498a85a1..d3a2a556b07 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -539,8 +539,6 @@ if (empty($conf->global->MEMBER_NEWFORM_FORCETYPE)) { // Moral/Physic attribute $morphys["phy"] = $langs->trans("Physical"); $morphys["mor"] = $langs->trans("Moral"); -print ''.$langs->trans('MemberNature').' *'."\n"; - if (empty($conf->global->MEMBER_NEWFORM_FORCEMORPHY)) { print ''.$langs->trans('MemberNature').' *'."\n"; print $form->selectarray("morphy", $morphys, GETPOST('morphy'), 1); From ebac8ef1f1a07b9512ea99a276cb2626f7cc6c38 Mon Sep 17 00:00:00 2001 From: Yoan Mollard Date: Sun, 5 Mar 2023 17:06:32 +0100 Subject: [PATCH 13/17] Fix double morphy display when morphy is forced --- htdocs/public/members/new.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index d3a2a556b07..17234702e3c 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -544,7 +544,6 @@ if (empty($conf->global->MEMBER_NEWFORM_FORCEMORPHY)) { print $form->selectarray("morphy", $morphys, GETPOST('morphy'), 1); print ''."\n"; } else { - print $morphys[$conf->global->MEMBER_NEWFORM_FORCEMORPHY]; print ''; } From f973dbca0b4c8fbf33e25844e9357d4367d1d5ae Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 6 Mar 2023 10:07:42 +0100 Subject: [PATCH 14/17] Fix warning --- htdocs/hrm/evaluation_list.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/hrm/evaluation_list.php b/htdocs/hrm/evaluation_list.php index dea398ad6a6..dd0505889b6 100644 --- a/htdocs/hrm/evaluation_list.php +++ b/htdocs/hrm/evaluation_list.php @@ -133,13 +133,13 @@ $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); // Permissions -$permissiontoread = $user->rights->hrm->evaluation->read; -$permissiontoreadall = $user->rights->hrm->evaluation->readall; -$permissiontoadd = $user->rights->hrm->evaluation->write; -$permissiontodelete = $user->rights->hrm->evaluation->delete; +$permissiontoread = $user->hasRight('hrm', 'evaluation', 'read'); +$permissiontoreadall = $user->hasRight('hrm', 'evaluation', 'readall'); +$permissiontoadd = $user->hasRight('hrm', 'evaluation', 'write'); +$permissiontodelete = $user->hasRight('hrm', 'evaluation', 'delete'); // Security check -if (empty($conf->hrm->enabled)) { +if (!isModEnabled('hrm')) { accessforbidden('Module not enabled'); } From b6012e07d824e0b90a8bafcc2db4067fa688c5cf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 8 Mar 2023 02:35:43 +0100 Subject: [PATCH 15/17] FIX Warning on purchase order + Property fk_commande not defined --- htdocs/fourn/class/fournisseur.commande.class.php | 3 ++- htdocs/fourn/commande/card.php | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 2cf0401d6eb..727fc96f0c4 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -489,7 +489,7 @@ class CommandeFournisseur extends CommonOrder $this->lines = array(); - $sql = "SELECT l.rowid, l.ref as ref_supplier, l.fk_product, l.product_type, l.label, l.description, l.qty,"; + $sql = "SELECT l.rowid, l.fk_commande, l.ref as ref_supplier, l.fk_product, l.product_type, l.label, l.description, l.qty,"; $sql .= " l.vat_src_code, l.tva_tx, l.remise_percent, l.subprice,"; $sql .= " l.localtax1_tx, l. localtax2_tx, l.localtax1_type, l. localtax2_type, l.total_localtax1, l.total_localtax2,"; $sql .= " l.total_ht, l.total_tva, l.total_ttc, l.special_code, l.fk_parent_line, l.rang,"; @@ -519,6 +519,7 @@ class CommandeFournisseur extends CommonOrder $line = new CommandeFournisseurLigne($this->db); $line->id = $objp->rowid; + $line->fk_commande = $objp->fk_commande; $line->desc = $objp->description; $line->description = $objp->description; $line->qty = $objp->qty; diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 842352475ad..ad9a204aef7 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -2093,7 +2093,7 @@ if ($action == 'create') { } print ''.$langs->trans("Date").''; print $object->date_commande ? dol_print_date($object->date_commande, $usehourmin ? 'dayhour' : 'day') : ''; - if ($object->hasDelay() && !empty($object->date_delivery) && !empty($object->date_commande)) { + if ($object->hasDelay() && !empty($object->delivery_date) && !empty($object->date_commande)) { print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning"); } print ""; @@ -2263,7 +2263,7 @@ if ($action == 'create') { $usehourmin = 1; } print $form->selectDate($object->delivery_date ? $object->delivery_date : -1, 'liv_', $usehourmin, $usehourmin, '', "setdate_livraison"); - print ''; + print ''; print ''; } else { $usehourmin = 'day'; @@ -2271,7 +2271,7 @@ if ($action == 'create') { $usehourmin = 'dayhour'; } print $object->delivery_date ? dol_print_date($object->delivery_date, $usehourmin) : ' '; - if ($object->hasDelay() && !empty($object->delivery_date)) { + if ($object->hasDelay() && !empty($object->delivery_date) && ($object->statut == $object::STATUS_ORDERSENT || $object->statut == $object::STATUS_RECEIVED_PARTIALLY)) { print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning"); } } From 16257a0e74944c42e06ef8205833c4263b942316 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 8 Mar 2023 02:08:25 +0100 Subject: [PATCH 16/17] FIX ODT management inverted between purchase invoice and order --- htdocs/admin/supplier_invoice.php | 39 ++++++++++++------- htdocs/admin/supplier_order.php | 23 ++++++----- ...doc_generic_supplier_order_odt.modules.php | 8 +++- 3 files changed, 45 insertions(+), 25 deletions(-) diff --git a/htdocs/admin/supplier_invoice.php b/htdocs/admin/supplier_invoice.php index 7b1831e759d..2aa1f4e65a6 100644 --- a/htdocs/admin/supplier_invoice.php +++ b/htdocs/admin/supplier_invoice.php @@ -38,9 +38,11 @@ require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; // Load translation files required by the page $langs->loadLangs(array("admin", "other", "orders")); +$action = GETPOST('action', 'aZ09'); + $type = GETPOST('type', 'alpha'); $value = GETPOST('value', 'alpha'); -$action = GETPOST('action', 'aZ09'); +$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php $label = GETPOST('label', 'alpha'); $scandir = GETPOST('scan_dir', 'alpha'); @@ -96,7 +98,9 @@ if ($action == 'specimen') { // For invoices $facture->thirdparty = $specimenthirdparty; // Define who should has build the invoice (so the supplier) // Search template files - $file = ''; $classname = ''; $filefound = 0; + $file = ''; + $classname = ''; + $filefound = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir."core/modules/supplier_invoice/doc/pdf_".$modele.".modules.php", 0); @@ -183,12 +187,12 @@ if ($action == 'set_SUPPLIER_INVOICE_FREE_TEXT') { * View */ +$form = new Form($db); + $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); llxHeader("", ""); -$form = new Form($db); - $linkback = ''.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans("SuppliersSetup"), $linkback, 'title_setup'); @@ -203,6 +207,7 @@ print dol_get_fiche_head($head, 'invoice', $langs->trans("Suppliers"), -1, 'comp print load_fiche_titre($langs->trans("SuppliersInvoiceNumberingModel"), '', ''); +print '
'; print ''; print ''; print ''; @@ -242,7 +247,7 @@ foreach ($dirmodels as $reldir) { print $module->info(); print ''; - // Show example of numbering model + // Show example of numbering module print '
'.$langs->trans("Name").''; $tmp = $module->getExample(); if (preg_match('/^Error/', $tmp)) { @@ -295,13 +300,13 @@ foreach ($dirmodels as $reldir) { } } -print '

'; +print '

'; /* - * Modeles documents for supplier invoices + * Documents models for supplier invoices */ print load_fiche_titre($langs->trans("BillsPDFModules"), '', ''); @@ -327,6 +332,7 @@ if ($resql) { dol_print_error($db); } +print '
'; print ''."\n"; print ''."\n"; print ''."\n"; @@ -378,7 +384,7 @@ foreach ($dirmodels as $reldir) { //if ($conf->global->INVOICE_SUPPLIER_ADDON_PDF != "$name") //{ // Even if choice is the default value, we allow to disable it: For supplier invoice, we accept to have no doc generation at all - print 'scandir).'&label='.urlencode($module->name).'&type=invoice_supplier">'; + print 'scandir).'&label='.urlencode($module->name).'&type=invoice_supplier">'; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; /*} @@ -389,7 +395,7 @@ foreach ($dirmodels as $reldir) { print ""; } else { print '"; } @@ -398,9 +404,9 @@ foreach ($dirmodels as $reldir) { if (getDolGlobalString("INVOICE_SUPPLIER_ADDON_PDF") == "$name") { //print img_picto($langs->trans("Default"),'on'); // Even if choice is the default value, we allow to disable it: For supplier invoice, we accept to have no doc generation at all - print 'scandir.'&label='.urlencode($module->name).'&type=invoice_supplier"" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"), 'on').''; + print 'scandir.'&label='.urlencode($module->name).'&type=invoice_supplier"" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"), 'on').''; } else { - print 'scandir.'&label='.urlencode($module->name).'&type=invoice_supplier"" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; + print 'scandir.'&label='.urlencode($module->name).'&type=invoice_supplier"" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } print ''; @@ -418,7 +424,7 @@ foreach ($dirmodels as $reldir) { print $form->textwithpicto('', $htmltooltip, 1, 0); print ''; print ''; print "\n"; @@ -430,7 +436,7 @@ foreach ($dirmodels as $reldir) { } } -print '
'.$langs->trans("Name").''."\n"; - print 'scandir).'&label='.urlencode($module->name).'&type=invoice_supplier">'.img_picto($langs->trans("Disabled"), 'switch_off').''; + print 'scandir).'&label='.urlencode($module->name).'&type=invoice_supplier">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print "'; - print ''.img_object($langs->trans("Preview"), 'pdf').''; + print ''.img_object($langs->trans("Preview"), 'pdf').''; print '

'; +print '

'; /* * Other options @@ -441,6 +447,8 @@ print ''; print ''; print load_fiche_titre($langs->trans("OtherOptions"), '', ''); + +print '
'; print ''; print ''; print ''; @@ -470,7 +478,7 @@ print '\n"; -print '
'.$langs->trans("Parameter").''; print ''; print "

'; +print '

'; print ''; @@ -480,6 +488,8 @@ print ''; */ print load_fiche_titre($langs->trans("Notifications"), '', ''); + +print '
'; print ''; print ''; print ''; @@ -493,6 +503,7 @@ print '\n"; print '
'.$langs->trans("Parameter").''; print "
'; +print '
'; // End of page llxFooter(); diff --git a/htdocs/admin/supplier_order.php b/htdocs/admin/supplier_order.php index abee8200cef..171ad4035a9 100644 --- a/htdocs/admin/supplier_order.php +++ b/htdocs/admin/supplier_order.php @@ -38,25 +38,28 @@ require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; // Load translation files required by the page $langs->loadLangs(array("admin", "other", "orders", "stocks")); -if (!$user->admin) { - accessforbidden(); -} +$action = GETPOST('action', 'aZ09'); $type = GETPOST('type', 'alpha'); $value = GETPOST('value', 'alpha'); $modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php $label = GETPOST('label', 'alpha'); -$action = GETPOST('action', 'aZ09'); $scandir = GETPOST('scan_dir', 'alpha'); $specimenthirdparty = new Societe($db); $specimenthirdparty->initAsSpecimen(); +$error = 0; + +if (!$user->admin) { + accessforbidden(); +} + /* -* Actions -*/ + * Actions + */ include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; @@ -77,7 +80,9 @@ if ($action == 'updateMask') { } else { setEventMessages($langs->trans("Error"), null, 'errors'); } -} elseif ($action == 'specimen') { // For orders +} + +if ($action == 'specimen') { // For orders $modele = GETPOST('module', 'alpha'); $commande = new CommandeFournisseur($db); @@ -317,8 +322,8 @@ print '

'; /* -* Documents models for supplier orders -*/ + * Documents models for supplier orders + */ print load_fiche_titre($langs->trans("OrdersModelModule"), '', ''); diff --git a/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php b/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php index 12bbcc12edc..186261de471 100644 --- a/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php +++ b/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php @@ -119,7 +119,7 @@ class doc_generic_supplier_order_odt extends ModelePDFSuppliersOrders $form = new Form($this->db); $texte = $this->description.".
\n"; - $texte .= '
'; + $texte .= ''; $texte .= ''; $texte .= ''; $texte .= ''; @@ -181,7 +181,11 @@ class doc_generic_supplier_order_odt extends ModelePDFSuppliersOrders } $texte .= ''; } - + // Add input to upload a new template file. + $texte .= '
'.$langs->trans("UploadNewTemplate").' '; + $texte .= ''; + $texte .= ''; + $texte .= '
'; $texte .= ''; $texte .= ''; From 238fbb23a8263e18eac505aee4e5998814f2787d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 8 Mar 2023 21:55:33 +0100 Subject: [PATCH 17/17] CSS --- htdocs/core/class/html.form.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 3c91de75304..8ce44bb9787 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -8937,7 +8937,9 @@ class Form print ''; print ''; print ''; - print ''; + print ''; print ''; print '
' . $langs->trans("Ref") . '   '; + print ' '; + print '
'; print '';