From b5904e49a023354f435858c7060a1d02cf9d3a07 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 1 Jun 2021 22:43:43 +0200 Subject: [PATCH 01/91] NEW Add field date from/to in customer payment list --- htdocs/compta/paiement/list.php | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index 1e99cf8676f..eb6d50712c5 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -56,11 +56,10 @@ $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'p $facid = GETPOST('facid', 'int'); $socid = GETPOST('socid', 'int'); $userid = GETPOST('userid', 'int'); -$day = GETPOST('day', 'int'); -$month = GETPOST('month', 'int'); -$year = GETPOST('year', 'int'); $search_ref = GETPOST("search_ref", "alpha"); +$search_date_start = dol_mktime(0, 0, 0, GETPOST('search_date_startmonth', 'int'), GETPOST('search_date_startday', 'int'), GETPOST('search_date_startyear', 'int')); +$search_date_end = dol_mktime(23, 59, 59, GETPOST('search_date_endmonth', 'int'), GETPOST('search_date_endday', 'int'), GETPOST('search_date_endyear', 'int')); $search_company = GETPOST("search_company", 'alpha'); $search_paymenttype = GETPOST("search_paymenttype"); $search_account = GETPOST("search_account", "int"); @@ -130,14 +129,13 @@ if (empty($reshook)) { // All tests are required to be compatible with all browsers if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { $search_ref = ''; + $search_date_start = ''; + $search_date_end = ''; $search_account = ''; $search_amount = ''; $search_paymenttype = ''; $search_payment_num = ''; $search_company = ''; - $day = ''; - $year = ''; - $month = ''; $option = ''; $toselect = ''; $search_array_options = array(); @@ -211,10 +209,15 @@ if (GETPOST("orphelins", "alpha")) { } // Search criteria - $sql .= dolSqlDateFilter("p.datep", $day, $month, $year); if ($search_ref) { $sql .= natural_search('p.ref', $search_ref); } + if ($search_date_start) { + $sql .= " AND p.datep >= '" . $db->idate($search_date_start) . "'"; + } + if ($search_date_end) { + $sql .= " AND p.datep <= '" . $db->idate($search_date_end) . "'"; + } if ($search_account > 0) { $sql .= " AND b.fk_account=".((int) $search_account); } @@ -275,6 +278,8 @@ if ($limit > 0 && $limit != $conf->liste_limit) { } $param .= (GETPOST("orphelins") ? "&orphelins=1" : ''); $param .= ($search_ref ? "&search_ref=".urlencode($search_ref) : ''); +$param .= ($search_date_start ? "&search_date_start=".urlencode($search_date_start) : ''); +$param .= ($search_date_end ? "&search_date_end=".urlencode($search_date_end) : ''); $param .= ($search_company ? "&search_company=".urlencode($search_company) : ''); $param .= ($search_amount ? "&search_amount=".urlencode($search_amount) : ''); $param .= ($search_payment_num ? "&search_payment_num=".urlencode($search_payment_num) : ''); @@ -331,11 +336,14 @@ if (!empty($arrayfields['p.ref']['checked'])) { // Filter: Date if (!empty($arrayfields['p.datep']['checked'])) { print ''; - if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) { - print ''; - } - print ''; - $formother->select_year($year ? $year : -1, 'year', 1, 20, 5); + print '
'; + print $langs->trans('From') . ' '; + print $form->selectDate($search_date_start?$search_date_start:-1, 'search_date_start', 0, 0, 1); + print '
'; + print '
'; + print $langs->trans('to') . ' '; + print $form->selectDate($search_date_end?$search_date_end:-1, 'search_date_end', 0, 0, 1); + print '
'; print ''; } From 3744ccdd286b8e33968031248884f331cbefd133 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 1 Jun 2021 22:50:55 +0200 Subject: [PATCH 02/91] Look & feel v14 --- htdocs/compta/paiement/list.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index eb6d50712c5..c06f8ee9cb5 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -337,12 +337,10 @@ if (!empty($arrayfields['p.ref']['checked'])) { if (!empty($arrayfields['p.datep']['checked'])) { print ''; print '
'; - print $langs->trans('From') . ' '; - print $form->selectDate($search_date_start?$search_date_start:-1, 'search_date_start', 0, 0, 1); + print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); print '
'; print '
'; - print $langs->trans('to') . ' '; - print $form->selectDate($search_date_end?$search_date_end:-1, 'search_date_end', 0, 0, 1); + print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); print '
'; print ''; } From c35124f036d75ab99dbf9a2d76abfbe4f24f2d74 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 1 Jun 2021 23:23:00 +0200 Subject: [PATCH 03/91] NEW Add field date from/to in supplier payment list --- htdocs/fourn/paiement/list.php | 41 ++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/htdocs/fourn/paiement/list.php b/htdocs/fourn/paiement/list.php index 6a38ae2033d..6b932ae2019 100644 --- a/htdocs/fourn/paiement/list.php +++ b/htdocs/fourn/paiement/list.php @@ -36,6 +36,7 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; // Load translation files required by the page $langs->loadLangs(array('companies', 'bills', 'banks', 'compta')); @@ -48,9 +49,8 @@ $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 've $socid = GETPOST('socid', 'int'); $search_ref = GETPOST('search_ref', 'alpha'); -$search_day = GETPOST('search_day', 'int'); -$search_month = GETPOST('search_month', 'int'); -$search_year = GETPOST('search_year', 'int'); +$search_date_start = dol_mktime(0, 0, 0, GETPOST('search_date_startmonth', 'int'), GETPOST('search_date_startday', 'int'), GETPOST('search_date_startyear', 'int')); +$search_date_end = dol_mktime(23, 59, 59, GETPOST('search_date_endmonth', 'int'), GETPOST('search_date_endday', 'int'), GETPOST('search_date_endyear', 'int')); $search_company = GETPOST('search_company', 'alpha'); $search_payment_type = GETPOST('search_payment_type'); $search_cheque_num = GETPOST('search_cheque_num', 'alpha'); @@ -135,9 +135,8 @@ if (empty($reshook)) { if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers $search_ref = ''; - $search_day = ''; - $search_month = ''; - $search_year = ''; + $search_date_start = ''; + $search_date_end = ''; $search_company = ''; $search_payment_type = ''; $search_cheque_num = ''; @@ -187,7 +186,13 @@ if ($socid > 0) { if ($search_ref) { $sql .= natural_search('p.ref', $search_ref); } -$sql .= dolSqlDateFilter('p.datep', $search_day, $search_month, $search_year); +if ($search_date_start) { + $sql .= " AND p.datep >= '" . $db->idate($search_date_start) . "'"; +} +if ($search_date_end) { + $sql .=" AND p.datep <= '" . $db->idate($search_date_end) . "'"; +} + if ($search_company) { $sql .= natural_search('s.nom', $search_company); } @@ -254,14 +259,11 @@ if ($optioncss != '') { if ($search_ref) { $param .= '&search_ref='.urlencode($search_ref); } -if ($saerch_day) { - $param .= '&search_day='.urlencode($search_day); +if ($search_date_start) { + $param.= '&search_date_start='.urlencode($search_date_start); } -if ($saerch_month) { - $param .= '&search_month='.urlencode($search_month); -} -if ($search_year) { - $param .= '&search_year='.urlencode($search_year); +if ($search_date_end) { + $param.= '&search_date_end='.urlencode($search_date_end); } if ($search_company) { $param .= '&search_company='.urlencode($search_company); @@ -336,11 +338,12 @@ if (!empty($arrayfields['p.ref']['checked'])) { // Filter: Date if (!empty($arrayfields['p.datep']['checked'])) { print ''; - if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) { - print ''; - } - print ''; - $formother->select_year($search_year ? $search_year : -1, 'search_year', 1, 20, 5); + print '
'; + print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); + print '
'; + print '
'; + print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); + print '
'; print ''; } From 466bc2625663f7b775dc8302e37cf21129b873d9 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sat, 5 Jun 2021 07:16:43 +0200 Subject: [PATCH 04/91] Fix with search_date_startxxx --- htdocs/fourn/paiement/list.php | 42 ++++++++++++++++++++++++++-------- 1 file changed, 33 insertions(+), 9 deletions(-) diff --git a/htdocs/fourn/paiement/list.php b/htdocs/fourn/paiement/list.php index 6b932ae2019..39ad7131b24 100644 --- a/htdocs/fourn/paiement/list.php +++ b/htdocs/fourn/paiement/list.php @@ -49,13 +49,19 @@ $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 've $socid = GETPOST('socid', 'int'); $search_ref = GETPOST('search_ref', 'alpha'); -$search_date_start = dol_mktime(0, 0, 0, GETPOST('search_date_startmonth', 'int'), GETPOST('search_date_startday', 'int'), GETPOST('search_date_startyear', 'int')); -$search_date_end = dol_mktime(23, 59, 59, GETPOST('search_date_endmonth', 'int'), GETPOST('search_date_endday', 'int'), GETPOST('search_date_endyear', 'int')); -$search_company = GETPOST('search_company', 'alpha'); +$search_date_startday = GETPOST('search_date_startday', 'int'); +$search_date_startmonth = GETPOST('search_date_startmonth', 'int'); +$search_date_startyear = GETPOST('search_date_startyear', 'int'); +$search_date_endday = GETPOST('search_date_endday', 'int'); +$search_date_endmonth = GETPOST('search_date_endmonth', 'int'); +$search_date_endyear = GETPOST('search_date_endyear', 'int'); +$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver +$search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear); +$search_company = GETPOST('search_company', 'alpha'); $search_payment_type = GETPOST('search_payment_type'); -$search_cheque_num = GETPOST('search_cheque_num', 'alpha'); +$search_cheque_num = GETPOST('search_cheque_num', 'alpha'); $search_bank_account = GETPOST('search_bank_account', 'int'); -$search_amount = GETPOST('search_amount', 'alpha'); // alpha because we must be able to search on '< x' +$search_amount = GETPOST('search_amount', 'alpha'); // alpha because we must be able to search on '< x' $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'alpha'); @@ -135,6 +141,12 @@ if (empty($reshook)) { if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers $search_ref = ''; + $search_date_startday = ''; + $search_date_startmonth = ''; + $search_date_startyear = ''; + $search_date_endday = ''; + $search_date_endmonth = ''; + $search_date_endyear = ''; $search_date_start = ''; $search_date_end = ''; $search_company = ''; @@ -259,11 +271,23 @@ if ($optioncss != '') { if ($search_ref) { $param .= '&search_ref='.urlencode($search_ref); } -if ($search_date_start) { - $param.= '&search_date_start='.urlencode($search_date_start); +if ($search_date_startday) { + $param .= '&search_date_startday='.urlencode($search_date_startday); } -if ($search_date_end) { - $param.= '&search_date_end='.urlencode($search_date_end); +if ($search_date_startmonth) { + $param .= '&search_date_startmonth='.urlencode($search_date_startmonth); +} +if ($search_date_startyear) { + $param .= '&search_date_startyear='.urlencode($search_date_startyear); +} +if ($search_date_endday) { + $param .= '&search_date_endday='.urlencode($search_date_endday); +} +if ($search_date_endmonth) { + $param .= '&search_date_endmonth='.urlencode($search_date_endmonth); +} +if ($search_date_endyear) { + $param .= '&search_date_endyear='.urlencode($search_date_endyear); } if ($search_company) { $param .= '&search_company='.urlencode($search_company); From a92bd31ce14d46b5786ad5fc303d5452a5af3b5e Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sat, 5 Jun 2021 07:39:15 +0200 Subject: [PATCH 05/91] Fix search_datexxx --- htdocs/compta/paiement/list.php | 68 +++++++++++++++++++++++++-------- 1 file changed, 53 insertions(+), 15 deletions(-) diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index c06f8ee9cb5..b6835765c00 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -5,7 +5,7 @@ * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2015 Juanjo Menent - * Copyright (C) 2017 Alexandre Spangaro + * Copyright (C) 2017-2021 Alexandre Spangaro * Copyright (C) 2018 Ferran Marcet * Copyright (C) 2018 Charlene Benke * Copyright (C) 2020 Tobias Sekan @@ -58,12 +58,18 @@ $socid = GETPOST('socid', 'int'); $userid = GETPOST('userid', 'int'); $search_ref = GETPOST("search_ref", "alpha"); -$search_date_start = dol_mktime(0, 0, 0, GETPOST('search_date_startmonth', 'int'), GETPOST('search_date_startday', 'int'), GETPOST('search_date_startyear', 'int')); -$search_date_end = dol_mktime(23, 59, 59, GETPOST('search_date_endmonth', 'int'), GETPOST('search_date_endday', 'int'), GETPOST('search_date_endyear', 'int')); -$search_company = GETPOST("search_company", 'alpha'); -$search_paymenttype = GETPOST("search_paymenttype"); -$search_account = GETPOST("search_account", "int"); -$search_payment_num = GETPOST('search_payment_num', 'alpha'); +$search_date_startday = GETPOST('search_date_startday', 'int'); +$search_date_startmonth = GETPOST('search_date_startmonth', 'int'); +$search_date_startyear = GETPOST('search_date_startyear', 'int'); +$search_date_endday = GETPOST('search_date_endday', 'int'); +$search_date_endmonth = GETPOST('search_date_endmonth', 'int'); +$search_date_endyear = GETPOST('search_date_endyear', 'int'); +$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver +$search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear); +$search_company = GETPOST("search_company", 'alpha'); +$search_paymenttype = GETPOST("search_paymenttype"); +$search_account = GETPOST("search_account", "int"); +$search_payment_num = GETPOST('search_payment_num', 'alpha'); $search_amount = GETPOST("search_amount", 'alpha'); // alpha because we must be able to search on "< x" $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; @@ -129,8 +135,13 @@ if (empty($reshook)) { // All tests are required to be compatible with all browsers if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { $search_ref = ''; + $search_date_startday = ''; + $search_date_startmonth = ''; + $search_date_startyear = ''; + $search_date_endday = ''; + $search_date_endmonth = ''; + $search_date_endyear = ''; $search_date_start = ''; - $search_date_end = ''; $search_account = ''; $search_amount = ''; $search_paymenttype = ''; @@ -276,13 +287,40 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { if ($limit > 0 && $limit != $conf->liste_limit) { $param .= '&limit='.urlencode($limit); } -$param .= (GETPOST("orphelins") ? "&orphelins=1" : ''); -$param .= ($search_ref ? "&search_ref=".urlencode($search_ref) : ''); -$param .= ($search_date_start ? "&search_date_start=".urlencode($search_date_start) : ''); -$param .= ($search_date_end ? "&search_date_end=".urlencode($search_date_end) : ''); -$param .= ($search_company ? "&search_company=".urlencode($search_company) : ''); -$param .= ($search_amount ? "&search_amount=".urlencode($search_amount) : ''); -$param .= ($search_payment_num ? "&search_payment_num=".urlencode($search_payment_num) : ''); + +if (GETPOST("orphelins")) { + $param .= '&orphelins=1'; +} +if ($search_ref) { + $param .= '&search_ref='.urlencode($search_ref); +} +if ($search_date_startday) { + $param .= '&search_date_startday='.urlencode($search_date_startday); +} +if ($search_date_startmonth) { + $param .= '&search_date_startmonth='.urlencode($search_date_startmonth); +} +if ($search_date_startyear) { + $param .= '&search_date_startyear='.urlencode($search_date_startyear); +} +if ($search_date_endday) { + $param .= '&search_date_endday='.urlencode($search_date_endday); +} +if ($search_date_endmonth) { + $param .= '&search_date_endmonth='.urlencode($search_date_endmonth); +} +if ($search_date_endyear) { + $param .= '&search_date_endyear='.urlencode($search_date_endyear); +} +if ($search_company) { + $param .= '&search_company='.urlencode($search_company); +} +if ($search_amount != '') { + $param .= '&search_amount='.urlencode($search_amount); +} +if ($search_payment_num) { + $param .= '&search_payment_num='.urlencode($search_payment_num); +} if ($optioncss != '') { $param .= '&optioncss='.urlencode($optioncss); } From c1757bdbd8b0476274ba452e774857fb51a8c754 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sun, 6 Jun 2021 06:28:38 +0200 Subject: [PATCH 06/91] Remove warning --- htdocs/compta/paiement/list.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index b6835765c00..ee847603954 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -71,6 +71,7 @@ $search_paymenttype = GETPOST("search_paymenttype"); $search_account = GETPOST("search_account", "int"); $search_payment_num = GETPOST('search_payment_num', 'alpha'); $search_amount = GETPOST("search_amount", 'alpha'); // alpha because we must be able to search on "< x" +$search_status = GETPOST('search_status', 'intcomma'); $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST("sortfield", 'alpha'); @@ -142,11 +143,13 @@ if (empty($reshook)) { $search_date_endmonth = ''; $search_date_endyear = ''; $search_date_start = ''; + $search_date_end = ''; $search_account = ''; $search_amount = ''; $search_paymenttype = ''; $search_payment_num = ''; $search_company = ''; + $search_status = ''; $option = ''; $toselect = ''; $search_array_options = array(); @@ -348,10 +351,12 @@ if ($search_all) { $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields +$massactionbutton = ''; if ($massactionbutton) { $selectedfields .= $form->showCheckAddButtons('checkforselect', 1); } +$moreforfilter = ''; print '
'; print ''; From a63d3364b4bdd72b40c0fbe5739747d4b18d2cc9 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sun, 6 Jun 2021 22:51:27 +0200 Subject: [PATCH 07/91] Fix links in box last MO --- htdocs/core/boxes/box_mos.php | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/htdocs/core/boxes/box_mos.php b/htdocs/core/boxes/box_mos.php index 43d1cd411e4..d7f7a8f72ae 100644 --- a/htdocs/core/boxes/box_mos.php +++ b/htdocs/core/boxes/box_mos.php @@ -86,12 +86,15 @@ class box_mos extends ModeleBoxes if ($user->rights->mrp->read) { $sql = "SELECT p.ref as product_ref"; + $sql .= ", p.rowid as productid"; + $sql .= ", p.tosell"; + $sql .= ", p.tobuy"; + $sql .= ", p.tobatch"; $sql .= ", c.rowid"; $sql .= ", c.date_creation"; $sql .= ", c.tms"; $sql .= ", c.ref"; $sql .= ", c.status"; - //$sql.= ", c.fk_user_valid"; $sql .= " FROM ".MAIN_DB_PREFIX."product as p"; $sql .= ", ".MAIN_DB_PREFIX."mrp_mo as c"; $sql .= " WHERE c.fk_product = p.rowid"; @@ -110,9 +113,12 @@ class box_mos extends ModeleBoxes $datem = $this->db->jdate($objp->tms); $mostatic->id = $objp->rowid; $mostatic->ref = $objp->ref; - $mostatic->id = $objp->socid; $mostatic->status = $objp->status; + $productstatic->id = $objp->productid; $productstatic->ref = $objp->product_ref; + $productstatic->status = $objp->tosell; + $productstatic->status_buy = $objp->tobuy; + $productstatic->status_batch = $objp->tobatch; $this->info_box_contents[$line][] = array( 'td' => 'class="nowraponall"', @@ -126,17 +132,6 @@ class box_mos extends ModeleBoxes 'asis' => 1, ); - if (!empty($conf->global->MRP_BOX_LAST_MOS_SHOW_VALIDATE_USER)) { - if ($objp->fk_user_valid > 0) { - $userstatic->fetch($objp->fk_user_valid); - } - $this->info_box_contents[$line][] = array( - 'td' => 'class="right"', - 'text' => (($objp->fk_user_valid > 0) ? $userstatic->getNomUrl(1) : ''), - 'asis' => 1, - ); - } - $this->info_box_contents[$line][] = array( 'td' => 'class="center nowraponall"', 'text' => dol_print_date($datem, 'day', 'tzuserrel'), From 6733d278d8775cab97e49afb47348c595e00510b Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Tue, 8 Jun 2021 18:13:18 +0200 Subject: [PATCH 08/91] NEW: project time spent: conf to prevent recording time after X months --- htdocs/core/lib/project.lib.php | 50 ++++++++++++++++++++++++++---- htdocs/langs/en_US/admin.lang | 1 + htdocs/langs/en_US/projects.lang | 1 + htdocs/projet/admin/project.php | 15 +++++++++ htdocs/projet/class/task.class.php | 12 +++++++ 5 files changed, 73 insertions(+), 6 deletions(-) diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index aaa1e144202..d48d37a9539 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -1076,6 +1076,13 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr $oldprojectforbreak = (empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT) ? 0 : -1); // 0 to start break , -1 no break } + $restrictBefore = null; + + if (! empty($conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS)) { + require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; + $restrictBefore = dol_time_plus_duree(dol_now(), - $conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS, 'm'); + } + //dol_syslog('projectLinesPerDay inc='.$inc.' preselectedday='.$preselectedday.' task parent id='.$parent.' level='.$level." count(lines)=".$numlines." count(lineswithoutlevel0)=".count($lineswithoutlevel0)); for ($i = 0; $i < $numlines; $i++) { @@ -1307,6 +1314,10 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr $disabledtask = 1; } + if ($restrictBefore && $preselectedday < $restrictBefore) { + $disabledtask = 1; + } + // Form to add new time print ''; +print ''; + +print ''; +print ''; + +print ''; +print ''; print '
'; $tableCell = $form->selectDate($preselectedday, $lines[$i]->id, 1, 1, 2, "addtime", 0, 0, $disabledtask); @@ -1451,6 +1462,13 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$ $oldprojectforbreak = (empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT) ? 0 : -1); // 0 = start break, -1 = never break } + $restrictBefore = null; + + if (! empty($conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS)) { + require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; + $restrictBefore = dol_time_plus_duree(dol_now(), - $conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS, 'm'); + } + for ($i = 0; $i < $numlines; $i++) { if ($parent == 0) $level = 0; @@ -1708,6 +1726,12 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$ $cssweekend = 'weekend'; } + $disabledtaskday = $disabledtask; + + if (! $disabledtask && $restrictBefore && $tmpday < $restrictBefore) { + $disabledtaskday = 1; + } + $tableCell = ''; //$tableCell .= 'idw='.$idw.' '.$conf->global->MAIN_START_WEEK.' '.$numstartworkingday.'-'.$numendworkingday; $placeholder = ''; @@ -1717,7 +1741,7 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$ //$placeholder=' placeholder="00:00"'; //$tableCell.='+'; } - $tableCell .= ''; @@ -1812,6 +1836,13 @@ function projectLinesPerMonth(&$inc, $firstdaytoshow, $fuser, $parent, $lines, & $oldprojectforbreak = (empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT) ? 0 : -1); // 0 = start break, -1 = never break } + $restrictBefore = null; + + if (! empty($conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS)) { + require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; + $restrictBefore = dol_time_plus_duree(dol_now(), - $conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS, 'm'); + } + for ($i = 0; $i < $numlines; $i++) { if ($parent == 0) $level = 0; @@ -1954,10 +1985,11 @@ function projectLinesPerMonth(&$inc, $firstdaytoshow, $fuser, $parent, $lines, & $tableCell = ''; $modeinput = 'hours'; $TFirstDay = getFirstDayOfEachWeek($TWeek, date('Y', $firstdaytoshow)); $TFirstDay[reset($TWeek)] = 1; - foreach ($TFirstDay as &$fday) { - $fday--; - } - foreach ($TWeek as $weekNb) + + $firstdaytoshowarray = dol_getdate($firstdaytoshow); + $year = $firstdaytoshowarray['year']; + $month = $firstdaytoshowarray['mon']; + foreach ($TWeek as $weekIndex => $weekNb) { $weekWorkLoad = $projectstatic->monthWorkLoadPerTask[$weekNb][$lines[$i]->id]; $totalforeachweek[$weekNb] += $weekWorkLoad; @@ -1966,6 +1998,12 @@ function projectLinesPerMonth(&$inc, $firstdaytoshow, $fuser, $parent, $lines, & if ($weekWorkLoad > 0) $alreadyspent = convertSecondToTime($weekWorkLoad, 'allhourmin'); $alttitle = $langs->trans("AddHereTimeSpentForWeek", $weekNb); + $disabledtaskweek = $disabledtask; + $firstdayofweek = dol_mktime(0, 0, 0, $month, $TFirstDay[$weekIndex], $year); + + if (! $disabledtask && $restrictBefore && $firstdayofweek < $restrictBefore) { + $disabledtaskweek = 1; + } $tableCell = ''; $placeholder = ''; @@ -1976,7 +2014,7 @@ function projectLinesPerMonth(&$inc, $firstdaytoshow, $fuser, $parent, $lines, & //$tableCell.='+'; } - $tableCell .= ''; diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index f5770bad737..446f01a5446 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -81,6 +81,7 @@ NumberOfBytes=Number of Bytes SearchString=Search string NotAvailableWhenAjaxDisabled=Not available when Ajax disabled AllowToSelectProjectFromOtherCompany=On document of a third party, can choose a project linked to another third party +TimesheetPreventAfterFollowingMonths=Prevent recording time spent after the following number of months JavascriptDisabled=JavaScript disabled UsePreviewTabs=Use preview tabs ShowPreview=Show preview diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang index 2aedbd53377..9fea85e7d1e 100644 --- a/htdocs/langs/en_US/projects.lang +++ b/htdocs/langs/en_US/projects.lang @@ -139,6 +139,7 @@ NoTasks=No tasks for this project LinkedToAnotherCompany=Linked to other third party TaskIsNotAssignedToUser=Task not assigned to user. Use button '%s' to assign task now. ErrorTimeSpentIsEmpty=Time spent is empty +TimeRecordingRestrictedToNMonthsBack=Time recording is restricted to %s months back ThisWillAlsoRemoveTasks=This action will also delete all tasks of project (%s tasks at the moment) and all inputs of time spent. IfNeedToUseOtherObjectKeepEmpty=If some objects (invoice, order, ...), belonging to another third party, must be linked to the project to create, keep this empty to have the project being multi third parties. CloneTasks=Clone tasks diff --git a/htdocs/projet/admin/project.php b/htdocs/projet/admin/project.php index f36aae34c4f..143f75b72ab 100644 --- a/htdocs/projet/admin/project.php +++ b/htdocs/projet/admin/project.php @@ -242,6 +242,11 @@ elseif ($action == 'setdoc') $projectToSelect = GETPOST('projectToSelect', 'alpha'); dolibarr_set_const($db, 'PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY', $projectToSelect, 'chaine', 0, '', $conf->entity); //Allow to disable this configuration if empty value } + if (GETPOST('PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS')) + { + $timesheetFreezeDuration = GETPOST('timesheetFreezeDuration', 'alpha'); + dolibarr_set_const($db, 'PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS', intval($timesheetFreezeDuration), 'chaine', 0, '', $conf->entity); //Allow to disable this configuration if empty value + } } @@ -839,6 +844,16 @@ print ''; print '
'.$langs->trans("TimesheetPreventAfterFollowingMonths").''; +print ' '; +print ''; +print '
'; diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index b4733de05ae..1b64f0d9a66 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -1095,6 +1095,18 @@ class Task extends CommonObject if (isset($this->timespent_note)) $this->timespent_note = trim($this->timespent_note); if (empty($this->timespent_datehour)) $this->timespent_datehour = $this->timespent_date; + if (! empty($conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS)) { + require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; + $restrictBefore = dol_time_plus_duree(dol_now(), - $conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS, 'm'); + + if ($this->timespent_date < $restrictBefore) { + $this->error = $langs->trans('TimeRecordingRestrictedToNMonthsBack', $conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS); + $this->errors[] = $this->error; + return -1; + } + } + + $this->db->begin(); $sql = "INSERT INTO ".MAIN_DB_PREFIX."projet_task_time ("; From 7317aad41f76c944b21618df2caf3346788520e8 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Wed, 9 Jun 2021 11:08:38 +0200 Subject: [PATCH 09/91] FIX: projet time spent: also restrict to X months back for update and delete --- htdocs/projet/class/task.class.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 1b64f0d9a66..e974532f545 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -1465,6 +1465,17 @@ class Task extends CommonObject if (empty($this->timespent_datehour)) $this->timespent_datehour = $this->timespent_date; if (isset($this->timespent_note)) $this->timespent_note = trim($this->timespent_note); + if (! empty($conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS)) { + require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; + $restrictBefore = dol_time_plus_duree(dol_now(), - $conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS, 'm'); + + if ($this->timespent_date < $restrictBefore) { + $this->error = $langs->trans('TimeRecordingRestrictedToNMonthsBack', $conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS); + $this->errors[] = $this->error; + return -1; + } + } + $this->db->begin(); $sql = "UPDATE ".MAIN_DB_PREFIX."projet_task_time SET"; @@ -1530,6 +1541,17 @@ class Task extends CommonObject $error = 0; + if (! empty($conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS)) { + require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; + $restrictBefore = dol_time_plus_duree(dol_now(), - $conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS, 'm'); + + if ($this->timespent_date < $restrictBefore) { + $this->error = $langs->trans('TimeRecordingRestrictedToNMonthsBack', $conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS); + $this->errors[] = $this->error; + return -1; + } + } + $this->db->begin(); $sql = "DELETE FROM ".MAIN_DB_PREFIX."projet_task_time"; From c62c668c68e9456cd36864de6ecbf3c5d95af2e0 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 9 Jun 2021 09:29:22 +0000 Subject: [PATCH 10/91] Fixing style errors. --- htdocs/projet/class/task.class.php | 54 +++++++++++++++--------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index f46869382a5..05ce98b8896 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -1158,16 +1158,16 @@ class Task extends CommonObject $this->timespent_datehour = $this->timespent_date; } - if (! empty($conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS)) { - require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; - $restrictBefore = dol_time_plus_duree(dol_now(), - $conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS, 'm'); + if (! empty($conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS)) { + require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; + $restrictBefore = dol_time_plus_duree(dol_now(), - $conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS, 'm'); - if ($this->timespent_date < $restrictBefore) { - $this->error = $langs->trans('TimeRecordingRestrictedToNMonthsBack', $conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS); - $this->errors[] = $this->error; - return -1; - } - } + if ($this->timespent_date < $restrictBefore) { + $this->error = $langs->trans('TimeRecordingRestrictedToNMonthsBack', $conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS); + $this->errors[] = $this->error; + return -1; + } + } $this->db->begin(); @@ -1531,16 +1531,16 @@ class Task extends CommonObject $this->timespent_note = trim($this->timespent_note); } - if (! empty($conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS)) { - require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; - $restrictBefore = dol_time_plus_duree(dol_now(), - $conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS, 'm'); + if (! empty($conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS)) { + require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; + $restrictBefore = dol_time_plus_duree(dol_now(), - $conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS, 'm'); - if ($this->timespent_date < $restrictBefore) { - $this->error = $langs->trans('TimeRecordingRestrictedToNMonthsBack', $conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS); - $this->errors[] = $this->error; - return -1; - } - } + if ($this->timespent_date < $restrictBefore) { + $this->error = $langs->trans('TimeRecordingRestrictedToNMonthsBack', $conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS); + $this->errors[] = $this->error; + return -1; + } + } $this->db->begin(); @@ -1608,16 +1608,16 @@ class Task extends CommonObject $error = 0; - if (! empty($conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS)) { - require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; - $restrictBefore = dol_time_plus_duree(dol_now(), - $conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS, 'm'); + if (! empty($conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS)) { + require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; + $restrictBefore = dol_time_plus_duree(dol_now(), - $conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS, 'm'); - if ($this->timespent_date < $restrictBefore) { - $this->error = $langs->trans('TimeRecordingRestrictedToNMonthsBack', $conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS); - $this->errors[] = $this->error; - return -1; - } - } + if ($this->timespent_date < $restrictBefore) { + $this->error = $langs->trans('TimeRecordingRestrictedToNMonthsBack', $conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS); + $this->errors[] = $this->error; + return -1; + } + } $this->db->begin(); From 21ebfb60948af94070960a00e9b9886bc362511a Mon Sep 17 00:00:00 2001 From: lvessiller Date: Tue, 22 Jun 2021 14:13:18 +0200 Subject: [PATCH 11/91] NEW parent company on exports --- htdocs/core/modules/modCommande.class.php | 9 +++++---- htdocs/core/modules/modFacture.class.php | 12 +++++++++--- htdocs/core/modules/modFournisseur.class.php | 7 ++++--- htdocs/core/modules/modPropale.class.php | 10 +++++----- 4 files changed, 23 insertions(+), 15 deletions(-) diff --git a/htdocs/core/modules/modCommande.class.php b/htdocs/core/modules/modCommande.class.php index 6a44075822c..4275d806d40 100644 --- a/htdocs/core/modules/modCommande.class.php +++ b/htdocs/core/modules/modCommande.class.php @@ -193,7 +193,7 @@ class modCommande extends DolibarrModules $this->export_label[$r] = 'CustomersOrdersAndOrdersLines'; // Translation key (used only if key ExportDataset_xxx_z not found) $this->export_permission[$r] = array(array("commande", "commande", "export")); $this->export_fields_array[$r] = array( - 's.rowid'=>"IdCompany", 's.nom'=>'CompanyName', 's.address'=>'Address', 's.zip'=>'Zip', 's.town'=>'Town', 'd.nom'=>'State', 'co.label'=>'Country', + 's.rowid'=>"IdCompany", 's.nom'=>'CompanyName', 'ps.nom'=>'ParentCompany', 's.address'=>'Address', 's.zip'=>'Zip', 's.town'=>'Town', 'd.nom'=>'State', 'co.label'=>'Country', 'co.code'=>"CountryCode", 's.phone'=>'Phone', 's.siren'=>'ProfId1', 's.siret'=>'ProfId2', 's.ape'=>'ProfId3', 's.idprof4'=>'ProfId4', 'c.rowid'=>"Id", 'c.ref'=>"Ref", 'c.ref_client'=>"RefCustomer", 'c.fk_soc'=>"IdCompany", 'c.date_creation'=>"DateCreation", 'c.date_commande'=>"OrderDate", 'c.date_livraison'=>"DateDeliveryPlanned", 'c.amount_ht'=>"Amount", 'c.remise_percent'=>"GlobalDiscount", 'c.total_ht'=>"TotalHT", @@ -219,7 +219,7 @@ class modCommande extends DolibarrModules // 'p.rowid'=>'List:product:ref','p.ref'=>'Text','p.label'=>'Text' //); $this->export_TypeFields_array[$r] = array( - 's.nom'=>'Text', 's.address'=>'Text', 's.zip'=>'Text', 's.town'=>'Text', 'co.label'=>'List:c_country:label:label', 'co.code'=>'Text', 's.phone'=>'Text', + 's.nom'=>'Text', 'ps.nom'=>'Text', 's.address'=>'Text', 's.zip'=>'Text', 's.town'=>'Text', 'co.label'=>'List:c_country:label:label', 'co.code'=>'Text', 's.phone'=>'Text', 's.siren'=>'Text', 's.siret'=>'Text', 's.ape'=>'Text', 's.idprof4'=>'Text', 'c.ref'=>"Text", 'c.ref_client'=>"Text", 'c.date_creation'=>"Date", 'c.date_commande'=>"Date", 'c.date_livraison'=>"Date", 'c.amount_ht'=>"Numeric", 'c.remise_percent'=>"Numeric", 'c.total_ht'=>"Numeric", 'c.total_ttc'=>"Numeric", 'c.facture'=>"Boolean", 'c.fk_statut'=>'Status', 'c.note_public'=>"Text", 'c.date_livraison'=>'Date', 'pj.ref'=>'Text', @@ -227,7 +227,7 @@ class modCommande extends DolibarrModules 'cd.total_ttc'=>"Numeric", 'p.rowid'=>'List:product:ref::product', 'p.ref'=>'Text', 'p.label'=>'Text', 'd.nom'=>'Text' ); $this->export_entities_array[$r] = array( - 's.rowid'=>"company", 's.nom'=>'company', 's.address'=>'company', 's.zip'=>'company', 's.town'=>'company', 'd.nom'=>'company', 'co.label'=>'company', + 's.rowid'=>"company", 's.nom'=>'company', 'ps.nom'=>'company', 's.address'=>'company', 's.zip'=>'company', 's.town'=>'company', 'd.nom'=>'company', 'co.label'=>'company', 'co.code'=>'company', 's.phone'=>'company', 's.siren'=>'company', 's.ape'=>'company', 's.idprof4'=>'company', 's.siret'=>'company', 'c.rowid'=>"order", 'c.ref'=>"order", 'c.ref_client'=>"order", 'c.fk_soc'=>"order", 'c.date_creation'=>"order", 'c.date_commande'=>"order", 'c.amount_ht'=>"order", 'c.remise_percent'=>"order", 'c.total_ht'=>"order", 'c.total_ttc'=>"order", 'c.facture'=>"order", 'c.fk_statut'=>"order", 'c.note'=>"order", @@ -254,10 +254,11 @@ class modCommande extends DolibarrModules include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_sql_start[$r] = 'SELECT DISTINCT '; $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'societe as s'; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe_extrafields as extra4 ON s.rowid = extra4.fk_object'; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe as ps ON ps.rowid = s.parent'; if (empty($user->rights->societe->client->voir)) { $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid'; } - $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe_extrafields as extra4 ON s.rowid = extra4.fk_object'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_departements as d ON s.fk_departement = d.rowid'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as co ON s.fk_pays = co.rowid,'; $this->export_sql_end[$r] .= ' '.MAIN_DB_PREFIX.'commande as c'; diff --git a/htdocs/core/modules/modFacture.class.php b/htdocs/core/modules/modFacture.class.php index a9765f45ada..475c8fc5996 100644 --- a/htdocs/core/modules/modFacture.class.php +++ b/htdocs/core/modules/modFacture.class.php @@ -242,7 +242,7 @@ class modFacture extends DolibarrModules $this->export_icon[$r] = 'invoice'; $this->export_permission[$r] = array(array("facture", "facture", "export", "other")); $this->export_fields_array[$r] = array( - 's.rowid'=>"IdCompany", 's.nom'=>'CompanyName', 's.code_client'=>'CustomerCode', 's.address'=>'Address', 's.zip'=>'Zip', 's.town'=>'Town', 'c.code'=>'CountryCode', 'cd.nom'=>'State', + 's.rowid'=>"IdCompany", 's.nom'=>'CompanyName', 'ps.nom' => 'ParentCompany', 's.code_client'=>'CustomerCode', 's.address'=>'Address', 's.zip'=>'Zip', 's.town'=>'Town', 'c.code'=>'CountryCode', 'cd.nom'=>'State', 's.phone'=>'Phone', 's.siren'=>'ProfId1', 's.siret'=>'ProfId2', 's.ape'=>'ProfId3', 's.idprof4'=>'ProfId4', 's.code_compta'=>'CustomerAccountancyCode', @@ -271,7 +271,7 @@ class modFacture extends DolibarrModules $this->export_fields_array[$r]['f.pos_source'] = 'POSTerminal'; } $this->export_TypeFields_array[$r] = array( - 's.rowid'=>'Numeric', 's.nom'=>'Text', 's.code_client'=>'Text', 's.address'=>'Text', 's.zip'=>'Text', 's.town'=>'Text', 'c.code'=>'Text', 'cd.nom'=>'Text', 's.phone'=>'Text', 's.siren'=>'Text', + 's.rowid'=>'Numeric', 's.nom'=>'Text', 'ps.nom'=>'Text', 's.code_client'=>'Text', 's.address'=>'Text', 's.zip'=>'Text', 's.town'=>'Text', 'c.code'=>'Text', 'cd.nom'=>'Text', 's.phone'=>'Text', 's.siren'=>'Text', 's.siret'=>'Text', 's.ape'=>'Text', 's.idprof4'=>'Text', 's.code_compta'=>'Text', 's.code_compta_fournisseur'=>'Text', 's.tva_intra'=>'Text', 'f.rowid'=>'Numeric', 'f.ref'=>"Text", 'f.ref_client'=>'Text', 'f.type'=>"Numeric", 'f.datec'=>"Date", 'f.datef'=>"Date", 'f.date_lim_reglement'=>"Date", 'f.total_ht'=>"Numeric", 'f.total_ttc'=>"Numeric", 'f.total_tva'=>"Numeric", 'f.localtax1'=>'Numeric', 'f.localtax2'=>'Numeric', 'f.paye'=>"Boolean", 'f.fk_statut'=>'Numeric', 'f.close_code'=>'Text', 'f.close_note'=>'Text', @@ -287,7 +287,7 @@ class modFacture extends DolibarrModules $this->export_TypeFields_array[$r]['f.pos_source'] = 'Text'; } $this->export_entities_array[$r] = array( - 's.rowid'=>"company", 's.nom'=>'company', 's.code_client'=>'company', 's.address'=>'company', 's.zip'=>'company', 's.town'=>'company', 'c.code'=>'company', 'cd.nom'=>'company', 's.phone'=>'company', + 's.rowid'=>"company", 's.nom'=>'company', 'ps.nom'=>'company', 's.code_client'=>'company', 's.address'=>'company', 's.zip'=>'company', 's.town'=>'company', 'c.code'=>'company', 'cd.nom'=>'company', 's.phone'=>'company', 's.siren'=>'company', 's.siret'=>'company', 's.ape'=>'company', 's.idprof4'=>'company', 's.code_compta'=>'company', 's.code_compta_fournisseur'=>'company', 's.tva_intra'=>'company', 'pj.ref'=>'project', 'pj.title'=>'project', 'fd.rowid'=>'invoice_line', 'fd.label'=>"invoice_line", 'fd.description'=>"invoice_line", 'fd.subprice'=>"invoice_line", 'fd.total_ht'=>"invoice_line", 'fd.total_tva'=>"invoice_line", 'fd.total_ttc'=>"invoice_line", 'fd.tva_tx'=>"invoice_line", @@ -309,8 +309,14 @@ class modFacture extends DolibarrModules $keyforelement = 'product'; $keyforaliasextra = 'extra3'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; + $keyforselect = 'societe'; + $keyforelement = 'company'; + $keyforaliasextra = 'extra4'; + include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_sql_start[$r] = 'SELECT DISTINCT '; $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'societe as s'; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe_extrafields as extra4 ON s.rowid = extra4.fk_object'; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe as ps ON ps.rowid = s.parent'; if (empty($user->rights->societe->client->voir)) { $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid'; } diff --git a/htdocs/core/modules/modFournisseur.class.php b/htdocs/core/modules/modFournisseur.class.php index fae1cfc0eb8..7696fd41683 100644 --- a/htdocs/core/modules/modFournisseur.class.php +++ b/htdocs/core/modules/modFournisseur.class.php @@ -288,7 +288,7 @@ class modFournisseur extends DolibarrModules $this->export_icon[$r] = 'bill'; $this->export_permission[$r] = array(array("fournisseur", "facture", "export")); $this->export_fields_array[$r] = array( - 's.rowid'=>"IdCompany", 's.nom'=>'CompanyName', 's.address'=>'Address', 's.zip'=>'Zip', 's.town'=>'Town', 'c.code'=>'CountryCode', 's.phone'=>'Phone', + 's.rowid'=>"IdCompany", 's.nom'=>'CompanyName', 'ps.nom'=>'ParentCompany', 's.address'=>'Address', 's.zip'=>'Zip', 's.town'=>'Town', 'c.code'=>'CountryCode', 's.phone'=>'Phone', 's.siren'=>'ProfId1', 's.siret'=>'ProfId2', 's.ape'=>'ProfId3', 's.idprof4'=>'ProfId4', 's.idprof5'=>'ProfId5', 's.idprof6'=>'ProfId6', 's.code_compta'=>'CustomerAccountancyCode', 's.code_compta_fournisseur'=>'SupplierAccountancyCode', 's.tva_intra'=>'VATIntra', 'f.rowid'=>"InvoiceId", 'f.ref'=>"InvoiceRef", 'f.ref_supplier'=>"RefSupplier", 'f.datec'=>"InvoiceDateCreation", 'f.datef'=>"DateInvoice", 'f.date_lim_reglement'=>'DateMaxPayment', @@ -312,14 +312,14 @@ class modFournisseur extends DolibarrModules // 'fd.tva'=>"Numeric",'fd.product_type'=>'Numeric','fd.fk_product'=>'List:product:label','p.ref'=>'Text','p.label'=>'Text' //); $this->export_TypeFields_array[$r] = array( - 's.nom'=>'Text', 's.address'=>'Text', 's.zip'=>'Text', 's.town'=>'Text', 'c.code'=>'Text', 's.phone'=>'Text', 's.siren'=>'Text', 's.siret'=>'Text', 's.ape'=>'Text', 's.idprof4'=>'Text', 's.idprof5'=>'Text', 's.idprof6'=>'Text', + 's.nom'=>'Text', 'ps.nom'=>'Text', 's.address'=>'Text', 's.zip'=>'Text', 's.town'=>'Text', 'c.code'=>'Text', 's.phone'=>'Text', 's.siren'=>'Text', 's.siret'=>'Text', 's.ape'=>'Text', 's.idprof4'=>'Text', 's.idprof5'=>'Text', 's.idprof6'=>'Text', 's.code_compta'=>'Text', 's.code_compta_fournisseur'=>'Text', 's.tva_intra'=>'Text', 'f.ref'=>"Text", 'f.ref_supplier'=>"Text", 'f.datec'=>"Date", 'f.datef'=>"Date", 'f.date_lim_reglement'=>'Date', 'f.total_ht'=>"Numeric", 'f.total_ttc'=>"Numeric", 'f.total_tva'=>"Numeric", 'f.paye'=>"Boolean", 'f.fk_statut'=>'Status', 'f.note_public'=>"Text", 'fd.description'=>"Text", 'fd.tva_tx'=>"Text", 'fd.qty'=>"Numeric", 'fd.total_ht'=>"Numeric", 'fd.total_ttc'=>"Numeric", 'fd.tva'=>"Numeric", 'fd.product_type'=>'Numeric', 'fd.fk_product'=>'List:product:label', 'p.ref'=>'Text', 'p.label'=>'Text', 'project.ref'=>'Text', 'project.title'=>'Text' ); $this->export_entities_array[$r] = array( - 's.rowid'=>"company", 's.nom'=>'company', 's.address'=>'company', 's.zip'=>'company', 's.town'=>'company', 'c.code'=>'company', 's.phone'=>'company', 's.siren'=>'company', 's.siret'=>'company', + 's.rowid'=>"company", 's.nom'=>'company', 'ps.nom'=>'company', 's.address'=>'company', 's.zip'=>'company', 's.town'=>'company', 'c.code'=>'company', 's.phone'=>'company', 's.siren'=>'company', 's.siret'=>'company', 's.ape'=>'company', 's.idprof4'=>'company', 's.idprof5'=>'company', 's.idprof6'=>'company', 's.code_compta'=>'company', 's.code_compta_fournisseur'=>'company', 's.tva_intra'=>'company', 'f.rowid'=>"invoice", 'f.ref'=>"invoice", 'f.ref_supplier'=>"invoice", 'f.datec'=>"invoice", 'f.datef'=>"invoice", 'f.date_lim_reglement'=>'invoice', 'f.total_ht'=>"invoice", 'f.total_ttc'=>"invoice", 'f.total_tva'=>"invoice", 'f.paye'=>"invoice", 'f.fk_statut'=>'invoice', 'f.note_public'=>"invoice", 'fd.rowid'=>'invoice_line', 'fd.description'=>"invoice_line", 'fd.tva_tx'=>"invoice_line", 'fd.qty'=>"invoice_line", @@ -406,6 +406,7 @@ class modFournisseur extends DolibarrModules // End add extra fields line $this->export_sql_start[$r] = 'SELECT DISTINCT '; $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'societe as s'; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe as ps ON ps.rowid = s.parent'; if (is_object($user) && empty($user->rights->societe->client->voir)) { $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid'; } diff --git a/htdocs/core/modules/modPropale.class.php b/htdocs/core/modules/modPropale.class.php index 048f8fcb508..83e2b5a0402 100644 --- a/htdocs/core/modules/modPropale.class.php +++ b/htdocs/core/modules/modPropale.class.php @@ -189,7 +189,7 @@ class modPropale extends DolibarrModules $this->export_label[$r] = 'ProposalsAndProposalsLines'; // Translation key (used only if key ExportDataset_xxx_z not found) $this->export_permission[$r] = array(array("propale", "export")); $this->export_fields_array[$r] = array( - 's.rowid'=>"IdCompany", 's.nom'=>'CompanyName', 's.address'=>'Address', 's.zip'=>'Zip', 's.town'=>'Town', 'co.code'=>'CountryCode', 's.phone'=>'Phone', + 's.rowid'=>"IdCompany", 's.nom'=>'CompanyName', 'ps.nom'=>'ParentCompany', 's.address'=>'Address', 's.zip'=>'Zip', 's.town'=>'Town', 'co.code'=>'CountryCode', 's.phone'=>'Phone', 's.siren'=>'ProfId1', 's.siret'=>'ProfId2', 's.ape'=>'ProfId3', 's.idprof4'=>'ProfId4', 'c.rowid'=>"Id", 'c.ref'=>"Ref", 'c.ref_client'=>"RefCustomer", 'c.fk_soc'=>"IdCompany", 'c.datec'=>"DateCreation", 'c.datep'=>"DatePropal", 'c.fin_validite'=>"DateEndPropal", 'c.remise_percent'=>"GlobalDiscount", 'c.total_ht'=>"TotalHT", 'c.total_ttc'=>"TotalTTC", 'c.fk_statut'=>'Status', 'c.note_public'=>"Note", 'c.date_livraison'=>'DeliveryDate', @@ -213,14 +213,14 @@ class modPropale extends DolibarrModules // 'cd.total_tva'=>"Numeric",'cd.total_ttc'=>"Numeric",'p.rowid'=>'List:product:label','p.ref'=>'Text','p.label'=>'Text' //); $this->export_TypeFields_array[$r] = array( - 's.nom'=>'Text', 's.address'=>'Text', 's.zip'=>'Text', 's.town'=>'Text', 'co.code'=>'Text', 's.phone'=>'Text', 's.siren'=>'Text', 's.siret'=>'Text', + 's.nom'=>'Text', 'ps.nom'=>'Text', 's.address'=>'Text', 's.zip'=>'Text', 's.town'=>'Text', 'co.code'=>'Text', 's.phone'=>'Text', 's.siren'=>'Text', 's.siret'=>'Text', 's.ape'=>'Text', 's.idprof4'=>'Text', 'c.ref'=>"Text", 'c.ref_client'=>"Text", 'c.datec'=>"Date", 'c.datep'=>"Date", 'c.fin_validite'=>"Date", 'c.remise_percent'=>"Numeric", 'c.total_ht'=>"Numeric", 'c.total_ttc'=>"Numeric", 'c.fk_statut'=>'Status', 'c.note_public'=>"Text", 'c.date_livraison'=>'Date', 'pj.ref'=>'Text', 'cd.description'=>"Text", 'cd.product_type'=>'Boolean', 'cd.tva_tx'=>"Numeric", 'cd.qty'=>"Numeric", 'cd.total_ht'=>"Numeric", 'cd.total_tva'=>"Numeric", 'cd.total_ttc'=>"Numeric", 'p.ref'=>'Text', 'p.label'=>'Text' ); $this->export_entities_array[$r] = array( - 's.rowid'=>"company", 's.nom'=>'company', 's.address'=>'company', 's.zip'=>'company', 's.town'=>'company', 'co.code'=>'company', 's.phone'=>'company', + 's.rowid'=>"company", 's.nom'=>'company', 'ps.nom'=>'company', 's.address'=>'company', 's.zip'=>'company', 's.town'=>'company', 'co.code'=>'company', 's.phone'=>'company', 's.siren'=>'company', 's.ape'=>'company', 's.idprof4'=>'company', 's.siret'=>'company', 'c.rowid'=>"propal", 'c.ref'=>"propal", 'c.ref_client'=>"propal", 'c.fk_soc'=>"propal", 'c.datec'=>"propal", 'c.datep'=>"propal", 'c.fin_validite'=>"propal", 'c.remise_percent'=>"propal", 'c.total_ht'=>"propal", 'c.total_ttc'=>"propal", 'c.fk_statut'=>"propal", 'c.note_public'=>"propal", 'c.date_livraison'=>"propal", 'pj.ref'=>'project', 'cd.rowid'=>'propal_line', @@ -241,14 +241,14 @@ class modPropale extends DolibarrModules $keyforaliasextra = 'extra3'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $keyforselect = 'societe'; - $keyforelement = 'societe'; + $keyforelement = 'company'; $keyforaliasextra = 'extra4'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_sql_start[$r] = 'SELECT DISTINCT '; $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'societe as s '; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe_extrafields as extra4 ON s.rowid = extra4.fk_object'; - + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe as ps ON ps.rowid = s.parent'; if (empty($user->rights->societe->client->voir)) { $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid'; } From 26c5875f9792259204b240f4f947027a325ec856 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 22 Jun 2021 14:20:08 +0200 Subject: [PATCH 12/91] Uniformize accounting dyiplays --- htdocs/accountancy/customer/lines.php | 4 ++-- htdocs/accountancy/supplier/lines.php | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index 884de9dd232..55700fe8439 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -458,8 +458,8 @@ if ($result) { $productstatic->accountancy_code_sell_export = $objp->accountancy_code_sell_export; $accountingaccountstatic->rowid = $objp->fk_compte; - $accountingaccountstatic->label = $objp->label; - $accountingaccountstatic->labelshort = $objp->labelshort; + $accountingaccountstatic->label = $objp->label_account; + $accountingaccountstatic->labelshort = $objp->labelshort_account; $accountingaccountstatic->account_number = $objp->account_number; print ''; diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index 4a3b8cd53ac..da8bc0cd5e9 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -194,7 +194,7 @@ print ''; - $arrayofselected = is_array($toselect) ? $toselect : array(); $param = ''; diff --git a/htdocs/asset/list.php b/htdocs/asset/list.php index 056a73328dc..1d994e25177 100644 --- a/htdocs/asset/list.php +++ b/htdocs/asset/list.php @@ -305,21 +305,6 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $ llxHeader('', $title, $help_url); -// Example : Adding jquery code -print ''; - $arrayofselected = is_array($toselect) ? $toselect : array(); $param = ''; diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index fbd219a298b..b598b95ae0a 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -244,22 +244,6 @@ $title = $langs->trans('BOM'); $help_url ='EN:Module_BOM'; llxHeader('', $title, $help_url); -// Example : Adding jquery code -print ''; - - // Part to create if ($action == 'create') { print load_fiche_titre($langs->trans("NewBOM"), '', 'bom'); diff --git a/htdocs/compta/cashcontrol/cashcontrol_list.php b/htdocs/compta/cashcontrol/cashcontrol_list.php index ab8451c9e59..ec7af37940c 100644 --- a/htdocs/compta/cashcontrol/cashcontrol_list.php +++ b/htdocs/compta/cashcontrol/cashcontrol_list.php @@ -343,21 +343,6 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $ llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'classforhorizontalscrolloftabs'); -// Example : Adding jquery code -print ''; - $arrayofselected = is_array($toselect) ? $toselect : array(); $param = ''; diff --git a/htdocs/eventorganization/conferenceorbooth_list.php b/htdocs/eventorganization/conferenceorbooth_list.php index b51823242f8..d7f7cdb8bb1 100644 --- a/htdocs/eventorganization/conferenceorbooth_list.php +++ b/htdocs/eventorganization/conferenceorbooth_list.php @@ -253,20 +253,6 @@ if ($projectid > 0) { llxHeader('', $title, $help_url); -// Example : Adding jquery code -print ''; if ($projectid > 0) { // To verify role of users diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php index 9a689c79a08..cac59593950 100644 --- a/htdocs/modulebuilder/template/myobject_card.php +++ b/htdocs/modulebuilder/template/myobject_card.php @@ -212,19 +212,19 @@ $help_url = ''; llxHeader('', $title, $help_url); // Example : Adding jquery code -print ''; +// print ''; // Part to create diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index 41561a5a45b..abc8b879d33 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -386,19 +386,19 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $ llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'classforhorizontalscrolloftabs'); // Example : Adding jquery code -print ''; +// print ''; $arrayofselected = is_array($toselect) ? $toselect : array(); diff --git a/htdocs/mrp/mo_card.php b/htdocs/mrp/mo_card.php index fad22645cd5..b6cc502bd60 100644 --- a/htdocs/mrp/mo_card.php +++ b/htdocs/mrp/mo_card.php @@ -201,20 +201,6 @@ $title = $langs->trans('Mo')." - ".$langs->trans("Card"); llxHeader('', $title, ''); -// Example : Adding jquery code -print ''; // Part to create diff --git a/htdocs/mrp/mo_list.php b/htdocs/mrp/mo_list.php index 1883517470c..731a7bcfc50 100644 --- a/htdocs/mrp/mo_list.php +++ b/htdocs/mrp/mo_list.php @@ -299,20 +299,6 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $ llxHeader('', $title, $help_url); -// Example : Adding jquery code -print ''; $arrayofselected = is_array($toselect) ? $toselect : array(); diff --git a/htdocs/partnership/partnership_list.php b/htdocs/partnership/partnership_list.php index 79f51be6ca9..49d46c652fd 100644 --- a/htdocs/partnership/partnership_list.php +++ b/htdocs/partnership/partnership_list.php @@ -398,20 +398,6 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $ llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'classforhorizontalscrolloftabs'); -// Example : Adding jquery code -print ''; $arrayofselected = is_array($toselect) ? $toselect : array(); diff --git a/htdocs/product/inventory/card.php b/htdocs/product/inventory/card.php index 6a29a414ed7..5ec359e5d8a 100644 --- a/htdocs/product/inventory/card.php +++ b/htdocs/product/inventory/card.php @@ -168,20 +168,6 @@ $help_url = 'EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks|DE:Modul_Best llxHeader('', $title, $help_url); -// Example : Adding jquery code -print ''; // Part to create diff --git a/htdocs/recruitment/recruitmentcandidature_card.php b/htdocs/recruitment/recruitmentcandidature_card.php index 4826dc735ef..a1e98ded601 100644 --- a/htdocs/recruitment/recruitmentcandidature_card.php +++ b/htdocs/recruitment/recruitmentcandidature_card.php @@ -305,21 +305,6 @@ $title = $langs->trans("RecruitmentCandidature"); $help_url = ''; llxHeader('', $title, $help_url); -// Example : Adding jquery code -print ''; - // Part to create if ($action == 'create') { diff --git a/htdocs/recruitment/recruitmentcandidature_list.php b/htdocs/recruitment/recruitmentcandidature_list.php index 1caeb05095f..7a5a88bc6c4 100644 --- a/htdocs/recruitment/recruitmentcandidature_list.php +++ b/htdocs/recruitment/recruitmentcandidature_list.php @@ -348,21 +348,6 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $ llxHeader('', $title, $help_url); -// Example : Adding jquery code -print ''; - $arrayofselected = is_array($toselect) ? $toselect : array(); $param = ''; diff --git a/htdocs/recruitment/recruitmentjobposition_list.php b/htdocs/recruitment/recruitmentjobposition_list.php index 6475a60a8ed..7ccad1de16a 100644 --- a/htdocs/recruitment/recruitmentjobposition_list.php +++ b/htdocs/recruitment/recruitmentjobposition_list.php @@ -349,21 +349,6 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $ llxHeader('', $title, $help_url); -// Example : Adding jquery code -print ''; - $arrayofselected = is_array($toselect) ? $toselect : array(); $param = ''; diff --git a/htdocs/website/websiteaccount_card.php b/htdocs/website/websiteaccount_card.php index 2074873a031..cf4d26b2c33 100644 --- a/htdocs/website/websiteaccount_card.php +++ b/htdocs/website/websiteaccount_card.php @@ -117,22 +117,6 @@ $formfile = new FormFile($db); llxHeader('', 'WebsiteAccount', ''); -// Example : Adding jquery code -print ''; - - // Part to create if ($action == 'create') { print load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("WebsiteAccount"))); diff --git a/htdocs/workstation/workstation_card.php b/htdocs/workstation/workstation_card.php index 673b1db935d..5b63ca2d481 100755 --- a/htdocs/workstation/workstation_card.php +++ b/htdocs/workstation/workstation_card.php @@ -159,7 +159,7 @@ $help_url = 'EN:Module_Workstation'; llxHeader('', $title, $help_url); -// Example : Adding jquery code +// jquery code ?> '; + $sql .= $this->db->order('ctc.pos', 'ASC'); + $resql = $this->db->query($sql); + if ($resql) { + $num_rows = $this->db->num_rows($resql); + $i = 0; + $arrayidused=array(); + while ($i < $num_rows) { + $obj = $this->db->fetch_object($resql); + if ($obj) { + $grouprowid = $obj->rowid; + $groupvalue = $obj->code; + $grouplabel = $obj->label; + $isparent = $obj->isparent; + $fatherid = $obj->fk_parent; + $arrayidused[] = $grouprowid; + $groupcodefather = $obj->codefather; + if ($isparent == 'NOTPARENT') { + $arraycodenotparent[] = $groupvalue; + } + $iselected = $groupticketchild == $obj->code ?'selected':''; + $stringtoprint .= ''; + if (empty($tabscript[$groupcodefather])) { + $tabscript[$groupcodefather] = 'if($("#'.$htmlname.($levelid > 1 ?'_child_'.$levelid-1:'').'")[0].value == "'.dol_escape_js($groupcodefather).'"){ + $(".'.$htmlname.'_'.dol_escape_htmltag($fatherid).'_child_'.$levelid.'").show() + console.log("We show childs tickets of '.$groupcodefather.' group ticket") + }else{ + $(".'.$htmlname.'_'.dol_escape_htmltag($fatherid).'_child_'.$levelid.'").hide() + console.log("We hide childs tickets of '.$groupcodefather.' group ticket") + }'; + } + } + $i++; + } + } else { + dol_print_error($this->db); + } + $stringtoprint .=''; + + $stringtoprint .=''; + } return $stringtoprint; } } From b83f57da4897b22406602a4f06a96d93a322afe1 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Tue, 29 Jun 2021 16:26:48 +0200 Subject: [PATCH 76/91] Fix some proposal php 8 warning --- htdocs/comm/index.php | 2 ++ htdocs/comm/propal/class/propal.class.php | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index 0a39e596ba3..9d0d9f1befc 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -65,6 +65,8 @@ $socid = GETPOST("socid", 'int'); if ($user->socid > 0) { $action = ''; $id = $user->socid; +} else { + $id = 0; } restrictedArea($user, 'societe', $id, '&societe', '', 'fk_soc', 'rowid', 0); diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 6c670c82364..940e0156c7e 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -2535,12 +2535,12 @@ class Propal extends CommonObject $resql = $this->db->query($sql); if ($resql) { // Status self::STATUS_REFUSED by default - $modelpdf = $conf->global->PROPALE_ADDON_PDF_ODT_CLOSED ? $conf->global->PROPALE_ADDON_PDF_ODT_CLOSED : $this->model_pdf; + $modelpdf = !empty($conf->global->PROPALE_ADDON_PDF_ODT_CLOSED) ? $conf->global->PROPALE_ADDON_PDF_ODT_CLOSED : $this->model_pdf; $trigger_name = 'PROPAL_CLOSE_REFUSED'; if ($status == self::STATUS_SIGNED) { // Status self::STATUS_SIGNED $trigger_name = 'PROPAL_CLOSE_SIGNED'; - $modelpdf = $conf->global->PROPALE_ADDON_PDF_ODT_TOBILL ? $conf->global->PROPALE_ADDON_PDF_ODT_TOBILL:$this->model_pdf; + $modelpdf = !empty($conf->global->PROPALE_ADDON_PDF_ODT_TOBILL) ? $conf->global->PROPALE_ADDON_PDF_ODT_TOBILL : $this->model_pdf; // The connected company is classified as a client $soc=new Societe($this->db); From b8f5dc74d70bcb831a1690712562d2b6ba243fa6 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Tue, 29 Jun 2021 16:30:36 +0200 Subject: [PATCH 77/91] Some order php 8 warning --- htdocs/commande/class/commande.class.php | 2 +- htdocs/commande/tpl/linkedobjectblock.tpl.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 2805f4556d3..f601606be33 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1368,7 +1368,7 @@ class Commande extends CommonOrder } // Possibility to add external linked objects with hooks $this->linked_objects[$this->origin] = $this->origin_id; - if (is_array($object->other_linked_objects) && !empty($object->other_linked_objects)) { + if (isset($object->other_linked_objects) && is_array($object->other_linked_objects) && !empty($object->other_linked_objects)) { $this->linked_objects = array_merge($this->linked_objects, $object->other_linked_objects); } diff --git a/htdocs/commande/tpl/linkedobjectblock.tpl.php b/htdocs/commande/tpl/linkedobjectblock.tpl.php index 428589aa844..a0641c4c493 100644 --- a/htdocs/commande/tpl/linkedobjectblock.tpl.php +++ b/htdocs/commande/tpl/linkedobjectblock.tpl.php @@ -47,7 +47,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) { } echo ''; echo ''.$langs->trans("CustomerOrder"); - if (!empty($showImportButton) && $conf->global->MAIN_ENABLE_IMPORT_LINKED_OBJECT_LINES) { + if (!empty($showImportButton) && !empty($conf->global->MAIN_ENABLE_IMPORT_LINKED_OBJECT_LINES)) { print ' '; From e4f61d430f9dc55aa8a630cf70c5cf11d0133547 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Tue, 29 Jun 2021 16:33:24 +0200 Subject: [PATCH 78/91] Invoice php 8 issue and warnings. Seems if ("" < 0) is true in php 8 --- htdocs/compta/facture/card.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 585cabc1be4..6ec837fe1d1 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -112,7 +112,12 @@ $extrafields->fetch_name_optionals_label($object->table_element); // Load object if ($id > 0 || !empty($ref)) { if ($action != 'add') { - $ret = $object->fetch($id, $ref, '', '', $conf->global->INVOICE_USE_SITUATION); + if (empty($conf->global->INVOICE_USE_SITUATION)) { + $fetch_situation = false; + } else { + $fetch_situation = true; + } + $ret = $object->fetch($id, $ref, '', '', $fetch_situation); } } @@ -607,7 +612,7 @@ if (empty($reshook)) { } // Check for mandatory fields in invoice - $array_to_check = array('REF_CUSTOMER'=>'RefCustomer'); + $array_to_check = array('REF_CLIENT'=>'RefCustomer'); foreach ($array_to_check as $key => $val) { $keymin = strtolower($key); $vallabel = $object->$keymin; @@ -2362,21 +2367,22 @@ if (empty($reshook)) { $line = new FactureLigne($db); $line->fetch(GETPOST('lineid', 'int')); $percent = $line->get_prev_progress($object->id); + $progress = floatval(GETPOST('progress', 'int')); if ($object->type == Facture::TYPE_CREDIT_NOTE && $object->situation_cycle_ref > 0) { // in case of situation credit note - if (GETPOST('progress') >= 0) { + if ($progress >= 0) { $mesg = $langs->trans("CantBeNullOrPositive"); setEventMessages($mesg, null, 'warnings'); $error++; $result = -1; - } elseif (GETPOST('progress') < $line->situation_percent) { // TODO : use a modified $line->get_prev_progress($object->id) result + } elseif ($progress < $line->situation_percent) { // TODO : use a modified $line->get_prev_progress($object->id) result $mesg = $langs->trans("CantBeLessThanMinPercent"); setEventMessages($mesg, null, 'warnings'); $error++; $result = -1; } - } elseif (GETPOST('progress') < $percent) { + } elseif ($progress < $percent) { $mesg = '
'.$langs->trans("CantBeLessThanMinPercent").'
'; setEventMessages($mesg, null, 'warnings'); $error++; From 0d7fccc7b30b00b241f85d5b1e28fdbbf19042e3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 29 Jun 2021 16:33:53 +0200 Subject: [PATCH 79/91] Fix test --- test/other/test_serialize.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/other/test_serialize.php b/test/other/test_serialize.php index 2fdfffaef3e..74d1d40e025 100644 --- a/test/other/test_serialize.php +++ b/test/other/test_serialize.php @@ -3,7 +3,10 @@ $path = __DIR__ . '/'; + $res=@include_once $path.'/../htdocs/master.inc.php'; +$res=@include_once $path.'/../../htdocs/master.inc.php'; +if (! $res) @include_once '../../master.inc.php'; if (! $res) @include_once '../master.inc.php'; if (! $res) @include_once './master.inc.php'; include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; From 051bb3f3ef8d7f31706f81457a6435af235581f6 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Tue, 29 Jun 2021 16:37:07 +0200 Subject: [PATCH 80/91] Fix some core php8 warnings. Fixing php 8 warnings seems also to solve some situations like a paiment condition removed from dictionary can not be selected. --- htdocs/core/class/html.form.class.php | 7 ++++++- htdocs/core/tpl/ajaxrow.tpl.php | 1 - htdocs/core/tpl/objectline_title.tpl.php | 2 +- htdocs/core/tpl/objectline_view.tpl.php | 4 ++-- htdocs/langs/en_US/errors.lang | 1 + 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 33e2ed8b972..0b1504d229a 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5085,7 +5085,12 @@ class Form } else { if ($selected) { $this->load_cache_conditions_paiements(); - print $this->cache_conditions_paiements[$selected]['label']; + if (isset($this->cache_conditions_paiements[$selected])) { + print $this->cache_conditions_paiements[$selected]['label']; + } else { + $langs->load('errors'); + print $langs->trans('ErrorNotInDictionaryPaymentConditions'); + } } else { print " "; } diff --git a/htdocs/core/tpl/ajaxrow.tpl.php b/htdocs/core/tpl/ajaxrow.tpl.php index 6d6df3a5408..88c643c641d 100644 --- a/htdocs/core/tpl/ajaxrow.tpl.php +++ b/htdocs/core/tpl/ajaxrow.tpl.php @@ -79,7 +79,6 @@ $(document).ready(function(){ function() { console.log("tableDND end of ajax call"); if (reloadpage == 1) { - //console.log(''); global->PRODUCT_USE_UNITS)) { print ''.$langs->trans('ReductionShort').''; // Fields for situation invoice -if ($this->situation_cycle_ref) { +if (isset($this->situation_cycle_ref) && $this->situation_cycle_ref) { print ''.$langs->trans('Progress').''; print ''.$form->textwithpicto($langs->trans('TotalHT100Short'), $langs->trans('UnitPriceXQtyLessDiscount')).''; } diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index 8e9d72d40b4..3b4bb3cfdcb 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -132,7 +132,7 @@ if (($line->info_bits & 2) == 2) { } } } else { - $format = $conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE ? 'dayhour' : 'day'; + $format = (isset($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE) && $conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE) ? 'dayhour' : 'day'; if ($line->fk_product > 0) { print $form->textwithtooltip($text, $description, 3, '', '', $i, 0, (!empty($line->fk_parent_line) ?img_picto('', 'rightarrow') : '')); @@ -288,7 +288,7 @@ if (!empty($line->remise_percent) && $line->special_code != 3) { } // Fields for situation invoices -if ($this->situation_cycle_ref) { +if (isset($this->situation_cycle_ref) && $this->situation_cycle_ref) { include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; $coldisplay++; print ''.$line->situation_percent.'%'; diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index c4e8a1d7226..3ed7441afa5 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -301,3 +301,4 @@ ErrorActionCommPropertyUserowneridNotDefined=User's owner is required ErrorActionCommBadType=Selected event type (id: %n, code: %s) do not exist in Event Type dictionary CheckVersionFail=Version check fail ErrorWrongFileName=Name of the file cannot have __SOMETHING__ in it +ErrorNotInDictionaryPaymentConditions=Not in Payment Terms Dictionary, please modify. From 796b2d201acb9938b903fb2afa297db289ecc93e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 29 Jun 2021 18:17:27 +0200 Subject: [PATCH 81/91] Enhance the sanitizing. --- htdocs/core/lib/functions.lib.php | 8 ++++++-- htdocs/main.inc.php | 9 +++++---- test/phpunit/SecurityTest.php | 10 +++++----- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index e3b288aff8e..87a4b966056 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -778,8 +778,12 @@ function checkVal($out = '', $check = 'alphanohtml', $filter = null, $options = do { $oldstringtoclean = $out; - // We replace chars encoded with numeric HTML entities with real char (to avoid to have numeric entities used for obfuscation of injections) - $out = preg_replace_callback('/&#(x?[0-9][0-9a-f]+);/i', 'realCharForNumericEntities', $out); + // We replace chars from a/A to z/Z encoded with numeric HTML entities with the real char so we won't loose the chars at the next step. + // No need to use a loop here, this step is not to sanitize (this is done at next step, this is to try to save chars, even if they are + // using a non coventionnel way to be encoded, to not have them sanitized just after) + $out = preg_replace_callback('/&#(x?[0-9][0-9a-f]+;?)/i', 'realCharForNumericEntities', $out); + + // Now we remove all remaining HTML entities staring with a number. We don't want such entities. $out = preg_replace('/&#x?[0-9]+/i', '', $out); // For example if we have javascript with an entities without the ; to hide the 'a' of 'javascript'. $out = dol_string_onlythesehtmltags($out, 0, 1, 1); diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 93388190275..b66b5f5b211 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -53,7 +53,7 @@ if (!empty($_SERVER['MAIN_SHOW_TUNING_INFO'])) { /** * Return the real char for a numeric entities. - * This function is required by testSqlAndScriptInject(). + * WARNING: This function is required by testSqlAndScriptInject() and the GETPOST 'restricthtml'. Regex calling must be similar. * * @param string $matches String of numeric entity * @return string New value @@ -61,17 +61,18 @@ if (!empty($_SERVER['MAIN_SHOW_TUNING_INFO'])) { function realCharForNumericEntities($matches) { $newstringnumentity = $matches[1]; + //print '$newstringnumentity='.$newstringnumentity; if (preg_match('/^x/i', $newstringnumentity)) { - $newstringnumentity = hexdec(preg_replace('/^x/i', '', $newstringnumentity)); + $newstringnumentity = hexdec(preg_replace('/;$/', '', preg_replace('/^x/i', '', $newstringnumentity))); } - // The numeric value we don't want as entities + // The numeric value we don't want as entities because they encode ascii char, and why using html entities on ascii except for haking ? if (($newstringnumentity >= 65 && $newstringnumentity <= 90) || ($newstringnumentity >= 97 && $newstringnumentity <= 122)) { return chr((int) $newstringnumentity); } - return '&#'.$matches[1]; + return '&#'.$matches[1]; // Value will be unchanged because regex was /&#( )/ } /** diff --git a/test/phpunit/SecurityTest.php b/test/phpunit/SecurityTest.php index 7e93f7673f2..08d4ec88703 100644 --- a/test/phpunit/SecurityTest.php +++ b/test/phpunit/SecurityTest.php @@ -345,7 +345,7 @@ class SecurityTest extends PHPUnit\Framework\TestCase $_GET["param5"]="a_1-b"; $_POST["param6"]="">assertEquals('">', $result); $result=GETPOST("param7", 'restricthtml'); - print __METHOD__." result=".$result."\n"; - $this->assertEquals('"c:\this is a path~1\aaan" abcdef', $result); + print __METHOD__." result param7 = ".$result."\n"; + $this->assertEquals('"c:\this is a path~1\aaan &#x;;;;" abcdef', $result); $result=GETPOST("param12", 'restricthtml'); print __METHOD__." result=".$result."\n"; @@ -488,11 +488,11 @@ class SecurityTest extends PHPUnit\Framework\TestCase $result=GETPOST("param13", 'restricthtml'); print __METHOD__." result=".$result."\n"; - $this->assertEquals('n n > < " XSS', $result, 'Test that HTML entities are decoded with restricthtml, but only for common alpha chars'); + $this->assertEquals('n n > < " XSS', $result, 'Test 13 that HTML entities are decoded with restricthtml, but only for common alpha chars'); $result=GETPOST("param13b", 'restricthtml'); print __METHOD__." result=".$result."\n"; - $this->assertEquals('n n > < " XSS', $result, 'Test that HTML entities are decoded with restricthtml, but only for common alpha chars'); + $this->assertEquals('n n > < " XSS', $result, 'Test 13b that HTML entities are decoded with restricthtml, but only for common alpha chars'); // Special test for GETPOST of backtopage, backtolist or backtourl parameter From 7aeb652c66a7cfff1e43fbbfe8985fed14b5b770 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 29 Jun 2021 18:22:36 +0200 Subject: [PATCH 82/91] Better sanitizing, fix phpcs --- .../reception/doc/pdf_squille.modules.php | 3 +-- .../doc/pdf_standard_myobject.modules.php | 16 ++++++++-------- ...standard_recruitmentjobposition.modules.php | 18 +++++++++--------- 3 files changed, 18 insertions(+), 19 deletions(-) diff --git a/htdocs/core/modules/reception/doc/pdf_squille.modules.php b/htdocs/core/modules/reception/doc/pdf_squille.modules.php index 2f4427d7566..68ceb87ba96 100644 --- a/htdocs/core/modules/reception/doc/pdf_squille.modules.php +++ b/htdocs/core/modules/reception/doc/pdf_squille.modules.php @@ -145,8 +145,7 @@ class pdf_squille extends ModelePdfReception $objphoto = new Product($this->db); $objphoto->fetch($object->lines[$i]->fk_product); - if (!empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) - { + if (!empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) { $pdir = get_exdir($object->lines[$i]->fk_product, 2, 0, 0, $objphoto, 'product').$object->lines[$i]->fk_product."/photos/"; $dir = $conf->product->dir_output.'/'.$pdir; } else { diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php b/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php index e5e352def43..43457d6620d 100644 --- a/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php +++ b/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php @@ -240,14 +240,14 @@ class pdf_standard_myobject extends ModelePDFMyObject { if (empty($object->lines[$i]->fk_product)) continue; - //var_dump($objphoto->ref);exit; - if (!empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) { - $pdir[0] = get_exdir($objphoto->id, 2, 0, 0, $objphoto, 'product').$objphoto->id."/photos/"; - $pdir[1] = get_exdir(0, 0, 0, 0, $objphoto, 'product').dol_sanitizeFileName($objphoto->ref).'/'; - } else { - $pdir[0] = get_exdir(0, 0, 0, 0, $objphoto, 'product'); // default - $pdir[1] = get_exdir($objphoto->id, 2, 0, 0, $objphoto, 'product').$objphoto->id."/photos/"; // alternative - } + //var_dump($objphoto->ref);exit; + if (!empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) { + $pdir[0] = get_exdir($objphoto->id, 2, 0, 0, $objphoto, 'product').$objphoto->id."/photos/"; + $pdir[1] = get_exdir(0, 0, 0, 0, $objphoto, 'product').dol_sanitizeFileName($objphoto->ref).'/'; + } else { + $pdir[0] = get_exdir(0, 0, 0, 0, $objphoto, 'product'); // default + $pdir[1] = get_exdir($objphoto->id, 2, 0, 0, $objphoto, 'product').$objphoto->id."/photos/"; // alternative + } $arephoto = false; foreach ($pdir as $midir) diff --git a/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php b/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php index 4600377ee01..4c6cb84783a 100644 --- a/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php +++ b/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php @@ -251,15 +251,15 @@ class pdf_standard_recruitmentjobposition extends ModelePDFRecruitmentJobPositio { if (empty($object->lines[$i]->fk_product)) continue; - $objphoto->fetch($object->lines[$i]->fk_product); - //var_dump($objphoto->ref);exit; - if (!empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) { - $pdir[0] = get_exdir($objphoto->id, 2, 0, 0, $objphoto, 'product').$objphoto->id."/photos/"; - $pdir[1] = get_exdir(0, 0, 0, 0, $objphoto, 'product').dol_sanitizeFileName($objphoto->ref).'/'; - } else { - $pdir[0] = get_exdir(0, 0, 0, 0, $objphoto, 'product'); // default - $pdir[1] = get_exdir($objphoto->id, 2, 0, 0, $objphoto, 'product').$objphoto->id."/photos/"; // alternative - } + $objphoto->fetch($object->lines[$i]->fk_product); + //var_dump($objphoto->ref);exit; + if (!empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) { + $pdir[0] = get_exdir($objphoto->id, 2, 0, 0, $objphoto, 'product').$objphoto->id."/photos/"; + $pdir[1] = get_exdir(0, 0, 0, 0, $objphoto, 'product').dol_sanitizeFileName($objphoto->ref).'/'; + } else { + $pdir[0] = get_exdir(0, 0, 0, 0, $objphoto, 'product'); // default + $pdir[1] = get_exdir($objphoto->id, 2, 0, 0, $objphoto, 'product').$objphoto->id."/photos/"; // alternative + } $arephoto = false; foreach ($pdir as $midir) From 0f020d5b203e5724b17e3e5f05c2eb0d4aa6b991 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 29 Jun 2021 19:05:18 +0200 Subject: [PATCH 83/91] Fix for phpv8 --- htdocs/core/lib/geturl.lib.php | 2 +- htdocs/main.inc.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/lib/geturl.lib.php b/htdocs/core/lib/geturl.lib.php index f87e7b7b4cd..3398189a771 100644 --- a/htdocs/core/lib/geturl.lib.php +++ b/htdocs/core/lib/geturl.lib.php @@ -223,7 +223,7 @@ function getURLContent($url, $postorget = 'GET', $param = '', $followlocation = // Set CURLOPT_CONNECT_TO so curl will not try another resolution that may give a different result. Possible only on PHP v7+ if (defined('CURLOPT_CONNECT_TO')) { - $connect_to = array(sprintf("%s:%d:%s:%d", $newUrlArray['host'], $newUrlArray['port'], $iptocheck, $newUrlArray['port'])); + $connect_to = array(sprintf("%s:%d:%s:%d", $newUrlArray['host'], empty($newUrlArray['port'])?'':$newUrlArray['port'], $iptocheck, empty($newUrlArray['port'])?'':$newUrlArray['port'])); //var_dump($newUrlArray); //var_dump($connect_to); curl_setopt($ch, CURLOPT_CONNECT_TO, $connect_to); diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index b66b5f5b211..bd0d77d3389 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -60,11 +60,11 @@ if (!empty($_SERVER['MAIN_SHOW_TUNING_INFO'])) { */ function realCharForNumericEntities($matches) { - $newstringnumentity = $matches[1]; - //print '$newstringnumentity='.$newstringnumentity; + $newstringnumentity = preg_replace('/;$/', '', $matches[1]); + //print ' $newstringnumentity='.$newstringnumentity; if (preg_match('/^x/i', $newstringnumentity)) { - $newstringnumentity = hexdec(preg_replace('/;$/', '', preg_replace('/^x/i', '', $newstringnumentity))); + $newstringnumentity = hexdec(preg_replace('/^x/i', '', $newstringnumentity)); } // The numeric value we don't want as entities because they encode ascii char, and why using html entities on ascii except for haking ? From 56787bc292074f4f576b1386f1c3073a246c8971 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 29 Jun 2021 19:14:03 +0200 Subject: [PATCH 84/91] Update card.php --- htdocs/compta/facture/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 265f515233f..1f6a03ca351 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2367,7 +2367,7 @@ if (empty($reshook)) { $line = new FactureLigne($db); $line->fetch(GETPOST('lineid', 'int')); $percent = $line->get_prev_progress($object->id); - $progress = floatval(GETPOST('progress', 'int')); + $progress = price2num(GETPOST('progress', 'alpha')); if ($object->type == Facture::TYPE_CREDIT_NOTE && $object->situation_cycle_ref > 0) { // in case of situation credit note From 2860e12b6558c1bb5dfd39a1e9072b530ad70ffb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 29 Jun 2021 19:16:29 +0200 Subject: [PATCH 85/91] Update objectline_view.tpl.php --- htdocs/core/tpl/objectline_view.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index 3b4bb3cfdcb..c0339c28fc4 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -132,7 +132,7 @@ if (($line->info_bits & 2) == 2) { } } } else { - $format = (isset($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE) && $conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE) ? 'dayhour' : 'day'; + $format = (!empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE) ? 'dayhour' : 'day'); if ($line->fk_product > 0) { print $form->textwithtooltip($text, $description, 3, '', '', $i, 0, (!empty($line->fk_parent_line) ?img_picto('', 'rightarrow') : '')); From d379151da6a4543294f68cc70ee3f2e630fbd7af Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 29 Jun 2021 19:19:38 +0200 Subject: [PATCH 86/91] Fix doc --- test/phpunit/KnowledgeRecordTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/phpunit/KnowledgeRecordTest.php b/test/phpunit/KnowledgeRecordTest.php index fc6f385e25d..5e4d9a0d301 100644 --- a/test/phpunit/KnowledgeRecordTest.php +++ b/test/phpunit/KnowledgeRecordTest.php @@ -87,7 +87,7 @@ class KnowledgeRecordTest extends PHPUnit\Framework\TestCase $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. if (empty($conf->knowledgemanagement->enabled)) { - print __METHOD__." module knowledgemanagement order must be enabled.\n"; die(1); + print __METHOD__." module knowledgemanagement must be enabled.\n"; die(1); } } From d59dfcb08a11c10323c75b2e35e424af4a02e059 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 29 Jun 2021 19:21:35 +0200 Subject: [PATCH 87/91] Update list.php --- htdocs/accountancy/customer/list.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index 5ce9f5e13e8..97d94a42f00 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -739,11 +739,13 @@ if ($result) { $s .= (empty($objp->code_sell_p) ? ''.$langs->trans("NotDefined").'' : length_accountg($objp->code_sell_p)); print $form->textwithpicto($s, $shelp, 1, $ttype, '', 0, 2, '', 1); } else { - print '
'; - $s = '2. '.(($objp->type_l == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': '; - $shelp = ''; - $s .= $langs->trans("NotDefined"); - print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1); + if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) { + print '
'; + $s = '2. '.(($objp->type_l == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': '; + $shelp = ''; + $s .= $langs->trans("NotDefined"); + print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1); + } } if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) { print '
'; From c74060d02cdc3da264a8c1ab4bdc5b5aa7805b6a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 29 Jun 2021 19:24:46 +0200 Subject: [PATCH 88/91] Fix lost change in merge --- htdocs/accountancy/customer/list.php | 12 +++++------- htdocs/societe/card.php | 6 ++---- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index 97d94a42f00..5ce9f5e13e8 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -739,13 +739,11 @@ if ($result) { $s .= (empty($objp->code_sell_p) ? ''.$langs->trans("NotDefined").'' : length_accountg($objp->code_sell_p)); print $form->textwithpicto($s, $shelp, 1, $ttype, '', 0, 2, '', 1); } else { - if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) { - print '
'; - $s = '2. '.(($objp->type_l == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': '; - $shelp = ''; - $s .= $langs->trans("NotDefined"); - print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1); - } + print '
'; + $s = '2. '.(($objp->type_l == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': '; + $shelp = ''; + $s .= $langs->trans("NotDefined"); + print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1); } if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) { print '
'; diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index a2b229147fa..8e1d03411cd 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -1659,8 +1659,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { $accountancy_code_buy = GETPOST('accountancy_code_buy', 'alpha'); print $formaccounting->select_account($accountancy_code_buy, 'accountancy_code_buy', 1, null, 1, 1, ''); print ''; - } else // For external software - { + } else { // For external software // Accountancy_code_sell print ''.$langs->trans("ProductAccountancySellCode").''; print ''; @@ -2364,8 +2363,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''; print $formaccounting->select_account($object->accountancy_code_buy, 'accountancy_code_buy', 1, '', 1, 1); print ''; - } else // For external software - { + } else { // For external software // Accountancy_code_sell print ''.$langs->trans("ProductAccountancySellCode").''; print ''; From c7befd9acc929cd1f3e3e2969a1ad2d07ce15397 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 29 Jun 2021 19:49:26 +0200 Subject: [PATCH 89/91] Fix php8 (related to #18019) --- htdocs/core/class/commonobject.class.php | 6 +++--- htdocs/core/lib/files.lib.php | 6 +++--- htdocs/core/photos_resize.php | 4 ++-- htdocs/ecm/file_card.php | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 789bfb4e8b2..ec9449eba8f 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -940,7 +940,7 @@ abstract class CommonObject $ecmfile->fullpath_orig = ''; $ecmfile->gen_or_uploaded = 'generated'; $ecmfile->description = ''; // indexed content - $ecmfile->keyword = ''; // keyword content + $ecmfile->keywords = ''; // keyword content $ecmfile->share = getRandomPassword(true); $result = $ecmfile->create($user); if ($result < 0) @@ -5261,7 +5261,7 @@ abstract class CommonObject $ecmfile->fullpath_orig = ''; $ecmfile->gen_or_uploaded = 'generated'; $ecmfile->description = ''; // indexed content - $ecmfile->keyword = ''; // keyword content + $ecmfile->keywords = ''; // keyword content $result = $ecmfile->update($user); if ($result < 0) { setEventMessages($ecmfile->error, $ecmfile->errors, 'warnings'); @@ -5274,7 +5274,7 @@ abstract class CommonObject $ecmfile->fullpath_orig = ''; $ecmfile->gen_or_uploaded = 'generated'; $ecmfile->description = ''; // indexed content - $ecmfile->keyword = ''; // keyword content + $ecmfile->keywords = ''; // keyword content $ecmfile->src_object_type = $this->table_element; $ecmfile->src_object_id = $this->id; diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 7e34eec5ecd..05d8c6c4ec5 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -377,7 +377,7 @@ function completeFileArrayWithDatabaseInfo(&$filearray, $relativedir) $ecmfile->fullpath_orig = $filearray[$key]['fullname']; $ecmfile->gen_or_uploaded = 'unknown'; $ecmfile->description = ''; // indexed content - $ecmfile->keyword = ''; // keyword content + $ecmfile->keywords = ''; // keyword content $result = $ecmfile->create($user); if ($result < 0) { setEventMessages($ecmfile->error, $ecmfile->errors, 'warnings'); @@ -933,7 +933,7 @@ function dol_move($srcfile, $destfile, $newmask = 0, $overwriteifexists = 1, $te $ecmfile->fullpath_orig = $srcfile; $ecmfile->gen_or_uploaded = 'unknown'; $ecmfile->description = ''; // indexed content - $ecmfile->keyword = ''; // keyword content + $ecmfile->keywords = ''; // keyword content $resultecm = $ecmfile->create($user); if ($resultecm < 0) { setEventMessages($ecmfile->error, $ecmfile->errors, 'warnings'); @@ -1785,7 +1785,7 @@ function addFileIntoDatabaseIndex($dir, $file, $fullpathorig = '', $mode = 'uplo $ecmfile->fullpath_orig = $fullpathorig; $ecmfile->gen_or_uploaded = $mode; $ecmfile->description = ''; // indexed content - $ecmfile->keyword = ''; // keyword content + $ecmfile->keywords = ''; // keyword content if (is_object($object) && $object->id > 0) { $ecmfile->src_object_id = $object->id; diff --git a/htdocs/core/photos_resize.php b/htdocs/core/photos_resize.php index 7c7813fbe14..374f381c098 100644 --- a/htdocs/core/photos_resize.php +++ b/htdocs/core/photos_resize.php @@ -383,7 +383,7 @@ if ($action == 'confirm_resize' && GETPOSTISSET("file") && GETPOSTISSET("sizex") $ecmfile->fullpath_orig = $fullpath; $ecmfile->gen_or_uploaded = 'unknown'; $ecmfile->description = ''; // indexed content - $ecmfile->keyword = ''; // keyword content + $ecmfile->keywords = ''; // keyword content $result = $ecmfile->create($user); if ($result < 0) { setEventMessages($ecmfile->error, $ecmfile->errors, 'warnings'); @@ -448,7 +448,7 @@ if ($action == 'confirm_crop') { $ecmfile->fullpath_orig = $fullpath; $ecmfile->gen_or_uploaded = 'unknown'; $ecmfile->description = ''; // indexed content - $ecmfile->keyword = ''; // keyword content + $ecmfile->keywords = ''; // keyword content $result = $ecmfile->create($user); if ($result < 0) { setEventMessages($ecmfile->error, $ecmfile->errors, 'warnings'); diff --git a/htdocs/ecm/file_card.php b/htdocs/ecm/file_card.php index 14bc7e377f0..5ca1667ac9f 100644 --- a/htdocs/ecm/file_card.php +++ b/htdocs/ecm/file_card.php @@ -205,7 +205,7 @@ if ($action == 'update' && $permtoadd) { $object->fullpath_orig = ''; $object->gen_or_uploaded = 'unknown'; $object->description = ''; // indexed content - $object->keyword = ''; // keyword content + $object->keywords = ''; // keyword content $result = $object->create($user); if ($result < 0) { setEventMessages($object->error, $object->errors, 'warnings'); From 5e37c2ef74664c2608620e149cbfe60fa69391bf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 30 Jun 2021 01:36:49 +0200 Subject: [PATCH 90/91] CSS --- htdocs/product/index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/product/index.php b/htdocs/product/index.php index 4aaaf3a0fa7..cab4f537c5d 100644 --- a/htdocs/product/index.php +++ b/htdocs/product/index.php @@ -354,10 +354,10 @@ if ((!empty($conf->product->enabled) || !empty($conf->service->enabled)) && ($us print ''; - print ''; + print ''; print $product_static->getNomUrl(1, '', 16); print "\n"; - print ''.dol_trunc($objp->label, 32).''; + print ''.dol_escape_htmltag($objp->label).''; print ""; print dol_print_date($db->jdate($objp->datem), 'day'); print ""; From 94974af738d9e15edfd1f3f5397fce775aeb291a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 30 Jun 2021 01:52:54 +0200 Subject: [PATCH 91/91] trans --- htdocs/knowledgemanagement/knowledgerecord_list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/knowledgemanagement/knowledgerecord_list.php b/htdocs/knowledgemanagement/knowledgerecord_list.php index efaf99b63a9..173ec749e2a 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_list.php +++ b/htdocs/knowledgemanagement/knowledgerecord_list.php @@ -202,7 +202,7 @@ $now = dol_now(); //$help_url="EN:Module_KnowledgeRecord|FR:Module_KnowledgeRecord_FR|ES:Módulo_KnowledgeRecord"; $help_url = ''; -$title = $langs->trans('ListOfArticles'); +$title = $langs->trans('ListKnowledgeRecord'); $morejs = array(); $morecss = array();