From 26a40e30e3a452a8f11590bea4417754841f3655 Mon Sep 17 00:00:00 2001 From: jpb Date: Wed, 23 Dec 2020 14:46:07 +0100 Subject: [PATCH 001/147] multicurrency update online and change some behaviors --- htdocs/multicurrency/multicurrency_rate.php | 185 +++++++++----------- 1 file changed, 82 insertions(+), 103 deletions(-) diff --git a/htdocs/multicurrency/multicurrency_rate.php b/htdocs/multicurrency/multicurrency_rate.php index eae788b0587..376269c0806 100644 --- a/htdocs/multicurrency/multicurrency_rate.php +++ b/htdocs/multicurrency/multicurrency_rate.php @@ -46,7 +46,8 @@ $confirm = GETPOST('confirm', 'alpha'); $toselect = GETPOST('toselect', 'array'); $id_rate_selected = GETPOST('id_rate', 'int'); $sall = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml')); -$search_date_sync = GETPOST('search_date_sync', 'alpha'); +$search_date_sync = dol_mktime(0, 0, 0, GETPOST('search_date_syncmonth', 'int'), GETPOST('search_date_syncday', 'int'), GETPOST('search_date_syncyear', 'int')); +$search_date_sync_end = dol_mktime(0, 0, 0, GETPOST('search_date_sync_endmonth', 'int'), GETPOST('search_date_sync_endday', 'int'), GETPOST('search_date_sync_endyear', 'int')); $search_rate = GETPOST('search_rate', 'alpha'); $search_code = GETPOST('search_code', 'alpha'); $multicurrency_code = GETPOST('multicurrency_code', 'alpha'); @@ -58,12 +59,13 @@ $sortfield = GETPOST("sortfield", 'alpha'); $sortorder = GETPOST("sortorder", 'alpha'); $page = (GETPOST("page", 'int') ?GETPOST("page", 'int') : 0); + if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; if (!$sortfield) $sortfield = "cr.date_sync"; -if (!$sortorder) $sortorder = "DESC"; +if (!$sortorder) $sortorder = "ASC"; // Initialize technical object to manage hooks. Note that conf->hooks_modules contains array of hooks @@ -200,6 +202,7 @@ if (empty($reshook)) { $sall = ""; $search_date_sync = ""; + $search_date_sync_end=""; $search_rate = ""; $search_code = ""; $search_array_options = array(); @@ -233,7 +236,7 @@ print dol_get_fiche_head($head, 'ratelist', $langs->trans("ModuleSetup"), -1, "m // ACTION -if ($action != "updateRate") { +if (!in_array( $action, array("updateRate", "deleteRate"))) { print ''; print ''; print ''."\n"; @@ -243,15 +246,15 @@ if ($action != "updateRate") { print ''; print ''; - print '
'.$langs->trans("FormCreateRate").'
'; + print '
'; print ' '; print ' '; print ''; - print ''; + print ''; print ' '; print ' '; @@ -267,54 +270,7 @@ if ($action != "updateRate") { print '
'; } -if ($action == "updateRate") { - $current_rate = new CurrencyRate($db); - $current_rate->fetch(intval($id_rate_selected)); - if ($current_rate) { - $curr = new MultiCurrency($db); - $resultcurrentCurrency = $curr->fetch($current_rate->fk_multicurrency); - - if ($resultcurrentCurrency) { - $currency_code = $curr->code; - } else { - $currency_code = ''; - } - - print '
'.$langs->trans('Date').''; - print $form->selectDate($dateinput, 'dateinput'); + print $form->selectDate($dateinput, 'dateinput', 0, 0, 1); print ' '.$langs->trans('Currency').''.$form->selectMultiCurrency((GETPOSTISSET('multicurrency_code') ? GETPOST('multicurrency_code', 'alpha') : $multicurrency_code), 'multicurrency_code', 0, " code != '".$conf->currency."'", true).''.$form->selectMultiCurrency((GETPOSTISSET('multicurrency_code') ? GETPOST('multicurrency_code', 'alpha') : $multicurrency_code), 'multicurrency_code', 1, " code != '".$conf->currency."'", true).''.$langs->trans('Rate').'
'; - print ''; - print ''."\n"; - print '
'.$langs->trans("FormUpdateRate").'
'; - - $form = new Form($db); - print ''; - print ''; - - print ''; - print ' '; - print ''; - - print ''; - print ''; - - print ''; - print ''; - - print ''; - print '
'.$langs->trans('Date').''; - print $form->selectDate($current_rate->date_sync, 'dateinput'); - print ' '.$langs->trans('Currency').''.$form->selectMultiCurrency($currency_code, 'multicurrency_code', 0, " code != '".$conf->currency."'", true).''.$langs->trans('Rate').''; - print ''; - print ''; - print ''; - print ''.$langs->trans('CancelUpdate').''; - - print '
'; - print ''; - } else { - dol_syslog("currency_rate:list:update", LOG_WARNING); - } -} $sql = 'SELECT cr.rowid, cr.date_sync, cr.rate, cr.entity, m.code, m.name '; @@ -325,7 +281,11 @@ $sql .= $hookmanager->resPrint; $sql .= ' FROM '.MAIN_DB_PREFIX.'multicurrency_rate as cr '; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."multicurrency AS m ON cr.fk_multicurrency = m.rowid"; if ($sall) $sql .= natural_search(array_keys($fieldstosearchall), $sall); -if ($search_date_sync) $sql .= natural_search('cr.date_sync', $search_date_sync); +if ($search_date_sync && $search_date_sync_end ){ + $sql .= " AND (cr.date_sync BETWEEN '".$db->idate($search_date_sync)."' AND '".$db->idate($search_date_sync_end)."')"; +} elseif ($search_date_sync && !$search_date_sync_end) { + $sql .= natural_search('cr.date_sync', $db->idate($search_date_sync)); +} if ($search_rate) $sql .= natural_search('cr.rate', $search_rate); if ($search_code) $sql .= natural_search('m.code', $search_code); $sql .= " WHERE m.code <> '".$db->escape($conf->currency)."'"; @@ -374,9 +334,10 @@ if ($resql) if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); if ($sall) $param .= "&sall=".urlencode($sall); - if ($search_date_sync) $param = "&search_date_sync=".urlencode($search_date_sync); + if ($search_date_sync) $param = "&search_date_sync=".$search_date_sync; + if ($search_date_sync_end) $param="&search_date_sync_end=".$search_date_sync_end; if ($search_rate) $param = "&search_rate=".urlencode($search_rate); - if ($search_code != '') $param .= "&search_code=".urlencode($search_code); + if ($search_code != '') $param.="&search_code=".urlencode($search_code); // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; @@ -426,7 +387,7 @@ if ($resql) if ($massactionbutton) $selectedfields .= $form->showCheckAddButtons('checkforselect', 1); print '
'; - print ''."\n"; + print '
'."\n"; // Lines with input filters print ''; @@ -435,14 +396,15 @@ if ($resql) if (!empty($arrayfields['cr.date_sync']['checked'])) { print ''; } // code if (!empty($arrayfields['m.code']['checked'])) { print ''; } // rate @@ -486,52 +448,69 @@ if ($resql) print ''; - // date_sync - if (!empty($arrayfields['cr.date_sync']['checked'])) - { - print '\n"; - if (!$i) $totalarray['nbfield']++; + // USER REQUEST UPDATE FOR THIS LINE + if ($action == "updateRate" && $obj->rowid == $id_rate_selected) { + // var_dump($obj); + print ' '; + print ''; + print ' '; + + print ''; + } + else { + // date_sync + if (!empty($arrayfields['cr.date_sync']['checked'])) + { + print '\n"; + if (!$i) $totalarray['nbfield']++; + } + + // code + if (! empty($arrayfields['m.code']['checked'])) + { + print '\n"; + + if (! $i) $totalarray['nbfield']++; + } + + // rate + if (! empty($arrayfields['cr.rate']['checked'])) + { + print '\n"; + if (! $i) $totalarray['nbfield']++; + } + + + // Fields from hook + $parameters = ['arrayfields' => $arrayfields, 'obj' => $obj]; + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + + // Action + print ''; + if (!$i) $totalarray['nbfield']++; } - // code - if (!empty($arrayfields['m.code']['checked'])) - { - print '\n"; - - if (!$i) $totalarray['nbfield']++; - } - - // rate - if (!empty($arrayfields['cr.rate']['checked'])) - { - print '\n"; - if (!$i) $totalarray['nbfield']++; - } - - // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj); - $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - - // Action - print ''; - if (!$i) $totalarray['nbfield']++; - print "\n"; $i++; } From a37bb4c6f23c506b176d2c977a8e5a947294b582 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 23 Dec 2020 13:51:13 +0000 Subject: [PATCH 002/147] Fixing style errors. --- htdocs/multicurrency/multicurrency_rate.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/multicurrency/multicurrency_rate.php b/htdocs/multicurrency/multicurrency_rate.php index 376269c0806..b8aaf0064c8 100644 --- a/htdocs/multicurrency/multicurrency_rate.php +++ b/htdocs/multicurrency/multicurrency_rate.php @@ -236,7 +236,7 @@ print dol_get_fiche_head($head, 'ratelist', $langs->trans("ModuleSetup"), -1, "m // ACTION -if (!in_array( $action, array("updateRate", "deleteRate"))) { +if (!in_array($action, array("updateRate", "deleteRate"))) { print '
'; - print ''; + print $form->selectDate($search_date_sync, 'search_date_sync', 0, 0, 1); + print $form->selectDate($search_date_sync_end, 'search_date_sync_end', 0, 0, 1); print ''; - print ''; + print $form->selectMultiCurrency($multicurrency_code, 'search_code', 1, " code != '".$conf->currency."'", true); print '
'; - print $obj->date_sync; - print "' . $form->selectMultiCurrency($obj->code, 'multicurrency_code', 1, " code != '".$conf->currency."'", true) . ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print $obj->date_sync; + print "'; + print $obj->code." ".$obj->name; + print "'; + print $obj->rate; + print "'; + if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + { + $selected = 0; + if (in_array($obj->rowid, $arrayofselected)) $selected = 1; + print 'rowid.'">'.img_picto('edit', 'edit').''; + print 'rowid.'">'.img_picto('delete', 'delete').''; + print ''; + } + print ''; - print $obj->code." ".$obj->name; - print "'; - print $obj->rate; - print "'; - if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined - { - $selected = 0; - if (in_array($obj->rowid, $arrayofselected)) $selected = 1; - print 'rowid.'">'.img_picto('edit', 'edit').''; - print 'rowid.'">'.img_picto('delete', 'delete').''; - print ''; - } - print '
'; print ''; print ''."\n"; From 367a038a1555b464ca5527be645f5947e9d59b20 Mon Sep 17 00:00:00 2001 From: jpb Date: Thu, 24 Dec 2020 09:55:09 +0100 Subject: [PATCH 003/147] hotfix : idate on create currency --- htdocs/multicurrency/multicurrency_rate.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/multicurrency/multicurrency_rate.php b/htdocs/multicurrency/multicurrency_rate.php index 376269c0806..a7bf7f2c7f7 100644 --- a/htdocs/multicurrency/multicurrency_rate.php +++ b/htdocs/multicurrency/multicurrency_rate.php @@ -109,7 +109,7 @@ if ($action == "create") { $currencyRate_static->fk_multicurrency = $fk_currency; $currencyRate_static->entity = $conf->entity; - $currencyRate_static->date_sync = $dateinput; + $currencyRate_static->date_sync = $db->idate($dateinput); $currencyRate_static->rate = $rateinput; $result = $currencyRate_static->create(intval($fk_currency)); From 20720ae0dd50ad9036f1b1f6103130fe1de77f4f Mon Sep 17 00:00:00 2001 From: jpb Date: Mon, 11 Jan 2021 14:06:21 +0100 Subject: [PATCH 004/147] remove idate --- htdocs/multicurrency/multicurrency_rate.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/multicurrency/multicurrency_rate.php b/htdocs/multicurrency/multicurrency_rate.php index 69d471c62dd..b8aaf0064c8 100644 --- a/htdocs/multicurrency/multicurrency_rate.php +++ b/htdocs/multicurrency/multicurrency_rate.php @@ -109,7 +109,7 @@ if ($action == "create") { $currencyRate_static->fk_multicurrency = $fk_currency; $currencyRate_static->entity = $conf->entity; - $currencyRate_static->date_sync = $db->idate($dateinput); + $currencyRate_static->date_sync = $dateinput; $currencyRate_static->rate = $rateinput; $result = $currencyRate_static->create(intval($fk_currency)); From 6b451bd870a55c33a40b5b55b5116d35d55018aa Mon Sep 17 00:00:00 2001 From: jpb Date: Mon, 1 Feb 2021 09:31:30 +0100 Subject: [PATCH 005/147] use form->selectdate --- htdocs/multicurrency/multicurrency_rate.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/multicurrency/multicurrency_rate.php b/htdocs/multicurrency/multicurrency_rate.php index b8aaf0064c8..21d64734f8b 100644 --- a/htdocs/multicurrency/multicurrency_rate.php +++ b/htdocs/multicurrency/multicurrency_rate.php @@ -396,8 +396,8 @@ if ($resql) if (!empty($arrayfields['cr.date_sync']['checked'])) { print ''; } // code @@ -503,7 +503,7 @@ if ($resql) { $selected = 0; if (in_array($obj->rowid, $arrayofselected)) $selected = 1; - print 'rowid.'">'.img_picto('edit', 'edit').''; + print 'rowid.'&page='.$page.'&sortorder='.$sortorder.'&sortfield='.$sortfield.'&search_code='.$search_code.'&search_rate='.$search_rate.'&search_date_sync='.dol_print_date($search_date_sync, "%Y-%m-%d") .'&search_date_sync_end='.dol_print_date($search_date_sync_end, "%Y-%m-%d") .'&edit_mode='. '1'. '">'.img_picto('edit', 'edit').''; print 'rowid.'">'.img_picto('delete', 'delete').''; print ''; } From 7966c6ed6d7d9291e2f6c01fbaa03ddb74a83ab8 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Mon, 1 Feb 2021 08:34:12 +0000 Subject: [PATCH 006/147] Fixing style errors. --- htdocs/multicurrency/multicurrency_rate.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/multicurrency/multicurrency_rate.php b/htdocs/multicurrency/multicurrency_rate.php index 21d64734f8b..09749ae612e 100644 --- a/htdocs/multicurrency/multicurrency_rate.php +++ b/htdocs/multicurrency/multicurrency_rate.php @@ -396,7 +396,7 @@ if ($resql) if (!empty($arrayfields['cr.date_sync']['checked'])) { print ''; } From 584c09d62c3ec64162d4212dc143000997ceb131 Mon Sep 17 00:00:00 2001 From: x Date: Mon, 19 Apr 2021 11:50:03 +0200 Subject: [PATCH 007/147] shorten link to 509 lenght Stickler CI / stickler-ci --- htdocs/multicurrency/multicurrency_rate.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/multicurrency/multicurrency_rate.php b/htdocs/multicurrency/multicurrency_rate.php index fb597b2e07c..ca3ee91703c 100644 --- a/htdocs/multicurrency/multicurrency_rate.php +++ b/htdocs/multicurrency/multicurrency_rate.php @@ -535,8 +535,8 @@ if ($resql) { { $selected = 0; if (in_array($obj->rowid, $arrayofselected)) $selected = 1; - $atag = 'rowid.'&page='.$page.'&sortorder='.$sortorder.'&sortfield='.$sortfield.'&search_code='.$search_code.'&search_rate='.$search_rate.'&search_date_sync='.dol_print_date($search_date_sync, "%Y-%m-%d") .'&search_date_sync_end='.dol_print_date($search_date_sync_end, "%Y-%m-%d") .'&edit_mode='. '1'. '">'.img_picto('edit', 'edit').'' - print $atag ; + $par = '&id_rate='.$obj->rowid.'&page='.$page.'&sortorder='.$sortorder.'&sortfield='.$sortfield.'&search_code='.$search_code.'&search_rate='.$search_rate.'&search_date_sync='.dol_print_date($search_date_sync, "%Y-%m-%d") .'&search_date_sync_end='.dol_print_date($search_date_sync_end, "%Y-%m-%d") .'&edit_mode=1'; + print ''.img_picto('edit', 'edit').''; print 'rowid.'">'.img_picto('delete', 'delete').''; print ''; } From 08787cf40fb883122265704b7a06c72518fadc5c Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Mon, 19 Apr 2021 09:52:17 +0000 Subject: [PATCH 008/147] Fixing style errors. --- htdocs/multicurrency/multicurrency_rate.php | 121 ++++++++++---------- 1 file changed, 58 insertions(+), 63 deletions(-) diff --git a/htdocs/multicurrency/multicurrency_rate.php b/htdocs/multicurrency/multicurrency_rate.php index ca3ee91703c..8a31a34b1f3 100644 --- a/htdocs/multicurrency/multicurrency_rate.php +++ b/htdocs/multicurrency/multicurrency_rate.php @@ -217,7 +217,7 @@ 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 $sall = ""; $search_date_sync = ""; - $search_date_sync_end=""; + $search_date_sync_end=""; $search_rate = ""; $search_code = ""; $search_array_options = array(); @@ -298,10 +298,10 @@ $sql .= $hookmanager->resPrint; $sql .= ' FROM '.MAIN_DB_PREFIX.'multicurrency_rate as cr '; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."multicurrency AS m ON cr.fk_multicurrency = m.rowid"; if ($sall) $sql .= natural_search(array_keys($fieldstosearchall), $sall); -if ($search_date_sync && $search_date_sync_end ){ - $sql .= " AND (cr.date_sync BETWEEN '".$db->idate($search_date_sync)."' AND '".$db->idate($search_date_sync_end)."')"; +if ($search_date_sync && $search_date_sync_end ) { + $sql .= " AND (cr.date_sync BETWEEN '".$db->idate($search_date_sync)."' AND '".$db->idate($search_date_sync_end)."')"; } elseif ($search_date_sync && !$search_date_sync_end) { - $sql .= natural_search('cr.date_sync', $db->idate($search_date_sync)); + $sql .= natural_search('cr.date_sync', $db->idate($search_date_sync)); } if ($search_rate) $sql .= natural_search('cr.rate', $search_rate); if ($search_code) $sql .= natural_search('m.code', $search_code); @@ -355,9 +355,9 @@ if ($resql) { } if ($search_date_sync) $param = "&search_date_sync=".$search_date_sync; - if ($search_date_sync_end) $param="&search_date_sync_end=".$search_date_sync_end; + if ($search_date_sync_end) $param="&search_date_sync_end=".$search_date_sync_end; if ($search_rate) $param = "&search_rate=".urlencode($search_rate); - if ($search_code != '') $param.="&search_code=".urlencode($search_code); + if ($search_code != '') $param.="&search_code=".urlencode($search_code); // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; @@ -427,13 +427,13 @@ if ($resql) { if (!empty($arrayfields['cr.date_sync']['checked'])) { print ''; } // code if (!empty($arrayfields['m.code']['checked'])) { print ''; } // rate @@ -481,67 +481,62 @@ if ($resql) { print ''; - // USER REQUEST UPDATE FOR THIS LINE - if ($action == "updateRate" && $obj->rowid == $id_rate_selected) { - // var_dump($obj); - print ' '; - print ''; - print ' '; + // USER REQUEST UPDATE FOR THIS LINE + if ($action == "updateRate" && $obj->rowid == $id_rate_selected) { + // var_dump($obj); + print ' '; + print ''; + print ' '; - print ''; - } - else { - // date_sync - if (!empty($arrayfields['cr.date_sync']['checked'])) - { - print '\n"; - if (!$i) $totalarray['nbfield']++; - } + print ''; + } else { + // date_sync + if (!empty($arrayfields['cr.date_sync']['checked'])) { + print '\n"; + if (!$i) $totalarray['nbfield']++; + } - // code - if (! empty($arrayfields['m.code']['checked'])) - { - print '\n"; + // code + if (! empty($arrayfields['m.code']['checked'])) { + print '\n"; - if (! $i) $totalarray['nbfield']++; - } + if (! $i) $totalarray['nbfield']++; + } - // rate - if (! empty($arrayfields['cr.rate']['checked'])) - { - print '\n"; - if (! $i) $totalarray['nbfield']++; - } + // rate + if (! empty($arrayfields['cr.rate']['checked'])) { + print '\n"; + if (! $i) $totalarray['nbfield']++; + } - // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj); - $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; + // Fields from hook + $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj); + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; - // Action - print ''; - if (!$i) $totalarray['nbfield']++; + // Action + print ''; + if (!$i) $totalarray['nbfield']++; } print "\n"; From 8f1046fcb3096525c685f1f90d6906e4e9cc81f2 Mon Sep 17 00:00:00 2001 From: x Date: Mon, 19 Apr 2021 11:56:37 +0200 Subject: [PATCH 009/147] use form->selectDate instead of html input type date --- htdocs/multicurrency/multicurrency_rate.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/multicurrency/multicurrency_rate.php b/htdocs/multicurrency/multicurrency_rate.php index ca3ee91703c..6a553fc5abf 100644 --- a/htdocs/multicurrency/multicurrency_rate.php +++ b/htdocs/multicurrency/multicurrency_rate.php @@ -484,7 +484,10 @@ if ($resql) { // USER REQUEST UPDATE FOR THIS LINE if ($action == "updateRate" && $obj->rowid == $id_rate_selected) { // var_dump($obj); - print ' '; + $form = new Form($db); + print ''; + + print ''; print ' '; From e78f6e3001a2ab55659d4cab6fe1192ba4af00fc Mon Sep 17 00:00:00 2001 From: x Date: Mon, 19 Apr 2021 12:03:52 +0200 Subject: [PATCH 010/147] replace urlencode --- htdocs/multicurrency/multicurrency_rate.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/multicurrency/multicurrency_rate.php b/htdocs/multicurrency/multicurrency_rate.php index 9f0a6af576b..0de0d0c458b 100644 --- a/htdocs/multicurrency/multicurrency_rate.php +++ b/htdocs/multicurrency/multicurrency_rate.php @@ -354,7 +354,7 @@ if ($resql) { $param .= "&sall=".urlencode($sall); } - if ($search_date_sync) $param = "&search_date_sync=".$search_date_sync; + if ($search_date_sync) $param = "&search_date_sync=".urlencode($search_date_sync); if ($search_date_sync_end) $param="&search_date_sync_end=".$search_date_sync_end; if ($search_rate) $param = "&search_rate=".urlencode($search_rate); if ($search_code != '') $param.="&search_code=".urlencode($search_code); From f71b15ac8ee9e665e6709194f48d3b513fcf19f8 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Mon, 19 Apr 2021 10:05:56 +0000 Subject: [PATCH 011/147] Fixing style errors. --- htdocs/multicurrency/multicurrency_rate.php | 104 +++++++++----------- 1 file changed, 49 insertions(+), 55 deletions(-) diff --git a/htdocs/multicurrency/multicurrency_rate.php b/htdocs/multicurrency/multicurrency_rate.php index 0de0d0c458b..7445a6ed274 100644 --- a/htdocs/multicurrency/multicurrency_rate.php +++ b/htdocs/multicurrency/multicurrency_rate.php @@ -482,71 +482,65 @@ if ($resql) { print ''; - // USER REQUEST UPDATE FOR THIS LINE - if ($action == "updateRate" && $obj->rowid == $id_rate_selected) { - // var_dump($obj); + // USER REQUEST UPDATE FOR THIS LINE + if ($action == "updateRate" && $obj->rowid == $id_rate_selected) { + // var_dump($obj); $form = new Form($db); print ''; - print ''; - print ' '; + print ''; + print ' '; - print ''; - } - else { - // date_sync - if (!empty($arrayfields['cr.date_sync']['checked'])) - { - print '\n"; - if (!$i) $totalarray['nbfield']++; - } + print ''; + } else { + // date_sync + if (!empty($arrayfields['cr.date_sync']['checked'])) { + print '\n"; + if (!$i) $totalarray['nbfield']++; + } - // code - if (! empty($arrayfields['m.code']['checked'])) - { - print '\n"; + // code + if (! empty($arrayfields['m.code']['checked'])) { + print '\n"; - if (! $i) $totalarray['nbfield']++; - } + if (! $i) $totalarray['nbfield']++; + } - // rate - if (! empty($arrayfields['cr.rate']['checked'])) - { - print '\n"; - if (! $i) $totalarray['nbfield']++; - } + // rate + if (! empty($arrayfields['cr.rate']['checked'])) { + print '\n"; + if (! $i) $totalarray['nbfield']++; + } - // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj); - $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - - // Action - print ''; - if (!$i) $totalarray['nbfield']++; + // Fields from hook + $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj); + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + // Action + print ''; + if (!$i) $totalarray['nbfield']++; } print "\n"; From 62d71028407dd94e6d580bdf0a180769a8321f61 Mon Sep 17 00:00:00 2001 From: jpb Date: Mon, 19 Apr 2021 12:22:31 +0200 Subject: [PATCH 012/147] commit git config --- htdocs/multicurrency/multicurrency_rate.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/htdocs/multicurrency/multicurrency_rate.php b/htdocs/multicurrency/multicurrency_rate.php index 0de0d0c458b..5ed206aa8dc 100644 --- a/htdocs/multicurrency/multicurrency_rate.php +++ b/htdocs/multicurrency/multicurrency_rate.php @@ -487,8 +487,6 @@ if ($resql) { // var_dump($obj); $form = new Form($db); print ''; - - print ''; print ' '; From 2c4e6da36a68f1e6da880585e3dc4ee2535a7d25 Mon Sep 17 00:00:00 2001 From: jpb Date: Mon, 19 Apr 2021 14:02:46 +0200 Subject: [PATCH 013/147] add escape to date --- htdocs/multicurrency/multicurrency_rate.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/multicurrency/multicurrency_rate.php b/htdocs/multicurrency/multicurrency_rate.php index 7445a6ed274..373d2a23304 100644 --- a/htdocs/multicurrency/multicurrency_rate.php +++ b/htdocs/multicurrency/multicurrency_rate.php @@ -299,7 +299,7 @@ $sql .= ' FROM '.MAIN_DB_PREFIX.'multicurrency_rate as cr '; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."multicurrency AS m ON cr.fk_multicurrency = m.rowid"; if ($sall) $sql .= natural_search(array_keys($fieldstosearchall), $sall); if ($search_date_sync && $search_date_sync_end ) { - $sql .= " AND (cr.date_sync BETWEEN '".$db->idate($search_date_sync)."' AND '".$db->idate($search_date_sync_end)."')"; + $sql .= " AND (cr.date_sync BETWEEN '".$db->escape($db->idate($search_date_sync))."' AND '".$db->escape($db->idate($search_date_sync_end))."')"; } elseif ($search_date_sync && !$search_date_sync_end) { $sql .= natural_search('cr.date_sync', $db->idate($search_date_sync)); } From 31a3c623f436db634dc6e12667c3a040947d9390 Mon Sep 17 00:00:00 2001 From: jpb Date: Mon, 19 Apr 2021 14:24:56 +0200 Subject: [PATCH 014/147] remove ->escape --- htdocs/multicurrency/multicurrency_rate.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/multicurrency/multicurrency_rate.php b/htdocs/multicurrency/multicurrency_rate.php index 373d2a23304..7445a6ed274 100644 --- a/htdocs/multicurrency/multicurrency_rate.php +++ b/htdocs/multicurrency/multicurrency_rate.php @@ -299,7 +299,7 @@ $sql .= ' FROM '.MAIN_DB_PREFIX.'multicurrency_rate as cr '; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."multicurrency AS m ON cr.fk_multicurrency = m.rowid"; if ($sall) $sql .= natural_search(array_keys($fieldstosearchall), $sall); if ($search_date_sync && $search_date_sync_end ) { - $sql .= " AND (cr.date_sync BETWEEN '".$db->escape($db->idate($search_date_sync))."' AND '".$db->escape($db->idate($search_date_sync_end))."')"; + $sql .= " AND (cr.date_sync BETWEEN '".$db->idate($search_date_sync)."' AND '".$db->idate($search_date_sync_end)."')"; } elseif ($search_date_sync && !$search_date_sync_end) { $sql .= natural_search('cr.date_sync', $db->idate($search_date_sync)); } From 3836481a1e67cb7b6cc3399da6e7a2d9a64fb41e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 19 Apr 2021 21:15:09 +0200 Subject: [PATCH 015/147] Update multicurrency_rate.php --- htdocs/multicurrency/multicurrency_rate.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/multicurrency/multicurrency_rate.php b/htdocs/multicurrency/multicurrency_rate.php index 7445a6ed274..78600c6b327 100644 --- a/htdocs/multicurrency/multicurrency_rate.php +++ b/htdocs/multicurrency/multicurrency_rate.php @@ -530,7 +530,7 @@ if ($resql) { print $hookmanager->resPrint; // Action - print ''; print ''; print ''; } From 18d2bef8f38c94d24731eab199237506588d4974 Mon Sep 17 00:00:00 2001 From: Sylvain Legrand Date: Wed, 28 Apr 2021 11:58:34 +0200 Subject: [PATCH 036/147] Error 500 on propal card when we change the deadline if we don't use the automatic generation for PDF documents (MAIN_DISABLE_PDF_AUTOUPDATE is set to 1) when we change the deadline on a proposal we get an error 500. --- htdocs/comm/propal/card.php | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 73ea01bc3f8..99a6f759206 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -285,8 +285,28 @@ if (empty($reshook)) } elseif ($action == 'setecheance' && $usercancreate) { $result = $object->set_echeance($user, dol_mktime(12, 0, 0, $_POST['echmonth'], $_POST['echday'], $_POST['echyear'])); - $result = $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); - if ($result < 0) + if ($result >= 0) + { + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) + { + $outputlangs = $langs; + $newlang = ''; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09'); + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; + if (!empty($newlang)) { + $outputlangs = new Translate("", $conf); + $outputlangs->setDefaultLang($newlang); + } + $model = $object->model_pdf; + $ret = $object->fetch($id); // Reload to get new records + if ($ret > 0) { + $object->fetch_thirdparty(); + } + + $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); + } + } + elseif ($result < 0) dol_print_error($db, $object->error); } elseif ($action == 'setdate_livraison' && $usercancreate) { From 6dcee425a1850c8802eede4a4835129643bbd430 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 28 Apr 2021 15:07:31 +0200 Subject: [PATCH 037/147] Update card.php --- htdocs/comm/propal/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 99a6f759206..af88178fe27 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -305,9 +305,9 @@ if (empty($reshook)) $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); } + } else { + setEventMessages($object->error, $object->errors, 'errors'); } - elseif ($result < 0) - dol_print_error($db, $object->error); } elseif ($action == 'setdate_livraison' && $usercancreate) { $result = $object->setDeliveryDate($user, dol_mktime(12, 0, 0, $_POST['date_livraisonmonth'], $_POST['date_livraisonday'], $_POST['date_livraisonyear'])); From 0108826ee58cc3207c839acdf3aee9b0f5a5f8a5 Mon Sep 17 00:00:00 2001 From: antonin_tdj <50403308+ibuiv@users.noreply.github.com> Date: Wed, 28 Apr 2021 16:03:40 +0200 Subject: [PATCH 038/147] add column instead of just add --- htdocs/install/mysql/migration/13.0.0-14.0.0.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql index 652be6ec035..3c21284363a 100644 --- a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql +++ b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql @@ -437,5 +437,5 @@ ALTER TABLE llx_entrepot ADD COLUMN fk_project INTEGER DEFAULT NULL AFTER entity UPDATE llx_const SET value = 'github' WHERE __DECRYPT('name')__ = 'MAIN_BUGTRACK_ENABLELINK' AND __DECRYPT('value')__ = 1; -- For MultiCompany PMP per entity -ALTER TABLE llx_product_perentity ADD pmp FLOAT NULL DEFAULT NULL AFTER accountancy_code_buy_export +ALTER TABLE llx_product_perentity ADD COLUMN pmp FLOAT NULL DEFAULT NULL AFTER accountancy_code_buy_export From 95ecb95ff142710a34bb2ee76cca7650431f5cf6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 28 Apr 2021 20:47:28 +0200 Subject: [PATCH 039/147] FIX dol_print_date for %a and %b with some timezone --- htdocs/core/lib/functions.lib.php | 124 +++++++++++++++++------------- 1 file changed, 70 insertions(+), 54 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 2a57a983496..37e55b42fde 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1991,19 +1991,15 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs = // Clean parameters $to_gmt = false; $offsettz = $offsetdst = 0; - if ($tzoutput) - { + if ($tzoutput) { $to_gmt = true; // For backward compatibility - if (is_string($tzoutput)) - { - if ($tzoutput == 'tzserver') - { + if (is_string($tzoutput)) { + if ($tzoutput == 'tzserver') { $to_gmt = false; $offsettzstring = @date_default_timezone_get(); // Example 'Europe/Berlin' or 'Indian/Reunion' - $offsettz = 0; - $offsetdst = 0; - } elseif ($tzoutput == 'tzuser' || $tzoutput == 'tzuserrel') - { + $offsettz = 0; // Timezone offset with server timezone, so 0 + $offsetdst = 0; // Dst offset with server timezone, so 0 + } elseif ($tzoutput == 'tzuser' || $tzoutput == 'tzuserrel') { $to_gmt = true; $offsettzstring = (empty($_SESSION['dol_tz_string']) ? 'UTC' : $_SESSION['dol_tz_string']); // Example 'Europe/Berlin' or 'Indian/Reunion' $offsettz = (empty($_SESSION['dol_tz']) ? 0 : $_SESSION['dol_tz']) * 60 * 60; // Will not be used anymore @@ -2011,54 +2007,77 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs = } } } - if (!is_object($outputlangs)) $outputlangs = $langs; - if (!$format) $format = 'daytextshort'; + if (!is_object($outputlangs)) { + $outputlangs = $langs; + } + if (!$format) { + $format = 'daytextshort'; + } // Do we have to reduce the length of date (year on 2 chars) to save space. // Note: dayinputnoreduce is same than day but no reduction of year length will be done $reduceformat = (!empty($conf->dol_optimize_smallscreen) && in_array($format, array('day', 'dayhour'))) ? 1 : 0; // Test on original $format param. $format = preg_replace('/inputnoreduce/', '', $format); // so format 'dayinputnoreduce' is processed like day $formatwithoutreduce = preg_replace('/reduceformat/', '', $format); - if ($formatwithoutreduce != $format) { $format = $formatwithoutreduce; $reduceformat = 1; } // so format 'dayreduceformat' is processed like day + if ($formatwithoutreduce != $format) { + $format = $formatwithoutreduce; + $reduceformat = 1; + } // so format 'dayreduceformat' is processed like day // Change predefined format into computer format. If found translation in lang file we use it, otherwise we use default. // TODO Add format daysmallyear and dayhoursmallyear - if ($format == 'day') $format = ($outputlangs->trans("FormatDateShort") != "FormatDateShort" ? $outputlangs->trans("FormatDateShort") : $conf->format_date_short); - elseif ($format == 'hour') $format = ($outputlangs->trans("FormatHourShort") != "FormatHourShort" ? $outputlangs->trans("FormatHourShort") : $conf->format_hour_short); - elseif ($format == 'hourduration') $format = ($outputlangs->trans("FormatHourShortDuration") != "FormatHourShortDuration" ? $outputlangs->trans("FormatHourShortDuration") : $conf->format_hour_short_duration); - elseif ($format == 'daytext') $format = ($outputlangs->trans("FormatDateText") != "FormatDateText" ? $outputlangs->trans("FormatDateText") : $conf->format_date_text); - elseif ($format == 'daytextshort') $format = ($outputlangs->trans("FormatDateTextShort") != "FormatDateTextShort" ? $outputlangs->trans("FormatDateTextShort") : $conf->format_date_text_short); - elseif ($format == 'dayhour') $format = ($outputlangs->trans("FormatDateHourShort") != "FormatDateHourShort" ? $outputlangs->trans("FormatDateHourShort") : $conf->format_date_hour_short); - elseif ($format == 'dayhoursec') $format = ($outputlangs->trans("FormatDateHourSecShort") != "FormatDateHourSecShort" ? $outputlangs->trans("FormatDateHourSecShort") : $conf->format_date_hour_sec_short); - elseif ($format == 'dayhourtext') $format = ($outputlangs->trans("FormatDateHourText") != "FormatDateHourText" ? $outputlangs->trans("FormatDateHourText") : $conf->format_date_hour_text); - elseif ($format == 'dayhourtextshort') $format = ($outputlangs->trans("FormatDateHourTextShort") != "FormatDateHourTextShort" ? $outputlangs->trans("FormatDateHourTextShort") : $conf->format_date_hour_text_short); - // Format not sensitive to language - elseif ($format == 'dayhourlog') $format = '%Y%m%d%H%M%S'; - elseif ($format == 'dayhourldap') $format = '%Y%m%d%H%M%SZ'; - elseif ($format == 'dayhourxcard') $format = '%Y%m%dT%H%M%SZ'; - elseif ($format == 'dayxcard') $format = '%Y%m%d'; - elseif ($format == 'dayrfc') $format = '%Y-%m-%d'; // DATE_RFC3339 - elseif ($format == 'dayhourrfc') $format = '%Y-%m-%dT%H:%M:%SZ'; // DATETIME RFC3339 - elseif ($format == 'standard') $format = '%Y-%m-%d %H:%M:%S'; + if ($format == 'day') { + $format = ($outputlangs->trans("FormatDateShort") != "FormatDateShort" ? $outputlangs->trans("FormatDateShort") : $conf->format_date_short); + } elseif ($format == 'hour') { + $format = ($outputlangs->trans("FormatHourShort") != "FormatHourShort" ? $outputlangs->trans("FormatHourShort") : $conf->format_hour_short); + } elseif ($format == 'hourduration') { + $format = ($outputlangs->trans("FormatHourShortDuration") != "FormatHourShortDuration" ? $outputlangs->trans("FormatHourShortDuration") : $conf->format_hour_short_duration); + } elseif ($format == 'daytext') { + $format = ($outputlangs->trans("FormatDateText") != "FormatDateText" ? $outputlangs->trans("FormatDateText") : $conf->format_date_text); + } elseif ($format == 'daytextshort') { + $format = ($outputlangs->trans("FormatDateTextShort") != "FormatDateTextShort" ? $outputlangs->trans("FormatDateTextShort") : $conf->format_date_text_short); + } elseif ($format == 'dayhour') { + $format = ($outputlangs->trans("FormatDateHourShort") != "FormatDateHourShort" ? $outputlangs->trans("FormatDateHourShort") : $conf->format_date_hour_short); + } elseif ($format == 'dayhoursec') { + $format = ($outputlangs->trans("FormatDateHourSecShort") != "FormatDateHourSecShort" ? $outputlangs->trans("FormatDateHourSecShort") : $conf->format_date_hour_sec_short); + } elseif ($format == 'dayhourtext') { + $format = ($outputlangs->trans("FormatDateHourText") != "FormatDateHourText" ? $outputlangs->trans("FormatDateHourText") : $conf->format_date_hour_text); + } elseif ($format == 'dayhourtextshort') { + $format = ($outputlangs->trans("FormatDateHourTextShort") != "FormatDateHourTextShort" ? $outputlangs->trans("FormatDateHourTextShort") : $conf->format_date_hour_text_short); + } elseif ($format == 'dayhourlog') { + // Format not sensitive to language + $format = '%Y%m%d%H%M%S'; + } elseif ($format == 'dayhourldap') { + $format = '%Y%m%d%H%M%SZ'; + } elseif ($format == 'dayhourxcard') { + $format = '%Y%m%dT%H%M%SZ'; + } elseif ($format == 'dayxcard') { + $format = '%Y%m%d'; + } elseif ($format == 'dayrfc') { + $format = '%Y-%m-%d'; // DATE_RFC3339 + } elseif ($format == 'dayhourrfc') { + $format = '%Y-%m-%dT%H:%M:%SZ'; // DATETIME RFC3339 + } elseif ($format == 'standard') { + $format = '%Y-%m-%d %H:%M:%S'; + } - if ($reduceformat) - { + if ($reduceformat) { $format = str_replace('%Y', '%y', $format); $format = str_replace('yyyy', 'yy', $format); } // If date undefined or "", we return "" - if (dol_strlen($time) == 0) return ''; // $time=0 allowed (it means 01/01/1970 00:00:00) + if (dol_strlen($time) == 0) { + return ''; // $time=0 allowed (it means 01/01/1970 00:00:00) + } // Clean format - if (preg_match('/%b/i', $format)) // There is some text to translate - { + if (preg_match('/%b/i', $format)) { // There is some text to translate // We inhibate translation to text made by strftime functions. We will use trans instead later. $format = str_replace('%b', '__b__', $format); $format = str_replace('%B', '__B__', $format); } - if (preg_match('/%a/i', $format)) // There is some text to translate - { + if (preg_match('/%a/i', $format)) { // There is some text to translate // We inhibate translation to text made by strftime functions. We will use trans instead later. $format = str_replace('%a', '__a__', $format); $format = str_replace('%A', '__A__', $format); @@ -2067,13 +2086,11 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs = // Analyze date $reg = array(); - if (preg_match('/^([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])$/i', $time, $reg)) // Deprecated. Ex: 1970-01-01, 1970-01-01 01:00:00, 19700101010000 - { + if (preg_match('/^([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])$/i', $time, $reg)) { // Deprecated. Ex: 1970-01-01, 1970-01-01 01:00:00, 19700101010000 dol_print_error("Functions.lib::dol_print_date function called with a bad value from page ".$_SERVER["PHP_SELF"]); return ''; - } elseif (preg_match('/^([0-9]+)\-([0-9]+)\-([0-9]+) ?([0-9]+)?:?([0-9]+)?:?([0-9]+)?/i', $time, $reg)) // Still available to solve problems in extrafields of type date - { - // This part of code should not be used. + } elseif (preg_match('/^([0-9]+)\-([0-9]+)\-([0-9]+) ?([0-9]+)?:?([0-9]+)?:?([0-9]+)?/i', $time, $reg)) { // Still available to solve problems in extrafields of type date + // This part of code should not be used anymore. dol_syslog("Functions.lib::dol_print_date function called with a bad value from page ".$_SERVER["PHP_SELF"], LOG_WARNING); //if (function_exists('debug_print_backtrace')) debug_print_backtrace(); // Date has format 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM:SS' @@ -2088,23 +2105,22 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs = $ret = adodb_strftime($format, $time + $offsettz + $offsetdst, $to_gmt); } else { // Date is a timestamps - if ($time < 100000000000) // Protection against bad date values - { + if ($time < 100000000000) { // Protection against bad date values $timetouse = $time + $offsettz + $offsetdst; // TODO Replace this with function Date PHP. We also should not use anymore offsettz and offsetdst but only offsettzstring. - $ret = adodb_strftime($format, $timetouse, $to_gmt); - } else $ret = 'Bad value '.$time.' for date'; + $ret = adodb_strftime($format, $timetouse, $to_gmt); // If to_gmt = false then adodb_strftime use TZ of server + } else { + $ret = 'Bad value '.$time.' for date'; + } } - if (preg_match('/__b__/i', $format)) - { + if (preg_match('/__b__/i', $format)) { $timetouse = $time + $offsettz + $offsetdst; // TODO Replace this with function Date PHP. We also should not use anymore offsettz and offsetdst but only offsettzstring. // Here ret is string in PHP setup language (strftime was used). Now we convert to $outputlangs. - $month = adodb_strftime('%m', $timetouse); + $month = adodb_strftime('%m', $timetouse, $to_gmt); // If to_gmt = false then adodb_strftime use TZ of server $month = sprintf("%02d", $month); // $month may be return with format '06' on some installation and '6' on other, so we force it to '06'. - if ($encodetooutput) - { + if ($encodetooutput) { $monthtext = $outputlangs->transnoentities('Month'.$month); $monthtextshort = $outputlangs->transnoentities('MonthShort'.$month); } else { @@ -2117,11 +2133,11 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs = //print 'x'.$outputlangs->charset_output.'-'.$ret.'x'; //return $ret; } - if (preg_match('/__a__/i', $format)) - { + if (preg_match('/__a__/i', $format)) { + //print "time=$time offsettz=$offsettz offsetdst=$offsetdst offsettzstring=$offsettzstring"; $timetouse = $time + $offsettz + $offsetdst; // TODO Replace this with function Date PHP. We also should not use anymore offsettz and offsetdst but only offsettzstring. - $w = adodb_strftime('%w', $timetouse); // TODO Replace this with function Date PHP. We also should not use anymore offsettz and offsetdst but only offsettzstring. + $w = adodb_strftime('%w', $timetouse, $to_gmt); // If to_gmt = false then adodb_strftime use TZ of server $dayweek = $outputlangs->transnoentitiesnoconv('Day'.$w); $ret = str_replace('__A__', $dayweek, $ret); $ret = str_replace('__a__', dol_substr($dayweek, 0, 3), $ret); From e5cd6f97f93818fa5f6a62c6f9ab2bdc44459a85 Mon Sep 17 00:00:00 2001 From: kastoras Date: Tue, 27 Apr 2021 01:01:27 +0300 Subject: [PATCH 040/147] New/NEW Product Variants API, add variant stock to response When acessing product variants via GET API /products/{id}/variants, Include stock_warehouse data to the response --- htdocs/product/class/api_products.class.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index 0c70af86c9c..95ad085ddc0 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -25,6 +25,7 @@ require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductAttribute.class.php'; require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductAttributeValue.class.php'; require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductCombination.class.php'; require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductCombination2ValuePair.class.php'; +require_once DOL_DOCUMENT_ROOT.'/product/stock/class/productstockentrepot.class.php'; /** * API class for products @@ -1587,6 +1588,11 @@ class Products extends DolibarrApi $prodc2vp = new ProductCombination2ValuePair($this->db); $combinations[$key]->attributes = $prodc2vp->fetchByFkCombination((int) $combination->id); $combinations[$key] = $this->_cleanObjectDatas($combinations[$key]); + + $productModel = new Product($this->db); + $productModel->fetch((int)$combination->fk_product_child); + $productModel->load_stock(); + $combinations[$key]->stock_warehouse = $this->_cleanObjectDatas($productModel)->stock_warehouse; } return $combinations; From 24dec80c7eb0449793b0e9c81023c12bdd5dfca3 Mon Sep 17 00:00:00 2001 From: kastoras Date: Thu, 29 Apr 2021 00:06:47 +0300 Subject: [PATCH 041/147] New/NEW Product Variants API, add variant stock to response by parameter If $includestock parameter is set to 1, the response will contain variant stock data --- htdocs/product/class/api_products.class.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index 95ad085ddc0..83b19fb35c0 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -1567,7 +1567,8 @@ class Products extends DolibarrApi /** * Get product variants. * - * @param int $id ID of Product + * @param int $id ID of Product + * @param int $includestock Default value 0. If parameter is set to 1 the response will contain stock data of each variant * @return array * * @throws RestException 500 @@ -1575,7 +1576,7 @@ class Products extends DolibarrApi * * @url GET {id}/variants */ - public function getVariants($id) + public function getVariants($id,$includestock=0) { if (!DolibarrApiAccess::$user->rights->produit->lire) { throw new RestException(401); @@ -1589,10 +1590,12 @@ class Products extends DolibarrApi $combinations[$key]->attributes = $prodc2vp->fetchByFkCombination((int) $combination->id); $combinations[$key] = $this->_cleanObjectDatas($combinations[$key]); - $productModel = new Product($this->db); - $productModel->fetch((int)$combination->fk_product_child); - $productModel->load_stock(); - $combinations[$key]->stock_warehouse = $this->_cleanObjectDatas($productModel)->stock_warehouse; + if($includestock==1){ + $productModel = new Product($this->db); + $productModel->fetch((int)$combination->fk_product_child); + $productModel->load_stock(); + $combinations[$key]->stock_warehouse = $this->_cleanObjectDatas($productModel)->stock_warehouse; + } } return $combinations; From 58b4074e57c91fbf75590243b86cad864c651fcd Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 28 Apr 2021 21:10:06 +0000 Subject: [PATCH 042/147] Fixing style errors. --- htdocs/product/class/api_products.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index d94fc1f42d3..62137730e5f 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -1568,7 +1568,7 @@ class Products extends DolibarrApi * Get product variants. * * @param int $id ID of Product - * @param int $includestock Default value 0. If parameter is set to 1 the response will contain stock data of each variant + * @param int $includestock Default value 0. If parameter is set to 1 the response will contain stock data of each variant * @return array * * @throws RestException 500 @@ -1576,7 +1576,7 @@ class Products extends DolibarrApi * * @url GET {id}/variants */ - public function getVariants($id,$includestock=0) + public function getVariants($id, $includestock = 0) { if (!DolibarrApiAccess::$user->rights->produit->lire) { throw new RestException(401); @@ -1590,9 +1590,9 @@ class Products extends DolibarrApi $combinations[$key]->attributes = $prodc2vp->fetchByFkCombination((int) $combination->id); $combinations[$key] = $this->_cleanObjectDatas($combinations[$key]); - if($includestock==1){ + if ($includestock==1) { $productModel = new Product($this->db); - $productModel->fetch((int)$combination->fk_product_child); + $productModel->fetch((int) $combination->fk_product_child); $productModel->load_stock(); $combinations[$key]->stock_warehouse = $this->_cleanObjectDatas($productModel)->stock_warehouse; } From 5d17e267385760d89541529c359c80db01058c8b Mon Sep 17 00:00:00 2001 From: Anthony Berton <34568357+bb2a@users.noreply.github.com> Date: Wed, 28 Apr 2021 23:25:03 +0200 Subject: [PATCH 043/147] add_pdf_template_and_read_if_module_activate --- htdocs/admin/pdf.php | 2 +- htdocs/admin/pdf_adherent.php | 110 +++++++++++++++++++ htdocs/admin/pdf_contrat.php | 110 +++++++++++++++++++ htdocs/admin/pdf_expensereport.php | 110 +++++++++++++++++++ htdocs/admin/pdf_holiday.php | 110 +++++++++++++++++++ htdocs/admin/pdf_intervention.php | 2 +- htdocs/admin/pdf_invoice.php | 2 +- htdocs/admin/pdf_order.php | 2 +- htdocs/admin/pdf_project.php | 2 +- htdocs/admin/pdf_proposal.php | 2 +- htdocs/admin/pdf_reception.php | 110 +++++++++++++++++++ htdocs/admin/pdf_recruitment.php | 2 +- htdocs/admin/pdf_shipment.php | 110 +++++++++++++++++++ htdocs/admin/pdf_stock.php | 110 +++++++++++++++++++ htdocs/admin/pdf_supplierinvoice.php | 2 +- htdocs/admin/pdf_supplierorder.php | 2 +- htdocs/admin/pdf_supplierproposal.php | 2 +- htdocs/admin/pdf_ticket.php | 2 +- htdocs/core/lib/pdf.lib.php | 148 +++++++++++++++++--------- htdocs/langs/en_US/admin.lang | 7 ++ 20 files changed, 888 insertions(+), 59 deletions(-) create mode 100644 htdocs/admin/pdf_adherent.php create mode 100644 htdocs/admin/pdf_contrat.php create mode 100644 htdocs/admin/pdf_expensereport.php create mode 100644 htdocs/admin/pdf_holiday.php create mode 100644 htdocs/admin/pdf_reception.php create mode 100644 htdocs/admin/pdf_shipment.php create mode 100644 htdocs/admin/pdf_stock.php diff --git a/htdocs/admin/pdf.php b/htdocs/admin/pdf.php index 0ee42d6cddf..348f1e30cb5 100644 --- a/htdocs/admin/pdf.php +++ b/htdocs/admin/pdf.php @@ -33,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; // Load translation files required by the page -$langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'stocks')); +$langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'stocks', 'Trips')); if (!$user->admin) { accessforbidden(); diff --git a/htdocs/admin/pdf_adherent.php b/htdocs/admin/pdf_adherent.php new file mode 100644 index 00000000000..af570117492 --- /dev/null +++ b/htdocs/admin/pdf_adherent.php @@ -0,0 +1,110 @@ + + * Copyright (C) 2004-2012 Laurent Destailleur + * Copyright (C) 2005-2011 Regis Houssin + * Copyright (C) 2012-2107 Juanjo Menent + * Copyright (C) 2019 Ferran Marcet + * Copyright (C) 2021 Anthony Berton + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/admin/pdf.php + * \brief Page to setup PDF options + */ + +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; + +// Load translation files required by the page +$langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'stocks', 'Trips')); + +if (!$user->admin) { + accessforbidden(); +} + +$action = GETPOST('action', 'aZ09'); +$cancel = GETPOST('cancel', 'alpha'); + + +/* + * Actions + */ + +if ($cancel) { + $action = ''; +} + +if ($action == 'update') { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + + header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup"); + exit; +} + + + +/* + * View + */ + +$wikihelp = 'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones'; +llxHeader('', $langs->trans("Setup"), $wikihelp); + +$form = new Form($db); +$formother = new FormOther($db); +$formadmin = new FormAdmin($db); + +print load_fiche_titre($langs->trans("PDF"), '', 'title_setup'); + +$head = pdf_admin_prepare_head(); + +print dol_get_fiche_head($head, 'adherent', $langs->trans("Adherent"), -1, 'pdf'); + +print ''.$form->textwithpicto($langs->trans("PDFAdherentDesc"), $s)."
\n"; +print "
\n"; + +print '
'; +print ''; +print ''; + +print '
'; +print '
'.$langs->trans("FormCreateRate").''; - print $form->selectDate($search_date_sync, 'search_date_sync', 0, 0, 1); - print $form->selectDate($search_date_sync_end, 'search_date_sync_end', 0, 0, 1); + print $form->selectDate(dol_print_date($search_date_sync, "%Y-%m-%d" ), 'search_date_sync', 0, 0, 1); + print $form->selectDate(dol_print_date($search_date_sync_end, "%Y-%m-%d"), 'search_date_sync_end', 0, 0, 1); print ''; - print $form->selectDate(dol_print_date($search_date_sync, "%Y-%m-%d" ), 'search_date_sync', 0, 0, 1); + print $form->selectDate(dol_print_date($search_date_sync, "%Y-%m-%d"), 'search_date_sync', 0, 0, 1); print $form->selectDate(dol_print_date($search_date_sync_end, "%Y-%m-%d"), 'search_date_sync_end', 0, 0, 1); print ''; print $form->selectDate(dol_print_date($search_date_sync, "%Y-%m-%d"), 'search_date_sync', 0, 0, 1); - print $form->selectDate(dol_print_date($search_date_sync_end, "%Y-%m-%d"), 'search_date_sync_end', 0, 0, 1); + print $form->selectDate(dol_print_date($search_date_sync_end, "%Y-%m-%d"), 'search_date_sync_end', 0, 0, 1); print ''; - print $form->selectMultiCurrency($multicurrency_code, 'search_code', 1, " code != '".$conf->currency."'", true); + print $form->selectMultiCurrency($multicurrency_code, 'search_code', 1, " code != '".$conf->currency."'", true); print '
' . $form->selectMultiCurrency($obj->code, 'multicurrency_code', 1, " code != '".$conf->currency."'", true) . '' . $form->selectMultiCurrency($obj->code, 'multicurrency_code', 1, " code != '".$conf->currency."'", true) . ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print $obj->date_sync; - print "'; + print ''; + print ''; + print ''; + print ''; + print ''; + print $obj->date_sync; + print "'; - print $obj->code." ".$obj->name; - print "'; + print $obj->code." ".$obj->name; + print "'; - print $obj->rate; - print "'; + print $obj->rate; + print "'; - if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined - { - $selected = 0; - if (in_array($obj->rowid, $arrayofselected)) $selected = 1; - $par = '&id_rate='.$obj->rowid.'&page='.$page.'&sortorder='.$sortorder.'&sortfield='.$sortfield.'&search_code='.$search_code.'&search_rate='.$search_rate.'&search_date_sync='.dol_print_date($search_date_sync, "%Y-%m-%d") .'&search_date_sync_end='.dol_print_date($search_date_sync_end, "%Y-%m-%d") .'&edit_mode=1'; - print ''.img_picto('edit', 'edit').''; - print 'rowid.'">'.img_picto('delete', 'delete').''; - print ''; - } - print ''; + if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + $selected = 0; + if (in_array($obj->rowid, $arrayofselected)) $selected = 1; + $par = '&id_rate='.$obj->rowid.'&page='.$page.'&sortorder='.$sortorder.'&sortfield='.$sortfield.'&search_code='.$search_code.'&search_rate='.$search_rate.'&search_date_sync='.dol_print_date($search_date_sync, "%Y-%m-%d") .'&search_date_sync_end='.dol_print_date($search_date_sync_end, "%Y-%m-%d") .'&edit_mode=1'; + print ''.img_picto('edit', 'edit').''; + print 'rowid.'">'.img_picto('delete', 'delete').''; + print ''; + } + print '
' . $form->selectDate($obj->date_sync, 'dateinput', 0, 0, 1).'' . $form->selectMultiCurrency($obj->code, 'multicurrency_code', 1, " code != '".$conf->currency."'", true) . '
' . $form->selectDate($obj->date_sync, 'dateinput', 0, 0, 1).'' . $form->selectMultiCurrency($obj->code, 'multicurrency_code', 1, " code != '".$conf->currency."'", true) . '' . $form->selectMultiCurrency($obj->code, 'multicurrency_code', 1, " code != '".$conf->currency."'", true) . ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print $obj->date_sync; - print "'; + print ''; + print ''; + print ''; + print ''; + print ''; + print $obj->date_sync; + print "'; - print $obj->code." ".$obj->name; - print "'; + print $obj->code." ".$obj->name; + print "'; - print $obj->rate; - print "'; + print $obj->rate; + print "'; - if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined - { - $selected = 0; - if (in_array($obj->rowid, $arrayofselected)) $selected = 1; - $par = '&id_rate='.$obj->rowid.'&page='.$page.'&sortorder='.$sortorder.'&sortfield='.$sortfield.'&search_code='.$search_code.'&search_rate='.$search_rate.'&search_date_sync='.dol_print_date($search_date_sync, "%Y-%m-%d") .'&search_date_sync_end='.dol_print_date($search_date_sync_end, "%Y-%m-%d") .'&edit_mode=1'; - print ''.img_picto('edit', 'edit').''; - print 'rowid.'">'.img_picto('delete', 'delete').''; - print ''; - } - print ''; + if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + $selected = 0; + if (in_array($obj->rowid, $arrayofselected)) $selected = 1; + $par = '&id_rate='.$obj->rowid.'&page='.$page.'&sortorder='.$sortorder.'&sortfield='.$sortfield.'&search_code='.$search_code.'&search_rate='.$search_rate.'&search_date_sync='.dol_print_date($search_date_sync, "%Y-%m-%d") .'&search_date_sync_end='.dol_print_date($search_date_sync_end, "%Y-%m-%d") .'&edit_mode=1'; + print ''.img_picto('edit', 'edit').''; + print 'rowid.'">'.img_picto('delete', 'delete').''; + print ''; + } + print '
' . $form->selectDate($obj->date_sync, 'dateinput', 0, 0, 1).'' . $form->selectMultiCurrency($obj->code, 'multicurrency_code', 1, " code != '".$conf->currency."'", true) . ''; + print ''; if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined $selected = 0; if (in_array($obj->rowid, $arrayofselected)) $selected = 1; From 2ab17c44e9fc12c162ba7e680ab8c5fcb680094b Mon Sep 17 00:00:00 2001 From: Adrien Raze Date: Fri, 23 Apr 2021 11:11:47 +0200 Subject: [PATCH 016/147] FIX : Add function price2num for rounding values in productAlertStock box --- htdocs/core/boxes/box_produits_alerte_stock.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/boxes/box_produits_alerte_stock.php b/htdocs/core/boxes/box_produits_alerte_stock.php index dcd95445ddd..47009c77a53 100644 --- a/htdocs/core/boxes/box_produits_alerte_stock.php +++ b/htdocs/core/boxes/box_produits_alerte_stock.php @@ -203,7 +203,7 @@ class box_produits_alerte_stock extends ModeleBoxes $this->info_box_contents[$line][] = array( 'td' => 'class="center"', - 'text' => $objp->total_stock.' / '.$objp->seuil_stock_alerte, + 'text' => price2num($objp->total_stock).' / '.$objp->seuil_stock_alerte, 'text2'=>img_warning($langs->transnoentitiesnoconv("StockLowerThanLimit", $objp->seuil_stock_alerte)), ); From c5775cc90257319341d150d1cd4ffc6a07795078 Mon Sep 17 00:00:00 2001 From: Adrien Raze Date: Fri, 23 Apr 2021 12:31:45 +0200 Subject: [PATCH 017/147] FIX : Add parameter to function price2num() --- htdocs/core/boxes/box_produits_alerte_stock.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/boxes/box_produits_alerte_stock.php b/htdocs/core/boxes/box_produits_alerte_stock.php index 47009c77a53..7982181f7ca 100644 --- a/htdocs/core/boxes/box_produits_alerte_stock.php +++ b/htdocs/core/boxes/box_produits_alerte_stock.php @@ -203,7 +203,7 @@ class box_produits_alerte_stock extends ModeleBoxes $this->info_box_contents[$line][] = array( 'td' => 'class="center"', - 'text' => price2num($objp->total_stock).' / '.$objp->seuil_stock_alerte, + 'text' => price2num($objp->total_stock, 'MF').' / '.$objp->seuil_stock_alerte, 'text2'=>img_warning($langs->transnoentitiesnoconv("StockLowerThanLimit", $objp->seuil_stock_alerte)), ); From 9e2ee5bf57d4b187ceea53ff874db63631a269d2 Mon Sep 17 00:00:00 2001 From: Antonin MARCHAL Date: Mon, 26 Apr 2021 19:29:56 +0200 Subject: [PATCH 018/147] add(pmp) PMP per entity --- htdocs/product/class/product.class.php | 53 ++++++++++++++++++- htdocs/product/stock/card.php | 25 ++++++++- htdocs/product/stock/class/entrepot.class.php | 25 ++++++++- 3 files changed, 100 insertions(+), 3 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 6ed0b4266a8..65a73814c8e 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -2181,12 +2181,52 @@ class Product extends CommonObject } else { $sql .= " pa.accountancy_code_buy, pa.accountancy_code_buy_intra, pa.accountancy_code_buy_export, pa.accountancy_code_sell, pa.accountancy_code_sell_intra, pa.accountancy_code_sell_export,"; } - $sql .= " p.stock,p.pmp, p.datec, p.tms, p.import_key, p.entity, p.desiredstock, p.tobatch, p.batch_mask, p.fk_unit,"; + //For MultiCompany PMP per entity + $separatedEntityPMP = false; + if (!empty($conf->global->MULTICOMPANY_PRODUCT_SHARING_ENABLED) && !empty($conf->global->MULTICOMPANY_PMP_PER_ENTITY_ENABLED)) { + $checkPMPPerEntity = $this->db->query("SELECT pmp FROM " . MAIN_DB_PREFIX . "entity_product_pmp WHERE fk_product = ".((int) $id)." AND entity = ".(int) $conf->entity); + if($this->db->num_rows($checkPMPPerEntity)>0){ + $separatedEntityPMP = true; + } + } + + //For MultiCompany Stocks Sharings stock_reel includes only stocks shared with this entity + $separatedStock = false; + if (!empty($conf->global->MULTICOMPANY_STOCK_SHARING_ENABLED)){ + global $mc; + $separatedStock = true; + $visibleWarehousesEntities = $conf->entity; + if(isset($mc->sharings['stock']) && !empty($mc->sharings['stock'])){ + $visibleWarehousesEntities .= "," . implode(",",$mc->sharings['stock']); + } + } + if($separatedStock){ + $sql .= " SUM(sp.reel) as stock,"; + } + else{ + $sql .= " p.stock,"; + } + + if ($separatedEntityPMP){ + $sql .= " ppe.pmp, p.datec, p.tms, p.import_key, p.entity, p.desiredstock, p.tobatch, p.batch_mask, p.fk_unit,"; + } + else{ + $sql .= " p.pmp, p.datec, p.tms, p.import_key, p.entity, p.desiredstock, p.tobatch, p.batch_mask, p.fk_unit,"; + } $sql .= " p.fk_price_expression, p.price_autogen, p.model_pdf"; $sql .= " FROM ".MAIN_DB_PREFIX."product as p"; if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as pa ON pa.fk_product = p.rowid AND pa.entity = " . ((int) $conf->entity); } + + if ($separatedEntityPMP) { + $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "entity_product_pmp as ppe ON ppe.fk_product = p.rowid"; + } + + if($separatedStock){ + $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_stock as sp ON sp.fk_product = p.rowid"; + } + if ($id) { $sql .= " WHERE p.rowid = ".((int) $id); } else { @@ -2200,6 +2240,17 @@ class Product extends CommonObject } } + if ($separatedEntityPMP) { + $sql .= " AND ppe.entity = " . (int) $conf->entity; + } + + if($separatedStock){ + $sql .= " AND sp.fk_entrepot IN ( + SELECT rowid + FROM ".MAIN_DB_PREFIX."entrepot WHERE entity IN (" . $visibleWarehousesEntities ."))"; + } + + $resql = $this->db->query($sql); if ($resql) { unset($this->oldcopy); diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php index 0a77a39a0df..25cea1621c7 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -596,15 +596,38 @@ if ($action == 'create') { $totalunit = 0; $totalvalue = $totalvaluesell = 0; - $sql = "SELECT p.rowid as rowid, p.ref, p.label as produit, p.tobatch, p.fk_product_type as type, p.pmp as ppmp, p.price, p.price_ttc, p.entity,"; + //For MultiCompany PMP per entity + $separatedPMP = false; + if (!empty($conf->global->MULTICOMPANY_PRODUCT_SHARING_ENABLED) && !empty($conf->global->MULTICOMPANY_PMP_PER_ENTITY_ENABLED)) { + $separatedPMP = true; + } + + $sql = "SELECT p.rowid as rowid, p.ref, p.label as produit, p.tobatch, p.fk_product_type as type, p.price, p.price_ttc, p.entity,"; + if ($separatedPMP) { + $sql .= " ppe.pmp as ppmp,"; + } + else{ + $sql .= " p.pmp as ppmp,"; + } + $sql .= " ps.reel as value"; if (!empty($conf->global->PRODUCT_USE_UNITS)) { $sql .= ",fk_unit"; } $sql .= " FROM ".MAIN_DB_PREFIX."product_stock as ps, ".MAIN_DB_PREFIX."product as p"; + + if ($separatedPMP) { + $sql .= ", ".MAIN_DB_PREFIX."entity_product_pmp as ppe"; + } + $sql .= " WHERE ps.fk_product = p.rowid"; $sql .= " AND ps.reel <> 0"; // We do not show if stock is 0 (no product in this warehouse) $sql .= " AND ps.fk_entrepot = ".$object->id; + + if ($separatedPMP) { + $sql .= " AND ppe.fk_product = p.rowid AND ppe.entity = ". (int) $conf->entity; + } + $sql .= $db->order($sortfield, $sortorder); dol_syslog('List products', LOG_DEBUG); diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index 8bd250bc76e..53799617420 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -610,13 +610,36 @@ class Entrepot extends CommonObject */ public function nb_products() { + global $conf; // phpcs:enable $ret = array(); - $sql = "SELECT sum(ps.reel) as nb, sum(ps.reel * p.pmp) as value"; + //For MultiCompany PMP per entity + $separatedPMP = false; + if (!empty($conf->global->MULTICOMPANY_PRODUCT_SHARING_ENABLED) && !empty($conf->global->MULTICOMPANY_PMP_PER_ENTITY_ENABLED)) { + $separatedPMP = true; + } + + if ($separatedPMP) { + $sql = "SELECT sum(ps.reel) as nb, sum(ps.reel * ppe.pmp) as value"; + } + else{ + $sql = "SELECT sum(ps.reel) as nb, sum(ps.reel * p.pmp) as value"; + } $sql .= " FROM ".MAIN_DB_PREFIX."product_stock as ps"; + $sql .= ", ".MAIN_DB_PREFIX."product as p"; + + if ($separatedPMP) { + $sql .= ", ".MAIN_DB_PREFIX."entity_product_pmp as ppe"; + } + $sql .= " WHERE ps.fk_entrepot = ".$this->id; + + if ($separatedPMP) { + $sql .= " AND ppe.fk_product = p.rowid AND ppe.entity = ". (int) $conf->entity; + } + $sql .= " AND ps.fk_product = p.rowid"; //print $sql; From 1d162cc62ca8ff486afb558ccf80c8cfa83ad9b4 Mon Sep 17 00:00:00 2001 From: Antonin MARCHAL Date: Mon, 26 Apr 2021 20:06:45 +0200 Subject: [PATCH 019/147] lint(stickler) --- htdocs/product/class/product.class.php | 27 +++++++------------ htdocs/product/stock/card.php | 4 +-- htdocs/product/stock/class/entrepot.class.php | 10 +++---- 3 files changed, 15 insertions(+), 26 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index be18056c223..cefc4a27b23 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -2185,32 +2185,30 @@ class Product extends CommonObject $separatedEntityPMP = false; if (!empty($conf->global->MULTICOMPANY_PRODUCT_SHARING_ENABLED) && !empty($conf->global->MULTICOMPANY_PMP_PER_ENTITY_ENABLED)) { $checkPMPPerEntity = $this->db->query("SELECT pmp FROM " . MAIN_DB_PREFIX . "entity_product_pmp WHERE fk_product = ".((int) $id)." AND entity = ".(int) $conf->entity); - if($this->db->num_rows($checkPMPPerEntity)>0){ + if( $this->db->num_rows($checkPMPPerEntity)>0 ){ $separatedEntityPMP = true; } } - //For MultiCompany Stocks Sharings stock_reel includes only stocks shared with this entity $separatedStock = false; - if (!empty($conf->global->MULTICOMPANY_STOCK_SHARING_ENABLED)){ + if (!empty($conf->global->MULTICOMPANY_STOCK_SHARING_ENABLED)) { global $mc; $separatedStock = true; $visibleWarehousesEntities = $conf->entity; - if(isset($mc->sharings['stock']) && !empty($mc->sharings['stock'])){ - $visibleWarehousesEntities .= "," . implode(",",$mc->sharings['stock']); + if (isset($mc->sharings['stock']) && !empty($mc->sharings['stock'])) { + $visibleWarehousesEntities .= "," . implode( ",", $mc->sharings['stock'] ); } } - if($separatedStock){ + if ($separatedStock) { $sql .= " SUM(sp.reel) as stock,"; } - else{ + else { $sql .= " p.stock,"; } - - if ($separatedEntityPMP){ + if ($separatedEntityPMP) { $sql .= " ppe.pmp, p.datec, p.tms, p.import_key, p.entity, p.desiredstock, p.tobatch, p.batch_mask, p.fk_unit,"; } - else{ + else { $sql .= " p.pmp, p.datec, p.tms, p.import_key, p.entity, p.desiredstock, p.tobatch, p.batch_mask, p.fk_unit,"; } $sql .= " p.fk_price_expression, p.price_autogen, p.model_pdf"; @@ -2218,15 +2216,12 @@ class Product extends CommonObject if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as pa ON pa.fk_product = p.rowid AND pa.entity = " . ((int) $conf->entity); } - if ($separatedEntityPMP) { $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "entity_product_pmp as ppe ON ppe.fk_product = p.rowid"; } - - if($separatedStock){ + if ($separatedStock) { $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_stock as sp ON sp.fk_product = p.rowid"; } - if ($id) { $sql .= " WHERE p.rowid = ".((int) $id); } else { @@ -2239,12 +2234,10 @@ class Product extends CommonObject $sql .= " AND p.barcode = '".$this->db->escape($barcode)."'"; } } - if ($separatedEntityPMP) { $sql .= " AND ppe.entity = " . (int) $conf->entity; } - - if($separatedStock){ + if ($separatedStock) { $sql .= " AND sp.fk_entrepot IN ( SELECT rowid FROM ".MAIN_DB_PREFIX."entrepot WHERE entity IN (" . $visibleWarehousesEntities ."))"; diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php index 865245aef72..86b97204cf0 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -605,8 +605,8 @@ if ($action == 'create') { $sql = "SELECT p.rowid as rowid, p.ref, p.label as produit, p.tobatch, p.fk_product_type as type, p.price, p.price_ttc, p.entity,"; if ($separatedPMP) { $sql .= " ppe.pmp as ppmp,"; - } - else{ + } + else { $sql .= " p.pmp as ppmp,"; } diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index 53799617420..f58f12f3240 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -622,8 +622,8 @@ class Entrepot extends CommonObject if ($separatedPMP) { $sql = "SELECT sum(ps.reel) as nb, sum(ps.reel * ppe.pmp) as value"; - } - else{ + } + else { $sql = "SELECT sum(ps.reel) as nb, sum(ps.reel * p.pmp) as value"; } $sql .= " FROM ".MAIN_DB_PREFIX."product_stock as ps"; @@ -632,16 +632,12 @@ class Entrepot extends CommonObject if ($separatedPMP) { $sql .= ", ".MAIN_DB_PREFIX."entity_product_pmp as ppe"; - } - + } $sql .= " WHERE ps.fk_entrepot = ".$this->id; - if ($separatedPMP) { $sql .= " AND ppe.fk_product = p.rowid AND ppe.entity = ". (int) $conf->entity; } - $sql .= " AND ps.fk_product = p.rowid"; - //print $sql; $result = $this->db->query($sql); if ($result) { From 285fa4a506c47f0a4e97ec420904e492b963c229 Mon Sep 17 00:00:00 2001 From: Antonin MARCHAL Date: Mon, 26 Apr 2021 20:10:57 +0200 Subject: [PATCH 020/147] lint(stickler) again --- htdocs/product/class/product.class.php | 10 +++++----- htdocs/product/stock/card.php | 1 - htdocs/product/stock/class/entrepot.class.php | 2 -- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index cefc4a27b23..1c803fefd7e 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -2185,7 +2185,7 @@ class Product extends CommonObject $separatedEntityPMP = false; if (!empty($conf->global->MULTICOMPANY_PRODUCT_SHARING_ENABLED) && !empty($conf->global->MULTICOMPANY_PMP_PER_ENTITY_ENABLED)) { $checkPMPPerEntity = $this->db->query("SELECT pmp FROM " . MAIN_DB_PREFIX . "entity_product_pmp WHERE fk_product = ".((int) $id)." AND entity = ".(int) $conf->entity); - if( $this->db->num_rows($checkPMPPerEntity)>0 ){ + if ($this->db->num_rows($checkPMPPerEntity)>0) { $separatedEntityPMP = true; } } @@ -2196,18 +2196,18 @@ class Product extends CommonObject $separatedStock = true; $visibleWarehousesEntities = $conf->entity; if (isset($mc->sharings['stock']) && !empty($mc->sharings['stock'])) { - $visibleWarehousesEntities .= "," . implode( ",", $mc->sharings['stock'] ); + $visibleWarehousesEntities .= "," . implode(",", $mc->sharings['stock']); } } if ($separatedStock) { $sql .= " SUM(sp.reel) as stock,"; - } + } else { $sql .= " p.stock,"; } if ($separatedEntityPMP) { $sql .= " ppe.pmp, p.datec, p.tms, p.import_key, p.entity, p.desiredstock, p.tobatch, p.batch_mask, p.fk_unit,"; - } + } else { $sql .= " p.pmp, p.datec, p.tms, p.import_key, p.entity, p.desiredstock, p.tobatch, p.batch_mask, p.fk_unit,"; } @@ -2235,7 +2235,7 @@ class Product extends CommonObject } } if ($separatedEntityPMP) { - $sql .= " AND ppe.entity = " . (int) $conf->entity; + $sql .= " AND ppe.entity = " . (int) $conf->entity; } if ($separatedStock) { $sql .= " AND sp.fk_entrepot IN ( diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php index 86b97204cf0..b0b5cdfe2c9 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -609,7 +609,6 @@ if ($action == 'create') { else { $sql .= " p.pmp as ppmp,"; } - $sql .= " ps.reel as value"; if (!empty($conf->global->PRODUCT_USE_UNITS)) { $sql .= ",fk_unit"; diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index f58f12f3240..8777450fbb9 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -627,9 +627,7 @@ class Entrepot extends CommonObject $sql = "SELECT sum(ps.reel) as nb, sum(ps.reel * p.pmp) as value"; } $sql .= " FROM ".MAIN_DB_PREFIX."product_stock as ps"; - $sql .= ", ".MAIN_DB_PREFIX."product as p"; - if ($separatedPMP) { $sql .= ", ".MAIN_DB_PREFIX."entity_product_pmp as ppe"; } From 57118da2068acb06f8c11db0a82d2d81430f3f69 Mon Sep 17 00:00:00 2001 From: Antonin MARCHAL Date: Mon, 26 Apr 2021 20:13:55 +0200 Subject: [PATCH 021/147] lint(stickler)3rd --- htdocs/product/class/product.class.php | 6 ++---- htdocs/product/stock/card.php | 3 +-- htdocs/product/stock/class/entrepot.class.php | 5 ++--- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 1c803fefd7e..d79ae061ae9 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -2201,14 +2201,12 @@ class Product extends CommonObject } if ($separatedStock) { $sql .= " SUM(sp.reel) as stock,"; - } - else { + } else { $sql .= " p.stock,"; } if ($separatedEntityPMP) { $sql .= " ppe.pmp, p.datec, p.tms, p.import_key, p.entity, p.desiredstock, p.tobatch, p.batch_mask, p.fk_unit,"; - } - else { + } else { $sql .= " p.pmp, p.datec, p.tms, p.import_key, p.entity, p.desiredstock, p.tobatch, p.batch_mask, p.fk_unit,"; } $sql .= " p.fk_price_expression, p.price_autogen, p.model_pdf"; diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php index b0b5cdfe2c9..1faa19be499 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -605,8 +605,7 @@ if ($action == 'create') { $sql = "SELECT p.rowid as rowid, p.ref, p.label as produit, p.tobatch, p.fk_product_type as type, p.price, p.price_ttc, p.entity,"; if ($separatedPMP) { $sql .= " ppe.pmp as ppmp,"; - } - else { + } else { $sql .= " p.pmp as ppmp,"; } $sql .= " ps.reel as value"; diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index 8777450fbb9..b51c0d4ea75 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -622,8 +622,7 @@ class Entrepot extends CommonObject if ($separatedPMP) { $sql = "SELECT sum(ps.reel) as nb, sum(ps.reel * ppe.pmp) as value"; - } - else { + } else { $sql = "SELECT sum(ps.reel) as nb, sum(ps.reel * p.pmp) as value"; } $sql .= " FROM ".MAIN_DB_PREFIX."product_stock as ps"; @@ -634,7 +633,7 @@ class Entrepot extends CommonObject $sql .= " WHERE ps.fk_entrepot = ".$this->id; if ($separatedPMP) { $sql .= " AND ppe.fk_product = p.rowid AND ppe.entity = ". (int) $conf->entity; - } + } $sql .= " AND ps.fk_product = p.rowid"; //print $sql; $result = $this->db->query($sql); From c0b6dd92d7ffb39e76f4e077a495c4be233a2442 Mon Sep 17 00:00:00 2001 From: Antonin MARCHAL Date: Mon, 26 Apr 2021 20:15:32 +0200 Subject: [PATCH 022/147] lint(stickler)4th --- htdocs/product/stock/class/entrepot.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index b51c0d4ea75..b1c41d24ef3 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -629,11 +629,11 @@ class Entrepot extends CommonObject $sql .= ", ".MAIN_DB_PREFIX."product as p"; if ($separatedPMP) { $sql .= ", ".MAIN_DB_PREFIX."entity_product_pmp as ppe"; - } + } $sql .= " WHERE ps.fk_entrepot = ".$this->id; if ($separatedPMP) { $sql .= " AND ppe.fk_product = p.rowid AND ppe.entity = ". (int) $conf->entity; - } + } $sql .= " AND ps.fk_product = p.rowid"; //print $sql; $result = $this->db->query($sql); From a296f81bc6424858207b6d55fc0db649de4c6579 Mon Sep 17 00:00:00 2001 From: Antonin MARCHAL Date: Mon, 26 Apr 2021 20:30:21 +0200 Subject: [PATCH 023/147] lint(travis) --- htdocs/product/class/product.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index d79ae061ae9..83354384e8b 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -2238,7 +2238,7 @@ class Product extends CommonObject if ($separatedStock) { $sql .= " AND sp.fk_entrepot IN ( SELECT rowid - FROM ".MAIN_DB_PREFIX."entrepot WHERE entity IN (" . $visibleWarehousesEntities ."))"; + FROM ".MAIN_DB_PREFIX."entrepot WHERE entity IN (" . $this->db->sanitize($visibleWarehousesEntities) ."))"; } From 8ba08552ca23ff232cbeeeaebf3cb688147a656c Mon Sep 17 00:00:00 2001 From: kastoras Date: Tue, 27 Apr 2021 01:01:27 +0300 Subject: [PATCH 024/147] New/NEW Product Variants API, add variant stock to response When acessing product variants via GET API /products/{id}/variants, Include stock_warehouse data to the response --- htdocs/product/class/api_products.class.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index 9b06b30765d..78afe88c310 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -25,6 +25,7 @@ require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductAttribute.class.php'; require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductAttributeValue.class.php'; require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductCombination.class.php'; require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductCombination2ValuePair.class.php'; +require_once DOL_DOCUMENT_ROOT.'/product/stock/class/productstockentrepot.class.php'; /** * API class for products @@ -1574,6 +1575,11 @@ class Products extends DolibarrApi $prodc2vp = new ProductCombination2ValuePair($this->db); $combinations[$key]->attributes = $prodc2vp->fetchByFkCombination((int) $combination->id); $combinations[$key] = $this->_cleanObjectDatas($combinations[$key]); + + $productModel = new Product($this->db); + $productModel->fetch((int)$combination->fk_product_child); + $productModel->load_stock(); + $combinations[$key]->stock_warehouse = $this->_cleanObjectDatas($productModel)->stock_warehouse; } return $combinations; From 1c1e111b0c57608ee07c7f9ae352ddc53e82cdcb Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Mon, 26 Apr 2021 22:06:11 +0000 Subject: [PATCH 025/147] Fixing style errors. --- htdocs/product/class/api_products.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index 78afe88c310..4d06cbce5bc 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -1577,7 +1577,7 @@ class Products extends DolibarrApi $combinations[$key] = $this->_cleanObjectDatas($combinations[$key]); $productModel = new Product($this->db); - $productModel->fetch((int)$combination->fk_product_child); + $productModel->fetch((int) $combination->fk_product_child); $productModel->load_stock(); $combinations[$key]->stock_warehouse = $this->_cleanObjectDatas($productModel)->stock_warehouse; } From 6353084777b62ed3adf0344146b9f052ef6c6f52 Mon Sep 17 00:00:00 2001 From: Anthony Berton <34568357+bb2a@users.noreply.github.com> Date: Tue, 27 Apr 2021 00:22:39 +0200 Subject: [PATCH 026/147] init --- htdocs/admin/pdf.php | 4 + htdocs/admin/pdf_intervention.php | 110 ++++++++++++++++++++++++ htdocs/admin/pdf_invoice.php | 110 ++++++++++++++++++++++++ htdocs/admin/pdf_order.php | 110 ++++++++++++++++++++++++ htdocs/admin/pdf_project.php | 110 ++++++++++++++++++++++++ htdocs/admin/pdf_proposal.php | 123 +++++++++++++++++++++++++++ htdocs/admin/pdf_recruitment.php | 110 ++++++++++++++++++++++++ htdocs/admin/pdf_supplierinvoice.php | 110 ++++++++++++++++++++++++ htdocs/admin/pdf_supplierorder.php | 110 ++++++++++++++++++++++++ htdocs/core/lib/pdf.lib.php | 80 +++++++++++++++++ htdocs/langs/en_US/admin.lang | 12 +++ 11 files changed, 989 insertions(+) create mode 100644 htdocs/admin/pdf_intervention.php create mode 100644 htdocs/admin/pdf_invoice.php create mode 100644 htdocs/admin/pdf_order.php create mode 100644 htdocs/admin/pdf_project.php create mode 100644 htdocs/admin/pdf_proposal.php create mode 100644 htdocs/admin/pdf_recruitment.php create mode 100644 htdocs/admin/pdf_supplierinvoice.php create mode 100644 htdocs/admin/pdf_supplierorder.php diff --git a/htdocs/admin/pdf.php b/htdocs/admin/pdf.php index a5c2770a9c4..0ee42d6cddf 100644 --- a/htdocs/admin/pdf.php +++ b/htdocs/admin/pdf.php @@ -161,6 +161,10 @@ if (class_exists('TCPDI')) { print load_fiche_titre($langs->trans("PDF"), '', 'title_setup'); +$head = pdf_admin_prepare_head(); + +print dol_get_fiche_head($head, 'general', $langs->trans("PDF"), -1, 'pdf'); + print ''.$form->textwithpicto($langs->trans("PDFDesc"), $s)."
\n"; print "
\n"; diff --git a/htdocs/admin/pdf_intervention.php b/htdocs/admin/pdf_intervention.php new file mode 100644 index 00000000000..f7a0244f9ab --- /dev/null +++ b/htdocs/admin/pdf_intervention.php @@ -0,0 +1,110 @@ + + * Copyright (C) 2004-2012 Laurent Destailleur + * Copyright (C) 2005-2011 Regis Houssin + * Copyright (C) 2012-2107 Juanjo Menent + * Copyright (C) 2019 Ferran Marcet + * Copyright (C) 2021 Anthony Berton + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/admin/pdf.php + * \brief Page to setup PDF options + */ + +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; + +// Load translation files required by the page +$langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'stocks')); + +if (!$user->admin) { + accessforbidden(); +} + +$action = GETPOST('action', 'aZ09'); +$cancel = GETPOST('cancel', 'alpha'); + + +/* + * Actions + */ + +if ($cancel) { + $action = ''; +} + +if ($action == 'update') { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + + header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup"); + exit; +} + + + +/* + * View + */ + +$wikihelp = 'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones'; +llxHeader('', $langs->trans("Setup"), $wikihelp); + +$form = new Form($db); +$formother = new FormOther($db); +$formadmin = new FormAdmin($db); + +print load_fiche_titre($langs->trans("PDF"), '', 'title_setup'); + +$head = pdf_admin_prepare_head(); + +print dol_get_fiche_head($head, 'intervention', $langs->trans("Intervention"), -1, 'pdf'); + +print ''.$form->textwithpicto($langs->trans("PDFInterventionDesc"), $s)."
\n"; +print "
\n"; + +print '
'; +print ''; +print ''; + +print '
'; +print ''; +print ''; + + +print ''; + +print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("").''; + +print '
'; +print '
'; + + +print '
'; +print ''; +print '
'; + +print '
'; + + +// End of page +llxFooter(); +$db->close(); diff --git a/htdocs/admin/pdf_invoice.php b/htdocs/admin/pdf_invoice.php new file mode 100644 index 00000000000..69859b9ea30 --- /dev/null +++ b/htdocs/admin/pdf_invoice.php @@ -0,0 +1,110 @@ + + * Copyright (C) 2004-2012 Laurent Destailleur + * Copyright (C) 2005-2011 Regis Houssin + * Copyright (C) 2012-2107 Juanjo Menent + * Copyright (C) 2019 Ferran Marcet + * Copyright (C) 2021 Anthony Berton + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/admin/pdf.php + * \brief Page to setup PDF options + */ + +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; + +// Load translation files required by the page +$langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'stocks')); + +if (!$user->admin) { + accessforbidden(); +} + +$action = GETPOST('action', 'aZ09'); +$cancel = GETPOST('cancel', 'alpha'); + + +/* + * Actions + */ + +if ($cancel) { + $action = ''; +} + +if ($action == 'update') { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + + header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup"); + exit; +} + + + +/* + * View + */ + +$wikihelp = 'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones'; +llxHeader('', $langs->trans("Setup"), $wikihelp); + +$form = new Form($db); +$formother = new FormOther($db); +$formadmin = new FormAdmin($db); + +print load_fiche_titre($langs->trans("PDF"), '', 'title_setup'); + +$head = pdf_admin_prepare_head(); + +print dol_get_fiche_head($head, 'invoice', $langs->trans("Invoice"), -1, 'pdf'); + +print ''.$form->textwithpicto($langs->trans("PDFInvoiceDesc"), $s)."
\n"; +print "
\n"; + +print '
'; +print ''; +print ''; + +print '
'; +print ''; +print ''; + + +print ''; + +print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("").''; + +print '
'; +print '
'; + + +print '
'; +print ''; +print '
'; + +print '
'; + + +// End of page +llxFooter(); +$db->close(); diff --git a/htdocs/admin/pdf_order.php b/htdocs/admin/pdf_order.php new file mode 100644 index 00000000000..e3a725eb33a --- /dev/null +++ b/htdocs/admin/pdf_order.php @@ -0,0 +1,110 @@ + + * Copyright (C) 2004-2012 Laurent Destailleur + * Copyright (C) 2005-2011 Regis Houssin + * Copyright (C) 2012-2107 Juanjo Menent + * Copyright (C) 2019 Ferran Marcet + * Copyright (C) 2021 Anthony Berton + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/admin/pdf.php + * \brief Page to setup PDF options + */ + +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; + +// Load translation files required by the page +$langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'stocks')); + +if (!$user->admin) { + accessforbidden(); +} + +$action = GETPOST('action', 'aZ09'); +$cancel = GETPOST('cancel', 'alpha'); + + +/* + * Actions + */ + +if ($cancel) { + $action = ''; +} + +if ($action == 'update') { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + + header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup"); + exit; +} + + + +/* + * View + */ + +$wikihelp = 'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones'; +llxHeader('', $langs->trans("Setup"), $wikihelp); + +$form = new Form($db); +$formother = new FormOther($db); +$formadmin = new FormAdmin($db); + +print load_fiche_titre($langs->trans("PDF"), '', 'title_setup'); + +$head = pdf_admin_prepare_head(); + +print dol_get_fiche_head($head, 'order', $langs->trans("Order"), -1, 'pdf'); + +print ''.$form->textwithpicto($langs->trans("PDFOrderDesc"), $s)."
\n"; +print "
\n"; + +print '
'; +print ''; +print ''; + +print '
'; +print ''; +print ''; + + +print ''; + +print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("").''; + +print '
'; +print '
'; + + +print '
'; +print ''; +print '
'; + +print '
'; + + +// End of page +llxFooter(); +$db->close(); diff --git a/htdocs/admin/pdf_project.php b/htdocs/admin/pdf_project.php new file mode 100644 index 00000000000..7e05c24ed56 --- /dev/null +++ b/htdocs/admin/pdf_project.php @@ -0,0 +1,110 @@ + + * Copyright (C) 2004-2012 Laurent Destailleur + * Copyright (C) 2005-2011 Regis Houssin + * Copyright (C) 2012-2107 Juanjo Menent + * Copyright (C) 2019 Ferran Marcet + * Copyright (C) 2021 Anthony Berton + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/admin/pdf.php + * \brief Page to setup PDF options + */ + +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; + +// Load translation files required by the page +$langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'stocks')); + +if (!$user->admin) { + accessforbidden(); +} + +$action = GETPOST('action', 'aZ09'); +$cancel = GETPOST('cancel', 'alpha'); + + +/* + * Actions + */ + +if ($cancel) { + $action = ''; +} + +if ($action == 'update') { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + + header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup"); + exit; +} + + + +/* + * View + */ + +$wikihelp = 'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones'; +llxHeader('', $langs->trans("Setup"), $wikihelp); + +$form = new Form($db); +$formother = new FormOther($db); +$formadmin = new FormAdmin($db); + +print load_fiche_titre($langs->trans("PDF"), '', 'title_setup'); + +$head = pdf_admin_prepare_head(); + +print dol_get_fiche_head($head, 'project', $langs->trans("Project"), -1, 'pdf'); + +print ''.$form->textwithpicto($langs->trans("PDFProjectDesc"), $s)."
\n"; +print "
\n"; + +print '
'; +print ''; +print ''; + +print '
'; +print ''; +print ''; + + +print ''; + +print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("").''; + +print '
'; +print '
'; + + +print '
'; +print ''; +print '
'; + +print '
'; + + +// End of page +llxFooter(); +$db->close(); diff --git a/htdocs/admin/pdf_proposal.php b/htdocs/admin/pdf_proposal.php new file mode 100644 index 00000000000..dc35a1cd538 --- /dev/null +++ b/htdocs/admin/pdf_proposal.php @@ -0,0 +1,123 @@ + + * Copyright (C) 2004-2012 Laurent Destailleur + * Copyright (C) 2005-2011 Regis Houssin + * Copyright (C) 2012-2107 Juanjo Menent + * Copyright (C) 2019 Ferran Marcet + * Copyright (C) 2021 Anthony Berton + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/admin/pdf.php + * \brief Page to setup PDF options + */ + +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; + +// Load translation files required by the page +$langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'stocks')); + +if (!$user->admin) { + accessforbidden(); +} + +$action = GETPOST('action', 'aZ09'); +$cancel = GETPOST('cancel', 'alpha'); + + +/* + * Actions + */ + +if ($cancel) { + $action = ''; +} + +if ($action == 'update') { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + + header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup"); + exit; +} + + + +/* + * View + */ + +$wikihelp = 'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones'; +llxHeader('', $langs->trans("Setup"), $wikihelp); + +$form = new Form($db); +$formother = new FormOther($db); +$formadmin = new FormAdmin($db); + +print load_fiche_titre($langs->trans("PDF"), '', 'title_setup'); + +$head = pdf_admin_prepare_head(); + +print dol_get_fiche_head($head, 'proposal', $langs->trans("Proposals"), -1, 'pdf'); + +print ''.$form->textwithpicto($langs->trans("PDFProposalDesc"), $s)."
\n"; +print "
\n"; + +print '
'; +print ''; +print ''; + +print '
'; +print ''; +print ''; + +print ''; + +print ''; + +print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("MAIN_GENERATE_PROPOSALS_WITH_PICTURE").''; +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('MAIN_GENERATE_PROPOSALS_WITH_PICTURE'); +} else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("MAIN_GENERATE_PROPOSALS_WITH_PICTURE", $arrval, $conf->global->MAIN_GENERATE_PROPOSALS_WITH_PICTURE); +} +print '
'.$langs->trans("MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING").''; +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING'); +} else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING", $arrval, $conf->global->MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING); +} +print '
'; +print '
'; + + +print '
'; +print ''; +print '
'; + +print '
'; + + +// End of page +llxFooter(); +$db->close(); diff --git a/htdocs/admin/pdf_recruitment.php b/htdocs/admin/pdf_recruitment.php new file mode 100644 index 00000000000..4e81e70802c --- /dev/null +++ b/htdocs/admin/pdf_recruitment.php @@ -0,0 +1,110 @@ + + * Copyright (C) 2004-2012 Laurent Destailleur + * Copyright (C) 2005-2011 Regis Houssin + * Copyright (C) 2012-2107 Juanjo Menent + * Copyright (C) 2019 Ferran Marcet + * Copyright (C) 2021 Anthony Berton + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/admin/pdf.php + * \brief Page to setup PDF options + */ + +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; + +// Load translation files required by the page +$langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'stocks')); + +if (!$user->admin) { + accessforbidden(); +} + +$action = GETPOST('action', 'aZ09'); +$cancel = GETPOST('cancel', 'alpha'); + + +/* + * Actions + */ + +if ($cancel) { + $action = ''; +} + +if ($action == 'update') { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + + header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup"); + exit; +} + + + +/* + * View + */ + +$wikihelp = 'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones'; +llxHeader('', $langs->trans("Setup"), $wikihelp); + +$form = new Form($db); +$formother = new FormOther($db); +$formadmin = new FormAdmin($db); + +print load_fiche_titre($langs->trans("PDF"), '', 'title_setup'); + +$head = pdf_admin_prepare_head(); + +print dol_get_fiche_head($head, 'recruitment', $langs->trans("recruitment"), -1, 'pdf'); + +print ''.$form->textwithpicto($langs->trans("PDFRecruitmentDesc"), $s)."
\n"; +print "
\n"; + +print '
'; +print ''; +print ''; + +print '
'; +print ''; +print ''; + + +print ''; + +print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("").''; + +print '
'; +print '
'; + + +print '
'; +print ''; +print '
'; + +print '
'; + + +// End of page +llxFooter(); +$db->close(); diff --git a/htdocs/admin/pdf_supplierinvoice.php b/htdocs/admin/pdf_supplierinvoice.php new file mode 100644 index 00000000000..c244e70457b --- /dev/null +++ b/htdocs/admin/pdf_supplierinvoice.php @@ -0,0 +1,110 @@ + + * Copyright (C) 2004-2012 Laurent Destailleur + * Copyright (C) 2005-2011 Regis Houssin + * Copyright (C) 2012-2107 Juanjo Menent + * Copyright (C) 2019 Ferran Marcet + * Copyright (C) 2021 Anthony Berton + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/admin/pdf.php + * \brief Page to setup PDF options + */ + +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; + +// Load translation files required by the page +$langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'stocks')); + +if (!$user->admin) { + accessforbidden(); +} + +$action = GETPOST('action', 'aZ09'); +$cancel = GETPOST('cancel', 'alpha'); + + +/* + * Actions + */ + +if ($cancel) { + $action = ''; +} + +if ($action == 'update') { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + + header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup"); + exit; +} + + + +/* + * View + */ + +$wikihelp = 'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones'; +llxHeader('', $langs->trans("Setup"), $wikihelp); + +$form = new Form($db); +$formother = new FormOther($db); +$formadmin = new FormAdmin($db); + +print load_fiche_titre($langs->trans("PDF"), '', 'title_setup'); + +$head = pdf_admin_prepare_head(); + +print dol_get_fiche_head($head, 'supplierinvoice', $langs->trans("supplierinvoice"), -1, 'pdf'); + +print ''.$form->textwithpicto($langs->trans("PDFSupplierinvoiceDesc"), $s)."
\n"; +print "
\n"; + +print '
'; +print ''; +print ''; + +print '
'; +print ''; +print ''; + + +print ''; + +print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("").''; + +print '
'; +print '
'; + + +print '
'; +print ''; +print '
'; + +print '
'; + + +// End of page +llxFooter(); +$db->close(); diff --git a/htdocs/admin/pdf_supplierorder.php b/htdocs/admin/pdf_supplierorder.php new file mode 100644 index 00000000000..98340aced97 --- /dev/null +++ b/htdocs/admin/pdf_supplierorder.php @@ -0,0 +1,110 @@ + + * Copyright (C) 2004-2012 Laurent Destailleur + * Copyright (C) 2005-2011 Regis Houssin + * Copyright (C) 2012-2107 Juanjo Menent + * Copyright (C) 2019 Ferran Marcet + * Copyright (C) 2021 Anthony Berton + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/admin/pdf.php + * \brief Page to setup PDF options + */ + +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; + +// Load translation files required by the page +$langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'stocks')); + +if (!$user->admin) { + accessforbidden(); +} + +$action = GETPOST('action', 'aZ09'); +$cancel = GETPOST('cancel', 'alpha'); + + +/* + * Actions + */ + +if ($cancel) { + $action = ''; +} + +if ($action == 'update') { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + + header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup"); + exit; +} + + + +/* + * View + */ + +$wikihelp = 'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones'; +llxHeader('', $langs->trans("Setup"), $wikihelp); + +$form = new Form($db); +$formother = new FormOther($db); +$formadmin = new FormAdmin($db); + +print load_fiche_titre($langs->trans("PDF"), '', 'title_setup'); + +$head = pdf_admin_prepare_head(); + +print dol_get_fiche_head($head, 'supplierorder', $langs->trans("supplierorder"), -1, 'pdf'); + +print ''.$form->textwithpicto($langs->trans("PDFSupplierorderDesc"), $s)."
\n"; +print "
\n"; + +print '
'; +print ''; +print ''; + +print '
'; +print ''; +print ''; + + +print ''; + +print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("").''; + +print '
'; +print '
'; + + +print '
'; +print ''; +print '
'; + +print '
'; + + +// End of page +llxFooter(); +$db->close(); diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 529355b94b2..1d55b45c221 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -12,6 +12,7 @@ * Copyright (C) 2015-2016 Marcos García * Copyright (C) 2019 Lenin Rivas * Copyright (C) 2020 Nicolas ZABOURI + * Copyright (C) 2021 Anthony Berton * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -35,6 +36,85 @@ */ +/** + * Return array head with list of tabs to view object informations. + * + * @return array head array with tabs + */ +function pdf_admin_prepare_head() +{ + global $langs, $conf, $user; + + $h = 0; + $head = array(); + + $head[$h][0] = DOL_URL_ROOT.'/admin/pdf.php'; + $head[$h][1] = $langs->trans("Général"); + $head[$h][2] = 'general'; + $h++; + + // Show more tabs from modules + // Entries must be declared in modules descriptor with line + // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab + // $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab + complete_head_from_modules($conf, $langs, null, $head, $h, 'pdf_admin'); + + $head[$h][0] = DOL_URL_ROOT.'/admin/pdf_project.php'; + $head[$h][1] = $langs->trans("Project"); + $head[$h][2] = 'project'; + $h++; + + $head[$h][0] = DOL_URL_ROOT.'/admin/pdf_proposal.php'; + $head[$h][1] = $langs->trans("Proposal"); + $head[$h][2] = 'proposal'; + $h++; + + $head[$h][0] = DOL_URL_ROOT.'/admin/pdf_order.php'; + $head[$h][1] = $langs->trans("Order"); + $head[$h][2] = 'order'; + $h++; + + $head[$h][0] = DOL_URL_ROOT.'/admin/pdf_invoice.php'; + $head[$h][1] = $langs->trans("Invoice"); + $head[$h][2] = 'invoice'; + $h++; + + $head[$h][0] = DOL_URL_ROOT.'/admin/pdf_Ticket.php'; + $head[$h][1] = $langs->trans("Ticket"); + $head[$h][2] = 'ticket'; + $h++; + + $head[$h][0] = DOL_URL_ROOT.'/admin/pdf_intervention.php'; + $head[$h][1] = $langs->trans("Intervention"); + $head[$h][2] = 'intervention'; + $h++; + + $head[$h][0] = DOL_URL_ROOT.'/admin/pdf_supplierproposal.php'; + $head[$h][1] = $langs->trans("SupplierProposal"); + $head[$h][2] = 'supplierproposal'; + $h++; + + $head[$h][0] = DOL_URL_ROOT.'/admin/pdf_supplierorder.php'; + $head[$h][1] = $langs->trans("SupplierOrder"); + $head[$h][2] = 'supplierorder'; + $h++; + + $head[$h][0] = DOL_URL_ROOT.'/admin/pdf_supplierinvoice.php'; + $head[$h][1] = $langs->trans("SuppliersInvoice"); + $head[$h][2] = 'supplierinvoice'; + $h++; + + $head[$h][0] = DOL_URL_ROOT.'/admin/pdf_recruitment.php'; + $head[$h][1] = $langs->trans("Recruitment"); + $head[$h][2] = 'recruitment'; + $h++; + + complete_head_from_modules($conf, $langs, null, $head, $h, 'pdf_admin', 'remove'); + + return $head; +} + + /** * Return array with format properties of default PDF format * diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 6a11c26c50c..4fb5952bf5b 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -398,6 +398,16 @@ SecurityToken=Key to secure URLs NoSmsEngine=No SMS sender manager available. A SMS sender manager is not installed with the default distribution because they depend on an external vendor, but you can find some on %s PDF=PDF PDFDesc=Global options for PDF generation +PDFProjectDesc=PDF Option for project +PDFProposalDesc=PDF Option for proposal +PDFOrderDesc=PDF Option for order +PDFInvoiceDesc=PDF Option for invoice +PDFTicketDesc=PDF Option for ticket +PDFInterventionDesc=PDF option for intervention +PDFSupplierproposalDesc=PDF Option for supplier proposal +PDFSupplierorderDesc=PDF Option for supplier order +PDFSupplierinvoiceDesc=PDF Option for supplier invoice +PDFRecruitmentDesc=PDF Option for recrutment PDFAddressForging=Rules for address section HideAnyVATInformationOnPDF=Hide all information related to Sales Tax / VAT PDFRulesForSalesTax=Rules for Sales Tax / VAT @@ -1977,6 +1987,8 @@ MAIN_PDF_MARGIN_RIGHT=Right margin on PDF MAIN_PDF_MARGIN_TOP=Top margin on PDF MAIN_PDF_MARGIN_BOTTOM=Bottom margin on PDF MAIN_DOCUMENTS_LOGO_HEIGHT=Height for logo on PDF +MAIN_GENERATE_PROPOSALS_WITH_PICTURE=Add picture on proposal ligne +MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING=Add electronic sign in PDF NothingToSetup=There is no specific setup required for this module. SetToYesIfGroupIsComputationOfOtherGroups=Set this to yes if this group is a computation of other groups EnterCalculationRuleIfPreviousFieldIsYes=Enter calculation rule if previous field was set to Yes.
For example:
CODEGRP1+CODEGRP2 From e7242cb87fcb7faef52e368b22caf7ecf630a431 Mon Sep 17 00:00:00 2001 From: Anthony Berton <34568357+bb2a@users.noreply.github.com> Date: Tue, 27 Apr 2021 00:23:59 +0200 Subject: [PATCH 027/147] next --- htdocs/admin/pdf_supplierproposal.php | 110 ++++++++++++++++++++++++++ htdocs/admin/pdf_ticket.php | 110 ++++++++++++++++++++++++++ 2 files changed, 220 insertions(+) create mode 100644 htdocs/admin/pdf_supplierproposal.php create mode 100644 htdocs/admin/pdf_ticket.php diff --git a/htdocs/admin/pdf_supplierproposal.php b/htdocs/admin/pdf_supplierproposal.php new file mode 100644 index 00000000000..45fd337354a --- /dev/null +++ b/htdocs/admin/pdf_supplierproposal.php @@ -0,0 +1,110 @@ + + * Copyright (C) 2004-2012 Laurent Destailleur + * Copyright (C) 2005-2011 Regis Houssin + * Copyright (C) 2012-2107 Juanjo Menent + * Copyright (C) 2019 Ferran Marcet + * Copyright (C) 2021 Anthony Berton + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/admin/pdf.php + * \brief Page to setup PDF options + */ + +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; + +// Load translation files required by the page +$langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'stocks')); + +if (!$user->admin) { + accessforbidden(); +} + +$action = GETPOST('action', 'aZ09'); +$cancel = GETPOST('cancel', 'alpha'); + + +/* + * Actions + */ + +if ($cancel) { + $action = ''; +} + +if ($action == 'update') { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + + header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup"); + exit; +} + + + +/* + * View + */ + +$wikihelp = 'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones'; +llxHeader('', $langs->trans("Setup"), $wikihelp); + +$form = new Form($db); +$formother = new FormOther($db); +$formadmin = new FormAdmin($db); + +print load_fiche_titre($langs->trans("PDF"), '', 'title_setup'); + +$head = pdf_admin_prepare_head(); + +print dol_get_fiche_head($head, 'supplierproposal', $langs->trans("supplierproposal"), -1, 'pdf'); + +print ''.$form->textwithpicto($langs->trans("PDFSupplierproposalDesc"), $s)."
\n"; +print "
\n"; + +print '
'; +print ''; +print ''; + +print '
'; +print ''; +print ''; + + +print ''; + +print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("").''; + +print '
'; +print '
'; + + +print '
'; +print ''; +print '
'; + +print '
'; + + +// End of page +llxFooter(); +$db->close(); diff --git a/htdocs/admin/pdf_ticket.php b/htdocs/admin/pdf_ticket.php new file mode 100644 index 00000000000..b8fbaed3b5c --- /dev/null +++ b/htdocs/admin/pdf_ticket.php @@ -0,0 +1,110 @@ + + * Copyright (C) 2004-2012 Laurent Destailleur + * Copyright (C) 2005-2011 Regis Houssin + * Copyright (C) 2012-2107 Juanjo Menent + * Copyright (C) 2019 Ferran Marcet + * Copyright (C) 2021 Anthony Berton + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/admin/pdf.php + * \brief Page to setup PDF options + */ + +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; + +// Load translation files required by the page +$langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'stocks')); + +if (!$user->admin) { + accessforbidden(); +} + +$action = GETPOST('action', 'aZ09'); +$cancel = GETPOST('cancel', 'alpha'); + + +/* + * Actions + */ + +if ($cancel) { + $action = ''; +} + +if ($action == 'update') { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + + header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup"); + exit; +} + + + +/* + * View + */ + +$wikihelp = 'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones'; +llxHeader('', $langs->trans("Setup"), $wikihelp); + +$form = new Form($db); +$formother = new FormOther($db); +$formadmin = new FormAdmin($db); + +print load_fiche_titre($langs->trans("PDF"), '', 'title_setup'); + +$head = pdf_admin_prepare_head(); + +print dol_get_fiche_head($head, 'ticket', $langs->trans("Ticket"), -1, 'pdf'); + +print ''.$form->textwithpicto($langs->trans("PDFTicketDesc"), $s)."
\n"; +print "
\n"; + +print '
'; +print ''; +print ''; + +print '
'; +print ''; +print ''; + + +print ''; + +print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("").''; + +print '
'; +print '
'; + + +print '
'; +print ''; +print '
'; + +print '
'; + + +// End of page +llxFooter(); +$db->close(); From e8c2085abd328a76e9d1f0841df4a0eb666927fa Mon Sep 17 00:00:00 2001 From: Adrien Raze Date: Tue, 27 Apr 2021 09:24:22 +0200 Subject: [PATCH 028/147] FIX : Change parameters MF to MS for price2num() function --- htdocs/core/boxes/box_produits_alerte_stock.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/boxes/box_produits_alerte_stock.php b/htdocs/core/boxes/box_produits_alerte_stock.php index 7982181f7ca..74b0703ccfa 100644 --- a/htdocs/core/boxes/box_produits_alerte_stock.php +++ b/htdocs/core/boxes/box_produits_alerte_stock.php @@ -203,7 +203,7 @@ class box_produits_alerte_stock extends ModeleBoxes $this->info_box_contents[$line][] = array( 'td' => 'class="center"', - 'text' => price2num($objp->total_stock, 'MF').' / '.$objp->seuil_stock_alerte, + 'text' => price2num($objp->total_stock, 'MS').' / '.$objp->seuil_stock_alerte, 'text2'=>img_warning($langs->transnoentitiesnoconv("StockLowerThanLimit", $objp->seuil_stock_alerte)), ); From b573d81e4596dc98577b13e4a45304626b5528bc Mon Sep 17 00:00:00 2001 From: Antonin MARCHAL Date: Tue, 27 Apr 2021 09:54:38 +0200 Subject: [PATCH 029/147] fix(lint) eldy's remarks + other table used --- htdocs/product/class/product.class.php | 32 ++++++++++++-------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 83354384e8b..bf1cfa1c244 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -2181,17 +2181,20 @@ class Product extends CommonObject } else { $sql .= " pa.accountancy_code_buy, pa.accountancy_code_buy_intra, pa.accountancy_code_buy_export, pa.accountancy_code_sell, pa.accountancy_code_sell_intra, pa.accountancy_code_sell_export,"; } - //For MultiCompany PMP per entity + + //For MultiCompany + //PMP per entity & Stocks Sharings stock_reel includes only stocks shared with this entity + //TODO : Add to Dolibarr update : SQL ; + $separatedEntityPMP = false; - if (!empty($conf->global->MULTICOMPANY_PRODUCT_SHARING_ENABLED) && !empty($conf->global->MULTICOMPANY_PMP_PER_ENTITY_ENABLED)) { - $checkPMPPerEntity = $this->db->query("SELECT pmp FROM " . MAIN_DB_PREFIX . "entity_product_pmp WHERE fk_product = ".((int) $id)." AND entity = ".(int) $conf->entity); - if ($this->db->num_rows($checkPMPPerEntity)>0) { - $separatedEntityPMP = true; - } - } - //For MultiCompany Stocks Sharings stock_reel includes only stocks shared with this entity $separatedStock = false; - if (!empty($conf->global->MULTICOMPANY_STOCK_SHARING_ENABLED)) { + if (!empty($conf->global->MULTICOMPANY_PRODUCT_SHARING_ENABLED)) { + if (!empty($conf->global->MULTICOMPANY_PMP_PER_ENTITY_ENABLED)) { + $checkPMPPerEntity = $this->db->query("SELECT pmp FROM " . MAIN_DB_PREFIX . "product_perentity WHERE fk_product = ".((int) $id)." AND entity = ".(int) $conf->entity); + if ($this->db->num_rows($checkPMPPerEntity)>0) { + $separatedEntityPMP = true; + } + } global $mc; $separatedStock = true; $visibleWarehousesEntities = $conf->entity; @@ -2199,24 +2202,22 @@ class Product extends CommonObject $visibleWarehousesEntities .= "," . implode(",", $mc->sharings['stock']); } } + if ($separatedStock) { $sql .= " SUM(sp.reel) as stock,"; } else { $sql .= " p.stock,"; } if ($separatedEntityPMP) { - $sql .= " ppe.pmp, p.datec, p.tms, p.import_key, p.entity, p.desiredstock, p.tobatch, p.batch_mask, p.fk_unit,"; + $sql .= " pa.pmp, p.datec, p.tms, p.import_key, p.entity, p.desiredstock, p.tobatch, p.batch_mask, p.fk_unit,"; } else { $sql .= " p.pmp, p.datec, p.tms, p.import_key, p.entity, p.desiredstock, p.tobatch, p.batch_mask, p.fk_unit,"; } $sql .= " p.fk_price_expression, p.price_autogen, p.model_pdf"; $sql .= " FROM ".MAIN_DB_PREFIX."product as p"; - if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { + if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) || $separatedEntityPMP) { $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as pa ON pa.fk_product = p.rowid AND pa.entity = " . ((int) $conf->entity); } - if ($separatedEntityPMP) { - $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "entity_product_pmp as ppe ON ppe.fk_product = p.rowid"; - } if ($separatedStock) { $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_stock as sp ON sp.fk_product = p.rowid"; } @@ -2232,9 +2233,6 @@ class Product extends CommonObject $sql .= " AND p.barcode = '".$this->db->escape($barcode)."'"; } } - if ($separatedEntityPMP) { - $sql .= " AND ppe.entity = " . (int) $conf->entity; - } if ($separatedStock) { $sql .= " AND sp.fk_entrepot IN ( SELECT rowid From 5fd0c1b81002de20cc13e162d0313ccd208a3a8e Mon Sep 17 00:00:00 2001 From: Antonin MARCHAL Date: Tue, 27 Apr 2021 09:55:35 +0200 Subject: [PATCH 030/147] fix(code)eldy's remarks --- htdocs/install/mysql/migration/13.0.0-14.0.0.sql | 3 +++ htdocs/product/stock/card.php | 6 +++--- htdocs/product/stock/class/entrepot.class.php | 6 +++--- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql index e762ddd94e4..652be6ec035 100644 --- a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql +++ b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql @@ -436,3 +436,6 @@ ALTER TABLE llx_entrepot ADD COLUMN fk_project INTEGER DEFAULT NULL AFTER entity UPDATE llx_const SET value = 'github' WHERE __DECRYPT('name')__ = 'MAIN_BUGTRACK_ENABLELINK' AND __DECRYPT('value')__ = 1; +-- For MultiCompany PMP per entity +ALTER TABLE llx_product_perentity ADD pmp FLOAT NULL DEFAULT NULL AFTER accountancy_code_buy_export + diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php index 1faa19be499..2a88e8191e8 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -604,7 +604,7 @@ if ($action == 'create') { $sql = "SELECT p.rowid as rowid, p.ref, p.label as produit, p.tobatch, p.fk_product_type as type, p.price, p.price_ttc, p.entity,"; if ($separatedPMP) { - $sql .= " ppe.pmp as ppmp,"; + $sql .= " pa.pmp as ppmp,"; } else { $sql .= " p.pmp as ppmp,"; } @@ -615,7 +615,7 @@ if ($action == 'create') { $sql .= " FROM ".MAIN_DB_PREFIX."product_stock as ps, ".MAIN_DB_PREFIX."product as p"; if ($separatedPMP) { - $sql .= ", ".MAIN_DB_PREFIX."entity_product_pmp as ppe"; + $sql .= ", ".MAIN_DB_PREFIX."product_perentity as pa"; } $sql .= " WHERE ps.fk_product = p.rowid"; @@ -623,7 +623,7 @@ if ($action == 'create') { $sql .= " AND ps.fk_entrepot = ".$object->id; if ($separatedPMP) { - $sql .= " AND ppe.fk_product = p.rowid AND ppe.entity = ". (int) $conf->entity; + $sql .= " AND pa.fk_product = p.rowid AND pa.entity = ". (int) $conf->entity; } $sql .= $db->order($sortfield, $sortorder); diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index b1c41d24ef3..dc15e092155 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -621,18 +621,18 @@ class Entrepot extends CommonObject } if ($separatedPMP) { - $sql = "SELECT sum(ps.reel) as nb, sum(ps.reel * ppe.pmp) as value"; + $sql = "SELECT sum(ps.reel) as nb, sum(ps.reel * pa.pmp) as value"; } else { $sql = "SELECT sum(ps.reel) as nb, sum(ps.reel * p.pmp) as value"; } $sql .= " FROM ".MAIN_DB_PREFIX."product_stock as ps"; $sql .= ", ".MAIN_DB_PREFIX."product as p"; if ($separatedPMP) { - $sql .= ", ".MAIN_DB_PREFIX."entity_product_pmp as ppe"; + $sql .= ", ".MAIN_DB_PREFIX."product_perentity as pa"; } $sql .= " WHERE ps.fk_entrepot = ".$this->id; if ($separatedPMP) { - $sql .= " AND ppe.fk_product = p.rowid AND ppe.entity = ". (int) $conf->entity; + $sql .= " AND pa.fk_product = p.rowid AND pa.entity = ". (int) $conf->entity; } $sql .= " AND ps.fk_product = p.rowid"; //print $sql; From c865199a783326e5a36cd5b64cc248c6d2926db8 Mon Sep 17 00:00:00 2001 From: Antonin MARCHAL Date: Tue, 27 Apr 2021 09:58:36 +0200 Subject: [PATCH 031/147] lint(stickler) --- htdocs/product/class/product.class.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index bf1cfa1c244..5b6ba2762c9 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -2181,11 +2181,9 @@ class Product extends CommonObject } else { $sql .= " pa.accountancy_code_buy, pa.accountancy_code_buy_intra, pa.accountancy_code_buy_export, pa.accountancy_code_sell, pa.accountancy_code_sell_intra, pa.accountancy_code_sell_export,"; } - - //For MultiCompany - //PMP per entity & Stocks Sharings stock_reel includes only stocks shared with this entity - //TODO : Add to Dolibarr update : SQL ; + //For MultiCompany + //PMP per entity & Stocks Sharings stock_reel includes only stocks shared with this entity $separatedEntityPMP = false; $separatedStock = false; if (!empty($conf->global->MULTICOMPANY_PRODUCT_SHARING_ENABLED)) { From 00ef5b94bf3fc9032fcac36119638369fa9bea1b Mon Sep 17 00:00:00 2001 From: Antonin MARCHAL Date: Tue, 27 Apr 2021 09:59:33 +0200 Subject: [PATCH 032/147] lint(stickler) --- htdocs/product/class/product.class.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 5b6ba2762c9..9c773d6382d 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -2200,7 +2200,6 @@ class Product extends CommonObject $visibleWarehousesEntities .= "," . implode(",", $mc->sharings['stock']); } } - if ($separatedStock) { $sql .= " SUM(sp.reel) as stock,"; } else { From 5d1d6eee95d4bbebd713dbd8a5281fb28647716d Mon Sep 17 00:00:00 2001 From: Antonin MARCHAL Date: Tue, 27 Apr 2021 10:51:15 +0200 Subject: [PATCH 033/147] add(pmp) on Warehouse List --- htdocs/product/stock/list.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/htdocs/product/stock/list.php b/htdocs/product/stock/list.php index d49db2f7b02..ae8b13c776f 100644 --- a/htdocs/product/stock/list.php +++ b/htdocs/product/stock/list.php @@ -208,7 +208,16 @@ if (!empty($extrafields->attributes[$object->table_element]['label'])) { $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.' as options_'.$key.', ' : ''); } } -$sql .= " SUM(p.pmp * ps.reel) as estimatedvalue, SUM(p.price * ps.reel) as sellvalue, SUM(ps.reel) as stockqty"; + +//For Multicompany PMP per entity +$separatedPMP = false; +if (!empty($conf->global->MULTICOMPANY_PRODUCT_SHARING_ENABLED) && !empty($conf->global->MULTICOMPANY_PMP_PER_ENTITY_ENABLED)) { + $separatedPMP = true; + $sql .= " SUM(pa.pmp * ps.reel) as estimatedvalue, SUM(p.price * ps.reel) as sellvalue, SUM(ps.reel) as stockqty"; +} else { + $sql .= " SUM(p.pmp * ps.reel) as estimatedvalue, SUM(p.price * ps.reel) as sellvalue, SUM(ps.reel) as stockqty"; +} + // Add fields from hooks $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook @@ -225,7 +234,12 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON t.rowid = ps.fk_ent $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON ps.fk_product = p.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as c_dep ON c_dep.rowid = t.fk_departement"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as ccount ON ccount.rowid = t.fk_pays"; +if ($separatedPMP) { + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_perentity as pa ON pa.fk_product = p.rowid AND pa.fk_product = ps.fk_product AND pa.entity = ". (int) $conf->entity; +} + $sql .= " WHERE t.entity IN (".getEntity('stock').")"; + if (!empty($conf->categorie->enabled)) { $sql .= Categorie::getFilterSelectQuery(Categorie::TYPE_WAREHOUSE, "t.rowid", $search_category_list); } @@ -273,6 +287,7 @@ $reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters); // $sql .= $hookmanager->resPrint; $sql = preg_replace('/,\s*$/', '', $sql); $totalnboflines = 0; + $result = $db->query($sql); if ($result) { $totalnboflines = $db->num_rows($result); From 52bf0f0359f9100264e7d66eb30474bfcb5b1915 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Tue, 27 Apr 2021 16:02:46 +0200 Subject: [PATCH 034/147] Close #17271 : Replament of 2 graph in compta/index.php --- htdocs/compta/index.php | 6 +- htdocs/core/lib/invoice.lib.php | 115 ++++++++++++++++++++++++++++++++ htdocs/langs/en_US/compta.lang | 6 ++ 3 files changed, 125 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index cbe9f7e0a42..6994211213e 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -102,9 +102,11 @@ print load_fiche_titre($langs->trans("AccountancyTreasuryArea"), '', 'bill'); print '
'; -print getCustomerInvoicePieChart($socid); +//print getCustomerInvoicePieChart($socid); +getNumberInvoicesPieChart('customers'); print '
'; -print getPurchaseInvoicePieChart($socid); +getNumberInvoicesPieChart('fourn'); +//print getPurchaseInvoicePieChart($socid); print '
'; print getCustomerInvoiceDraftTable($max, $socid); print '
'; diff --git a/htdocs/core/lib/invoice.lib.php b/htdocs/core/lib/invoice.lib.php index ece491d2c69..f294cbd7916 100644 --- a/htdocs/core/lib/invoice.lib.php +++ b/htdocs/core/lib/invoice.lib.php @@ -456,6 +456,121 @@ function getPurchaseInvoicePieChart($socid = 0) return $result; } +/** + * Return an HTML table that contains a pie chart of the number of customers or supplier invoices + * @param string $mode Can be customer or fourn + * @return string A HTML table that contains a pie chart of customers or supplier invoices + */ +function getNumberInvoicesPieChart($mode) +{ + global $conf, $db, $langs, $user; + if (!empty($conf->facture->enabled) && !empty($user->rights->facture->lire)) { + include DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php'; + $langs->load("boxes"); + $tmpinvoice = new Facture($db); + $sql = "SELECT f.rowid, f.ref, f.fk_statut as status, f.type, f.total_ht, f.total_tva, f.total_ttc, f.paye, f.datef"; + if ($mode == 'customers') { + $sql .= " FROM ".MAIN_DB_PREFIX."facture as f"; + } elseif ($mode == 'fourn') { + $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f"; + } else { + return ''; + } + $sql .= " WHERE f.type <> 2"; + $sql .= " AND f.fk_statut = 1"; + $resql = $db->query($sql); + if ($resql) { + $num = $db->num_rows($resql); + $i = 0; + $now = date_create(date('Y-m-d', dol_now())); + $datenowsub30 = date_create(date('Y-m-d', dol_now())); + $datenowsub15 = date_create(date('Y-m-d', dol_now())); + $datenowadd30 = date_create(date('Y-m-d', dol_now())); + $datenowadd15 = date_create(date('Y-m-d', dol_now())); + $interval30days = date_interval_create_from_date_string('30 days'); + $interval15days = date_interval_create_from_date_string('15 days'); + date_sub($datenowsub30, $interval30days); + date_sub($datenowsub15, $interval15days); + date_add($datenowadd30, $interval30days); + date_add($datenowadd15, $interval15days); + $numberinvoices = array('late30'=>0,'late15'=>0,'late'=>0,'notlate'=>0,'notlate15'=>0,'notlate30'=>0); + $labelnumberinvoices = array('late30'=>'InvoiceLate30Days', + 'late15'=>'InvoiceLate15Days', + 'late'=>'InvoiceLateMinus15Days', + 'notlate'=>'InvoiceNotLate', + 'notlate15'=>'InvoiceNotLate15Days', + 'notlate30'=>'InvoiceNotLate30Days'); + $total = 0; + while ($i < $num) { + $obj = $db->fetch_object($resql); + $datef = date_create($obj->datef); + if ($datef < $datenowsub30) { + $numberinvoices['late30']++; + } elseif ($datef < $datenowsub15) { + $numberinvoices['late15']++; + } elseif ($datef < $now) { + $numberinvoices['late']++; + } elseif ($datef > $datenowadd30) { + $numberinvoices['notlate30']++; + } elseif ($datef > $datenowadd15) { + $numberinvoices['notlate15']++; + } else { + $numberinvoices['notlate']++; + } + $total++; + $i++; + } + $dataseries = array(); + $colorseries = array(); + foreach ($numberinvoices as $key => $nbinvoice) { + $dataseries[] = array($langs->trans($labelnumberinvoices[$key]),$nbinvoice); + } + $colorseries[] = $badgeStatus8; + $colorseries[] = $badgeStatus1; + $colorseries[] = $badgeStatus3; + $colorseries[] = $badgeStatus2; + $colorseries[] = $badgeStatus4; + $colorseries[] = $badgeStatus0; + if ($conf->use_javascript_ajax) { + $result = '
'; + $result .= ''; + $result .= ''; + $result .= ''; + } elseif ($mode == 'fourn') { + $result .= $langs->trans("SupplierInvoice").''; + } else { + return ''; + } + $result .= ''; + + $dolgraph = new DolGraph(); + $dolgraph->SetData($dataseries); + $dolgraph->SetDataColor(array_values($colorseries)); + $dolgraph->setShowLegend(2); + $dolgraph->setShowPercent(1); + $dolgraph->SetType(['pie']); + $dolgraph->setHeight('150'); + $dolgraph->setWidth('300'); + if ($mode == 'customers') { + $dolgraph->draw('idgraphcustomerinvoices'); + } elseif ($mode == 'fourn') { + $dolgraph->draw('idgraphfourninvoices'); + } else { + return ''; + } + + $result .= ''; + $result .= ''; + $result .= ''; + $result .= '
'.$langs->trans("Statistics").' - '; + if ($mode == 'customers') { + $result .= $langs->trans("CustomerInvoice").'
'.$dolgraph->show($total ? 0 : 1).'
'; + $result .= '
'; + } + print $result; + } + } +} /** * Return a HTML table that contains a list with customer invoice drafts * diff --git a/htdocs/langs/en_US/compta.lang b/htdocs/langs/en_US/compta.lang index 926cda53c9f..b326eeced00 100644 --- a/htdocs/langs/en_US/compta.lang +++ b/htdocs/langs/en_US/compta.lang @@ -286,3 +286,9 @@ ReportPurchaseTurnover=Purchase turnover invoiced ReportPurchaseTurnoverCollected=Purchase turnover collected IncludeVarpaysInResults = Include various payments in reports IncludeLoansInResults = Include loans in reports +InvoiceLate30Days = Invoices late 30 days +InvoiceLate15Days = Invoices late 15 days +InvoiceLateMinus15Days = Invoices late +InvoiceNotLate = To pay < 15 days +InvoiceNotLate15Days = To pay > 15 days +InvoiceNotLate30Days = To pay in > 30 days From 0037da1a5657a1bdb1a1c76fa0e0f1de82ec0df8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Apr 2021 23:29:53 +0200 Subject: [PATCH 035/147] FIX selection of project for reception must use PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS --- htdocs/reception/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index 66aa1b300b8..18aa08b0d85 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -770,8 +770,8 @@ if ($action == 'create') $langs->load("projects"); print '
'.$langs->trans("Project").''; - $numprojet = $formproject->select_projects($soc->id, $projectid, 'projectid', 0); - print '   id).'">'.$langs->trans("AddProject").''; + print $formproject->select_projects((empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) ? $soc->id : -1), $projectid, 'projectid', 0, 0, 1, 0, 1, 0, 0, '', 1, 0, 'maxwidth500'); + print '   id).'">'; print '
'; +print ''; + + +print ''; + +print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("").''; + +print '
'; +print '
'; + + +print '
'; +print ''; +print '
'; + +print ''; + + +// End of page +llxFooter(); +$db->close(); diff --git a/htdocs/admin/pdf_contrat.php b/htdocs/admin/pdf_contrat.php new file mode 100644 index 00000000000..b6624ba59d6 --- /dev/null +++ b/htdocs/admin/pdf_contrat.php @@ -0,0 +1,110 @@ + + * Copyright (C) 2004-2012 Laurent Destailleur + * Copyright (C) 2005-2011 Regis Houssin + * Copyright (C) 2012-2107 Juanjo Menent + * Copyright (C) 2019 Ferran Marcet + * Copyright (C) 2021 Anthony Berton + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/admin/pdf.php + * \brief Page to setup PDF options + */ + +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; + +// Load translation files required by the page +$langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'stocks', 'Trips')); + +if (!$user->admin) { + accessforbidden(); +} + +$action = GETPOST('action', 'aZ09'); +$cancel = GETPOST('cancel', 'alpha'); + + +/* + * Actions + */ + +if ($cancel) { + $action = ''; +} + +if ($action == 'update') { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + + header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup"); + exit; +} + + + +/* + * View + */ + +$wikihelp = 'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones'; +llxHeader('', $langs->trans("Setup"), $wikihelp); + +$form = new Form($db); +$formother = new FormOther($db); +$formadmin = new FormAdmin($db); + +print load_fiche_titre($langs->trans("PDF"), '', 'title_setup'); + +$head = pdf_admin_prepare_head(); + +print dol_get_fiche_head($head, 'contrat', $langs->trans("Contrat"), -1, 'pdf'); + +print ''.$form->textwithpicto($langs->trans("PDFContratDesc"), $s)."
\n"; +print "
\n"; + +print '
'; +print ''; +print ''; + +print '
'; +print ''; +print ''; + + +print ''; + +print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("").''; + +print '
'; +print '
'; + + +print '
'; +print ''; +print '
'; + +print '
'; + + +// End of page +llxFooter(); +$db->close(); diff --git a/htdocs/admin/pdf_expensereport.php b/htdocs/admin/pdf_expensereport.php new file mode 100644 index 00000000000..3620679f525 --- /dev/null +++ b/htdocs/admin/pdf_expensereport.php @@ -0,0 +1,110 @@ + + * Copyright (C) 2004-2012 Laurent Destailleur + * Copyright (C) 2005-2011 Regis Houssin + * Copyright (C) 2012-2107 Juanjo Menent + * Copyright (C) 2019 Ferran Marcet + * Copyright (C) 2021 Anthony Berton + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/admin/pdf.php + * \brief Page to setup PDF options + */ + +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; + +// Load translation files required by the page +$langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'stocks', 'Trips')); + +if (!$user->admin) { + accessforbidden(); +} + +$action = GETPOST('action', 'aZ09'); +$cancel = GETPOST('cancel', 'alpha'); + + +/* + * Actions + */ + +if ($cancel) { + $action = ''; +} + +if ($action == 'update') { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + + header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup"); + exit; +} + + + +/* + * View + */ + +$wikihelp = 'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones'; +llxHeader('', $langs->trans("Setup"), $wikihelp); + +$form = new Form($db); +$formother = new FormOther($db); +$formadmin = new FormAdmin($db); + +print load_fiche_titre($langs->trans("PDF"), '', 'title_setup'); + +$head = pdf_admin_prepare_head(); + +print dol_get_fiche_head($head, 'expensereport', $langs->trans("Expensereport"), -1, 'pdf'); + +print ''.$form->textwithpicto($langs->trans("PDFExpensereportDesc"), $s)."
\n"; +print "
\n"; + +print '
'; +print ''; +print ''; + +print '
'; +print ''; +print ''; + + +print ''; + +print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("").''; + +print '
'; +print '
'; + + +print '
'; +print ''; +print '
'; + +print '
'; + + +// End of page +llxFooter(); +$db->close(); diff --git a/htdocs/admin/pdf_holiday.php b/htdocs/admin/pdf_holiday.php new file mode 100644 index 00000000000..7b6074b31aa --- /dev/null +++ b/htdocs/admin/pdf_holiday.php @@ -0,0 +1,110 @@ + + * Copyright (C) 2004-2012 Laurent Destailleur + * Copyright (C) 2005-2011 Regis Houssin + * Copyright (C) 2012-2107 Juanjo Menent + * Copyright (C) 2019 Ferran Marcet + * Copyright (C) 2021 Anthony Berton + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/admin/pdf.php + * \brief Page to setup PDF options + */ + +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; + +// Load translation files required by the page +$langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'stocks', 'Trips')); + +if (!$user->admin) { + accessforbidden(); +} + +$action = GETPOST('action', 'aZ09'); +$cancel = GETPOST('cancel', 'alpha'); + + +/* + * Actions + */ + +if ($cancel) { + $action = ''; +} + +if ($action == 'update') { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + + header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup"); + exit; +} + + + +/* + * View + */ + +$wikihelp = 'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones'; +llxHeader('', $langs->trans("Setup"), $wikihelp); + +$form = new Form($db); +$formother = new FormOther($db); +$formadmin = new FormAdmin($db); + +print load_fiche_titre($langs->trans("PDF"), '', 'title_setup'); + +$head = pdf_admin_prepare_head(); + +print dol_get_fiche_head($head, 'holiday', $langs->trans("Holiday"), -1, 'pdf'); + +print ''.$form->textwithpicto($langs->trans("PDFHolidaytDesc"), $s)."
\n"; +print "
\n"; + +print '
'; +print ''; +print ''; + +print '
'; +print ''; +print ''; + + +print ''; + +print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("").''; + +print '
'; +print '
'; + + +print '
'; +print ''; +print '
'; + +print '
'; + + +// End of page +llxFooter(); +$db->close(); diff --git a/htdocs/admin/pdf_intervention.php b/htdocs/admin/pdf_intervention.php index f7a0244f9ab..993e1f1f5b1 100644 --- a/htdocs/admin/pdf_intervention.php +++ b/htdocs/admin/pdf_intervention.php @@ -34,7 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; // Load translation files required by the page -$langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'stocks')); +$langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'stocks', 'Trips')); if (!$user->admin) { accessforbidden(); diff --git a/htdocs/admin/pdf_invoice.php b/htdocs/admin/pdf_invoice.php index 69859b9ea30..9064d2fd499 100644 --- a/htdocs/admin/pdf_invoice.php +++ b/htdocs/admin/pdf_invoice.php @@ -34,7 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; // Load translation files required by the page -$langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'stocks')); +$langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'stocks', 'Trips')); if (!$user->admin) { accessforbidden(); diff --git a/htdocs/admin/pdf_order.php b/htdocs/admin/pdf_order.php index e3a725eb33a..b81cc649d61 100644 --- a/htdocs/admin/pdf_order.php +++ b/htdocs/admin/pdf_order.php @@ -34,7 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; // Load translation files required by the page -$langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'stocks')); +$langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'stocks', 'Trips')); if (!$user->admin) { accessforbidden(); diff --git a/htdocs/admin/pdf_project.php b/htdocs/admin/pdf_project.php index 7e05c24ed56..3a85f0ea258 100644 --- a/htdocs/admin/pdf_project.php +++ b/htdocs/admin/pdf_project.php @@ -34,7 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; // Load translation files required by the page -$langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'stocks')); +$langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'stocks', 'Trips')); if (!$user->admin) { accessforbidden(); diff --git a/htdocs/admin/pdf_proposal.php b/htdocs/admin/pdf_proposal.php index dc35a1cd538..06d7bc6f15c 100644 --- a/htdocs/admin/pdf_proposal.php +++ b/htdocs/admin/pdf_proposal.php @@ -34,7 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; // Load translation files required by the page -$langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'stocks')); +$langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'stocks', 'Trips')); if (!$user->admin) { accessforbidden(); diff --git a/htdocs/admin/pdf_reception.php b/htdocs/admin/pdf_reception.php new file mode 100644 index 00000000000..32003e51f30 --- /dev/null +++ b/htdocs/admin/pdf_reception.php @@ -0,0 +1,110 @@ + + * Copyright (C) 2004-2012 Laurent Destailleur + * Copyright (C) 2005-2011 Regis Houssin + * Copyright (C) 2012-2107 Juanjo Menent + * Copyright (C) 2019 Ferran Marcet + * Copyright (C) 2021 Anthony Berton + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/admin/pdf.php + * \brief Page to setup PDF options + */ + +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; + +// Load translation files required by the page +$langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'stocks', 'Trips')); + +if (!$user->admin) { + accessforbidden(); +} + +$action = GETPOST('action', 'aZ09'); +$cancel = GETPOST('cancel', 'alpha'); + + +/* + * Actions + */ + +if ($cancel) { + $action = ''; +} + +if ($action == 'update') { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + + header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup"); + exit; +} + + + +/* + * View + */ + +$wikihelp = 'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones'; +llxHeader('', $langs->trans("Setup"), $wikihelp); + +$form = new Form($db); +$formother = new FormOther($db); +$formadmin = new FormAdmin($db); + +print load_fiche_titre($langs->trans("PDF"), '', 'title_setup'); + +$head = pdf_admin_prepare_head(); + +print dol_get_fiche_head($head, 'reception', $langs->trans("reception"), -1, 'pdf'); + +print ''.$form->textwithpicto($langs->trans("PDFReceptionDesc"), $s)."
\n"; +print "
\n"; + +print '
'; +print ''; +print ''; + +print '
'; +print ''; +print ''; + + +print ''; + +print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("").''; + +print '
'; +print '
'; + + +print '
'; +print ''; +print '
'; + +print '
'; + + +// End of page +llxFooter(); +$db->close(); diff --git a/htdocs/admin/pdf_recruitment.php b/htdocs/admin/pdf_recruitment.php index 4e81e70802c..575d3bc23cc 100644 --- a/htdocs/admin/pdf_recruitment.php +++ b/htdocs/admin/pdf_recruitment.php @@ -34,7 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; // Load translation files required by the page -$langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'stocks')); +$langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'stocks', 'Trips')); if (!$user->admin) { accessforbidden(); diff --git a/htdocs/admin/pdf_shipment.php b/htdocs/admin/pdf_shipment.php new file mode 100644 index 00000000000..d456a6fb2ea --- /dev/null +++ b/htdocs/admin/pdf_shipment.php @@ -0,0 +1,110 @@ + + * Copyright (C) 2004-2012 Laurent Destailleur + * Copyright (C) 2005-2011 Regis Houssin + * Copyright (C) 2012-2107 Juanjo Menent + * Copyright (C) 2019 Ferran Marcet + * Copyright (C) 2021 Anthony Berton + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/admin/pdf.php + * \brief Page to setup PDF options + */ + +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; + +// Load translation files required by the page +$langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'stocks', 'Trips')); + +if (!$user->admin) { + accessforbidden(); +} + +$action = GETPOST('action', 'aZ09'); +$cancel = GETPOST('cancel', 'alpha'); + + +/* + * Actions + */ + +if ($cancel) { + $action = ''; +} + +if ($action == 'update') { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + + header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup"); + exit; +} + + + +/* + * View + */ + +$wikihelp = 'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones'; +llxHeader('', $langs->trans("Setup"), $wikihelp); + +$form = new Form($db); +$formother = new FormOther($db); +$formadmin = new FormAdmin($db); + +print load_fiche_titre($langs->trans("PDF"), '', 'title_setup'); + +$head = pdf_admin_prepare_head(); + +print dol_get_fiche_head($head, 'shipment', $langs->trans("shipment"), -1, 'pdf'); + +print ''.$form->textwithpicto($langs->trans("PDFShipmentDesc"), $s)."
\n"; +print "
\n"; + +print '
'; +print ''; +print ''; + +print '
'; +print ''; +print ''; + + +print ''; + +print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("").''; + +print '
'; +print '
'; + + +print '
'; +print ''; +print '
'; + +print '
'; + + +// End of page +llxFooter(); +$db->close(); diff --git a/htdocs/admin/pdf_stock.php b/htdocs/admin/pdf_stock.php new file mode 100644 index 00000000000..e6b0af587b0 --- /dev/null +++ b/htdocs/admin/pdf_stock.php @@ -0,0 +1,110 @@ + + * Copyright (C) 2004-2012 Laurent Destailleur + * Copyright (C) 2005-2011 Regis Houssin + * Copyright (C) 2012-2107 Juanjo Menent + * Copyright (C) 2019 Ferran Marcet + * Copyright (C) 2021 Anthony Berton + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/admin/pdf.php + * \brief Page to setup PDF options + */ + +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; + +// Load translation files required by the page +$langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'stocks', 'Trips')); + +if (!$user->admin) { + accessforbidden(); +} + +$action = GETPOST('action', 'aZ09'); +$cancel = GETPOST('cancel', 'alpha'); + + +/* + * Actions + */ + +if ($cancel) { + $action = ''; +} + +if ($action == 'update') { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + + header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup"); + exit; +} + + + +/* + * View + */ + +$wikihelp = 'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones'; +llxHeader('', $langs->trans("Setup"), $wikihelp); + +$form = new Form($db); +$formother = new FormOther($db); +$formadmin = new FormAdmin($db); + +print load_fiche_titre($langs->trans("PDF"), '', 'title_setup'); + +$head = pdf_admin_prepare_head(); + +print dol_get_fiche_head($head, 'stock', $langs->trans("Stock"), -1, 'pdf'); + +print ''.$form->textwithpicto($langs->trans("PDFStockDesc"), $s)."
\n"; +print "
\n"; + +print '
'; +print ''; +print ''; + +print '
'; +print ''; +print ''; + + +print ''; + +print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("").''; + +print '
'; +print '
'; + + +print '
'; +print ''; +print '
'; + +print '
'; + + +// End of page +llxFooter(); +$db->close(); diff --git a/htdocs/admin/pdf_supplierinvoice.php b/htdocs/admin/pdf_supplierinvoice.php index c244e70457b..57dd647139d 100644 --- a/htdocs/admin/pdf_supplierinvoice.php +++ b/htdocs/admin/pdf_supplierinvoice.php @@ -34,7 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; // Load translation files required by the page -$langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'stocks')); +$langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'stocks', 'Trips')); if (!$user->admin) { accessforbidden(); diff --git a/htdocs/admin/pdf_supplierorder.php b/htdocs/admin/pdf_supplierorder.php index 98340aced97..ecf0ad4cae8 100644 --- a/htdocs/admin/pdf_supplierorder.php +++ b/htdocs/admin/pdf_supplierorder.php @@ -34,7 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; // Load translation files required by the page -$langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'stocks')); +$langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'stocks', 'Trips')); if (!$user->admin) { accessforbidden(); diff --git a/htdocs/admin/pdf_supplierproposal.php b/htdocs/admin/pdf_supplierproposal.php index 45fd337354a..3fb929ed797 100644 --- a/htdocs/admin/pdf_supplierproposal.php +++ b/htdocs/admin/pdf_supplierproposal.php @@ -34,7 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; // Load translation files required by the page -$langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'stocks')); +$langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'stocks', 'Trips')); if (!$user->admin) { accessforbidden(); diff --git a/htdocs/admin/pdf_ticket.php b/htdocs/admin/pdf_ticket.php index b8fbaed3b5c..5ca775e2447 100644 --- a/htdocs/admin/pdf_ticket.php +++ b/htdocs/admin/pdf_ticket.php @@ -34,7 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; // Load translation files required by the page -$langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'stocks')); +$langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'stocks', 'Trips')); if (!$user->admin) { accessforbidden(); diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 1d55b45c221..05f53b72df7 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -59,55 +59,107 @@ function pdf_admin_prepare_head() // $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab complete_head_from_modules($conf, $langs, null, $head, $h, 'pdf_admin'); - $head[$h][0] = DOL_URL_ROOT.'/admin/pdf_project.php'; - $head[$h][1] = $langs->trans("Project"); - $head[$h][2] = 'project'; - $h++; + if (!empty($conf->adherent->enabled)) { + $head[$h][0] = DOL_URL_ROOT.'/admin/pdf_adherent.php'; + $head[$h][1] = $langs->trans("Adherent"); + $head[$h][2] = 'adherent'; + $h++; + } + if (!empty($conf->projet->enabled)) { + $head[$h][0] = DOL_URL_ROOT.'/admin/pdf_project.php'; + $head[$h][1] = $langs->trans("Project"); + $head[$h][2] = 'project'; + $h++; + } + if (!empty($conf->propal->enabled)) { + $head[$h][0] = DOL_URL_ROOT.'/admin/pdf_proposal.php'; + $head[$h][1] = $langs->trans("Proposal"); + $head[$h][2] = 'proposal'; + $h++; + } + if (!empty($conf->commande->enabled)) { + $head[$h][0] = DOL_URL_ROOT.'/admin/pdf_order.php'; + $head[$h][1] = $langs->trans("Order"); + $head[$h][2] = 'order'; + $h++; + } + if (!empty($conf->facture->enabled)) { + $head[$h][0] = DOL_URL_ROOT.'/admin/pdf_invoice.php'; + $head[$h][1] = $langs->trans("Invoice"); + $head[$h][2] = 'invoice'; + $h++; + } + if (!empty($conf->expedition->enabled)) { + $head[$h][0] = DOL_URL_ROOT.'/admin/pdf_shipment.php'; + $head[$h][1] = $langs->trans("Sendings"); + $head[$h][2] = 'shipment'; + $h++; + } + if (!empty($conf->reception->enabled)) { + $head[$h][0] = DOL_URL_ROOT.'/admin/pdf_reception.php'; + $head[$h][1] = $langs->trans("Reception"); + $head[$h][2] = 'reception'; + $h++; + } + if (!empty($conf->ticket->enabled)) { + $head[$h][0] = DOL_URL_ROOT.'/admin/pdf_Ticket.php'; + $head[$h][1] = $langs->trans("Ticket"); + $head[$h][2] = 'ticket'; + $h++; + } + if (!empty($conf->ficheinter->enabled)) { + $head[$h][0] = DOL_URL_ROOT.'/admin/pdf_intervention.php'; + $head[$h][1] = $langs->trans("Intervention"); + $head[$h][2] = 'intervention'; + $h++; + } + if (!empty($conf->supplier_proposal->enabled)) { + $head[$h][0] = DOL_URL_ROOT.'/admin/pdf_supplierproposal.php'; + $head[$h][1] = $langs->trans("SupplierProposal"); + $head[$h][2] = 'supplierproposal'; + $h++; + } + if (!empty($conf->fournisseur->enabled)) { + $head[$h][0] = DOL_URL_ROOT.'/admin/pdf_supplierorder.php'; + $head[$h][1] = $langs->trans("SupplierOrder"); + $head[$h][2] = 'supplierorder'; + $h++; - $head[$h][0] = DOL_URL_ROOT.'/admin/pdf_proposal.php'; - $head[$h][1] = $langs->trans("Proposal"); - $head[$h][2] = 'proposal'; - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/admin/pdf_order.php'; - $head[$h][1] = $langs->trans("Order"); - $head[$h][2] = 'order'; - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/admin/pdf_invoice.php'; - $head[$h][1] = $langs->trans("Invoice"); - $head[$h][2] = 'invoice'; - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/admin/pdf_Ticket.php'; - $head[$h][1] = $langs->trans("Ticket"); - $head[$h][2] = 'ticket'; - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/admin/pdf_intervention.php'; - $head[$h][1] = $langs->trans("Intervention"); - $head[$h][2] = 'intervention'; - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/admin/pdf_supplierproposal.php'; - $head[$h][1] = $langs->trans("SupplierProposal"); - $head[$h][2] = 'supplierproposal'; - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/admin/pdf_supplierorder.php'; - $head[$h][1] = $langs->trans("SupplierOrder"); - $head[$h][2] = 'supplierorder'; - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/admin/pdf_supplierinvoice.php'; - $head[$h][1] = $langs->trans("SuppliersInvoice"); - $head[$h][2] = 'supplierinvoice'; - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/admin/pdf_recruitment.php'; - $head[$h][1] = $langs->trans("Recruitment"); - $head[$h][2] = 'recruitment'; - $h++; + $head[$h][0] = DOL_URL_ROOT.'/admin/pdf_supplierinvoice.php'; + $head[$h][1] = $langs->trans("SuppliersInvoice"); + $head[$h][2] = 'supplierinvoice'; + $h++; + } + if (!empty($conf->recruitment->enabled)) { + $head[$h][0] = DOL_URL_ROOT.'/admin/pdf_recruitment.php'; + $head[$h][1] = $langs->trans("Recruitment"); + $head[$h][2] = 'recruitment'; + $h++; + } + if (!empty($conf->contrat->enabled)) { + $head[$h][0] = DOL_URL_ROOT.'/admin/pdf_contrat.php'; + $head[$h][1] = $langs->trans("Contrat"); + $head[$h][2] = 'contrat'; + $h++; + } + if (!empty($conf->stock->enabled)) { + $head[$h][0] = DOL_URL_ROOT.'/admin/pdf_stock.php'; + $head[$h][1] = $langs->trans("Stock"); + $head[$h][2] = 'stock'; + $h++; + } + if (!empty($conf->holiday->enabled)) { + $head[$h][0] = DOL_URL_ROOT.'/admin/pdf_holiday.php'; + $head[$h][1] = $langs->trans("Holidays"); + $head[$h][2] = 'holiday'; + $h++; + } + if (!empty($conf->expensereport->enabled)) { + $head[$h][0] = DOL_URL_ROOT.'/admin/pdf_expensereport.php'; + $head[$h][1] = $langs->trans("Trips"); + $head[$h][2] = 'expensereport'; + $h++; + } complete_head_from_modules($conf, $langs, null, $head, $h, 'pdf_admin', 'remove'); diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 4fb5952bf5b..1cddacbaeb1 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -402,12 +402,19 @@ PDFProjectDesc=PDF Option for project PDFProposalDesc=PDF Option for proposal PDFOrderDesc=PDF Option for order PDFInvoiceDesc=PDF Option for invoice +PDFShipmentDesc=PDF Option for shipment +PDFReceptionDesc=PDF Option for reception PDFTicketDesc=PDF Option for ticket PDFInterventionDesc=PDF option for intervention PDFSupplierproposalDesc=PDF Option for supplier proposal PDFSupplierorderDesc=PDF Option for supplier order PDFSupplierinvoiceDesc=PDF Option for supplier invoice PDFRecruitmentDesc=PDF Option for recrutment +PDFContratDesc=PDF Option for contrat +PDFStockDesc=PDF Option for stock +PDFHolidaytDesc=PDF Option for holiday +PDFExpensereportDesc=PDF Option for Expensereport +PDFAdherentDescPDF Option for Adhrent PDFAddressForging=Rules for address section HideAnyVATInformationOnPDF=Hide all information related to Sales Tax / VAT PDFRulesForSalesTax=Rules for Sales Tax / VAT From c89830b25b3db9ab457c7941455bda4db1027a44 Mon Sep 17 00:00:00 2001 From: Antonin MARCHAL Date: Thu, 29 Apr 2021 01:17:21 +0200 Subject: [PATCH 044/147] fix(sql) pmp added to create table both migration and install --- htdocs/install/mysql/migration/13.0.0-14.0.0.sql | 9 +++------ htdocs/install/mysql/tables/llx_product_perentity.sql | 3 ++- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql index 652be6ec035..acc0659bbcb 100644 --- a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql +++ b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql @@ -307,7 +307,8 @@ create table llx_product_perentity accountancy_code_sell_export varchar(32), -- Selling accountancy code for vat export accountancy_code_buy varchar(32), -- Buying accountancy code accountancy_code_buy_intra varchar(32), -- Buying accountancy code for vat intracommunity - accountancy_code_buy_export varchar(32) -- Buying accountancy code for vat import + accountancy_code_buy_export varchar(32), -- Buying accountancy code for vat import + pmp double(24,8) )ENGINE=innodb; ALTER TABLE llx_product_perentity ADD INDEX idx_product_perentity_fk_product (fk_product); @@ -434,8 +435,4 @@ ALTER TABLE llx_entrepot ADD COLUMN fk_project INTEGER DEFAULT NULL AFTER entity -- Rebuild sequence for postgres only after query INSERT INTO llx_salary(rowid, ... -- VPGSQL8.2 SELECT dol_util_rebuild_sequences(); -UPDATE llx_const SET value = 'github' WHERE __DECRYPT('name')__ = 'MAIN_BUGTRACK_ENABLELINK' AND __DECRYPT('value')__ = 1; - --- For MultiCompany PMP per entity -ALTER TABLE llx_product_perentity ADD pmp FLOAT NULL DEFAULT NULL AFTER accountancy_code_buy_export - +UPDATE llx_const SET value = 'github' WHERE __DECRYPT('name')__ = 'MAIN_BUGTRACK_ENABLELINK' AND __DECRYPT('value')__ = 1; \ No newline at end of file diff --git a/htdocs/install/mysql/tables/llx_product_perentity.sql b/htdocs/install/mysql/tables/llx_product_perentity.sql index 6e32e506ddf..495324f9f5b 100644 --- a/htdocs/install/mysql/tables/llx_product_perentity.sql +++ b/htdocs/install/mysql/tables/llx_product_perentity.sql @@ -26,5 +26,6 @@ create table llx_product_perentity accountancy_code_sell_export varchar(32), -- Selling accountancy code for vat export accountancy_code_buy varchar(32), -- Buying accountancy code accountancy_code_buy_intra varchar(32), -- Buying accountancy code for vat intracommunity - accountancy_code_buy_export varchar(32) -- Buying accountancy code for vat import + accountancy_code_buy_export varchar(32), -- Buying accountancy code for vat import + pmp double(24,8) )ENGINE=innodb; From 799d1de8303aad047dca2a366ad337bbd2439a09 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Thu, 29 Apr 2021 09:31:49 +0200 Subject: [PATCH 045/147] Update incoice.lib.php and index.php match eldy's requests --- htdocs/compta/index.php | 4 +- htdocs/core/lib/invoice.lib.php | 80 +++++++++++++-------------------- 2 files changed, 34 insertions(+), 50 deletions(-) diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index 6994211213e..e33ddc35610 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -103,9 +103,9 @@ print load_fiche_titre($langs->trans("AccountancyTreasuryArea"), '', 'bill'); print '
'; //print getCustomerInvoicePieChart($socid); -getNumberInvoicesPieChart('customers'); +print getNumberInvoicesPieChart('customers'); print '
'; -getNumberInvoicesPieChart('fourn'); +print getNumberInvoicesPieChart('fourn'); //print getPurchaseInvoicePieChart($socid); print '
'; print getCustomerInvoiceDraftTable($max, $socid); diff --git a/htdocs/core/lib/invoice.lib.php b/htdocs/core/lib/invoice.lib.php index f294cbd7916..4a1d71de540 100644 --- a/htdocs/core/lib/invoice.lib.php +++ b/htdocs/core/lib/invoice.lib.php @@ -466,9 +466,25 @@ function getNumberInvoicesPieChart($mode) global $conf, $db, $langs, $user; if (!empty($conf->facture->enabled) && !empty($user->rights->facture->lire)) { include DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php'; - $langs->load("boxes"); - $tmpinvoice = new Facture($db); - $sql = "SELECT f.rowid, f.ref, f.fk_statut as status, f.type, f.total_ht, f.total_tva, f.total_ttc, f.paye, f.datef"; + + $now = date_create(date('Y-m-d', dol_now())); + $datenowsub30 = date_create(date('Y-m-d', dol_now())); + $datenowsub15 = date_create(date('Y-m-d', dol_now())); + $datenowadd30 = date_create(date('Y-m-d', dol_now())); + $datenowadd15 = date_create(date('Y-m-d', dol_now())); + $interval30days = date_interval_create_from_date_string('30 days'); + $interval15days = date_interval_create_from_date_string('15 days'); + date_sub($datenowsub30, $interval30days); + date_sub($datenowsub15, $interval15days); + date_add($datenowadd30, $interval30days); + date_add($datenowadd15, $interval15days); + + $sql = "SELECT sum(".$db->ifsql("f.date_lim_reglement < '".date_format($datenowsub30, 'Y-m-d')."'", 1, 0).") as nblate30"; + $sql .= ", sum(".$db->ifsql("f.date_lim_reglement < '".date_format($datenowsub15, 'Y-m-d')."'", 1, 0).") as nblate15"; + $sql .= ", sum(".$db->ifsql("f.date_lim_reglement < '".date_format($now, 'Y-m-d')."'", 1, 0).") as nblatenow"; + $sql .= ", sum(".$db->ifsql("f.date_lim_reglement > '".date_format($datenowadd30, 'Y-m-d')."'", 1, 0).") as nbnotlate30"; + $sql .= ", sum(".$db->ifsql("f.date_lim_reglement > '".date_format($datenowadd15, 'Y-m-d')."'", 1, 0).") as nbnotlate15"; + $sql .= ", sum(".$db->ifsql("f.date_lim_reglement >= '".date_format($now, 'Y-m-d')."'", 1, 0).") as nbnotlatenow"; if ($mode == 'customers') { $sql .= " FROM ".MAIN_DB_PREFIX."facture as f"; } elseif ($mode == 'fourn') { @@ -482,55 +498,22 @@ function getNumberInvoicesPieChart($mode) if ($resql) { $num = $db->num_rows($resql); $i = 0; - $now = date_create(date('Y-m-d', dol_now())); - $datenowsub30 = date_create(date('Y-m-d', dol_now())); - $datenowsub15 = date_create(date('Y-m-d', dol_now())); - $datenowadd30 = date_create(date('Y-m-d', dol_now())); - $datenowadd15 = date_create(date('Y-m-d', dol_now())); - $interval30days = date_interval_create_from_date_string('30 days'); - $interval15days = date_interval_create_from_date_string('15 days'); - date_sub($datenowsub30, $interval30days); - date_sub($datenowsub15, $interval15days); - date_add($datenowadd30, $interval30days); - date_add($datenowadd15, $interval15days); - $numberinvoices = array('late30'=>0,'late15'=>0,'late'=>0,'notlate'=>0,'notlate15'=>0,'notlate30'=>0); - $labelnumberinvoices = array('late30'=>'InvoiceLate30Days', - 'late15'=>'InvoiceLate15Days', - 'late'=>'InvoiceLateMinus15Days', - 'notlate'=>'InvoiceNotLate', - 'notlate15'=>'InvoiceNotLate15Days', - 'notlate30'=>'InvoiceNotLate30Days'); $total = 0; + $dataseries = array(); while ($i < $num) { $obj = $db->fetch_object($resql); - $datef = date_create($obj->datef); - if ($datef < $datenowsub30) { - $numberinvoices['late30']++; - } elseif ($datef < $datenowsub15) { - $numberinvoices['late15']++; - } elseif ($datef < $now) { - $numberinvoices['late']++; - } elseif ($datef > $datenowadd30) { - $numberinvoices['notlate30']++; - } elseif ($datef > $datenowadd15) { - $numberinvoices['notlate15']++; - } else { - $numberinvoices['notlate']++; - } - $total++; + $dataseries = array(array($langs->trans('InvoiceLate30Days'),$obj->nblate30) + ,array($langs->trans('InvoiceLate15Days'),$obj->nblate15-$obj->nblate30) + ,array($langs->trans('InvoiceLateMinus15Days'),$obj->nblatenow-$obj->nblate15) + ,array($langs->trans('InvoiceNotLate'),$obj->nbnotlatenow-$obj->nbnotlate15) + ,array($langs->trans('InvoiceNotLate15Days'),$obj->nbnotlate15-$obj->nbnotlate30) + ,array($langs->trans('InvoiceNotLate30Days'),$obj->nbnotlate30)); $i++; } - $dataseries = array(); - $colorseries = array(); - foreach ($numberinvoices as $key => $nbinvoice) { - $dataseries[] = array($langs->trans($labelnumberinvoices[$key]),$nbinvoice); + foreach ($dataseries as $key=>$value) { + $total+=$value[1]; } - $colorseries[] = $badgeStatus8; - $colorseries[] = $badgeStatus1; - $colorseries[] = $badgeStatus3; - $colorseries[] = $badgeStatus2; - $colorseries[] = $badgeStatus4; - $colorseries[] = $badgeStatus0; + $colorseries = array($badgeStatus8,$badgeStatus1,$badgeStatus3,$badgeStatus2,$badgeStatus4,$badgeStatus0); if ($conf->use_javascript_ajax) { $result = '
'; $result .= ''; @@ -560,14 +543,15 @@ function getNumberInvoicesPieChart($mode) } else { return ''; } - $result .= ''; $result .= ''; $result .= ''; $result .= '
'.$dolgraph->show($total ? 0 : 1).'
'; $result .= '
'; } - print $result; + return $result; + } else { + dol_print_error($db); } } } From 68415322ecfaef55e885bea7ee2f9b7b044c5e28 Mon Sep 17 00:00:00 2001 From: daraelmin Date: Thu, 29 Apr 2021 10:00:54 +0200 Subject: [PATCH 046/147] Fix v11 wrong alias in natural_search --- htdocs/adherents/type.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 4590254ebf6..65996fc7283 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -511,7 +511,7 @@ if ($rowid > 0) $sql .= " AND t.rowid = ".$object->id; if ($sall) { - $sql .= natural_search(array("f.firstname", "d.lastname", "d.societe", "d.email", "d.login", "d.address", "d.town", "d.note_public", "d.note_private"), $sall); + $sql .= natural_search(array("d.firstname", "d.lastname", "d.societe", "d.email", "d.login", "d.address", "d.town", "d.note_public", "d.note_private"), $sall); } if ($status != '') { From a7b093ed81d81768e1a528e2370e8951222ea198 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 29 Apr 2021 11:34:09 +0200 Subject: [PATCH 047/147] FIX: Espadon PDF shippment model with long public note now wroking --- .../expedition/doc/pdf_espadon.modules.php | 180 ++++++++++++++---- 1 file changed, 141 insertions(+), 39 deletions(-) diff --git a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php index 165e83a8e87..e0d9695f79f 100644 --- a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php @@ -274,6 +274,15 @@ class pdf_espadon extends ModelePdfExpedition if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6; $pdf->SetAutoPageBreak(1, 0); + // Create pdf instance + /*$pdf = pdf_getInstance($this->format); + $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance + $pdf->SetAutoPageBreak(1, 0); + + $heightforinfotot = 40; // Height reserved to output the info and total part + $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page + $heightforfooter = $this->marge_basse + (empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 12 : 22); // Height reserved to output the footer (value include bottom margin) + */ if (class_exists('TCPDF')) { $pdf->setPrintHeader(false); @@ -306,13 +315,13 @@ class pdf_espadon extends ModelePdfExpedition $pdf->AddPage(); if (!empty($tplidx)) $pdf->useTemplate($tplidx); $pagenb++; - $this->_pagehead($pdf, $object, 1, $outputlangs); + $top_shift = $this->_pagehead($pdf, $object, 1, $outputlangs); $pdf->SetFont('', '', $default_font_size - 1); $pdf->MultiCell(0, 3, ''); // Set interline to 3 $pdf->SetTextColor(0, 0, 0); $tab_top = 90; - $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 : 10); + $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 + $top_shift: 10); $tab_height = 130; $tab_height_newpage = 150; @@ -351,62 +360,153 @@ class pdf_espadon extends ModelePdfExpedition $notetoshow = dol_concatdesc($notetoshow, $extranote); } - if (!empty($notetoshow) || !empty($object->tracking_number)) - { - $tab_top = 88 + $height_incoterms; - $tab_top_alt = $tab_top; - - $pdf->SetFont('', 'B', $default_font_size - 2); - $pdf->writeHTMLCell(60, 4, $this->posxdesc - 1, $tab_top - 1, $outputlangs->transnoentities("TrackingNumber")." : ".$object->tracking_number, 0, 1, false, true, 'L'); - - $tab_top_alt = $pdf->GetY(); - //$tab_top_alt += 1; + if (!empty($notetoshow) || !empty($object->tracking_number)) { + $tab_top -= 2; // Tracking number - if (!empty($object->tracking_number)) - { + if (!empty($object->tracking_number)) { + $pdf->SetFont('', 'B', $default_font_size - 2); + $pdf->writeHTMLCell(60, 4, $this->posxdesc - 1, $tab_top - 1, $outputlangs->transnoentities("TrackingNumber") . " : " . $object->tracking_number, 0, 1, false, true, 'L'); + + $tab_top_alt = $pdf->GetY(); $object->getUrlTrackingStatus($object->tracking_number); - if (!empty($object->tracking_url)) - { - if ($object->shipping_method_id > 0) - { + if (!empty($object->tracking_url)) { + if ($object->shipping_method_id > 0) { // Get code using getLabelFromKey $code = $outputlangs->getLabelFromKey($this->db, $object->shipping_method_id, 'c_shipment_mode', 'rowid', 'code'); $label = ''; - if ($object->tracking_url != $object->tracking_number) $label .= $outputlangs->trans("LinkToTrackYourPackage")."
"; - $label .= $outputlangs->trans("SendingMethod").": ".$outputlangs->trans("SendingMethod".strtoupper($code)); + if ($object->tracking_url != $object->tracking_number) $label .= $outputlangs->trans("LinkToTrackYourPackage") . "
"; + $label .= $outputlangs->trans("SendingMethod") . ": " . $outputlangs->trans("SendingMethod" . strtoupper($code)); //var_dump($object->tracking_url != $object->tracking_number);exit; - if ($object->tracking_url != $object->tracking_number) - { + if ($object->tracking_url != $object->tracking_number) { $label .= " : "; $label .= $object->tracking_url; } $pdf->SetFont('', 'B', $default_font_size - 2); $pdf->writeHTMLCell(60, 4, $this->posxdesc - 1, $tab_top_alt, $label, 0, 1, false, true, 'L'); - $tab_top_alt = $pdf->GetY(); + $tab_top = $pdf->GetY(); } } } + // Notes + $pagenb = $pdf->getPage(); if (!empty($notetoshow)) { - $pdf->SetFont('', '', $default_font_size - 1); // In loop to manage multi-page - $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top_alt, dol_htmlentitiesbr($notetoshow), 0, 1); + $tab_top -= 2; + + $tab_width = $this->page_largeur - $this->marge_gauche - $this->marge_droite; + $pageposbeforenote = $pagenb; + + $substitutionarray = pdf_getSubstitutionArray($outputlangs, null, $object); + complete_substitutions_array($substitutionarray, $outputlangs, $object); + $notetoshow = make_substitutions($notetoshow, $substitutionarray, $outputlangs); + $notetoshow = convertBackOfficeMediasLinksToPublicLinks($notetoshow); + + $pdf->startTransaction(); + + $pdf->SetFont('', '', $default_font_size - 1); + $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top, dol_htmlentitiesbr($notetoshow), 0, 1); + // Description + $pageposafternote = $pdf->getPage(); + $posyafter = $pdf->GetY(); + + if ($pageposafternote > $pageposbeforenote) + { + $pdf->rollbackTransaction(true); + + // prepare pages to receive notes + while ($pagenb < $pageposafternote) { + $pdf->AddPage(); + $pagenb++; + if (!empty($tplidx)) $pdf->useTemplate($tplidx); + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); + // $this->_pagefoot($pdf,$object,$outputlangs,1); + $pdf->setTopMargin($tab_top_newpage); + // The only function to edit the bottom margin of current page to set it. + $pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext); + } + + // back to start + $pdf->setPage($pageposbeforenote); + $pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext); + $pdf->SetFont('', '', $default_font_size - 1); + $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top, dol_htmlentitiesbr($notetoshow), 0, 1); + $pageposafternote = $pdf->getPage(); + + $posyafter = $pdf->GetY(); + + if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + 20))) // There is no space left for total+free text + { + $pdf->AddPage('', '', true); + $pagenb++; + $pageposafternote++; + $pdf->setPage($pageposafternote); + $pdf->setTopMargin($tab_top_newpage); + // The only function to edit the bottom margin of current page to set it. + $pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext); + //$posyafter = $tab_top_newpage; + } + + + // apply note frame to previous pages + $i = $pageposbeforenote; + while ($i < $pageposafternote) { + $pdf->setPage($i); + + + $pdf->SetDrawColor(128, 128, 128); + // Draw note frame + if ($i > $pageposbeforenote) { + $height_note = $this->page_hauteur - ($tab_top_newpage + $heightforfooter); + $pdf->Rect($this->marge_gauche, $tab_top_newpage - 1, $tab_width, $height_note + 1); + } else { + $height_note = $this->page_hauteur - ($tab_top + $heightforfooter); + $pdf->Rect($this->marge_gauche, $tab_top - 1, $tab_width, $height_note + 1); + } + + // Add footer + $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. + $this->_pagefoot($pdf, $object, $outputlangs, 1); + + $i++; + } + + // apply note frame to last page + $pdf->setPage($pageposafternote); + if (!empty($tplidx)) $pdf->useTemplate($tplidx); + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); + $height_note = $posyafter - $tab_top_newpage; + $pdf->Rect($this->marge_gauche, $tab_top_newpage - 1, $tab_width, $height_note + 1); + } else // No pagebreak + { + $pdf->commitTransaction(); + $posyafter = $pdf->GetY(); + $height_note = $posyafter - $tab_top; + $pdf->Rect($this->marge_gauche, $tab_top - 1, $tab_width, $height_note + 1); + + + if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + 20))) + { + // not enough space, need to add page + $pdf->AddPage('', '', true); + $pagenb++; + $pageposafternote++; + $pdf->setPage($pageposafternote); + if (!empty($tplidx)) $pdf->useTemplate($tplidx); + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); + + $posyafter = $tab_top_newpage; + } + } + + $tab_height = $tab_height - $height_note; + $tab_top = $posyafter + 6; + } else { + $height_note = 0; } - - $nexY = $pdf->GetY(); - $height_note = $nexY - $tab_top; - - // Rect takes a length in 3rd parameter - $pdf->SetDrawColor(192, 192, 192); - $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 1); - - $tab_height = $tab_height - $height_note; - $tab_top = $nexY + 6; - } else { - $height_note = 0; } @@ -415,13 +515,15 @@ class pdf_espadon extends ModelePdfExpedition // Table simulation to know the height of the title line $pdf->startTransaction(); - $this->pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, $hidetop); + $this->pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs); $pdf->rollbackTransaction(true); $nexY = $tab_top + $this->tabTitleHeight; // Loop on each lines + $pageposbeforeprintlines = $pdf->getPage(); + $pagenb = $pageposbeforeprintlines; for ($i = 0; $i < $nblines; $i++) { $curY = $nexY; @@ -590,7 +692,7 @@ class pdf_espadon extends ModelePdfExpedition while ($pagenb < $pageposafter) { $pdf->setPage($pagenb); - if ($pagenb == 1) + if ($pagenb == $pageposbeforeprintlines) { $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1); } else { From d9e25c61bbbfc80ade62c277bdf1866441f76bec Mon Sep 17 00:00:00 2001 From: fr69400 <82267780+fr69400@users.noreply.github.com> Date: Thu, 29 Apr 2021 15:32:15 +0200 Subject: [PATCH 048/147] formAddObjectLine cant be overloaded by hook --- htdocs/bom/bom_card.php | 5 ++++- htdocs/comm/propal/card.php | 4 +++- htdocs/commande/card.php | 4 +++- htdocs/compta/facture/card-rec.php | 4 +++- htdocs/compta/facture/card.php | 4 +++- htdocs/contrat/card.php | 4 +++- htdocs/eventorganization/conferenceorboothattendee_card.php | 4 +++- htdocs/fourn/commande/card.php | 4 +++- htdocs/fourn/facture/card.php | 6 ++++-- htdocs/modulebuilder/template/myobject_card.php | 6 ++++-- htdocs/partnership/partnership_card.php | 6 ++++-- htdocs/supplier_proposal/card.php | 6 ++++-- 12 files changed, 41 insertions(+), 16 deletions(-) diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index 37ec67e1ba3..5969d402345 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -572,10 +572,13 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if ($object->status == 0 && $permissiontoadd && $action != 'selectlines') { if ($action != 'editline') { // Add products/services form - $object->formAddObjectLine(1, $mysoc, null, '/bom/tpl'); + $parameters = array(); $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + if (empty($reshook)) + $object->formAddObjectLine(1, $mysoc, null, '/bom/tpl'); } } diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index ebca0177868..3d305ee9b59 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -2457,10 +2457,12 @@ if ($action == 'create') { if ($object->statut == Propal::STATUS_DRAFT && $usercancreate && $action != 'selectlines') { if ($action != 'editline') { // Add products/services form - $object->formAddObjectLine(1, $mysoc, $soc); $parameters = array(); $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + if (empty($reshook)) + $object->formAddObjectLine(1, $societe, $mysoc); } else { $parameters = array(); $reshook = $hookmanager->executeHooks('formEditObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 0665a567738..34d32b26c2e 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -2442,11 +2442,13 @@ if ($action == 'create' && $usercancreate) { if ($object->statut == Commande::STATUS_DRAFT && $usercancreate && $action != 'selectlines') { if ($action != 'editline') { // Add free products/services - $object->formAddObjectLine(1, $mysoc, $soc); $parameters = array(); // Note that $action and $object may be modified by hook $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + if (empty($reshook)) + $object->formAddObjectLine(1, $societe, $mysoc); } } print ''; diff --git a/htdocs/compta/facture/card-rec.php b/htdocs/compta/facture/card-rec.php index 4f0148a05a1..496ca43386e 100644 --- a/htdocs/compta/facture/card-rec.php +++ b/htdocs/compta/facture/card-rec.php @@ -1620,10 +1620,12 @@ if ($action == 'create') { if ($object->statut == $object::STATUS_DRAFT && $user->rights->facture->creer && $action != 'valid' && $action != 'editline') { if ($action != 'editline') { // Add free products/services - $object->formAddObjectLine(0, $mysoc, $object->thirdparty); // No date selector for template invoice $parameters = array(); $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + if (empty($reshook)) + $object->formAddObjectLine(0, $mysoc, $object->thirdparty); // No date selector for template invoice } } diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index bde5a6e6c38..4d206bd4790 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -5191,10 +5191,12 @@ if ($action == 'create') { if ($object->statut == 0 && $usercancreate && $action != 'valid' && $action != 'editline') { if ($action != 'editline' && $action != 'selectlines') { // Add free products/services - $object->formAddObjectLine(1, $mysoc, $soc); $parameters = array(); $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + if (empty($reshook)) + $object->formAddObjectLine(1, $societe, $mysoc); } } diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 1ab26b73c75..1393ecf4929 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -1981,10 +1981,12 @@ if ($action == 'create') { } // Add free products/services - $object->formAddObjectLine(1, $mysoc, $soc); $parameters = array(); $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + if (empty($reshook)) + $object->formAddObjectLine(1, $societe, $mysoc); } print ''; diff --git a/htdocs/eventorganization/conferenceorboothattendee_card.php b/htdocs/eventorganization/conferenceorboothattendee_card.php index 68f6c4eef13..1462a7ee8a7 100644 --- a/htdocs/eventorganization/conferenceorboothattendee_card.php +++ b/htdocs/eventorganization/conferenceorboothattendee_card.php @@ -595,10 +595,12 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if ($object->status == 0 && $permissiontoadd && $action != 'selectlines') { if ($action != 'editline') { // Add products/services form - $object->formAddObjectLine(1, $mysoc, $soc); $parameters = array(); $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + if (empty($reshook)) + $object->formAddObjectLine(1, $societe, $mysoc); } } diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 8358b71f2c7..c34e7d68fdb 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -2309,10 +2309,12 @@ if ($action == 'create') { if ($object->statut == CommandeFournisseur::STATUS_DRAFT && $usercancreate) { if ($action != 'editline') { // Add free products/services - $object->formAddObjectLine(1, $societe, $mysoc); $parameters = array(); $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + if (empty($reshook)) + $object->formAddObjectLine(1, $societe, $mysoc); } } print ''; diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 578c9c7e062..8bb672d16cd 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -3326,10 +3326,12 @@ if ($action == 'create') { if ($object->statut == FactureFournisseur::STATUS_DRAFT && $usercancreate) { if ($action != 'editline') { // Add free products/services - $object->formAddObjectLine(1, $societe, $mysoc); - + $parameters = array(); $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + if (empty($reshook)) + $object->formAddObjectLine(1, $societe, $mysoc); } } diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php index fe4cd496df0..b686bdf6cdf 100644 --- a/htdocs/modulebuilder/template/myobject_card.php +++ b/htdocs/modulebuilder/template/myobject_card.php @@ -458,10 +458,12 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if ($object->status == 0 && $permissiontoadd && $action != 'selectlines') { if ($action != 'editline') { // Add products/services form - $object->formAddObjectLine(1, $mysoc, $soc); - + $parameters = array(); $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + if (empty($reshook)) + $object->formAddObjectLine(1, $mysoc, $soc); } } diff --git a/htdocs/partnership/partnership_card.php b/htdocs/partnership/partnership_card.php index dbf889137d8..acf1711724e 100644 --- a/htdocs/partnership/partnership_card.php +++ b/htdocs/partnership/partnership_card.php @@ -548,10 +548,12 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if ($object->status == 0 && $permissiontoadd && $action != 'selectlines') { if ($action != 'editline') { // Add products/services form - $object->formAddObjectLine(1, $mysoc, $soc); - + $parameters = array(); $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + if (empty($reshook)) + $object->formAddObjectLine(1, $mysoc, $soc); } } diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index 122b881495f..e382d274387 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -1773,10 +1773,12 @@ if ($action == 'create') { if ($object->statut == SupplierProposal::STATUS_DRAFT && $usercancreate) { if ($action != 'editline') { // Add products/services form - $object->formAddObjectLine($dateSelector, $soc, $mysoc); - + $parameters = array(); $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + if (empty($reshook)) + $object->formAddObjectLine($dateSelector, $soc, $mysoc); } } From 8fda2ba2b4d16bb1a483ffb99bee63ba6162c198 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 29 Apr 2021 13:34:43 +0000 Subject: [PATCH 049/147] Fixing style errors. --- htdocs/bom/bom_card.php | 2 +- htdocs/fourn/facture/card.php | 2 +- htdocs/modulebuilder/template/myobject_card.php | 2 +- htdocs/partnership/partnership_card.php | 2 +- htdocs/supplier_proposal/card.php | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index 5969d402345..2accdfd8d62 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -572,7 +572,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if ($object->status == 0 && $permissiontoadd && $action != 'selectlines') { if ($action != 'editline') { // Add products/services form - + $parameters = array(); $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 8bb672d16cd..36ad97a19de 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -3326,7 +3326,7 @@ if ($action == 'create') { if ($object->statut == FactureFournisseur::STATUS_DRAFT && $usercancreate) { if ($action != 'editline') { // Add free products/services - + $parameters = array(); $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php index b686bdf6cdf..a89fb588d14 100644 --- a/htdocs/modulebuilder/template/myobject_card.php +++ b/htdocs/modulebuilder/template/myobject_card.php @@ -458,7 +458,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if ($object->status == 0 && $permissiontoadd && $action != 'selectlines') { if ($action != 'editline') { // Add products/services form - + $parameters = array(); $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); diff --git a/htdocs/partnership/partnership_card.php b/htdocs/partnership/partnership_card.php index acf1711724e..8de5fb5138a 100644 --- a/htdocs/partnership/partnership_card.php +++ b/htdocs/partnership/partnership_card.php @@ -548,7 +548,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if ($object->status == 0 && $permissiontoadd && $action != 'selectlines') { if ($action != 'editline') { // Add products/services form - + $parameters = array(); $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index e382d274387..2c62db6a2ce 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -1773,7 +1773,7 @@ if ($action == 'create') { if ($object->statut == SupplierProposal::STATUS_DRAFT && $usercancreate) { if ($action != 'editline') { // Add products/services form - + $parameters = array(); $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); From 330c08ac139ebe8ed74e64461242a97172dec1f7 Mon Sep 17 00:00:00 2001 From: jpb Date: Thu, 29 Apr 2021 15:59:55 +0200 Subject: [PATCH 050/147] remove number to text type input --- htdocs/multicurrency/multicurrency_rate.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/multicurrency/multicurrency_rate.php b/htdocs/multicurrency/multicurrency_rate.php index 09749ae612e..e25570e4b42 100644 --- a/htdocs/multicurrency/multicurrency_rate.php +++ b/htdocs/multicurrency/multicurrency_rate.php @@ -257,7 +257,7 @@ if (!in_array($action, array("updateRate", "deleteRate"))) { print ''.$form->selectMultiCurrency((GETPOSTISSET('multicurrency_code') ? GETPOST('multicurrency_code', 'alpha') : $multicurrency_code), 'multicurrency_code', 1, " code != '".$conf->currency."'", true).''; print ' '.$langs->trans('Rate').''; - print ' '; + print ' '; print ''; print ''; From 5f7a3571cd70059189863f019d677cfb5849ddd6 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Thu, 29 Apr 2021 16:08:27 +0200 Subject: [PATCH 051/147] Update llx_00_c_country.sql countries in english --- htdocs/install/mysql/data/llx_00_c_country.sql | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/install/mysql/data/llx_00_c_country.sql b/htdocs/install/mysql/data/llx_00_c_country.sql index b0d578829b9..88df2349391 100644 --- a/htdocs/install/mysql/data/llx_00_c_country.sql +++ b/htdocs/install/mysql/data/llx_00_c_country.sql @@ -35,17 +35,17 @@ INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (4, INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (5,'DE','DEU','Germany',1,0); INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (6,'CH','CHE','Switzerland',1,0); INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (7,'GB','GBR','United Kingdom',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (8,'IE','IRL','Irland',1,0); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (8,'IE','IRL','Ireland',1,0); INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (9,'CN','CHN','China',1,0); INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (10,'TN','TUN','Tunisia',1,0); INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (11,'US','USA','United States',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (12,'MA','MAR','Maroc',1,0); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (12,'MA','MAR','Morocco',1,0); INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (13,'DZ','DZA','Algeria',1,0); INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (14,'CA','CAN','Canada',1,0); INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (15,'TG','TGO','Togo',1,0); INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (16,'GA','GAB','Gabon',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (17,'NL','NLD','Nederland',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (18,'HU','HUN','Hongrie',1,0); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (17,'NL','NLD','Netherlands',1,0); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (18,'HU','HUN','Hungary',1,0); INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (19,'RU','RUS','Russia',1,0); INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (20,'SE','SWE','Sweden',1,0); INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (21,'CI','CIV','Côte d''Ivoire',1,0); From 96baa1ef49f513b51599d9b95b4287531f3c24e9 Mon Sep 17 00:00:00 2001 From: fr69400 <82267780+fr69400@users.noreply.github.com> Date: Thu, 29 Apr 2021 17:36:45 +0200 Subject: [PATCH 052/147] wrong variable name --- htdocs/comm/propal/card.php | 2 +- htdocs/commande/card.php | 2 +- htdocs/compta/facture/card.php | 2 +- htdocs/contrat/card.php | 2 +- htdocs/eventorganization/conferenceorboothattendee_card.php | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 3d305ee9b59..e46d3ac243b 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -2462,7 +2462,7 @@ if ($action == 'create') { $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if (empty($reshook)) - $object->formAddObjectLine(1, $societe, $mysoc); + $object->formAddObjectLine(1, $mysoc, $soc); } else { $parameters = array(); $reshook = $hookmanager->executeHooks('formEditObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 34d32b26c2e..c11599fb6be 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -2448,7 +2448,7 @@ if ($action == 'create' && $usercancreate) { $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if (empty($reshook)) - $object->formAddObjectLine(1, $societe, $mysoc); + $object->formAddObjectLine(1, $mysoc, $soc); } } print ''; diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 4d206bd4790..405739bd36b 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -5196,7 +5196,7 @@ if ($action == 'create') { $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if (empty($reshook)) - $object->formAddObjectLine(1, $societe, $mysoc); + $object->formAddObjectLine(1, $mysoc, $soc); } } diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 1393ecf4929..ffc8dc37df6 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -1986,7 +1986,7 @@ if ($action == 'create') { $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if (empty($reshook)) - $object->formAddObjectLine(1, $societe, $mysoc); + $object->formAddObjectLine(1, $mysoc, $soc); } print ''; diff --git a/htdocs/eventorganization/conferenceorboothattendee_card.php b/htdocs/eventorganization/conferenceorboothattendee_card.php index 1462a7ee8a7..8a3767f0606 100644 --- a/htdocs/eventorganization/conferenceorboothattendee_card.php +++ b/htdocs/eventorganization/conferenceorboothattendee_card.php @@ -600,7 +600,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if (empty($reshook)) - $object->formAddObjectLine(1, $societe, $mysoc); + $object->formAddObjectLine(1, $mysoc, $soc); } } From d5af15a1020ba94b8e6f61bf9aab60d8e8efa751 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 29 Apr 2021 15:37:19 +0000 Subject: [PATCH 053/147] Fixing style errors. --- htdocs/multicurrency/multicurrency_rate.php | 189 ++++++++++---------- 1 file changed, 92 insertions(+), 97 deletions(-) diff --git a/htdocs/multicurrency/multicurrency_rate.php b/htdocs/multicurrency/multicurrency_rate.php index 94a36dcba3c..3e99a19cc57 100644 --- a/htdocs/multicurrency/multicurrency_rate.php +++ b/htdocs/multicurrency/multicurrency_rate.php @@ -202,8 +202,7 @@ if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massa $parameters = array(); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); -if (empty($reshook)) -{ +if (empty($reshook)) { // Selection of new fields include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; @@ -292,7 +291,7 @@ $sql .= $hookmanager->resPrint; $sql .= ' FROM '.MAIN_DB_PREFIX.'multicurrency_rate as cr '; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."multicurrency AS m ON cr.fk_multicurrency = m.rowid"; if ($sall) $sql .= natural_search(array_keys($fieldstosearchall), $sall); -if ($search_date_sync && $search_date_sync_end ){ +if ($search_date_sync && $search_date_sync_end ) { $sql .= " AND (cr.date_sync BETWEEN '".$db->idate($search_date_sync)."' AND '".$db->idate($search_date_sync_end)."')"; } elseif ($search_date_sync && !$search_date_sync_end) { $sql .= natural_search('cr.date_sync', $db->idate($search_date_sync)); @@ -418,24 +417,24 @@ if ($resql) { print ''; // date - if (!empty($arrayfields['cr.date_sync']['checked'])) { - print ''; - print $form->selectDate(dol_print_date($search_date_sync, "%Y-%m-%d"), 'search_date_sync', 0, 0, 1); - print $form->selectDate(dol_print_date($search_date_sync_end, "%Y-%m-%d"), 'search_date_sync_end', 0, 0, 1); - print ''; - } +if (!empty($arrayfields['cr.date_sync']['checked'])) { + print ''; + print $form->selectDate(dol_print_date($search_date_sync, "%Y-%m-%d"), 'search_date_sync', 0, 0, 1); + print $form->selectDate(dol_print_date($search_date_sync_end, "%Y-%m-%d"), 'search_date_sync_end', 0, 0, 1); + print ''; +} // code - if (!empty($arrayfields['m.code']['checked'])) { - print ''; - print $form->selectMultiCurrency($multicurrency_code, 'search_code', 1, " code != '".$conf->currency."'", true); - print ''; - } +if (!empty($arrayfields['m.code']['checked'])) { + print ''; + print $form->selectMultiCurrency($multicurrency_code, 'search_code', 1, " code != '".$conf->currency."'", true); + print ''; +} // rate - if (!empty($arrayfields['cr.rate']['checked'])) { - print ''; - print ''; - print ''; - } +if (!empty($arrayfields['cr.rate']['checked'])) { + print ''; + print ''; + print ''; +} // Fields from hook $parameters = array('arrayfields'=>$arrayfields); @@ -470,90 +469,86 @@ if ($resql) { $i = 0; $totalarray = array(); - while ($i < min($num, $limit)) { - $obj = $db->fetch_object($resql); +while ($i < min($num, $limit)) { + $obj = $db->fetch_object($resql); - print ''; + print ''; - // USER REQUEST UPDATE FOR THIS LINE - if ($action == "updateRate" && $obj->rowid == $id_rate_selected) { - // var_dump($obj); - print ' '; - print '' . $form->selectMultiCurrency($obj->code, 'multicurrency_code', 1, " code != '".$conf->currency."'", true) . ''; - print ' '; + // USER REQUEST UPDATE FOR THIS LINE + if ($action == "updateRate" && $obj->rowid == $id_rate_selected) { + // var_dump($obj); + print ' '; + print '' . $form->selectMultiCurrency($obj->code, 'multicurrency_code', 1, " code != '".$conf->currency."'", true) . ''; + print ' '; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - } - else { - // date_sync - if (!empty($arrayfields['cr.date_sync']['checked'])) - { - print ''; - print $obj->date_sync; - print "\n"; - if (!$i) $totalarray['nbfield']++; - } - - // code - if (! empty($arrayfields['m.code']['checked'])) - { - print ''; - print $obj->code." ".$obj->name; - print "\n"; - - if (! $i) $totalarray['nbfield']++; - } - - // rate - if (! empty($arrayfields['cr.rate']['checked'])) - { - print ''; - print $obj->rate; - print "\n"; - if (! $i) $totalarray['nbfield']++; - } - - - // Fields from hook - $parameters = ['arrayfields' => $arrayfields, 'obj' => $obj]; - $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - - // Action - print ''; - if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined - $selected = 0; - if (in_array($obj->rowid, $arrayofselected)) { - $selected = 1; - } - print 'rowid.'">'.img_picto('edit', 'edit').''; - print 'rowid.'">'.img_picto('delete', 'delete').''; - print ''; - } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - - print "\n"; - $i++; - } - - $db->free($resql); - - print ""; - print "
"; - - print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; } else { - dol_print_error($db); + // date_sync + if (!empty($arrayfields['cr.date_sync']['checked'])) { + print ''; + print $obj->date_sync; + print "\n"; + if (!$i) $totalarray['nbfield']++; + } + + // code + if (! empty($arrayfields['m.code']['checked'])) { + print ''; + print $obj->code." ".$obj->name; + print "\n"; + + if (! $i) $totalarray['nbfield']++; + } + + // rate + if (! empty($arrayfields['cr.rate']['checked'])) { + print ''; + print $obj->rate; + print "\n"; + if (! $i) $totalarray['nbfield']++; + } + + + // Fields from hook + $parameters = ['arrayfields' => $arrayfields, 'obj' => $obj]; + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + + // Action + print ''; + if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + $selected = 0; + if (in_array($obj->rowid, $arrayofselected)) { + $selected = 1; + } + print 'rowid.'">'.img_picto('edit', 'edit').''; + print 'rowid.'">'.img_picto('delete', 'delete').''; + print ''; + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + + print "\n"; + $i++; } + $db->free($resql); + + print ""; + print "
"; + + print ''; +} else { + dol_print_error($db); +} + llxFooter(); $db->close(); From 965eb2d6397025e8ddf72501d4f46185a1aed744 Mon Sep 17 00:00:00 2001 From: daraelmin Date: Thu, 29 Apr 2021 22:57:39 +0200 Subject: [PATCH 054/147] Fix logical test always false subscription is an integer and is set to 0 or 1. So subscription is never equal to "yes" --- htdocs/adherents/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index 838e7cd9a5c..dad19ffafcd 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -857,7 +857,7 @@ while ($i < min($num, $limit)) else { print ''; - if ($obj->subscription == 'yes') + if (!empty($obj->subscription)) { print $langs->trans("SubscriptionNotReceived"); if ($obj->statut > 0) print " ".img_warning(); From 4174ebd9c0023bdda8ad1d9899a8a1a003aeb19b Mon Sep 17 00:00:00 2001 From: daraelmin Date: Thu, 29 Apr 2021 23:11:51 +0200 Subject: [PATCH 055/147] Fix subscription =="yes" --- htdocs/adherents/type.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 4590254ebf6..81e387b8dbb 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -710,7 +710,7 @@ if ($rowid > 0) else { print ''; - if ($objp->subscription == 'yes') + if (!empty($objp->subscription)) { print $langs->trans("SubscriptionNotReceived"); if ($objp->statut > 0) print " ".img_warning(); From 749aeeb233f26cdf1af9f3de6edcae140296af45 Mon Sep 17 00:00:00 2001 From: daraelmin Date: Thu, 29 Apr 2021 23:16:21 +0200 Subject: [PATCH 056/147] Fix $objp->subscription =="yes" --- htdocs/societe/societecontact.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/societecontact.php b/htdocs/societe/societecontact.php index 8874a62bc3b..4a8879c60bd 100644 --- a/htdocs/societe/societecontact.php +++ b/htdocs/societe/societecontact.php @@ -331,7 +331,7 @@ if ($id > 0 || ! empty($ref)) else { print ''; - if ($objp->subscription == 'yes') + if (!empty($objp->subscription)) { print $langs->trans("SubscriptionNotReceived"); if ($objp->statut > 0) print " ".img_warning(); From 5e98d9932156019c948c1d3e3b29011a8451a12a Mon Sep 17 00:00:00 2001 From: atm-lena Date: Fri, 30 Apr 2021 10:04:21 +0200 Subject: [PATCH 057/147] FIX SQL Error show_contacts : socialnetworks --- htdocs/core/lib/company.lib.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 48ab350d60f..d71be0b723e 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -902,11 +902,11 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '') 't.email', ); //Social media - foreach ($socialnetworks as $key => $value) { - if ($value['active']) { - $searchAddressPhoneDBFields['t.'.$key] = "t.socialnetworks->'$.".$key."'"; - } - } +// foreach ($socialnetworks as $key => $value) { +// if ($value['active']) { +// $searchAddressPhoneDBFields['t.'.$key] = "t.socialnetworks->'$.".$key."'"; +// } +// } if (!$sortorder) $sortorder = "ASC"; if (!$sortfield) $sortfield = "t.lastname"; From 81b964db45b353abf21f54a8bb6e369e32f1b600 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Fri, 30 Apr 2021 08:12:24 +0000 Subject: [PATCH 058/147] Fixing style errors. --- htdocs/core/lib/company.lib.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index d71be0b723e..16f52ad80e3 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -902,11 +902,11 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '') 't.email', ); //Social media -// foreach ($socialnetworks as $key => $value) { -// if ($value['active']) { -// $searchAddressPhoneDBFields['t.'.$key] = "t.socialnetworks->'$.".$key."'"; -// } -// } + // foreach ($socialnetworks as $key => $value) { + // if ($value['active']) { + // $searchAddressPhoneDBFields['t.'.$key] = "t.socialnetworks->'$.".$key."'"; + // } + // } if (!$sortorder) $sortorder = "ASC"; if (!$sortfield) $sortfield = "t.lastname"; From 6c1e0919c8c42789ab2993d61ae116b9c952a832 Mon Sep 17 00:00:00 2001 From: ATM john Date: Fri, 30 Apr 2021 12:20:43 +0200 Subject: [PATCH 059/147] Fix checkbox multiselect pre-selected value from get/post --- htdocs/core/class/extrafields.class.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index ed85a328edc..07d80acd9aa 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1339,7 +1339,11 @@ class ExtraFields } elseif ($type == 'checkbox') { - $value_arr = explode(',', $value); + $value_arr = $value; + if (!is_array($value)) + { + $value_arr = explode(',', $value); + } $out = $form->multiselectarray($keyprefix.$key.$keysuffix, (empty($param['options']) ?null:$param['options']), $value_arr, '', 0, '', 0, '100%'); } elseif ($type == 'radio') From 06e550cb19be9f358151425716463a7b4f00dd3f Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Fri, 30 Apr 2021 12:32:53 +0200 Subject: [PATCH 060/147] Fix : Error on knowledgemanagement_list error $sql extrafields --- 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 fdc05ac5137..931d94d18bf 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_list.php +++ b/htdocs/knowledgemanagement/knowledgerecord_list.php @@ -262,7 +262,7 @@ $sql .= $object->getFieldList('t'); // Add fields from extrafields if (!empty($extrafields->attributes[$object->table_element]['label'])) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { - $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.' as options_'.$key.', ' : ''); + $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ",ef.".$key.' as options_'.$key.', ' : ''); } } // Add fields from hooks From ab89fe73c25f9c2e785660ef12c350dc43972794 Mon Sep 17 00:00:00 2001 From: lvessiller Date: Fri, 30 Apr 2021 16:08:46 +0200 Subject: [PATCH 061/147] NEW rise code tries in digeteria customer and supplier accountant code --- htdocs/core/modules/societe/mod_codecompta_digitaria.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/societe/mod_codecompta_digitaria.php b/htdocs/core/modules/societe/mod_codecompta_digitaria.php index 363d3984516..56c5b8e8885 100644 --- a/htdocs/core/modules/societe/mod_codecompta_digitaria.php +++ b/htdocs/core/modules/societe/mod_codecompta_digitaria.php @@ -207,7 +207,7 @@ class mod_codecompta_digitaria extends ModeleAccountancyCode if (!isset($conf->global->COMPANY_DIGITARIA_UNIQUE_CODE) || !empty($conf->global->COMPANY_DIGITARIA_UNIQUE_CODE)) { $disponibility = $this->checkIfAccountancyCodeIsAlreadyUsed($db, $this->code, $type); - while ($disponibility <> 0 && $i < 100) { + while ($disponibility <> 0 && $i < 1000) { $widthsupplier = $this->supplieraccountancycodecharacternumber; $widthcustomer = $this->customeraccountancycodecharacternumber; @@ -217,6 +217,9 @@ class mod_codecompta_digitaria extends ModeleAccountancyCode if ($i >= 10 && $i <= 99) { $a = 2; } + if ($i >= 100 && $i <= 999) { + $a = 3; + } if ($type == 'supplier') { $this->code = $prefix.strtoupper(substr($codetouse, 0, $widthsupplier - $a)).$i; From 6fb256822bd93b50a917a0fcd98da39828aac38d Mon Sep 17 00:00:00 2001 From: Luis Fernando Date: Fri, 30 Apr 2021 21:07:24 -0500 Subject: [PATCH 062/147] Update card.php: Change position(ExtraFields) --- htdocs/fourn/facture/card.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 801abaa7407..63eef7854e4 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -2257,6 +2257,10 @@ if ($action == 'create') { print ''; } + if (empty($reshook)) { + print $object->showOptionals($extrafields, 'edit'); + } + // Public note print ''.$langs->trans('NotePublic').''; print ''; @@ -2275,9 +2279,6 @@ if ($action == 'create') { // print ''; print ''; - if (empty($reshook)) { - print $object->showOptionals($extrafields, 'edit'); - } if (is_object($objectsrc)) { print "\n"; From 76f42c9b51dcc89aad10233652dc06d539dd6e2b Mon Sep 17 00:00:00 2001 From: mafzalzadeh Date: Sat, 1 May 2021 11:09:34 +0430 Subject: [PATCH 063/147] fixed Persian themes direction to rtl --- htdocs/langs/fa_IR/main.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/fa_IR/main.lang b/htdocs/langs/fa_IR/main.lang index e06cabfcf01..9cd002fb039 100644 --- a/htdocs/langs/fa_IR/main.lang +++ b/htdocs/langs/fa_IR/main.lang @@ -1,5 +1,5 @@ # Dolibarr language file - Source file is en_US - main -DIRECTION=چپ‌به‌راست +DIRECTION=rtl # Note for Chinese: # msungstdlight or cid0ct are for traditional Chinese (traditional does not render with Ubuntu pdf reader) # stsongstdlight or cid0cs are for simplified Chinese From 54cb158af6b444e797334bdf6b819c54f4560c10 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Sat, 1 May 2021 12:31:30 +0200 Subject: [PATCH 064/147] Update COPYRIGHT GeoIP2 v0.2.0 --> Apache License 2.0 --- COPYRIGHT | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/COPYRIGHT b/COPYRIGHT index 9704c857ed3..aedcb1be614 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -12,41 +12,41 @@ Dolibarr uses some external libraries released under different licenses. This is Component Version License GPL Compatible Usage ------------------------------------------------------------------------------------- PHP libraries: -AdoDb-Date 0.36 Modified BSD License Yes Date convertion (not into rpm package) +ADOdb-Date 0.36 Modified BSD License Yes Date convertion (not into rpm package) CKEditor 4.12.1 LGPL-2.1+ Yes Editor WYSIWYG EvalMath 1.0 BSD Yes Safe math expressions evaluation Escpos-php 2.2 MIT License Yes Thermal receipt printer library, for use with ESC/POS compatible printers -GeoIP2 0.2.0 LGPL-2.1+ Yes Lib to make geoip convert +GeoIP2 0.2.0 Apache License 2.0 Yes Lib to make geoip convert Mobiledetect 2.8.34 MIT License Yes Detect mobile devices browsers NuSoap 0.9.5 LGPL 2.1+ Yes Library to develop SOAP Web services (not into rpm and deb package) PEAR Mail_MIME 1.8.9 BSD Yes NuSoap dependency ParseDown 1.6 MIT License Yes Markdown parser PCLZip 2.8.4 LGPL-3+ Yes Library to zip/unzip files -PHPDebugBar 1.15.1 MIT License Yes Used only by the module "debugbar" for developers +PHPDebugBar 1.15.1 MIT License Yes Used only by the module "debugbar" for developers PHPSpreadSheet 1.8.2 LGPL-2.1+ Yes Read/Write XLS files, read ODS files php-iban 1.4.7 LGPL-3+ Yes Parse and validate IBAN (and IIBAN) bank account information in PHP PHPoAuthLib 0.8.2 MIT License Yes Library to provide oauth1 and oauth2 to different service PHPPrintIPP 1.3 GPL-2+ Yes Library to send print IPP requests -PSR/Logs 1.0 Library for logs (used by DebugBar) -PSR/simple-cache ? Library for cache (used by PHPSpreadSheet) +PSR/Logs 1.0 Library for logs (used by DebugBar) +PSR/simple-cache ? MIT License Yes Library for cache (used by PHPSpreadSheet) Restler 3.1.1 LGPL-3+ Yes Library to develop REST Web services (+ swagger-ui js lib into dir explorer) Sabre 3.2.2 BSD Yes DAV support -Swift Mailer 5.4.2-DEV MIT license Yes Comprehensive mailing tools for PHP -Stripe 7.67.0 MIT licence Yes Library for Stripe module +Swift Mailer 5.4.2-DEV MIT License Yes Comprehensive mailing tools for PHP +Stripe 7.67.0 MIT Licence Yes Library for Stripe module TCPDF 6.3.2 LGPL-3+ Yes PDF generation TCPDI 1.0.0 LGPL-3+ / Apache 2.0 Yes FPDI replacement JS libraries: Ace 1.4.8 BSD Yes JS library to get code syntaxique coloration in a textarea. -ChartJS 2.9.4 MIT License Yes JS library for graph +ChartJS 2.9.4 MIT License Yes JS library for graph jQuery 3.5.1 MIT License Yes JS library jQuery UI 1.12.1 GPL and MIT License Yes JS library plugin UI -jQuery select2 4.0.13 GPL and Apache License Yes JS library plugin for sexier multiselect. Warning: 4.0.6+ create troubles without patching css +jQuery select2 4.0.13 GPL and Apache License Yes JS library plugin for sexier multiselect. Warning: 4.0.6+ create troubles without patching css jQuery blockUI 2.70.0 GPL and MIT License Yes JS library plugin blockUI (to use ajax popups) jQuery Colorpicker 1.1 MIT License Yes JS library for color picker for a defined list of colors jQuery JCrop 0.9.8 GPL and MIT License Yes JS library plugin Crop (to crop images) jQuery Jeditable 1.7.1 GPL and MIT License Yes JS library plugin jeditable (to edit in place) -jQuery jNotify 1.1.00 Apache Software License 2.0 Yes JS library plugin jNotify (to use ajax popups) +jQuery jNotify 1.1.00 Apache License 2.0 Yes JS library plugin jNotify (to use ajax popups) jQuery jPicker 1.1.6 GPL and MIT License Yes JS library for color picker with not defined list of colors jQuery jqueryFileTree 1.0.1 GPL and MIT License Yes JS library for filetree jQuery jquerytreeview 1.4.1 MIT License Yes JS library for filetree @@ -54,13 +54,13 @@ jQuery TableDnD 0.6 GPL and MIT License Yes jQuery Timepicker 1.1.0 GPL and MIT License Yes JS library Timepicker addon for Datepicker jsGanttImproved 2.7.3 BSD License Yes JS library (to build Gantt reports) JsTimezoneDetect 1.0.6 MIT License Yes JS library to detect user timezone -SwaggerUI 2.2.10 GPL-2+ Yes JS library to offer the REST API explorer +SwaggerUI 2.2.10 GPL-2+ Yes JS library to offer the REST API explorer Image libraries: Octicons 8.1 MIT Yes Font libraries: -Fontawesome 5.13 Font Awesome Free licence Yes +Fontawesome 5.13 Font Awesome Free Licence Yes For licenses compatibility informations: From 5f23c68f8572411ec19fefc0320328cbe3760d8f Mon Sep 17 00:00:00 2001 From: daraelmin Date: Sat, 1 May 2021 20:01:18 +0200 Subject: [PATCH 065/147] Update type.php --- htdocs/adherents/type.php | 53 ++++++++++++++++++++++++++------------- 1 file changed, 36 insertions(+), 17 deletions(-) diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index c9b98784142..707dd7acb7c 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -7,6 +7,7 @@ * Copyright (C) 2015 Alexandre Spangaro * Copyright (C) 2019 Thibault Foucart * Copyright (C) 2020 Josep Lluís Amador + * Copyright (C) 2021 Waël Almoman * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -70,6 +71,7 @@ $label = GETPOST("label", "alpha"); $morphy = GETPOST("morphy", "alpha"); $status = GETPOST("status", "int"); $subscription = GETPOST("subscription", "int"); +$amount = price2num(GETPOST('amount', 'alpha'), 'MT'); $duration_value = GETPOST('duration_value', 'int'); $duration_unit = GETPOST('duration_unit', 'alpha'); $vote = GETPOST("vote", "int"); @@ -114,14 +116,15 @@ if ($cancel) { if ($action == 'add' && $user->rights->adherent->configurer) { $object->label = trim($label); - $object->morphy = trim($morphy); - $object->status = (int) $status; - $object->subscription = (int) $subscription; - $object->duration_value = $duration_value; - $object->duration_unit = $duration_unit; - $object->note = trim($comment); + $object->morphy = trim($morphy); + $object->status = (int) $status; + $object->subscription = (int) $subscription; + $object->amount = $amount; + $object->duration_value = $duration_value; + $object->duration_unit = $duration_unit; + $object->note = trim($comment); $object->mail_valid = trim($mail_valid); - $object->vote = (int) $vote; + $object->vote = (int) $vote; // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost(null, $object); @@ -164,15 +167,16 @@ if ($action == 'update' && $user->rights->adherent->configurer) { $object->oldcopy = clone $object; - $object->label = trim($label); - $object->morphy = trim($morphy); - $object->status = (int) $status; + $object->label= trim($label); + $object->morphy = trim($morphy); + $object->status = (int) $status; $object->subscription = (int) $subscription; - $object->duration_value = $duration_value; - $object->duration_unit = $duration_unit; - $object->note = trim($comment); + $object->amount = $amount; + $object->duration_value = $duration_value; + $object->duration_unit = $duration_unit; + $object->note = trim($comment); $object->mail_valid = trim($mail_valid); - $object->vote = (boolean) trim($vote); + $object->vote = (boolean) trim($vote); // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost(null, $object); @@ -222,7 +226,7 @@ llxHeader('', $langs->trans("MembersTypeSetup"), $help_url); if (!$rowid && $action != 'create' && $action != 'edit') { //print dol_get_fiche_head(''); - $sql = "SELECT d.rowid, d.libelle as label, d.subscription, d.vote, d.statut as status, d.morphy"; + $sql = "SELECT d.rowid, d.libelle as label, d.subscription, d.amount, d.vote, d.statut as status, d.morphy"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as d"; $sql .= " WHERE d.entity IN (".getEntity('member_type').")"; @@ -268,6 +272,7 @@ if (!$rowid && $action != 'create' && $action != 'edit') { print ''.$langs->trans("Label").''; print ''.$langs->trans("MembersNature").''; print ''.$langs->trans("SubscriptionRequired").''; + print ''.$langs->trans("Amount").''; print ''.$langs->trans("VoteAllowed").''; print ''.$langs->trans("Status").''; print ' '; @@ -283,6 +288,7 @@ if (!$rowid && $action != 'create' && $action != 'edit') { $membertype->label = $objp->rowid; $membertype->status = $objp->status; $membertype->subscription = $objp->subscription; + $membertype->amount = $objp->amount; print ''; print ''; @@ -300,6 +306,7 @@ if (!$rowid && $action != 'create' && $action != 'edit') { } print ''; print ''.yn($objp->subscription).''; + print ''.price($objp->amount).''; print ''.yn($objp->vote).''; print ''.$membertype->getLibStatut(5).''; if ($user->rights->adherent->configurer) { @@ -358,6 +365,10 @@ if ($action == 'create') { print $form->selectyesno("subscription", 1, 1); print ''; + print ''.$langs->trans("Amount").''; + print ''; + print ''; + print ''.$langs->trans("VoteAllowed").''; print $form->selectyesno("vote", GETPOSTISSET("vote") ? GETPOST('vote', 'aZ09') : 1, 1); print ''; @@ -434,6 +445,10 @@ if ($rowid > 0) { print yn($object->subscription); print ''; + print ''.$langs->trans("Amount").''; + print price($object->amount); + print ''; + print ''.$langs->trans("VoteAllowed").''; print yn($object->vote); print ''; @@ -496,13 +511,13 @@ if ($rowid > 0) { $sql = "SELECT d.rowid, d.login, d.firstname, d.lastname, d.societe as company,"; $sql .= " d.datefin,"; $sql .= " d.email, d.fk_adherent_type as type_id, d.morphy, d.statut as status,"; - $sql .= " t.libelle as type, t.subscription"; + $sql .= " t.libelle as type, t.subscription, t.amount"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t"; $sql .= " WHERE d.fk_adherent_type = t.rowid "; $sql .= " AND d.entity IN (".getEntity('adherent').")"; $sql .= " AND t.rowid = ".((int) $object->id); if ($sall) { - $sql .= natural_search(array("f.firstname", "d.lastname", "d.societe", "d.email", "d.login", "d.address", "d.town", "d.note_public", "d.note_private"), $sall); + $sql .= natural_search(array("d.firstname", "d.lastname", "d.societe", "d.email", "d.login", "d.address", "d.town", "d.note_public", "d.note_private"), $sall); } if ($status != '') { $sql .= natural_search('d.statut', $status, 2); @@ -780,6 +795,10 @@ if ($rowid > 0) { print ''.$langs->trans("SubscriptionRequired").''; print $form->selectyesno("subscription", $object->subscription, 1); print ''; + + print ''.$langs->trans("DefineAmountMemberType").''; + print ''; + print ''; print ''.$langs->trans("VoteAllowed").''; print $form->selectyesno("vote", $object->vote, 1); From 4c3e37681cd5bf2fe443f545db2c880daada24b3 Mon Sep 17 00:00:00 2001 From: daraelmin Date: Sat, 1 May 2021 20:06:15 +0200 Subject: [PATCH 066/147] Update adherent_type.class.php --- .../adherents/class/adherent_type.class.php | 49 ++++++++++++++++++- 1 file changed, 47 insertions(+), 2 deletions(-) diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index d051c40810b..4924acf5ab6 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -4,7 +4,7 @@ * Copyright (C) 2009-2017 Regis Houssin * Copyright (C) 2016 Charlie Benke * Copyright (C) 2018-2019 Thibault Foucart - * Copyright (C) 2021 Waël Almoman + * Copyright (C) 2021 Waël Almoman * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -88,6 +88,11 @@ class AdherentType extends CommonObject * @var int Subsription required (0 or 1) */ public $subscription; + + /** + * @var float amount for subscription if required + */ + public $amount; /** @var string Public note */ public $note; @@ -361,6 +366,7 @@ class AdherentType extends CommonObject $sql .= "libelle = '".$this->db->escape($this->label)."',"; $sql .= "morphy = '".$this->db->escape($this->morphy)."',"; $sql .= "subscription = '".$this->db->escape($this->subscription)."',"; + $sql .= "amount = '".$this->db->escape($this->amount)."',"; $sql .= "duration = '".$this->db->escape($this->duration_value.$this->duration_unit)."',"; $sql .= "note = '".$this->db->escape($this->note)."',"; $sql .= "vote = ".(integer) $this->db->escape($this->vote).","; @@ -455,7 +461,7 @@ class AdherentType extends CommonObject { global $langs, $conf; - $sql = "SELECT d.rowid, d.libelle as label, d.morphy, d.statut as status, d.duration, d.subscription, d.mail_valid, d.note, d.vote"; + $sql = "SELECT d.rowid, d.libelle as label, d.morphy, d.statut as status, d.duration, d.subscription, d.amount, d.mail_valid, d.note, d.vote"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as d"; $sql .= " WHERE d.rowid = ".(int) $rowid; @@ -475,6 +481,7 @@ class AdherentType extends CommonObject $this->duration_value = substr($obj->duration, 0, dol_strlen($obj->duration) - 1); $this->duration_unit = substr($obj->duration, -1); $this->subscription = $obj->subscription; + $this->amount = $obj->amount; $this->mail_valid = $obj->mail_valid; $this->note = $obj->note; $this->vote = $obj->vote; @@ -535,6 +542,44 @@ class AdherentType extends CommonObject return $adherenttypes; } + /** + * Return list of amount by type id + * + * @param int $status Filter on status of type + * @return array List of types of members + */ + public function amount_by_type($status = null) { + + global $conf, $langs; + + $amountbytype = array(); + + $sql = "SELECT rowid, amount"; + $sql .= " FROM ".MAIN_DB_PREFIX."adherent_type"; + $sql .= " WHERE entity IN (".getEntity('member_type').")"; + if ($status !== null) { + $sql .= " AND statut = ".((int) $status); + } + + $resql = $this->db->query($sql); + if ($resql) { + $nump = $this->db->num_rows($resql); + + if ($nump) { + $i = 0; + while ($i < $nump) { + $obj = $this->db->fetch_object($resql); + + $amountbytype[$obj->rowid] = $obj->amount; + $i++; + } + } + } else { + print $this->db->error(); + } + return $amountbytype; + } + /** * Return array of Member objects for member type this->id (or all if this->id not defined) * From 5ff60c31e6fa48adfbc859dea846de8b87bc915d Mon Sep 17 00:00:00 2001 From: daraelmin Date: Sat, 1 May 2021 20:08:32 +0200 Subject: [PATCH 067/147] Update 13.0.0-14.0.0.sql --- htdocs/install/mysql/migration/13.0.0-14.0.0.sql | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql index 8eebe1db211..cda3f4310bb 100644 --- a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql +++ b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql @@ -467,4 +467,7 @@ create table llx_knowledgemanagement_knowledgerecord_extrafields tms timestamp, fk_object integer NOT NULL, import_key varchar(14) -- import key -) ENGINE=innodb; \ No newline at end of file +) ENGINE=innodb; + +-- add default amount by member type +ALTER TABLE llx_adherent_type ADD COLUMN amount DOUBLE(24,8) NULL DEFAULT NULL AFTER subscription; From 8457fef1a2684946094043b43f049a14d8bf5ec4 Mon Sep 17 00:00:00 2001 From: daraelmin Date: Sat, 1 May 2021 20:10:17 +0200 Subject: [PATCH 068/147] Update llx_adherent_type.sql --- htdocs/install/mysql/tables/llx_adherent_type.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/install/mysql/tables/llx_adherent_type.sql b/htdocs/install/mysql/tables/llx_adherent_type.sql index bdce18ef0bc..243372c0452 100644 --- a/htdocs/install/mysql/tables/llx_adherent_type.sql +++ b/htdocs/install/mysql/tables/llx_adherent_type.sql @@ -32,6 +32,7 @@ create table llx_adherent_type morphy varchar(3) NOT NULL, duration varchar(6) DEFAULT NULL, subscription varchar(3) NOT NULL DEFAULT '1', + amount double(24,8) DEFAULT NULL, vote varchar(3) NOT NULL DEFAULT '1', note text, mail_valid text From 031d258b328824eb7551af2afbfa9002af06cfa3 Mon Sep 17 00:00:00 2001 From: daraelmin Date: Sat, 1 May 2021 20:17:29 +0200 Subject: [PATCH 069/147] Update newpayment.php --- htdocs/public/payment/newpayment.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 8659b3ca8bd..10c929b78e2 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -1444,20 +1444,18 @@ if ($source == 'member' || $source == 'membersubscription') { print ''.$langs->trans("LastMemberType"); print ''.dol_escape_htmltag($member->type); print "\n"; - } - if (!empty($conf->global->MEMBER_SUBSCRIPTION_AMOUNT_BY_TYPE)) { + require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php'; + $adht = new AdherentType($db); // Amount by member type - $amountbytype = array(); // TODO Read the amount of subscription into table of types + $amountbytype = $adht->amount_by_type(1); // Set the member type $member->typeid = (int) (GETPOSTISSET("typeid") ? GETPOST("typeid", 'int') : $member->typeid); // If we change the type of membership, we set also label of new type $member->type = dol_getIdFromCode($db, $member->typeid, 'adherent_type', 'rowid', 'libelle'); // Set amount for the subscription - $amount = (!empty($member->last_subscription_amount)) ? $member->last_subscription_amount : $amountbytype[$member->typeid]; + $amount = (!empty($amountbytype[$member->typeid])) ? $amountbytype[$member->typeid] : $member->last_subscription_amount; // list member type - require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php'; - $adht = new AdherentType($db); if ( !$action) { $form = new Form($db); // so we can call method selectarray print ''.$langs->trans("NewSubscription"); From b643af9c03252a333d2a561c8bce03093b837c80 Mon Sep 17 00:00:00 2001 From: daraelmin Date: Sat, 1 May 2021 20:28:47 +0200 Subject: [PATCH 070/147] Remove unused code from reverted pr --- htdocs/adherents/admin/member.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/htdocs/adherents/admin/member.php b/htdocs/adherents/admin/member.php index 62291791fc5..d494b0ab438 100644 --- a/htdocs/adherents/admin/member.php +++ b/htdocs/adherents/admin/member.php @@ -9,8 +9,7 @@ * Copyright (C) 2012 J. Fernando Lagrange * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2020-2021 Frédéric France - * Copyright (C) 2021 Waël Almoman - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or @@ -34,7 +33,6 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php'; // Load translation files required by the page $langs->loadLangs(array("admin", "members")); From 832ceb2be376fd7da9ce06624c122d6119e28278 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Sat, 1 May 2021 18:36:59 +0000 Subject: [PATCH 071/147] Fixing style errors. --- htdocs/adherents/admin/member.php | 2 +- htdocs/adherents/class/adherent_type.class.php | 5 +++-- htdocs/adherents/type.php | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/adherents/admin/member.php b/htdocs/adherents/admin/member.php index d494b0ab438..32476f137a8 100644 --- a/htdocs/adherents/admin/member.php +++ b/htdocs/adherents/admin/member.php @@ -9,7 +9,7 @@ * Copyright (C) 2012 J. Fernando Lagrange * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2020-2021 Frédéric France - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index 4924acf5ab6..505350a9c54 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -88,7 +88,7 @@ class AdherentType extends CommonObject * @var int Subsription required (0 or 1) */ public $subscription; - + /** * @var float amount for subscription if required */ @@ -548,7 +548,8 @@ class AdherentType extends CommonObject * @param int $status Filter on status of type * @return array List of types of members */ - public function amount_by_type($status = null) { + public function amount_by_type($status = null) + { global $conf, $langs; diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 707dd7acb7c..05d50bed52d 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -795,7 +795,7 @@ if ($rowid > 0) { print ''.$langs->trans("SubscriptionRequired").''; print $form->selectyesno("subscription", $object->subscription, 1); print ''; - + print ''.$langs->trans("DefineAmountMemberType").''; print ''; print ''; From 28ba84770997466037b93b4b976484c6042bb96b Mon Sep 17 00:00:00 2001 From: daraelmin Date: Sat, 1 May 2021 20:43:58 +0200 Subject: [PATCH 072/147] camelCase format for method amountByType --- htdocs/adherents/class/adherent_type.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index 505350a9c54..9e15934cdb5 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -548,7 +548,7 @@ class AdherentType extends CommonObject * @param int $status Filter on status of type * @return array List of types of members */ - public function amount_by_type($status = null) + public function amountByType($status = null) { global $conf, $langs; From 0610ca89c1ff8e5abf15d7335d85be6972834217 Mon Sep 17 00:00:00 2001 From: daraelmin Date: Sat, 1 May 2021 20:45:57 +0200 Subject: [PATCH 073/147] camelCase for amountByType --- htdocs/public/payment/newpayment.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 10c929b78e2..7007455791a 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -1448,7 +1448,7 @@ if ($source == 'member' || $source == 'membersubscription') { require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php'; $adht = new AdherentType($db); // Amount by member type - $amountbytype = $adht->amount_by_type(1); + $amountbytype = $adht->amountByType(1); // Set the member type $member->typeid = (int) (GETPOSTISSET("typeid") ? GETPOST("typeid", 'int') : $member->typeid); // If we change the type of membership, we set also label of new type From 127654e792dc77d23333f7d7faf1641bb4cb22ad Mon Sep 17 00:00:00 2001 From: kastoras Date: Sat, 1 May 2021 22:32:08 +0300 Subject: [PATCH 074/147] New/NEW Product Variants API, add variant stock to response Remove dependency inserded by mistake --- htdocs/product/class/api_products.class.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index 62137730e5f..39d8b8aa83a 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -25,7 +25,6 @@ require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductAttribute.class.php'; require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductAttributeValue.class.php'; require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductCombination.class.php'; require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductCombination2ValuePair.class.php'; -require_once DOL_DOCUMENT_ROOT.'/product/stock/class/productstockentrepot.class.php'; /** * API class for products From 1d05ce4a152a9cccb35b331a92399086af4e33ea Mon Sep 17 00:00:00 2001 From: daraelmin Date: Sat, 1 May 2021 21:40:43 +0200 Subject: [PATCH 075/147] Update comment --- htdocs/adherents/class/adherent_type.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index 9e15934cdb5..2ffc1e2c9fd 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -90,7 +90,7 @@ class AdherentType extends CommonObject public $subscription; /** - * @var float amount for subscription if required + * @var float amount for subscription */ public $amount; From f25997b292b09f81285a273235f50bd1f7900be7 Mon Sep 17 00:00:00 2001 From: daraelmin Date: Sat, 1 May 2021 21:42:13 +0200 Subject: [PATCH 076/147] phpunit --- test/phpunit/AdherentTest.php | 1 + 1 file changed, 1 insertion(+) diff --git a/test/phpunit/AdherentTest.php b/test/phpunit/AdherentTest.php index d9ba2e267e9..63b55dd37aa 100644 --- a/test/phpunit/AdherentTest.php +++ b/test/phpunit/AdherentTest.php @@ -154,6 +154,7 @@ class AdherentTest extends PHPUnit\Framework\TestCase $localobject->statut=1; $localobject->label='Adherent type test'; $localobject->subscription=1; + $localobject->amount=0; $localobject->vote=1; $localobject->company='Old company label'; $result=$localobject->create($user); From 125162f52012e1c9e2e6f7748d1f6eb5b1c6b2cb Mon Sep 17 00:00:00 2001 From: daraelmin Date: Sat, 1 May 2021 22:01:04 +0200 Subject: [PATCH 077/147] Fix #17352 card number overlaps expiration date on public payment page with Stripe --- htdocs/theme/eldy/global.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index f96844e1655..4227019fc09 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -4420,7 +4420,7 @@ div.backgreypublicpayment { background-color: #f0f0f0; padding: 20px; border-bot color: #222; opacity: 0.3; } -#dolpaymenttable { min-width: 290px; font-size: 16px; } /* Width must have min to make stripe input area visible. Lower than 320 makes input area crazy for credit card that need zip code */ +#dolpaymenttable { min-width: 320px; font-size: 16px; } /* Width must have min to make stripe input area visible. Lower than 320 makes input area crazy for credit card that need zip code */ #tablepublicpayment { border: 1px solid #CCCCCC !important; width: 100%; padding: 20px; } #tablepublicpayment .CTableRow1 { background-color: #F0F0F0 !important; } #tablepublicpayment tr.liste_total { border-bottom: 1px solid #CCCCCC !important; } From 0acbd87a53690c8b5e5e46fd726aabf1b2a28694 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sun, 2 May 2021 01:47:29 +0200 Subject: [PATCH 078/147] NEW Accountancy - Add select date from/to in binding customer list --- htdocs/accountancy/customer/list.php | 65 +++++++++++++++++++--------- 1 file changed, 45 insertions(+), 20 deletions(-) diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index 678e5081937..b7f1efbcbc0 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -1,6 +1,6 @@ - * Copyright (C) 2013-2020 Alexandre Spangaro + * Copyright (C) 2013-2021 Alexandre Spangaro * Copyright (C) 2014-2015 Ari Elbaz (elarifr) * Copyright (C) 2013-2014 Florian Henry * Copyright (C) 2014 Juanjo Menent @@ -59,9 +59,14 @@ $search_desc = GETPOST('search_desc', 'alpha'); $search_amount = GETPOST('search_amount', 'alpha'); $search_account = GETPOST('search_account', 'alpha'); $search_vat = GETPOST('search_vat', 'alpha'); -$search_day = GETPOST("search_day", "int"); -$search_month = GETPOST("search_month", "int"); -$search_year = GETPOST("search_year", "int"); +$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_country = GETPOST('search_country', 'alpha'); $search_tvaintra = GETPOST('search_tvaintra', 'alpha'); @@ -135,9 +140,14 @@ if (empty($reshook)) { $search_amount = ''; $search_account = ''; $search_vat = ''; - $search_day = ''; - $search_month = ''; - $search_year = ''; + $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_country = ''; $search_tvaintra = ''; } @@ -289,7 +299,12 @@ if (strlen(trim($search_account))) { if (strlen(trim($search_vat))) { $sql .= natural_search("l.tva_tx", price2num($search_vat), 1); } -$sql .= dolSqlDateFilter('f.datef', $search_day, $search_month, $search_year); +if ($search_date_start) { + $sql .= " AND f.datef >= '".$db->idate($search_date_start)."'"; +} +if ($search_date_end) { + $sql .= " AND f.datef <= '".$db->idate($search_date_end)."'"; +} if (strlen(trim($search_country))) { $arrayofcode = getCountriesInEEC(); $country_code_in_EEC = $country_code_in_EEC_without_me = ''; @@ -368,14 +383,23 @@ if ($result) { if ($search_lineid) { $param .= '&search_lineid='.urlencode($search_lineid); } - if ($search_day) { - $param .= '&search_day='.urlencode($search_day); + if ($search_date_startday) { + $param .= '&search_date_startday='.urlencode($search_date_startday); } - if ($search_month) { - $param .= '&search_month='.urlencode($search_month); + if ($search_date_startmonth) { + $param .= '&search_date_startmonth='.urlencode($search_date_startmonth); } - if ($search_year) { - $param .= '&search_year='.urlencode($search_year); + 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_invoice) { $param .= '&search_invoice='.urlencode($search_invoice); @@ -436,12 +460,13 @@ if ($result) { print ''; print ''; print ''; - print ''; - if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) { - print ''; - } - print ''; - $formother->select_year($search_year, 'search_year', 1, 20, 5); + print ''; + 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 ''; print ''; //print ''; From 3c01eba11a2d1d6c8301a043c499dc772ec4dce6 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sun, 2 May 2021 01:53:49 +0200 Subject: [PATCH 079/147] NEW Accountancy - Add select date from/to in already bind customer list --- htdocs/accountancy/customer/lines.php | 63 +++++++++++++++++++-------- 1 file changed, 44 insertions(+), 19 deletions(-) diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index b8cc34c3cae..68d49793553 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -53,9 +53,14 @@ $search_desc = GETPOST('search_desc', 'alpha'); $search_amount = GETPOST('search_amount', 'alpha'); $search_account = GETPOST('search_account', 'alpha'); $search_vat = GETPOST('search_vat', 'alpha'); -$search_day = GETPOST("search_day", "int"); -$search_month = GETPOST("search_month", "int"); -$search_year = GETPOST("search_year", "int"); +$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_country = GETPOST('search_country', 'alpha'); $search_tvaintra = GETPOST('search_tvaintra', 'alpha'); @@ -109,9 +114,14 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' $search_amount = ''; $search_account = ''; $search_vat = ''; - $search_day = ''; - $search_month = ''; - $search_year = ''; + $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_country = ''; $search_tvaintra = ''; } @@ -240,7 +250,12 @@ if (strlen(trim($search_account))) { if (strlen(trim($search_vat))) { $sql .= natural_search("fd.tva_tx", price2num($search_vat), 1); } -$sql .= dolSqlDateFilter('f.datef', $search_day, $search_month, $search_year); +if ($search_date_start) { + $sql .= " AND f.datef >= '".$db->idate($search_date_start)."'"; +} +if ($search_date_end) { + $sql .= " AND f.datef <= '".$db->idate($search_date_end)."'"; +} if (strlen(trim($search_country))) { $arrayofcode = getCountriesInEEC(); $country_code_in_EEC = $country_code_in_EEC_without_me = ''; @@ -315,14 +330,23 @@ if ($result) { if ($search_vat) { $param .= "&search_vat=".urlencode($search_vat); } - if ($search_day) { - $param .= '&search_day='.urlencode($search_day); + if ($search_date_startday) { + $param .= '&search_date_startday='.urlencode($search_date_startday); } - if ($search_month) { - $param .= '&search_month='.urlencode($search_month); + if ($search_date_startmonth) { + $param .= '&search_date_startmonth='.urlencode($search_date_startmonth); } - if ($search_year) { - $param .= '&search_year='.urlencode($search_year); + 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_country) { $param .= "&search_country=".urlencode($search_country); @@ -357,12 +381,13 @@ if ($result) { print ''; print ''; print ''; - print ''; - if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) { - print ''; - } - print ''; - $formother->select_year($search_year, 'search_year', 1, 20, 5); + print ''; + 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 ''; print ''; //print ''; From 87b9f7a77d116c2ee00c70c07d3c782a468790e8 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sun, 2 May 2021 01:59:11 +0200 Subject: [PATCH 080/147] NEW Accountancy - Add select date from/to in already bind supplier list --- htdocs/accountancy/supplier/lines.php | 63 +++++++++++++++++++-------- 1 file changed, 44 insertions(+), 19 deletions(-) diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index deed1299fd5..90e7213c8f9 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -54,9 +54,14 @@ $search_desc = GETPOST('search_desc', 'alpha'); $search_amount = GETPOST('search_amount', 'alpha'); $search_account = GETPOST('search_account', 'alpha'); $search_vat = GETPOST('search_vat', 'alpha'); -$search_day = GETPOST("search_day", "int"); -$search_month = GETPOST("search_month", "int"); -$search_year = GETPOST("search_year", "int"); +$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_country = GETPOST('search_country', 'alpha'); $search_tvaintra = GETPOST('search_tvaintra', 'alpha'); @@ -112,9 +117,14 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' $search_amount = ''; $search_account = ''; $search_vat = ''; - $search_day = ''; - $search_month = ''; - $search_year = ''; + $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_country = ''; $search_tvaintra = ''; } @@ -234,7 +244,12 @@ if (strlen(trim($search_account))) { if (strlen(trim($search_vat))) { $sql .= natural_search("l.tva_tx", price2num($search_vat), 1); } -$sql .= dolSqlDateFilter('f.datef', $search_day, $search_month, $search_year); +if ($search_date_start) { + $sql .= " AND f.datef >= '".$db->idate($search_date_start)."'"; +} +if ($search_date_end) { + $sql .= " AND f.datef <= '".$db->idate($search_date_end)."'"; +} if (strlen(trim($search_country))) { $arrayofcode = getCountriesInEEC(); $country_code_in_EEC = $country_code_in_EEC_without_me = ''; @@ -315,14 +330,23 @@ if ($result) { if ($search_vat) { $param .= "&search_vat=".urlencode($search_vat); } - if ($search_day) { - $param .= '&search_day='.urlencode($search_day); + if ($search_date_startday) { + $param .= '&search_date_startday='.urlencode($search_date_startday); } - if ($search_month) { - $param .= '&search_month='.urlencode($search_month); + if ($search_date_startmonth) { + $param .= '&search_date_startmonth='.urlencode($search_date_startmonth); } - if ($search_year) { - $param .= '&search_year='.urlencode($search_year); + 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_country) { $param .= "&search_country=".urlencode($search_country); @@ -359,12 +383,13 @@ if ($result) { print ''; print ''; print ''; - print ''; - if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) { - print ''; - } - print ''; - $formother->select_year($search_year, 'search_year', 1, 20, 5); + print ''; + 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 ''; print ''; print ''; From 6b75edf2f3e9ad786803fc0e99bc15bdd4640363 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sun, 2 May 2021 02:03:19 +0200 Subject: [PATCH 081/147] NEW Accountancy - Add select date from/to in binding supplier list --- htdocs/accountancy/supplier/list.php | 65 +++++++++++++++++++--------- 1 file changed, 45 insertions(+), 20 deletions(-) diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index dda111856d3..cc3430af872 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -1,6 +1,6 @@ - * Copyright (C) 2013-2020 Alexandre Spangaro + * Copyright (C) 2013-2021 Alexandre Spangaro * Copyright (C) 2014-2015 Ari Elbaz (elarifr) * Copyright (C) 2013-2014 Florian Henry * Copyright (C) 2014 Juanjo Menent s @@ -60,9 +60,14 @@ $search_desc = GETPOST('search_desc', 'alpha'); $search_amount = GETPOST('search_amount', 'alpha'); $search_account = GETPOST('search_account', 'alpha'); $search_vat = GETPOST('search_vat', 'alpha'); -$search_day = GETPOST("search_day", "int"); -$search_month = GETPOST("search_month", "int"); -$search_year = GETPOST("search_year", "int"); +$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_country = GETPOST('search_country', 'alpha'); $search_tvaintra = GETPOST('search_tvaintra', 'alpha'); @@ -140,9 +145,14 @@ if (empty($reshook)) { $search_amount = ''; $search_account = ''; $search_vat = ''; - $search_day = ''; - $search_month = ''; - $search_year = ''; + $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_country = ''; $search_tvaintra = ''; } @@ -293,7 +303,12 @@ if (strlen(trim($search_account))) { if (strlen(trim($search_vat))) { $sql .= natural_search("l.tva_tx", price2num($search_vat), 1); } -$sql .= dolSqlDateFilter('f.datef', $search_day, $search_month, $search_year); +if ($search_date_start) { + $sql .= " AND f.datef >= '".$db->idate($search_date_start)."'"; +} +if ($search_date_end) { + $sql .= " AND f.datef <= '".$db->idate($search_date_end)."'"; +} if (strlen(trim($search_country))) { $arrayofcode = getCountriesInEEC(); $country_code_in_EEC = $country_code_in_EEC_without_me = ''; @@ -372,14 +387,23 @@ if ($result) { if ($search_lineid) { $param .= '&search_lineid='.urlencode($search_lineid); } - if ($search_day) { - $param .= '&search_day='.urlencode($search_day); + if ($search_date_startday) { + $param .= '&search_date_startday='.urlencode($search_date_startday); } - if ($search_month) { - $param .= '&search_month='.urlencode($search_month); + if ($search_date_startmonth) { + $param .= '&search_date_startmonth='.urlencode($search_date_startmonth); } - if ($search_year) { - $param .= '&search_year='.urlencode($search_year); + 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_invoice) { $param .= '&search_invoice='.urlencode($search_invoice); @@ -444,12 +468,13 @@ if ($result) { print ''; print ''; //print ''; - print ''; - if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) { - print ''; - } - print ''; - $formother->select_year($search_year, 'search_year', 1, 20, 5); + print ''; + 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 ''; print ''; print ''; From cd6bcd14f3abbca6041dfa530da43b38f940127c Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sun, 2 May 2021 02:35:16 +0200 Subject: [PATCH 082/147] NEW Accountancy - Possibility to select journals in balance --- htdocs/accountancy/bookkeeping/balance.php | 19 +++++++++++++++++-- .../accountancy/class/bookkeeping.class.php | 9 ++++++++- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index e03790a8995..9a044ed42c2 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -1,7 +1,7 @@ * Copyright (C) 2016 Florian Henry - * Copyright (C) 2016-2020 Alexandre Spangaro + * Copyright (C) 2016-2021 Alexandre Spangaro * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -30,6 +30,7 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php'; +require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancyexport.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; @@ -60,7 +61,7 @@ $pagenext = $page + 1; $show_subgroup = GETPOST('show_subgroup', 'alpha'); $search_date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETPOST('date_startday', 'int'), GETPOST('date_startyear', 'int')); $search_date_end = dol_mktime(23, 59, 59, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int')); - +$search_ledger_code = GETPOST('search_ledger_code', 'array'); $search_accountancy_code_start = GETPOST('search_accountancy_code_start', 'alpha'); if ($search_accountancy_code_start == - 1) { $search_accountancy_code_start = ''; @@ -134,6 +135,12 @@ if (!empty($search_accountancy_code_end)) { $filter['t.numero_compte<='] = $search_accountancy_code_end; $param .= '&search_accountancy_code_end='.$search_accountancy_code_end; } +if (!empty($search_ledger_code)) { + $filter['t.code_journal'] = $search_ledger_code; + foreach ($search_ledger_code as $code) { + $param .= '&search_ledger_code[]='.urlencode($code); + } +} if (empty($conf->accounting->enabled)) { accessforbidden(); @@ -157,6 +164,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' $search_date_end = ''; $search_accountancy_code_start = ''; $search_accountancy_code_end = ''; + $search_ledger_code = array(); $filter = array(); } @@ -265,6 +273,13 @@ if ($action != 'export_csv') { print ''; + print ''; + print ''; + print ''; + print ''; print ''; print ''; -print ''; +print ''; if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) { print ''; } @@ -764,8 +764,8 @@ if (!empty($arrayfields['t.subledger_account']['checked'])) { // TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because it does not // use setup of keypress to select thirdparty and this hang browser on large database. if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) { - print $langs->trans('From').' '; - print $formaccounting->select_auxaccount($search_accountancy_aux_code_start, 'search_accountancy_aux_code_start', 1); + //print $langs->trans('From').' '; + print $formaccounting->select_auxaccount($search_accountancy_aux_code_start, 'search_accountancy_aux_code_start', $langs->trans('From'), 'maxwidth250', 'subledgeraccount'); } else { print ''; } @@ -774,8 +774,8 @@ if (!empty($arrayfields['t.subledger_account']['checked'])) { // TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because it does not // use setup of keypress to select thirdparty and this hang browser on large database. if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) { - print $langs->trans('to').' '; - print $formaccounting->select_auxaccount($search_accountancy_aux_code_end, 'search_accountancy_aux_code_end', 1); + //print $langs->trans('to').' '; + print $formaccounting->select_auxaccount($search_accountancy_aux_code_end, 'search_accountancy_aux_code_end', $langs->trans('to'), 'maxwidth250', 'subledgeraccount'); } else { print ''; } diff --git a/htdocs/core/class/html.formaccounting.class.php b/htdocs/core/class/html.formaccounting.class.php index afbda03be8e..a57e39f1779 100644 --- a/htdocs/core/class/html.formaccounting.class.php +++ b/htdocs/core/class/html.formaccounting.class.php @@ -32,7 +32,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; */ class FormAccounting extends Form { - private $options_cache = array(); /** @@ -87,7 +86,7 @@ class FormAccounting extends Form $sql .= " WHERE active = 1"; $sql .= " AND entity = ".$conf->entity; if ($nature && is_numeric($nature)) { - $sql .= " AND nature = ".$nature; + $sql .= " AND nature = ".((int) $nature); } $sql .= " ORDER BY code"; @@ -167,7 +166,7 @@ class FormAccounting extends Form $sql .= " WHERE active = 1"; $sql .= " AND entity = ".$conf->entity; if ($nature && is_numeric($nature)) { - $sql .= " AND nature = ".$nature; + $sql .= " AND nature = ".((int) $nature); } $sql .= " ORDER BY code"; @@ -435,67 +434,77 @@ class FormAccounting extends Form /** * Return list of auxilary accounts. Cumulate list from customers, suppliers and users. * - * @param string $selectid Preselected pcg_type - * @param string $htmlname Name of field in html form - * @param int $showempty Add an empty field - * @param string $morecss More css - * @return string String with HTML select + * @param string $selectid Preselected pcg_type + * @param string $htmlname Name of field in html form + * @param int|string $showempty Add an empty field + * @param string $morecss More css + * @param string $usecache Key to use to store result into a cache. Next call with same key will reuse the cache. + * @return string String with HTML select */ - public function select_auxaccount($selectid, $htmlname = 'account_num_aux', $showempty = 0, $morecss = 'maxwidth250') + public function select_auxaccount($selectid, $htmlname = 'account_num_aux', $showempty = 0, $morecss = 'maxwidth250', $usecache = '') { // phpcs:enable $aux_account = array(); - // Auxiliary thirdparties account - $sql = "SELECT code_compta, code_compta_fournisseur, nom as name"; - $sql .= " FROM ".MAIN_DB_PREFIX."societe"; - $sql .= " WHERE entity IN (".getEntity('societe').")"; - $sql .= " AND client IN (1,3) OR fournisseur = 1"; - - dol_syslog(get_class($this)."::select_auxaccount", LOG_DEBUG); - $resql = $this->db->query($sql); - if ($resql) { - while ($obj = $this->db->fetch_object($resql)) { - if (!empty($obj->code_compta)) { - $aux_account[$obj->code_compta] = $obj->code_compta.' ('.$obj->name.')'; - } - if (!empty($obj->code_compta_fournisseur)) { - $aux_account[$obj->code_compta_fournisseur] = $obj->code_compta_fournisseur.' ('.$obj->name.')'; - } - } + if ($usecache && !empty($this->options_cache[$usecache])) { + $aux_account = $aux_account + $this->options_cache[$usecache]; // We use + instead of array_merge because we don't want to reindex key from 0 } else { - $this->error = "Error ".$this->db->lasterror(); - dol_syslog(get_class($this)."::select_auxaccount ".$this->error, LOG_ERR); - return -1; - } + dol_syslog(get_class($this)."::select_auxaccount", LOG_DEBUG); - ksort($aux_account); + // Auxiliary thirdparties account + $sql = "SELECT code_compta, code_compta_fournisseur, nom as name"; + $sql .= " FROM ".MAIN_DB_PREFIX."societe"; + $sql .= " WHERE entity IN (".getEntity('societe').")"; + $sql .= " AND client IN (1,3) OR fournisseur = 1"; - $this->db->free($resql); - - // Auxiliary user account - $sql = "SELECT DISTINCT accountancy_code, lastname, firstname "; - $sql .= " FROM ".MAIN_DB_PREFIX."user"; - $sql .= " WHERE entity IN (".getEntity('user').")"; - $sql .= " ORDER BY accountancy_code"; - dol_syslog(get_class($this)."::select_auxaccount", LOG_DEBUG); - $resql = $this->db->query($sql); - if ($resql) { - while ($obj = $this->db->fetch_object($resql)) { - if (!empty($obj->accountancy_code)) { - $aux_account[$obj->accountancy_code] = $obj->accountancy_code.' ('.dolGetFirstLastname($obj->firstname, $obj->lastname).')'; + $resql = $this->db->query($sql); + if ($resql) { + while ($obj = $this->db->fetch_object($resql)) { + if (!empty($obj->code_compta)) { + $aux_account[$obj->code_compta] = $obj->code_compta.' ('.$obj->name.')'; + } + if (!empty($obj->code_compta_fournisseur)) { + $aux_account[$obj->code_compta_fournisseur] = $obj->code_compta_fournisseur.' ('.$obj->name.')'; + } } + } else { + $this->error = "Error ".$this->db->lasterror(); + dol_syslog(get_class($this)."::select_auxaccount ".$this->error, LOG_ERR); + return -1; + } + + ksort($aux_account); + + $this->db->free($resql); + + // Auxiliary user account + $sql = "SELECT DISTINCT accountancy_code, lastname, firstname "; + $sql .= " FROM ".MAIN_DB_PREFIX."user"; + $sql .= " WHERE entity IN (".getEntity('user').")"; + $sql .= " ORDER BY accountancy_code"; + + $resql = $this->db->query($sql); + if ($resql) { + while ($obj = $this->db->fetch_object($resql)) { + if (!empty($obj->accountancy_code)) { + $aux_account[$obj->accountancy_code] = $obj->accountancy_code.' ('.dolGetFirstLastname($obj->firstname, $obj->lastname).')'; + } + } + } else { + $this->error = "Error ".$this->db->lasterror(); + dol_syslog(get_class($this)."::select_auxaccount ".$this->error, LOG_ERR); + return -1; + } + $this->db->free($resql); + + if ($usecache) { + $this->options_cache[$usecache] = $aux_account; } - } else { - $this->error = "Error ".$this->db->lasterror(); - dol_syslog(get_class($this)."::select_auxaccount ".$this->error, LOG_ERR); - return -1; } - $this->db->free($resql); // Build select - $out .= Form::selectarray($htmlname, $aux_account, $selectid, $showempty, 0, 0, '', 0, 0, 0, '', $morecss, 1); + $out .= Form::selectarray($htmlname, $aux_account, $selectid, ($showempty ? (is_numeric($showempty) ? 1 : $showempty): 0), 0, 0, '', 0, 0, 0, '', $morecss, 1); return $out; } From e9ed985e183472f2480fad9e3115e1370eb2df82 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 3 May 2021 12:47:40 +0200 Subject: [PATCH 111/147] Fix filter --- htdocs/accountancy/bookkeeping/list.php | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index e5edeaa0852..a8a24e67d9d 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -72,7 +72,7 @@ if ($search_accountancy_code_end == - 1) { $search_accountancy_code_end = ''; } -$search_accountancy_aux_code = GETPOST("search_accountancy_aux_code"); +$search_accountancy_aux_code = GETPOST("search_accountancy_aux_code", 'alpha'); $search_accountancy_aux_code_start = GETPOST('search_accountancy_aux_code_start', 'alpha'); if ($search_accountancy_aux_code_start == - 1) { $search_accountancy_aux_code_start = ''; @@ -457,12 +457,14 @@ if (count($filter) > 0) { $sqlwhere[] = $key.'=\''.$db->idate($value).'\''; } elseif ($key == 't.doc_date>=' || $key == 't.doc_date<=') { $sqlwhere[] = $key.'\''.$db->idate($value).'\''; - } elseif ($key == 't.numero_compte>=' || $key == 't.numero_compte<=' || $key == 't.subledger_account>=' || $key == 't.subledger_account<=') { + } elseif ($key == 't.numero_compte>=' || $key == 't.numero_compte<=') { $sqlwhere[] = $key.'\''.$db->escape($value).'\''; } elseif ($key == 't.fk_doc' || $key == 't.fk_docdet' || $key == 't.piece_num') { $sqlwhere[] = $key.'='.$value; - } elseif ($key == 't.subledger_account' || $key == 't.numero_compte') { + } elseif ($key == 't.numero_compte') { $sqlwhere[] = $key.' LIKE \''.$db->escape($value).'%\''; + } elseif ($key == 't.subledger_account') { + $sqlwhere[] = natural_search($key, $value, 0, 1); } elseif ($key == 't.date_creation>=' || $key == 't.date_creation<=') { $sqlwhere[] = $key.'\''.$db->idate($value).'\''; } elseif ($key == 't.tms>=' || $key == 't.tms<=') { @@ -760,26 +762,19 @@ if (!empty($arrayfields['t.numero_compte']['checked'])) { // Subledger account if (!empty($arrayfields['t.subledger_account']['checked'])) { print ''; } // Label operation From 76a669a13f6430268c2b431622a60634cfe7d915 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 3 May 2021 13:12:09 +0200 Subject: [PATCH 112/147] Only en_US must exists into template --- .../template/langs/fr_FR/mymodule.lang | 48 ------------------- 1 file changed, 48 deletions(-) delete mode 100644 htdocs/modulebuilder/template/langs/fr_FR/mymodule.lang diff --git a/htdocs/modulebuilder/template/langs/fr_FR/mymodule.lang b/htdocs/modulebuilder/template/langs/fr_FR/mymodule.lang deleted file mode 100644 index 20d9cb64259..00000000000 --- a/htdocs/modulebuilder/template/langs/fr_FR/mymodule.lang +++ /dev/null @@ -1,48 +0,0 @@ -# Copyright (C) ---Put here your own copyright and developer email--- -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -# -# Générique -# - -# Module label 'ModuleMyModuleName' -ModuleMyModuleName = Mon module -# Module description 'ModuleMyModuleDesc' -ModuleMyModuleDesc = Description de MyModule - -# -# Page d'administration -# -MyModuleSetup = Configuration du module MyModule -Settings = Réglages -MyModuleSetupPage = Page de configuration du module MyModule - -# -# Page À propos -# -About = À propos -MyModuleAbout = À propos de MyModule -MyModuleAboutPage = Page à propos de MyModule - -# -# Page d'exemple -# -MyPageName = Nom de ma page - -# -# Box d'exemple -# -MyWidget = Mon widget -MyWidgetDescription = Description de mon widget From a806a1845584ef786bfe28f1daccc769c70bff59 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 3 May 2021 13:35:10 +0200 Subject: [PATCH 113/147] Reduce sql --- htdocs/accountancy/admin/defaultaccounts.php | 4 ++-- htdocs/accountancy/customer/list.php | 12 ++++++------ htdocs/accountancy/supplier/list.php | 10 +++++----- htdocs/core/class/html.form.class.php | 9 ++++++--- 4 files changed, 19 insertions(+), 16 deletions(-) diff --git a/htdocs/accountancy/admin/defaultaccounts.php b/htdocs/accountancy/admin/defaultaccounts.php index 59aeaae06f0..79a5c0975b7 100644 --- a/htdocs/accountancy/admin/defaultaccounts.php +++ b/htdocs/accountancy/admin/defaultaccounts.php @@ -169,7 +169,7 @@ foreach ($list_account_main as $key) { print ''; // Value print ''; print ''; } @@ -186,7 +186,7 @@ foreach ($list_account as $key) { print ''; // Value print ''; print ''; } diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index b7f1efbcbc0..4df8d6b9b15 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -475,7 +475,7 @@ if ($result) { print ''; print ''; print ''; print ''; @@ -712,8 +712,8 @@ if ($result) { print ''; // Found accounts - print ''; // Found accounts - print ''; From 28b1d83ae97f1f0231f3d5c37aaf4709debcd84f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 3 May 2021 18:29:21 +0200 Subject: [PATCH 128/147] Make some performance enhancements --- .../accountancy/class/bookkeeping.class.php | 25 ++++---- htdocs/accountancy/journal/bankjournal.php | 62 +++++++++---------- .../journal/expensereportsjournal.php | 13 +++- .../accountancy/journal/purchasesjournal.php | 25 ++++++-- htdocs/accountancy/journal/sellsjournal.php | 22 +++++-- .../install/mysql/migration/13.0.0-14.0.0.sql | 6 ++ .../tables/llx_accounting_bookkeeping.key.sql | 3 +- test/phpunit/ImagesLibTest.php | 4 +- 8 files changed, 99 insertions(+), 61 deletions(-) diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 499ace29b8b..eb2c3476275 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -129,13 +129,13 @@ class BookKeeping extends CommonObject /** * @var float FEC:Amount (Not necessary) - * @deprecated Use $amount + * @deprecated No more used (we have info into debit/credit and sens) */ public $montant; /** * @var float FEC:Amount (Not necessary) - * @deprecated No more used + * @deprecated No more used (we have info into debit/credit and sens) */ public $amount; @@ -287,17 +287,17 @@ class BookKeeping extends CommonObject $this->piece_num = 0; // First check if line not yet already in bookkeeping. - // Note that we must include doc_type - fk_doc - numero_compte - label to be sure to have unicity of line (we may have several lines + // Note that we must include 'doc_type - fk_doc - numero_compte - label' to be sure to have unicity of line (because we may have several lines // with same doc_type, fk_doc, numero_compte for 1 invoice line when using localtaxes with same account) // WARNING: This is not reliable, label may have been modified. This is just a small protection. - // The page to make journalization make the test on couple doc_type - fk_doc only. + // The page that make transfer make the test on couple (doc_type - fk_doc) only. $sql = "SELECT count(*) as nb"; $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element; $sql .= " WHERE doc_type = '".$this->db->escape($this->doc_type)."'"; $sql .= " AND fk_doc = ".$this->fk_doc; if (!empty($conf->global->ACCOUNTANCY_ENABLE_FKDOCDET)) { - // DO NOT USE THIS IN PRPDUCTION. This will generate a lot of trouble into reports and will corrupt database (by generating duplicate entries. - $sql .= " AND fk_docdet = " . $this->fk_docdet; // This field can be 0 if record is for several lines + // DO NOT USE THIS IN PRODUCTION. This will generate a lot of trouble into reports and will corrupt database (by generating duplicate entries. + $sql .= " AND fk_docdet = " . $this->fk_docdet; // This field can be 0 if record is for several lines } $sql .= " AND numero_compte = '".$this->db->escape($this->numero_compte)."'"; $sql .= " AND label_operation = '".$this->db->escape($this->label_operation)."'"; @@ -307,12 +307,16 @@ class BookKeeping extends CommonObject if ($resql) { $row = $this->db->fetch_object($resql); - if ($row->nb == 0) { - // Determine piece_num + if ($row->nb == 0) { // Not already into bookkeeping + // Check to know if piece_num already exists for data we try to insert to reuse the same value $sqlnum = "SELECT piece_num"; $sqlnum .= " FROM ".MAIN_DB_PREFIX.$this->table_element; $sqlnum .= " WHERE doc_type = '".$this->db->escape($this->doc_type)."'"; // For example doc_type = 'bank' - $sqlnum .= " AND fk_docdet = ".$this->db->escape($this->fk_docdet); // fk_docdet is rowid into llx_bank or llx_facturedet or llx_facturefourndet, or ... + $sqlnum .= " AND fk_doc = ".$this->fk_doc; + if (!empty($conf->global->ACCOUNTANCY_ENABLE_FKDOCDET)) { + // fk_docdet is rowid into llx_bank or llx_facturedet or llx_facturefourndet, or ... + $sqlnum .= " AND fk_docdet = ".((int) $this->fk_docdet); + } $sqlnum .= " AND doc_ref = '".$this->db->escape($this->doc_ref)."'"; // ref of source object $sqlnum .= " AND entity IN (".getEntity('accountancy').")"; @@ -329,13 +333,12 @@ class BookKeeping extends CommonObject $sqlnum .= " FROM ".MAIN_DB_PREFIX.$this->table_element; $sqlnum .= " WHERE entity IN (".getEntity('accountancy').")"; - dol_syslog(get_class($this).":: create sqlnum=".$sqlnum, LOG_DEBUG); $resqlnum = $this->db->query($sqlnum); if ($resqlnum) { $objnum = $this->db->fetch_object($resqlnum); $this->piece_num = $objnum->maxpiecenum; } - dol_syslog(get_class($this).":: create this->piece_num=".$this->piece_num, LOG_DEBUG); + dol_syslog(get_class($this).":: create now this->piece_num=".$this->piece_num, LOG_DEBUG); } if (empty($this->piece_num)) { $this->piece_num = 1; diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index edb5e209df7..76984d55fba 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -511,6 +511,18 @@ var_dump($tabtype);*/ if (!$error && $action == 'writebookkeeping') { $now = dol_now(); + $accountingaccountcustomer = new AccountingAccount($db); + $accountingaccountcustomer->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER, true); + + $accountingaccountsupplier = new AccountingAccount($db); + $accountingaccountsupplier->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER, true); + + $accountingaccountpayment = new AccountingAccount($db); + $accountingaccountpayment->fetch(null, $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT, true); + + $accountingaccountsuspense = new AccountingAccount($db); + $accountingaccountsuspense->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_SUSPENSE, true); + $error = 0; foreach ($tabpay as $key => $val) { // $key is rowid into llx_bank $date = dol_print_date($db->jdate($val["date"]), 'day'); @@ -534,6 +546,9 @@ if (!$error && $action == 'writebookkeeping') { // Line into bank account foreach ($tabbq[$key] as $k => $mt) { if ($mt) { + $accountingaccount->fetch(null, $k, true); // $k is accounting bank account. TODO We should use a cache here to avoid this fetch + $account_label = $accountingaccount->label; + $reflabel = ''; if (!empty($val['lib'])) { $reflabel .= dol_string_nohtmltag($val['lib'])." - "; @@ -549,10 +564,9 @@ if (!$error && $action == 'writebookkeeping') { $bookkeeping->doc_type = 'bank'; $bookkeeping->fk_doc = $key; $bookkeeping->fk_docdet = $val["fk_bank"]; - $bookkeeping->numero_compte = $k; - $accountingaccount->fetch(null, $k, true); // $k is accounting bank account. TODO We should use a cache here to avoid this fetch - $bookkeeping->label_compte = $accountingaccount->label; + $bookkeeping->numero_compte = $k; + $bookkeeping->label_compte = $account_label; $bookkeeping->label_operation = $reflabel; $bookkeeping->montant = $mt; @@ -610,6 +624,7 @@ if (!$error && $action == 'writebookkeeping') { $bookkeeping->doc_type = 'bank'; $bookkeeping->fk_doc = $key; $bookkeeping->fk_docdet = $val["fk_bank"]; + $bookkeeping->label_operation = $reflabel; $bookkeeping->montant = $mt; $bookkeeping->sens = ($mt < 0) ? 'D' : 'C'; @@ -624,78 +639,63 @@ if (!$error && $action == 'writebookkeeping') { $bookkeeping->subledger_account = $k; // For payment, the subledger account is stored as $key of $tabtp $bookkeeping->subledger_label = $tabcompany[$key]['name']; // $tabcompany is defined only if we are sure there is 1 thirdparty for the bank transaction $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER; - - $accountingaccount->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER, true); - $bookkeeping->label_compte = $accountingaccount->label; + $bookkeeping->label_compte = $accountingaccountcustomer->label; } elseif ($tabtype[$key] == 'payment_supplier') { // If payment is payment of supplier invoice, we get ref of invoice $bookkeeping->subledger_account = $k; // For payment, the subledger account is stored as $key of $tabtp $bookkeeping->subledger_label = $tabcompany[$key]['name']; // $tabcompany is defined only if we are sure there is 1 thirdparty for the bank transaction $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER; - - $accountingaccount->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER, true); - $bookkeeping->label_compte = $accountingaccount->label; + $bookkeeping->label_compte = $accountingaccountsupplier->label; } elseif ($tabtype[$key] == 'payment_expensereport') { $bookkeeping->subledger_account = $tabuser[$key]['accountancy_code']; $bookkeeping->subledger_label = $tabuser[$key]['name']; $bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT; - - $accountingaccount->fetch(null, $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT, true); - $bookkeeping->label_compte = $accountingaccount->label; + $bookkeeping->label_compte = $accountingaccountpayment->label; } elseif ($tabtype[$key] == 'payment_salary') { $bookkeeping->subledger_account = $tabuser[$key]['accountancy_code']; $bookkeeping->subledger_label = $tabuser[$key]['name']; $bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT; - - $accountingaccount->fetch(null, $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT, true); - $bookkeeping->label_compte = $accountingaccount->label; + $bookkeeping->label_compte = $accountingaccountpayment->label; } elseif (in_array($tabtype[$key], array('sc', 'payment_sc'))) { // If payment is payment of social contribution $bookkeeping->subledger_account = ''; $bookkeeping->subledger_label = ''; + $accountingaccount->fetch(null, $k, true); // TODO Use a cache $bookkeeping->numero_compte = $k; - - $accountingaccount->fetch(null, $k, true); $bookkeeping->label_compte = $accountingaccount->label; } elseif ($tabtype[$key] == 'payment_vat') { $bookkeeping->subledger_account = ''; $bookkeeping->subledger_label = ''; + $accountingaccount->fetch(null, $k, true); // TODO Use a cache $bookkeeping->numero_compte = $k; - - $accountingaccount->fetch(null, $k, true); $bookkeeping->label_compte = $accountingaccount->label; } elseif ($tabtype[$key] == 'payment_donation') { $bookkeeping->subledger_account = ''; $bookkeeping->subledger_label = ''; + $accountingaccount->fetch(null, $k, true); // TODO Use a cache $bookkeeping->numero_compte = $k; - - $accountingaccount->fetch(null, $k, true); $bookkeeping->label_compte = $accountingaccount->label; } elseif ($tabtype[$key] == 'member') { $bookkeeping->subledger_account = ''; $bookkeeping->subledger_label = ''; + $accountingaccount->fetch(null, $k, true); // TODO Use a cache $bookkeeping->numero_compte = $k; - - $accountingaccount->fetch(null, $k, true); $bookkeeping->label_compte = $accountingaccount->label; } elseif ($tabtype[$key] == 'payment_loan') { $bookkeeping->subledger_account = ''; $bookkeeping->subledger_label = ''; + $accountingaccount->fetch(null, $k, true); // TODO Use a cache $bookkeeping->numero_compte = $k; - - $accountingaccount->fetch(null, $k, true); $bookkeeping->label_compte = $accountingaccount->label; } elseif ($tabtype[$key] == 'payment_various') { $bookkeeping->subledger_account = $k; $bookkeeping->subledger_label = $tabcompany[$key]['name']; + $accountingaccount->fetch(null, $tabpay[$key]["account_various"], true); // TODO Use a cache $bookkeeping->numero_compte = $tabpay[$key]["account_various"]; - - $accountingaccount->fetch(null, $bookkeeping->numero_compte, true); $bookkeeping->label_compte = $accountingaccount->label; } elseif ($tabtype[$key] == 'banktransfert') { $bookkeeping->subledger_account = ''; $bookkeeping->subledger_label = ''; + $accountingaccount->fetch(null, $k, true); // TODO Use a cache $bookkeeping->numero_compte = $k; - - $accountingaccount->fetch(null, $k, true); $bookkeeping->label_compte = $accountingaccount->label; } else { if ($tabtype[$key] == 'unknown') { // Unknown transaction, we will use a waiting account for thirdparty. @@ -703,9 +703,7 @@ if (!$error && $action == 'writebookkeeping') { $bookkeeping->subledger_account = ''; $bookkeeping->subledger_label = ''; $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUSPENSE; - - $accountingaccount->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_SUSPENSE, true); - $bookkeeping->label_compte = $accountingaccount->label; + $bookkeeping->label_compte = $accountingaccountsuspense->label; } } $bookkeeping->label_operation = $reflabel; diff --git a/htdocs/accountancy/journal/expensereportsjournal.php b/htdocs/accountancy/journal/expensereportsjournal.php index 9681ed7eaa0..0273690ae81 100644 --- a/htdocs/accountancy/journal/expensereportsjournal.php +++ b/htdocs/accountancy/journal/expensereportsjournal.php @@ -228,6 +228,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->doc_type = 'expense_report'; $bookkeeping->fk_doc = $key; $bookkeeping->fk_docdet = $val["fk_expensereportdet"]; + $bookkeeping->subledger_account = $tabuser[$key]['user_accountancy_code']; $bookkeeping->subledger_label = $tabuser[$key]['name']; @@ -276,10 +277,13 @@ if ($action == 'writebookkeeping') { $bookkeeping->doc_type = 'expense_report'; $bookkeeping->fk_doc = $key; $bookkeeping->fk_docdet = $val["fk_expensereportdet"]; + $bookkeeping->subledger_account = ''; $bookkeeping->subledger_label = ''; + $bookkeeping->numero_compte = $k; $bookkeeping->label_compte = $accountingaccount->label; + $bookkeeping->label_operation = $accountingaccount->label; $bookkeeping->montant = $mt; $bookkeeping->sens = ($mt < 0) ? 'C' : 'D'; @@ -324,6 +328,9 @@ if ($action == 'writebookkeeping') { foreach ($arrayofvat[$key] as $k => $mt) { if ($mt) { + $accountingaccount->fetch($k, null, true); // TODO Use a cache for label + $account_label = $accountingaccount->label; + // get compte id and label $bookkeeping = new BookKeeping($db); $bookkeeping->doc_date = $val["date"]; @@ -332,12 +339,12 @@ if ($action == 'writebookkeeping') { $bookkeeping->doc_type = 'expense_report'; $bookkeeping->fk_doc = $key; $bookkeeping->fk_docdet = $val["fk_expensereportdet"]; + $bookkeeping->subledger_account = ''; $bookkeeping->subledger_label = ''; - $bookkeeping->numero_compte = $k; - $accountingaccount->fetch($k, null, true); - $bookkeeping->label_compte = $accountingaccount->label; + $bookkeeping->numero_compte = $k; + $bookkeeping->label_compte = $account_label; $bookkeeping->label_operation = $langs->trans("VAT").' '.join(', ', $def_tva[$key][$k]).' %'; $bookkeeping->montant = $mt; diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index a09b9c305f3..2677f8569f2 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -334,6 +334,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->fk_doc = $key; $bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add $bookkeeping->thirdparty_code = $companystatic->code_fournisseur; + $bookkeeping->subledger_account = $tabcompany[$key]['code_compta_fournisseur']; $bookkeeping->subledger_label = $tabcompany[$key]['name']; @@ -373,8 +374,11 @@ if ($action == 'writebookkeeping') { // Product / Service if (!$errorforline) { foreach ($tabht[$key] as $k => $mt) { + $resultfetch = $accountingaccount->fetch(null, $k, true); // TODO Use a cache + $label_account = $accountingaccount->label; + // get compte id and label - if ($accountingaccount->fetch(null, $k, true)) { + if ($resultfetch > 0) { $bookkeeping = new BookKeeping($db); $bookkeeping->doc_date = $val["date"]; $bookkeeping->date_lim_reglement = $val["datereg"]; @@ -384,11 +388,14 @@ if ($action == 'writebookkeeping') { $bookkeeping->fk_doc = $key; $bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add $bookkeeping->thirdparty_code = $companystatic->code_fournisseur; + $bookkeeping->subledger_account = ''; $bookkeeping->subledger_label = ''; + $bookkeeping->numero_compte = $k; - $bookkeeping->label_compte = $accountingaccount->label; - $bookkeeping->label_operation = dol_trunc($companystatic->name, 16).' - '.$invoicestatic->ref_supplier.' - '.$accountingaccount->label; + $bookkeeping->label_compte = $label_account; + + $bookkeeping->label_operation = dol_trunc($companystatic->name, 16).' - '.$invoicestatic->ref_supplier.' - '.$label_account; $bookkeeping->montant = $mt; $bookkeeping->sens = ($mt < 0) ? 'C' : 'D'; $bookkeeping->debit = ($mt > 0) ? $mt : 0; @@ -434,6 +441,9 @@ if ($action == 'writebookkeeping') { foreach ($arrayofvat[$key] as $k => $mt) { if ($mt) { + $accountingaccount->fetch($k, null, true); // TODO Use a cache for label + $label_account = $accountingaccount->label; + $bookkeeping = new BookKeeping($db); $bookkeeping->doc_date = $val["date"]; $bookkeeping->date_lim_reglement = $val["datereg"]; @@ -443,12 +453,12 @@ if ($action == 'writebookkeeping') { $bookkeeping->fk_doc = $key; $bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add $bookkeeping->thirdparty_code = $companystatic->code_fournisseur; + $bookkeeping->subledger_account = ''; $bookkeeping->subledger_label = ''; - $bookkeeping->numero_compte = $k; - $accountingaccount->fetch($k, null, true); - $bookkeeping->label_compte = $accountingaccount->label; + $bookkeeping->numero_compte = $k; + $bookkeeping->label_compte = $label_account; $bookkeeping->label_operation = dol_trunc($companystatic->name, 16).' - '.$invoicestatic->ref_supplier.' - '.$langs->trans("VAT").' '.join(', ', $def_tva[$key][$k]).' %'.($numtax ? ' - Localtax '.$numtax : ''); $bookkeeping->montant = $mt; @@ -496,9 +506,12 @@ if ($action == 'writebookkeeping') { $bookkeeping->fk_doc = $key; $bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add $bookkeeping->thirdparty_code = $companystatic->code_fournisseur; + $bookkeeping->subledger_account = ''; $bookkeeping->subledger_label = ''; + $bookkeeping->numero_compte = $k; + $bookkeeping->label_operation = dol_trunc($companystatic->name, 16).' - '.$invoicestatic->ref_supplier.' - '.$langs->trans("VAT").' NPR'; $bookkeeping->montant = $mt; $bookkeeping->sens = ($mt < 0) ? 'C' : 'D'; diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index 88398901fa4..d147186a8d8 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -347,6 +347,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->fk_doc = $key; $bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add $bookkeeping->thirdparty_code = $companystatic->code_client; + $bookkeeping->subledger_account = $tabcompany[$key]['code_compta']; $bookkeeping->subledger_label = $tabcompany[$key]['name']; @@ -386,8 +387,11 @@ if ($action == 'writebookkeeping') { // Product / Service if (!$errorforline) { foreach ($tabht[$key] as $k => $mt) { + $resultfetch = $accountingaccount->fetch(null, $k, true); // TODO Use a cache + $label_account = $accountingaccount->label; + // get compte id and label - if ($accountingaccount->fetch(null, $k, true)) { + if ($resultfetch > 0) { $bookkeeping = new BookKeeping($db); $bookkeeping->doc_date = $val["date"]; $bookkeeping->date_lim_reglement = $val["datereg"]; @@ -397,11 +401,14 @@ if ($action == 'writebookkeeping') { $bookkeeping->fk_doc = $key; $bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add $bookkeeping->thirdparty_code = $companystatic->code_client; + $bookkeeping->subledger_account = ''; $bookkeeping->subledger_label = ''; + $bookkeeping->numero_compte = $k; - $bookkeeping->label_compte = $accountingaccount->label; - $bookkeeping->label_operation = dol_trunc($companystatic->name, 16).' - '.$invoicestatic->ref.' - '.$accountingaccount->label; + $bookkeeping->label_compte = $label_account; + + $bookkeeping->label_operation = dol_trunc($companystatic->name, 16).' - '.$invoicestatic->ref.' - '.$label_account; $bookkeeping->montant = $mt; $bookkeeping->sens = ($mt < 0) ? 'D' : 'C'; $bookkeeping->debit = ($mt < 0) ? -$mt : 0; @@ -446,6 +453,9 @@ if ($action == 'writebookkeeping') { foreach ($arrayofvat[$key] as $k => $mt) { if ($mt) { + $accountingaccount->fetch($k, null, true); // TODO Use a cache for label + $label_account = $accountingaccount->label; + $bookkeeping = new BookKeeping($db); $bookkeeping->doc_date = $val["date"]; $bookkeeping->date_lim_reglement = $val["datereg"]; @@ -455,12 +465,12 @@ if ($action == 'writebookkeeping') { $bookkeeping->fk_doc = $key; $bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add $bookkeeping->thirdparty_code = $companystatic->code_client; + $bookkeeping->subledger_account = ''; $bookkeeping->subledger_label = ''; - $bookkeeping->numero_compte = $k; - $accountingaccount->fetch($k, null, true); - $bookkeeping->label_compte = $accountingaccount->label; // TODO Use a cache for each label from $k. + $bookkeeping->numero_compte = $k; + $bookkeeping->label_compte = $label_account; $bookkeeping->label_operation = dol_trunc($companystatic->name, 16).' - '.$invoicestatic->ref.' - '.$langs->trans("VAT").' '.join(', ', $def_tva[$key][$k]).' %'.($numtax ? ' - Localtax '.$numtax : ''); $bookkeeping->montant = $mt; diff --git a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql index cda3f4310bb..59d1fa2b9c2 100644 --- a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql +++ b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql @@ -32,6 +32,12 @@ -- Missing in v13 or lower +ALTER TABLE llx_accounting_bookkeeping ADD INDEX idx_accounting_bookkeeping_fk_docdet (fk_docdet); +ALTER TABLE llx_accounting_bookkeeping ADD INDEX idx_accounting_bookkeeping_doc_date (doc_date); +ALTER TABLE llx_accounting_bookkeeping ADD INDEX idx_accounting_bookkeeping_numero_compte (numero_compte); +ALTER TABLE llx_accounting_bookkeeping ADD INDEX idx_accounting_bookkeeping_code_journal (code_journal); +ALTER TABLE llx_accounting_bookkeeping ADD INDEX idx_accounting_bookkeeping_piece_num (piece_num); + ALTER TABLE llx_recruitment_recruitmentcandidature MODIFY COLUMN email_msgid VARCHAR(175); ALTER TABLE llx_asset CHANGE COLUMN amount amount_ht double(24,8) DEFAULT NULL; diff --git a/htdocs/install/mysql/tables/llx_accounting_bookkeeping.key.sql b/htdocs/install/mysql/tables/llx_accounting_bookkeeping.key.sql index ca71d90aa0b..3d9337c0789 100644 --- a/htdocs/install/mysql/tables/llx_accounting_bookkeeping.key.sql +++ b/htdocs/install/mysql/tables/llx_accounting_bookkeeping.key.sql @@ -16,11 +16,12 @@ -- -- ============================================================================ -ALTER TABLE llx_accounting_bookkeeping ADD INDEX idx_accounting_bookkeeping_doc_date (doc_date); ALTER TABLE llx_accounting_bookkeeping ADD INDEX idx_accounting_bookkeeping_fk_doc (fk_doc); ALTER TABLE llx_accounting_bookkeeping ADD INDEX idx_accounting_bookkeeping_fk_docdet (fk_docdet); +ALTER TABLE llx_accounting_bookkeeping ADD INDEX idx_accounting_bookkeeping_doc_date (doc_date); ALTER TABLE llx_accounting_bookkeeping ADD INDEX idx_accounting_bookkeeping_numero_compte (numero_compte); ALTER TABLE llx_accounting_bookkeeping ADD INDEX idx_accounting_bookkeeping_code_journal (code_journal); +ALTER TABLE llx_accounting_bookkeeping ADD INDEX idx_accounting_bookkeeping_piece_num (piece_num); -- Current unicity is tested by the journalize page on couple (fk_doc, doc_type) -- TODO Add a key for unicity (not so easy as fk_doc, doc_type may have several lines for one piece) diff --git a/test/phpunit/ImagesLibTest.php b/test/phpunit/ImagesLibTest.php index 95704b2a51b..960dd56c4b5 100644 --- a/test/phpunit/ImagesLibTest.php +++ b/test/phpunit/ImagesLibTest.php @@ -170,11 +170,11 @@ class ImagesLibTest extends PHPUnit\Framework\TestCase print __METHOD__." result=".$result."\n"; $this->assertEquals($filetarget, $result, 'Failed to convert PNG '.$file.' into '.$filetarget); - $file=dirname(__FILE__).'/img250x20.png'; + /*$file=dirname(__FILE__).'/img250x20.png'; $filetarget=$conf->admin->dir_temp.'/img250x20.webp'; dol_delete_file($filetarget); $result = dol_imageResizeOrCrop($file, 0, 0, 0, 0, 0, $filetarget); print __METHOD__." result=".$result."\n"; - $this->assertEquals($filetarget, $result, 'Failed to convert PNG '.$file.' into WEBP '.$filetarget); + $this->assertEquals($filetarget, $result, 'Failed to convert PNG '.$file.' into WEBP '.$filetarget);*/ } } From 706545081cac9ff42cc4dce138d4abfe03b78112 Mon Sep 17 00:00:00 2001 From: WimpyMan <12594973+WimpyMan@users.noreply.github.com> Date: Mon, 3 May 2021 18:23:31 +0200 Subject: [PATCH 129/147] FIX #17476 releve.php: Fix SQL statement Single quotes `'` should be uses instead of double quotes `"` for string values. --- htdocs/compta/bank/releve.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/bank/releve.php b/htdocs/compta/bank/releve.php index 9a534b76320..a58c85469b8 100644 --- a/htdocs/compta/bank/releve.php +++ b/htdocs/compta/bank/releve.php @@ -177,7 +177,7 @@ $sqlrequestforbankline = $sql; if ($action == 'confirm_editbankreceipt' && !empty($oldbankreceipt) && !empty($newbankreceipt)) { // TODO Add a test to check newbankreceipt does not exists yet - $sqlupdate = 'UPDATE '.MAIN_DB_PREFIX.'bank SET num_releve = "'.$db->escape($newbankreceipt).'" WHERE num_releve = "'.$db->escape($oldbankreceipt).'" AND fk_account = '.$id; + $sqlupdate = 'UPDATE '.MAIN_DB_PREFIX.'bank SET num_releve = \''.$db->escape($newbankreceipt).'\' WHERE num_releve = \''.$db->escape($oldbankreceipt).'\' AND fk_account = '.$id; $result = $db->query($sqlupdate); if ($result < 0) dol_print_error($db); From 03e8f2aee1952bb3a37f020c93636fb2f3d4e072 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 3 May 2021 18:49:37 +0200 Subject: [PATCH 130/147] Fix for performance troubles --- htdocs/accountancy/class/bookkeeping.class.php | 6 +++--- htdocs/install/mysql/migration/13.0.0-14.0.0.sql | 10 +++++++--- .../mysql/tables/llx_accounting_bookkeeping.key.sql | 6 +++--- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index eb2c3476275..3594bb26fc8 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -301,7 +301,7 @@ class BookKeeping extends CommonObject } $sql .= " AND numero_compte = '".$this->db->escape($this->numero_compte)."'"; $sql .= " AND label_operation = '".$this->db->escape($this->label_operation)."'"; - $sql .= " AND entity IN (".getEntity('accountancy').")"; + $sql .= " AND entity = ".$conf->entity; // Do not use getEntity for accounting features $resql = $this->db->query($sql); @@ -318,7 +318,7 @@ class BookKeeping extends CommonObject $sqlnum .= " AND fk_docdet = ".((int) $this->fk_docdet); } $sqlnum .= " AND doc_ref = '".$this->db->escape($this->doc_ref)."'"; // ref of source object - $sqlnum .= " AND entity IN (".getEntity('accountancy').")"; + $sqlnum .= " AND entity = ".$conf->entity; // Do not use getEntity for accounting features dol_syslog(get_class($this).":: create sqlnum=".$sqlnum, LOG_DEBUG); $resqlnum = $this->db->query($sqlnum); @@ -331,7 +331,7 @@ class BookKeeping extends CommonObject if (empty($this->piece_num)) { $sqlnum = "SELECT MAX(piece_num)+1 as maxpiecenum"; $sqlnum .= " FROM ".MAIN_DB_PREFIX.$this->table_element; - $sqlnum .= " WHERE entity IN (".getEntity('accountancy').")"; + $sqlnum .= " WHERE entity = ".$conf->entity; // Do not use getEntity for accounting features $resqlnum = $this->db->query($sqlnum); if ($resqlnum) { diff --git a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql index 59d1fa2b9c2..65f4fb9adcd 100644 --- a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql +++ b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql @@ -32,11 +32,15 @@ -- Missing in v13 or lower +ALTER TABLE llx_accounting_bookkeeping DROP INDEX idx_accounting_bookkeeping_numero_compte; +ALTER TABLE llx_accounting_bookkeeping DROP INDEX idx_accounting_bookkeeping_code_journal; + ALTER TABLE llx_accounting_bookkeeping ADD INDEX idx_accounting_bookkeeping_fk_docdet (fk_docdet); ALTER TABLE llx_accounting_bookkeeping ADD INDEX idx_accounting_bookkeeping_doc_date (doc_date); -ALTER TABLE llx_accounting_bookkeeping ADD INDEX idx_accounting_bookkeeping_numero_compte (numero_compte); -ALTER TABLE llx_accounting_bookkeeping ADD INDEX idx_accounting_bookkeeping_code_journal (code_journal); -ALTER TABLE llx_accounting_bookkeeping ADD INDEX idx_accounting_bookkeeping_piece_num (piece_num); +ALTER TABLE llx_accounting_bookkeeping ADD INDEX idx_accounting_bookkeeping_numero_compte (numero_compte, entity); +ALTER TABLE llx_accounting_bookkeeping ADD INDEX idx_accounting_bookkeeping_code_journal (code_journal, entity); + +ALTER TABLE llx_accounting_bookkeeping ADD INDEX idx_accounting_bookkeeping_piece_num (piece_num, entity); ALTER TABLE llx_recruitment_recruitmentcandidature MODIFY COLUMN email_msgid VARCHAR(175); diff --git a/htdocs/install/mysql/tables/llx_accounting_bookkeeping.key.sql b/htdocs/install/mysql/tables/llx_accounting_bookkeeping.key.sql index 3d9337c0789..766de8d6230 100644 --- a/htdocs/install/mysql/tables/llx_accounting_bookkeeping.key.sql +++ b/htdocs/install/mysql/tables/llx_accounting_bookkeeping.key.sql @@ -19,9 +19,9 @@ ALTER TABLE llx_accounting_bookkeeping ADD INDEX idx_accounting_bookkeeping_fk_doc (fk_doc); ALTER TABLE llx_accounting_bookkeeping ADD INDEX idx_accounting_bookkeeping_fk_docdet (fk_docdet); ALTER TABLE llx_accounting_bookkeeping ADD INDEX idx_accounting_bookkeeping_doc_date (doc_date); -ALTER TABLE llx_accounting_bookkeeping ADD INDEX idx_accounting_bookkeeping_numero_compte (numero_compte); -ALTER TABLE llx_accounting_bookkeeping ADD INDEX idx_accounting_bookkeeping_code_journal (code_journal); -ALTER TABLE llx_accounting_bookkeeping ADD INDEX idx_accounting_bookkeeping_piece_num (piece_num); +ALTER TABLE llx_accounting_bookkeeping ADD INDEX idx_accounting_bookkeeping_numero_compte (numero_compte, entity); +ALTER TABLE llx_accounting_bookkeeping ADD INDEX idx_accounting_bookkeeping_code_journal (code_journal, entity); +ALTER TABLE llx_accounting_bookkeeping ADD INDEX idx_accounting_bookkeeping_piece_num (piece_num, entity); -- Current unicity is tested by the journalize page on couple (fk_doc, doc_type) -- TODO Add a key for unicity (not so easy as fk_doc, doc_type may have several lines for one piece) From 1d2f8b09d96c398faf7c1c15bab6c53859b21e48 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 3 May 2021 18:55:25 +0200 Subject: [PATCH 131/147] Update releve.php --- htdocs/compta/bank/releve.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/bank/releve.php b/htdocs/compta/bank/releve.php index a58c85469b8..d0812ae4ea9 100644 --- a/htdocs/compta/bank/releve.php +++ b/htdocs/compta/bank/releve.php @@ -177,7 +177,7 @@ $sqlrequestforbankline = $sql; if ($action == 'confirm_editbankreceipt' && !empty($oldbankreceipt) && !empty($newbankreceipt)) { // TODO Add a test to check newbankreceipt does not exists yet - $sqlupdate = 'UPDATE '.MAIN_DB_PREFIX.'bank SET num_releve = \''.$db->escape($newbankreceipt).'\' WHERE num_releve = \''.$db->escape($oldbankreceipt).'\' AND fk_account = '.$id; + $sqlupdate = "UPDATE ".MAIN_DB_PREFIX."bank SET num_releve = '".$db->escape($newbankreceipt)."' WHERE num_releve = '".$db->escape($oldbankreceipt)."' AND fk_account = ".((int) $id); $result = $db->query($sqlupdate); if ($result < 0) dol_print_error($db); From a36df785b08800707417c54b0d2787ac84b912b9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 3 May 2021 19:20:49 +0200 Subject: [PATCH 132/147] Fix lang --- htdocs/langs/zh_CN/main.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/zh_CN/main.lang b/htdocs/langs/zh_CN/main.lang index 917bbfefb1c..458863d28bc 100644 --- a/htdocs/langs/zh_CN/main.lang +++ b/htdocs/langs/zh_CN/main.lang @@ -1,5 +1,5 @@ # Dolibarr language file - Source file is en_US - main -DIRECTION=升 +DIRECTION=ltr # Note for Chinese: # msungstdlight or cid0ct are for traditional Chinese (traditional does not render with Ubuntu pdf reader) # stsongstdlight or cid0cs are for simplified Chinese From 9dc36d13c3bdb0496e65e6d20dec9028430398cb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 3 May 2021 19:25:16 +0200 Subject: [PATCH 133/147] Enhance error management --- htdocs/core/lib/images.lib.php | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/htdocs/core/lib/images.lib.php b/htdocs/core/lib/images.lib.php index a1a6e97c8d2..0a0ebe3ce02 100644 --- a/htdocs/core/lib/images.lib.php +++ b/htdocs/core/lib/images.lib.php @@ -203,6 +203,7 @@ function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x = 0, } } + // Test function to read source image exists $imgfonction = ''; switch ($infoImg[2]) { case 1: // IMG_GIF @@ -228,6 +229,34 @@ function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x = 0, } } + // Test function to write target image exists + if ($filetowrite) { + $imgfonction = ''; + switch ($newExt) { + case 'gif': // IMG_GIF + $imgfonction = 'imagecreatefromgif'; + break; + case 'jpg': // IMG_JPG + $imgfonction = 'imagecreatefromjpeg'; + break; + case 'png': // IMG_PNG + $imgfonction = 'imagecreatefrompng'; + break; + case 'bmp': // IMG_WBMP + $imgfonction = 'imagecreatefromwbmp'; + break; + case 'webp': // IMG_WEBP + $imgfonction = 'imagecreatefromwebp'; + break; + } + if ($imgfonction) { + if (!function_exists($imgfonction)) { + // Fonctions de conversion non presente dans ce PHP + return 'Write of image not possible. This PHP does not support GD functions '.$imgfonction; + } + } + } + // Read source image file switch ($infoImg[2]) { case 1: // Gif From e4499976e9936eba795321e6baf1e6aa9014a080 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 3 May 2021 19:56:31 +0200 Subject: [PATCH 134/147] Disable empty tabs --- htdocs/core/lib/pdf.lib.php | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 05f53b72df7..755f292132e 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -59,13 +59,13 @@ function pdf_admin_prepare_head() // $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab complete_head_from_modules($conf, $langs, null, $head, $h, 'pdf_admin'); - if (!empty($conf->adherent->enabled)) { + if (1 == 2 && !empty($conf->adherent->enabled)) { $head[$h][0] = DOL_URL_ROOT.'/admin/pdf_adherent.php'; $head[$h][1] = $langs->trans("Adherent"); $head[$h][2] = 'adherent'; $h++; } - if (!empty($conf->projet->enabled)) { + if (1 == 2 && !empty($conf->projet->enabled)) { $head[$h][0] = DOL_URL_ROOT.'/admin/pdf_project.php'; $head[$h][1] = $langs->trans("Project"); $head[$h][2] = 'project'; @@ -77,49 +77,49 @@ function pdf_admin_prepare_head() $head[$h][2] = 'proposal'; $h++; } - if (!empty($conf->commande->enabled)) { + if (1 == 2 && !empty($conf->commande->enabled)) { $head[$h][0] = DOL_URL_ROOT.'/admin/pdf_order.php'; $head[$h][1] = $langs->trans("Order"); $head[$h][2] = 'order'; $h++; } - if (!empty($conf->facture->enabled)) { + if (1 == 2 && !empty($conf->facture->enabled)) { $head[$h][0] = DOL_URL_ROOT.'/admin/pdf_invoice.php'; $head[$h][1] = $langs->trans("Invoice"); $head[$h][2] = 'invoice'; $h++; } - if (!empty($conf->expedition->enabled)) { + if (1 == 2 && !empty($conf->expedition->enabled)) { $head[$h][0] = DOL_URL_ROOT.'/admin/pdf_shipment.php'; $head[$h][1] = $langs->trans("Sendings"); $head[$h][2] = 'shipment'; $h++; } - if (!empty($conf->reception->enabled)) { + if (1 == 2 && !empty($conf->reception->enabled)) { $head[$h][0] = DOL_URL_ROOT.'/admin/pdf_reception.php'; $head[$h][1] = $langs->trans("Reception"); $head[$h][2] = 'reception'; $h++; } - if (!empty($conf->ticket->enabled)) { - $head[$h][0] = DOL_URL_ROOT.'/admin/pdf_Ticket.php'; + if (1 == 2 && !empty($conf->ticket->enabled)) { + $head[$h][0] = DOL_URL_ROOT.'/admin/pdf_ticket.php'; $head[$h][1] = $langs->trans("Ticket"); $head[$h][2] = 'ticket'; $h++; } - if (!empty($conf->ficheinter->enabled)) { + if (1 == 2 && !empty($conf->ficheinter->enabled)) { $head[$h][0] = DOL_URL_ROOT.'/admin/pdf_intervention.php'; $head[$h][1] = $langs->trans("Intervention"); $head[$h][2] = 'intervention'; $h++; } - if (!empty($conf->supplier_proposal->enabled)) { + if (1 == 2 && !empty($conf->supplier_proposal->enabled)) { $head[$h][0] = DOL_URL_ROOT.'/admin/pdf_supplierproposal.php'; $head[$h][1] = $langs->trans("SupplierProposal"); $head[$h][2] = 'supplierproposal'; $h++; } - if (!empty($conf->fournisseur->enabled)) { + if (1 == 2 && !empty($conf->fournisseur->enabled)) { $head[$h][0] = DOL_URL_ROOT.'/admin/pdf_supplierorder.php'; $head[$h][1] = $langs->trans("SupplierOrder"); $head[$h][2] = 'supplierorder'; @@ -130,31 +130,31 @@ function pdf_admin_prepare_head() $head[$h][2] = 'supplierinvoice'; $h++; } - if (!empty($conf->recruitment->enabled)) { + if (1 == 2 && !empty($conf->recruitment->enabled)) { $head[$h][0] = DOL_URL_ROOT.'/admin/pdf_recruitment.php'; $head[$h][1] = $langs->trans("Recruitment"); $head[$h][2] = 'recruitment'; $h++; } - if (!empty($conf->contrat->enabled)) { + if (1 == 2 && !empty($conf->contrat->enabled)) { $head[$h][0] = DOL_URL_ROOT.'/admin/pdf_contrat.php'; $head[$h][1] = $langs->trans("Contrat"); $head[$h][2] = 'contrat'; $h++; } - if (!empty($conf->stock->enabled)) { + if (1 == 2 && !empty($conf->stock->enabled)) { $head[$h][0] = DOL_URL_ROOT.'/admin/pdf_stock.php'; $head[$h][1] = $langs->trans("Stock"); $head[$h][2] = 'stock'; $h++; } - if (!empty($conf->holiday->enabled)) { + if (1 == 2 && !empty($conf->holiday->enabled)) { $head[$h][0] = DOL_URL_ROOT.'/admin/pdf_holiday.php'; $head[$h][1] = $langs->trans("Holidays"); $head[$h][2] = 'holiday'; $h++; } - if (!empty($conf->expensereport->enabled)) { + if (1 == 2 && !empty($conf->expensereport->enabled)) { $head[$h][0] = DOL_URL_ROOT.'/admin/pdf_expensereport.php'; $head[$h][1] = $langs->trans("Trips"); $head[$h][2] = 'expensereport'; From 6e32efdb400e594752e0bfdb23997964a5457358 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 3 May 2021 20:22:36 +0200 Subject: [PATCH 135/147] Fix phpcs --- htdocs/compta/paiement/rapport.php | 9 +++------ htdocs/core/lib/company.lib.php | 2 +- .../expedition/doc/pdf_espadon.modules.php | 15 +++++---------- 3 files changed, 9 insertions(+), 17 deletions(-) diff --git a/htdocs/compta/paiement/rapport.php b/htdocs/compta/paiement/rapport.php index bde222ff8e0..492404a9380 100644 --- a/htdocs/compta/paiement/rapport.php +++ b/htdocs/compta/paiement/rapport.php @@ -112,15 +112,12 @@ clearstatcache(); // Show link on other years $year_dirs = dol_dir_list($dir, 'directories', 0, '^[0-9]{4}$', '', 'DESC'); -foreach ($year_dirs as $d) -{ +foreach ($year_dirs as $d) { print ''.$d['name'].'  '; } -if ($year) -{ - if (is_dir($dir.'/'.$year)) - { +if ($year) { + if (is_dir($dir.'/'.$year)) { if (!empty($year_dirs)) print '
'; print '
'; print '
'; + print $langs->trans('Journals'); + print $formaccounting->multi_select_journal($search_ledger_code, 'search_ledger_code', 0, 1, 1, 1); + print '
'; print $langs->trans('From'); diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index a93b36cf2b4..06ff8d9cb8c 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -1103,7 +1103,8 @@ class BookKeeping extends CommonObject $sql = 'SELECT'; $sql .= " t.numero_compte,"; $sql .= " SUM(t.debit) as debit,"; - $sql .= " SUM(t.credit) as credit"; + $sql .= " SUM(t.credit) as credit,"; + $sql .= " t.code_journal"; $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; // Manage filter $sqlwhere = array(); @@ -1121,6 +1122,12 @@ class BookKeeping extends CommonObject $sqlwhere[] = $key.' LIKE \''.$this->db->escape($value).'%\''; } elseif ($key == 't.subledger_label') { $sqlwhere[] = $key.' LIKE \''.$this->db->escape($value).'%\''; + } elseif ($key == 't.code_journal' && !empty($value)) { + if (is_array($value)) { + $sqlwhere[] = natural_search("t.code_journal", join(',', $value), 3, 1); + } else { + $sqlwhere[] = natural_search("t.code_journal", $value, 3, 1); + } } else { $sqlwhere[] = $key.' LIKE \'%'.$this->db->escape($value).'%\''; } From 8eddc75a227e9724b726d816b9aee61e1ba1318b Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sun, 2 May 2021 02:49:53 +0200 Subject: [PATCH 083/147] Remove duplicate variable --- htdocs/accountancy/bookkeeping/balance.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index 9a044ed42c2..bc0cca4cc1b 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -39,9 +39,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; // Load translation files required by the page $langs->loadLangs(array("accountancy", "compta")); -$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); -$sortorder = GETPOST("sortorder", 'alpha'); -$sortfield = GETPOST("sortfield", 'alpha'); $action = GETPOST('action', 'aZ09'); // Load variable for pagination From 24a58b1956a1be782e0e7dfb584ac58cceb18350 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 2 May 2021 11:21:01 +0200 Subject: [PATCH 084/147] Removed not used permission --- htdocs/core/modules/modKnowledgeManagement.class.php | 5 ----- htdocs/knowledgemanagement/knowledgerecord_card.php | 6 +++--- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/htdocs/core/modules/modKnowledgeManagement.class.php b/htdocs/core/modules/modKnowledgeManagement.class.php index 47c25232d67..a08070d8d0c 100644 --- a/htdocs/core/modules/modKnowledgeManagement.class.php +++ b/htdocs/core/modules/modKnowledgeManagement.class.php @@ -275,11 +275,6 @@ class modKnowledgeManagement extends DolibarrModules $this->rights[$r][4] = 'knowledgerecord'; // In php code, permission will be checked by test if ($user->rights->knowledgemanagement->level1->level2) $this->rights[$r][5] = 'delete'; // In php code, permission will be checked by test if ($user->rights->knowledgemanagement->level1->level2) $r++; - $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used) - $this->rights[$r][1] = 'Reply to objects of Knowledge Management'; // Permission label - $this->rights[$r][4] = 'knowledgerecord'; // In php code, permission will be checked by test if ($user->rights->knowledgemanagement->level1->level2) - $this->rights[$r][5] = 'reply'; // In php code, permission will be checked by test if ($user->rights->knowledgemanagement->level1->level2) - $r++; /* END MODULEBUILDER PERMISSIONS */ // Main menu entries to add diff --git a/htdocs/knowledgemanagement/knowledgerecord_card.php b/htdocs/knowledgemanagement/knowledgerecord_card.php index 771c8ff241a..f4e949a8603 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_card.php +++ b/htdocs/knowledgemanagement/knowledgerecord_card.php @@ -123,7 +123,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be includ $permissiontoread = $user->rights->knowledgemanagement->knowledgerecord->read; -$permissiontoreply = $user->rights->knowledgemanagement->knowledgerecord->reply; +$permissiontovalidate = $user->rights->knowledgemanagement->knowledgerecord->write; $permissiontoadd = $user->rights->knowledgemanagement->knowledgerecord->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php $permissiontodelete = $user->rights->knowledgemanagement->knowledgerecord->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT); $permissionnote = $user->rights->knowledgemanagement->knowledgerecord->write; // Used by the include of actions_setnotes.inc.php @@ -461,12 +461,12 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if ($object->status == $object::STATUS_VALIDATED) { print dolGetButtonAction($langs->trans('SetToDraft'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=confirm_setdraft&confirm=yes', '', $permissiontoadd); } - if ($object->status == $object::STATUS_VALIDATED && $permissiontoreply) { + if ($object->status == $object::STATUS_VALIDATED && $permissiontovalidate) { print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit', '', $permissiontoadd); } // Validate if ($object->status == $object::STATUS_DRAFT) { - if ((empty($object->table_element_line) || (is_array($object->lines) && count($object->lines) > 0)) && $permissiontoreply) { + if ((empty($object->table_element_line) || (is_array($object->lines) && count($object->lines) > 0)) && $permissiontovalidate) { print dolGetButtonAction($langs->trans('ValidateReply'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_validate&confirm=yes', '', $permissiontoadd); } else { $langs->load("errors"); From 173ef31ad4b22c70e87028c782572605f4ee9a04 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 2 May 2021 12:15:31 +0200 Subject: [PATCH 085/147] Enhance modulebuilder --- htdocs/admin/knowledgemanagement.php | 2 +- htdocs/admin/knowledgerecord_extrafields.php | 2 +- .../lib/knowledgemanagement.lib.php | 4 +- htdocs/langs/en_US/modulebuilder.lang | 1 + htdocs/modulebuilder/index.php | 78 +++++++++++++------ 5 files changed, 59 insertions(+), 28 deletions(-) diff --git a/htdocs/admin/knowledgemanagement.php b/htdocs/admin/knowledgemanagement.php index e9e7f971575..5bc994bb086 100644 --- a/htdocs/admin/knowledgemanagement.php +++ b/htdocs/admin/knowledgemanagement.php @@ -210,7 +210,7 @@ print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup'); // Configuration header $head = knowledgemanagementAdminPrepareHead(); -print dol_get_fiche_head($head, 'knowledgemanagement', $langs->trans('ModuleKnowledgeManagementName'), -1, "knowledgemanagement"); +print dol_get_fiche_head($head, 'setup', $langs->trans('ModuleKnowledgeManagementName'), -1, "knowledgemanagement"); // Setup page goes here echo ''.$langs->trans("KnowledgeManagementSetupPage").'

'; diff --git a/htdocs/admin/knowledgerecord_extrafields.php b/htdocs/admin/knowledgerecord_extrafields.php index 34d3b4858e9..823366e1fbe 100644 --- a/htdocs/admin/knowledgerecord_extrafields.php +++ b/htdocs/admin/knowledgerecord_extrafields.php @@ -103,7 +103,7 @@ print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup'); $head = knowledgemanagementAdminPrepareHead(); -print dol_get_fiche_head($head, 'knowledgerecord_extrafields', $langs->trans("KnowledgeRecordExtraFields"), -1, 'knowledgemanagement'); +print dol_get_fiche_head($head, 'extra', $langs->trans("KnowledgeRecordExtraFields"), -1, 'knowledgemanagement'); require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; diff --git a/htdocs/knowledgemanagement/lib/knowledgemanagement.lib.php b/htdocs/knowledgemanagement/lib/knowledgemanagement.lib.php index 15279f01983..ba81dd49057 100644 --- a/htdocs/knowledgemanagement/lib/knowledgemanagement.lib.php +++ b/htdocs/knowledgemanagement/lib/knowledgemanagement.lib.php @@ -37,13 +37,13 @@ function knowledgemanagementAdminPrepareHead() $head[$h][0] = dol_buildpath("/admin/knowledgemanagement.php", 1); $head[$h][1] = $langs->trans("Setup"); - $head[$h][2] = 'settings'; + $head[$h][2] = 'setup'; $h++; $head[$h][0] = dol_buildpath("admin/knowledgerecord_extrafields.php", 1); $head[$h][1] = $langs->trans("ExtraFields"); - $head[$h][2] = 'settings'; + $head[$h][2] = 'extra'; $h++; /*$head[$h][0] = dol_buildpath("/knowledgemanagement/admin/about.php", 1); diff --git a/htdocs/langs/en_US/modulebuilder.lang b/htdocs/langs/en_US/modulebuilder.lang index 9fdaa1a533a..7ba539d3bd4 100644 --- a/htdocs/langs/en_US/modulebuilder.lang +++ b/htdocs/langs/en_US/modulebuilder.lang @@ -143,3 +143,4 @@ AsciiToHtmlConverter=Ascii to HTML converter AsciiToPdfConverter=Ascii to PDF converter TableNotEmptyDropCanceled=Table not empty. Drop has been canceled. ModuleBuilderNotAllowed=The module builder is available but not allowed to your user. +ImportExportProfiles=Import and export profiles \ No newline at end of file diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index dc5a84071d7..c56c37d00c3 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -726,9 +726,33 @@ if ($dirins && $action == 'initdoc' && !empty($module)) { // add Language if ($dirins && $action == 'addlanguage' && !empty($module)) { $newlangcode = GETPOST('newlangcode', 'aZ09'); - $srcfile = $dirins.'/'.strtolower($module).'/langs/en_US'; - $destfile = $dirins.'/'.strtolower($module).'/langs/'.$newlangcode; - $result = dolCopyDir($srcfile, $destfile, 0, 0); + + if ($newlangcode) { + $modulelowercase = strtolower($module); + + // Dir for module + $diroflang = dol_buildpath($modulelowercase, 0); + + if ($diroflang == $dirread.'/'.$modulelowercase) { + // This is not a custom module, we force diroflang to htdocs root + $diroflang = $dirread; + + $srcfile = $diroflang.'/langs/en_US/'.$modulelowercase.'.lang'; + $destfile = $diroflang.'/langs/'.$newlangcode.'/'.$modulelowercase.'.lang'; + + $result = dol_copy($srcfile, $destfile, 0, 0); + if ($result < 0) { + setEventMessages($langs->trans("ErrorFailToCopyFile", $srcfile, $destfile), null, 'errors'); + } + } else { + $srcfile = $diroflang.'/langs/en_US'; + $destfile = $diroflang.'/langs/'.$newlangcode; + + $result = dolCopyDir($srcfile, $destfile, 0, 0); + } + } else { + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Language")), null, 'errors'); + } } @@ -1448,17 +1472,37 @@ if ($dirins && $action == 'confirm_deleteobject' && $objectname) { $tabobj = 'deleteobject'; } +if ($dirins && $action == 'generatedoc') { + $modulelowercase = strtolower($module); + + // Dir for module + $dirofmodule = dol_buildpath($modulelowercase, 0).'/doc'; + + $FILENAMEDOC = strtolower($module).'.html'; + + $util = new Utils($db); + $result = $util->generateDoc($module); + + if ($result > 0) { + setEventMessages($langs->trans("DocFileGeneratedInto", $dirofmodule), null); + } else { + setEventMessages($util->error, $util->errors, 'errors'); + } +} if ($dirins && $action == 'generatepackage') { $modulelowercase = strtolower($module); + $pathtofile = $listofmodules[strtolower($module)]['moduledescriptorrelpath']; + // Dir for module - $dir = $dirins.'/'.$modulelowercase; + $dir = dol_buildpath($modulelowercase, 0); + // Zip file to build $FILENAMEZIP = ''; // Load module - dol_include_once($modulelowercase.'/core/modules/mod'.$module.'.class.php'); + dol_include_once($pathtofile); $class = 'mod'.$module; if (class_exists($class)) { @@ -1466,18 +1510,18 @@ if ($dirins && $action == 'generatepackage') { $moduleobj = new $class($db); } catch (Exception $e) { $error++; - dol_print_error($e->getMessage()); + dol_print_error($db, $e->getMessage()); } } else { $error++; $langs->load("errors"); - dol_print_error($langs->trans("ErrorFailedToLoadModuleDescriptorForXXX", $module)); + dol_print_error($db, $langs->trans("ErrorFailedToLoadModuleDescriptorForXXX", $module)); exit; } $arrayversion = explode('.', $moduleobj->version, 3); if (count($arrayversion)) { - $FILENAMEZIP = "module_".$modulelowercase.'-'.$arrayversion[0].'.'.$arrayversion[1].($arrayversion[2] ? ".".$arrayversion[2] : "").".zip"; + $FILENAMEZIP = "module_".$modulelowercase.'-'.$arrayversion[0].($arrayversion[1] ? '.'.$arrayversion[1] : '').($arrayversion[2] ? '.'.$arrayversion[2] : '').'.zip'; $dirofmodule = dol_buildpath($modulelowercase, 0).'/bin'; $outputfilezip = $dirofmodule.'/'.$FILENAMEZIP; @@ -1504,20 +1548,6 @@ if ($dirins && $action == 'generatepackage') { } } -if ($dirins && $action == 'generatedoc') { - $FILENAMEDOC = strtolower($module).'.html'; - $dirofmodule = dol_buildpath(strtolower($module), 0).'/doc'; - - $util = new Utils($db); - $result = $util->generateDoc($module); - - if ($result > 0) { - setEventMessages($langs->trans("DocFileGeneratedInto", $dirofmodule), null); - } else { - setEventMessages($util->error, $util->errors, 'errors'); - } -} - // Save file if ($action == 'savefile' && empty($cancel)) { @@ -3812,12 +3842,12 @@ if ($module == 'initmodule') { $moduleobj = new $class($db); } catch (Exception $e) { $error++; - dol_print_error($e->getMessage()); + dol_print_error($db, $e->getMessage()); } } else { $error++; $langs->load("errors"); - dol_print_error($langs->trans("ErrorFailedToLoadModuleDescriptorForXXX", $module)); + dol_print_error($db, $langs->trans("ErrorFailedToLoadModuleDescriptorForXXX", $module)); exit; } From e8f48667ddcce2f91d31df1477c7a7a7598acb29 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 2 May 2021 12:35:47 +0200 Subject: [PATCH 086/147] Enhance modulebuilder --- htdocs/modulebuilder/index.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index c56c37d00c3..c35aa1c3f87 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -2155,7 +2155,21 @@ if ($module == 'initmodule') { print '
'; print '
'; - $langfiles = dol_dir_list(dol_buildpath($modulelowercase.'/langs', 0), 'files', 1, '\.lang$'); + $modulelowercase = strtolower($module); + + // Dir for module + $diroflang = dol_buildpath($modulelowercase, 0); + + if (!preg_match('/custom/', $dirread)) { + $diroflang = $dirread; + $diroflang .= '/langs'; + + $langfiles = dol_dir_list($diroflang, 'files', 1, $modulelowercase.'\.lang$'); + } else { + $diroflang .= '/langs'; + + $langfiles = dol_dir_list($diroflang, 'files', 1, '\.lang$'); + } print ''; foreach ($langfiles as $langfile) { From 88fa042c3bcc3e7ea86da256e5802380d854f6f4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 2 May 2021 12:39:33 +0200 Subject: [PATCH 087/147] Can edit language file for core modules --- htdocs/modulebuilder/index.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index c35aa1c3f87..35e5e5b81b0 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -2159,21 +2159,22 @@ if ($module == 'initmodule') { // Dir for module $diroflang = dol_buildpath($modulelowercase, 0); + $diroflang .= '/langs'; + $langfiles = dol_dir_list($diroflang, 'files', 1, '\.lang$'); if (!preg_match('/custom/', $dirread)) { + // If this is not a module into custom $diroflang = $dirread; $diroflang .= '/langs'; - $langfiles = dol_dir_list($diroflang, 'files', 1, $modulelowercase.'\.lang$'); - } else { - $diroflang .= '/langs'; - - $langfiles = dol_dir_list($diroflang, 'files', 1, '\.lang$'); } print '
'; foreach ($langfiles as $langfile) { $pathtofile = $modulelowercase.'/langs/'.$langfile['relativename']; + if (!preg_match('/custom/', $dirread)) { // If this is not a module into custom + $pathtofile = 'langs/'.$langfile['relativename']; + } print ''; print ''; - if (is_resource($handle)) - { - while (($file = readdir($handle)) !== false) - { - if (preg_match('/^payment/i', $file)) - { - $tfile = $dir.'/'.$year.'/'.$file; - $relativepath = $year.'/'.$file; - print ''; - print ''; - print ''; - print ''; - print ''; - } + $files = (scandir($dir.'/'.$year)); + foreach ($files as $f) { + $tfile = $dir.'/'.$year.'/'.$f; + $relativepath = $year.'/'.$f; + if (is_file($tfile)) { + print ''; + print ''; + print ''; + print ''; + print ''; } - closedir($handle); } print '
'.$langs->trans("LanguageFile").' '.basename(dirname($pathtofile)).' : '.$pathtofile.''; print ''.img_picto($langs->trans("Edit"), 'edit').''; print ''.img_picto($langs->trans("Delete"), 'delete').''; From 3edb929f9e7735e7adc4f6746833021dcd8a2118 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 2 May 2021 12:43:28 +0200 Subject: [PATCH 088/147] Debug v14 --- htdocs/core/modules/modKnowledgeManagement.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/modules/modKnowledgeManagement.class.php b/htdocs/core/modules/modKnowledgeManagement.class.php index a08070d8d0c..504c363b648 100644 --- a/htdocs/core/modules/modKnowledgeManagement.class.php +++ b/htdocs/core/modules/modKnowledgeManagement.class.php @@ -45,7 +45,7 @@ class modKnowledgeManagement extends DolibarrModules // Id for module (must be unique). // Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id). - $this->numero = 57000; // TODO Go on page https://wiki.dolibarr.org/index.php/List_of_modules_id to reserve an id number for your module + $this->numero = 57000; // Key text used to identify module (for permissions, menus, etc...) $this->rights_class = 'knowledgemanagement'; @@ -260,17 +260,17 @@ class modKnowledgeManagement extends DolibarrModules $r = 0; // Add here entries to declare new permissions /* BEGIN MODULEBUILDER PERMISSIONS */ - $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used) + $this->rights[$r][0] = $this->numero + $r + 1; // Permission id (must not be already used) $this->rights[$r][1] = 'Read objects of Knowledge Management'; // Permission label $this->rights[$r][4] = 'knowledgerecord'; // In php code, permission will be checked by test if ($user->rights->knowledgemanagement->level1->level2) $this->rights[$r][5] = 'read'; // In php code, permission will be checked by test if ($user->rights->knowledgemanagement->level1->level2) $r++; - $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used) + $this->rights[$r][0] = $this->numero + $r + 1; // Permission id (must not be already used) $this->rights[$r][1] = 'Create/Update objects of Knowledge Management'; // Permission label $this->rights[$r][4] = 'knowledgerecord'; // In php code, permission will be checked by test if ($user->rights->knowledgemanagement->level1->level2) $this->rights[$r][5] = 'write'; // In php code, permission will be checked by test if ($user->rights->knowledgemanagement->level1->level2) $r++; - $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used) + $this->rights[$r][0] = $this->numero + $r + 1; // Permission id (must not be already used) $this->rights[$r][1] = 'Delete objects of Knowledge Management'; // Permission label $this->rights[$r][4] = 'knowledgerecord'; // In php code, permission will be checked by test if ($user->rights->knowledgemanagement->level1->level2) $this->rights[$r][5] = 'delete'; // In php code, permission will be checked by test if ($user->rights->knowledgemanagement->level1->level2) From a54e60d3456d4fcd15161d61586ba1d99aeb20f9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 2 May 2021 13:13:55 +0200 Subject: [PATCH 089/147] Look and feel v14 --- htdocs/admin/system/modules.php | 2 +- htdocs/core/lib/functions.lib.php | 16 ++++++++++------ htdocs/core/modules/DolibarrModules.class.php | 17 +++++++++++++++++ htdocs/core/modules/modIncoterm.class.php | 2 +- htdocs/core/modules/modPartnership.class.php | 2 +- 5 files changed, 30 insertions(+), 9 deletions(-) diff --git a/htdocs/admin/system/modules.php b/htdocs/admin/system/modules.php index 2796f09fbfd..f3892e105bb 100644 --- a/htdocs/admin/system/modules.php +++ b/htdocs/admin/system/modules.php @@ -134,7 +134,7 @@ foreach ($modules as $key => $module) { $newModule->name = $module->getName(); $newModule->version = $module->getVersion(); $newModule->id = $key; - $newModule->module_position = $module->module_position; + $newModule->module_position = $module->getModulePosition(); $alt = $module->name.' - '.$modules_files[$key]; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 4239ff4bafe..e5d7acbd250 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3517,7 +3517,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'filter', 'file-code', 'file-export', 'file-import', 'file-upload', 'autofill', 'folder', 'folder-open', 'folder-plus', 'globe', 'globe-americas', 'graph', 'grip', 'grip_title', 'group', 'help', 'holiday', - 'images', 'info', 'intervention', 'inventory', 'intracommreport', 'knowledgemanagement', + 'images', 'incoterm', 'info', 'intervention', 'inventory', 'intracommreport', 'knowledgemanagement', 'label', 'language', 'link', 'list', 'listlight', 'loan', 'lot', 'long-arrow-alt-right', 'margin', 'map-marker-alt', 'member', 'meeting', 'money-bill-alt', 'movement', 'mrp', 'note', 'next', 'off', 'on', 'order', @@ -3553,7 +3553,8 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'donation'=>'file-alt', 'dynamicprice'=>'hand-holding-usd', 'setup'=>'cog', 'companies'=>'building', 'products'=>'cube', 'commercial'=>'suitcase', 'invoicing'=>'coins', 'accounting'=>'search-dollar', 'category'=>'tag', 'dollyrevert'=>'dolly', - 'hrm'=>'user-tie', 'margin'=>'calculator', 'members'=>'user-friends', 'ticket'=>'ticket-alt', 'globe'=>'external-link-alt', 'lot'=>'barcode', + 'hrm'=>'user-tie', 'incoterm'=>'truck-loading', + 'margin'=>'calculator', 'members'=>'user-friends', 'ticket'=>'ticket-alt', 'globe'=>'external-link-alt', 'lot'=>'barcode', 'email'=>'at', 'establishment'=>'building', 'edit'=>'pencil-alt', 'graph'=>'chart-line', 'grip_title'=>'arrows-alt', 'grip'=>'arrows-alt', 'help'=>'question-circle', 'generic'=>'file', 'holiday'=>'umbrella-beach', @@ -3635,9 +3636,10 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'bill'=>'infobox-commande', 'billa'=>'infobox-commande', 'billr'=>'infobox-commande', 'billd'=>'infobox-commande', 'conferenceorbooth'=>'infobox-project', 'cash-register'=>'infobox-bank_account', 'contract'=>'infobox-contrat', 'check'=>'font-status4', 'collab'=>'infobox-action', 'conversation'=>'infobox-contrat', - 'donation'=>'infobox-commande', 'dollyrevert'=>'flip', + 'donation'=>'infobox-commande', 'dolly'=>'infobox-commande', 'dollyrevert'=>'flip infobox-order_supplier', 'ecm'=>'infobox-action', 'eventorganization'=>'infobox-project', 'hrm'=>'infobox-adherent', 'group'=>'infobox-adherent', 'intervention'=>'infobox-contrat', + 'incoterm'=>'infobox-supplier_proposal', 'multicurrency'=>'infobox-bank_account', 'members'=>'infobox-adherent', 'member'=>'infobox-adherent', 'money-bill-alt'=>'infobox-bank_account', 'order'=>'infobox-commande', @@ -3648,7 +3650,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'payment'=>'infobox-bank_account', 'poll'=>'infobox-adherent', 'pos'=>'infobox-bank_account', 'project'=>'infobox-project', 'projecttask'=>'infobox-project', 'propal'=>'infobox-propal', 'reception'=>'flip', 'recruitmentjobposition'=>'infobox-adherent', 'recruitmentcandidature'=>'infobox-adherent', 'resource'=>'infobox-action', - 'salary'=>'infobox-bank_account', 'supplier_invoice'=>'infobox-order_supplier', 'supplier_invoicea'=>'infobox-order_supplier', 'supplier_invoiced'=>'infobox-order_supplier', + 'salary'=>'infobox-bank_account', 'shipment'=>'infobox-commande', 'supplier_invoice'=>'infobox-order_supplier', 'supplier_invoicea'=>'infobox-order_supplier', 'supplier_invoiced'=>'infobox-order_supplier', 'supplier_order'=>'infobox-order_supplier', 'supplier_proposal'=>'infobox-supplier_proposal', 'ticket'=>'infobox-contrat', 'title_accountancy'=>'infobox-bank_account', 'title_hrm'=>'infobox-holiday', 'expensereport'=>'infobox-expensereport', 'trip'=>'infobox-expensereport', 'title_agenda'=>'infobox-action', //'title_setup'=>'infobox-action', 'tools'=>'infobox-action', @@ -3664,11 +3666,13 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'cog'=>'#999', 'companies'=>'#6c6aa8', 'company'=>'#6c6aa8', 'contact'=>'#6c6aa8', 'cron'=>'#555', 'dynamicprice'=>'#a69944', 'edit'=>'#444', 'note'=>'#999', 'error'=>'', 'help'=>'#bbb', 'listlight'=>'#999', 'language'=>'#555', - 'dolly'=>'#a69944', 'dollyrevert'=>'#a69944', 'lot'=>'#a69944', + //'dolly'=>'#a69944', 'dollyrevert'=>'#a69944', + 'lot'=>'#a69944', 'map-marker-alt'=>'#aaa', 'mrp'=>'#a69944', 'product'=>'#a69944', 'service'=>'#a69944', 'inventory'=>'#a69944', 'stock'=>'#a69944', 'movement'=>'#a69944', 'other'=>'#ddd', 'partnership'=>'#6c6aa8', 'playdisabled'=>'#ccc', 'printer'=>'#444', 'projectpub'=>'#986c6a', 'reception'=>'#a69944', 'resize'=>'#444', 'rss'=>'#cba', - 'shipment'=>'#a69944', 'stats'=>'#444', 'switch_off'=>'#999', 'technic'=>'#999', 'timespent'=>'#555', + //'shipment'=>'#a69944', + 'stats'=>'#444', 'switch_off'=>'#999', 'technic'=>'#999', 'timespent'=>'#555', 'uncheck'=>'#800', 'uparrow'=>'#555', 'user-cog'=>'#999', 'country'=>'#aaa', 'globe-americas'=>'#aaa', 'website'=>'#304', 'workstation'=>'#a69944' ); diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index 30ee2bb72be..5fbfc05a9fb 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -800,6 +800,23 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it return $ret; } + /** + * Gives the module position + * + * @return int Module position (an external module should never return a value lower than 100000. 1-100000 are reserved for core) + */ + public function getModulePosition() + { + if (in_array($this->version, array('dolibarr', 'experimental', 'development'))) { // core module + return $this->module_position; + } else { // external module + if ($this->module_position >= 100000) { + return $this->module_position; + } else { + return $this->module_position + 100000; + } + } + } /** * Tells if module is core or external diff --git a/htdocs/core/modules/modIncoterm.class.php b/htdocs/core/modules/modIncoterm.class.php index a7a260dba6e..9ef50fe3aac 100644 --- a/htdocs/core/modules/modIncoterm.class.php +++ b/htdocs/core/modules/modIncoterm.class.php @@ -56,7 +56,7 @@ class modIncoterm extends DolibarrModules $this->version = 'dolibarr'; // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - $this->picto = 'generic'; + $this->picto = 'incoterm'; $this->module_parts = array(); $this->dirs = array(); diff --git a/htdocs/core/modules/modPartnership.class.php b/htdocs/core/modules/modPartnership.class.php index 1165461368b..8b3b0cdb2c4 100644 --- a/htdocs/core/modules/modPartnership.class.php +++ b/htdocs/core/modules/modPartnership.class.php @@ -48,7 +48,7 @@ class modPartnership extends DolibarrModules // Id for module (must be unique). // Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id). - $this->numero = 500000; // TODO Go on page https://wiki.dolibarr.org/index.php/List_of_modules_id to reserve an id number for your module + $this->numero = 58000; // Key text used to identify module (for permissions, menus, etc...) $this->rights_class = 'partnership'; From 71ed90a153d21f89302d18b66f19d8d53a827d64 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 2 May 2021 13:16:41 +0200 Subject: [PATCH 090/147] Fix phpcs --- htdocs/theme/eldy/btn.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/theme/eldy/btn.inc.php b/htdocs/theme/eldy/btn.inc.php index 9f057fe46c1..6f05daba22f 100644 --- a/htdocs/theme/eldy/btn.inc.php +++ b/htdocs/theme/eldy/btn.inc.php @@ -86,7 +86,7 @@ span.butAction, span.butActionDelete { text-align: center; cursor: pointer; color: #444; - border: 1px solid transparent; /* So for buttonRefused with a border, it will not have any flash effect */ + border: 1px solid transparent; /* So for buttonRefused with a border, it will not have any flash effect */ /* border: 1px solid #aaa; */ /* border-color: rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.25); */ From 9e2a987ee31e6057e711a07c6ab24d59e24e0540 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Sun, 2 May 2021 13:17:05 +0200 Subject: [PATCH 091/147] Update llx_20_c_departements.sql Morocco / Maroc Provinces (have to check before/after year 2015) --- .../mysql/data/llx_20_c_departements.sql | 172 +++++++++--------- 1 file changed, 86 insertions(+), 86 deletions(-) diff --git a/htdocs/install/mysql/data/llx_20_c_departements.sql b/htdocs/install/mysql/data/llx_20_c_departements.sql index fd60de31aa3..1dfb11db9c5 100644 --- a/htdocs/install/mysql/data/llx_20_c_departements.sql +++ b/htdocs/install/mysql/data/llx_20_c_departements.sql @@ -54,7 +54,7 @@ -- Italy -- Luxembourg -- Netherlands --- (Moroco) +-- Morocco -- Panama -- Portugal -- Romania @@ -663,6 +663,91 @@ INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (14003, 'LU0012', '', 0, '', 'Mersch'); +-- Morocco/Maroc Provinces (62) & Prefectures (13) (id country=12) +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1209, 'MA', '', 0, '', 'Province de Benslimane'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1209, 'MA1', '', 0, '', 'Province de Berrechid'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1209, 'MA2', '', 0, '', 'Province de Khouribga'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1209, 'MA3', '', 0, '', 'Province de Settat'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1210, 'MA4', '', 0, '', 'Province d''El Jadida'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1210, 'MA5', '', 0, '', 'Province de Safi'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1210, 'MA6', '', 0, '', 'Province de Sidi Bennour'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1210, 'MA7', '', 0, '', 'Province de Youssoufia'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1205, 'MA6B', '', 0, '', 'Préfecture de Fès'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1205, 'MA7B', '', 0, '', 'Province de Boulemane'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1205, 'MA8', '', 0, '', 'Province de Moulay Yacoub'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1205, 'MA9', '', 0, '', 'Province de Sefrou'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1202, 'MA8A', '', 0, '', 'Province de Kénitra'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1202, 'MA9A', '', 0, '', 'Province de Sidi Kacem'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1202, 'MA10', '', 0, '', 'Province de Sidi Slimane'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1208, 'MA11', '', 0, '', 'Préfecture de Casablanca'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1208, 'MA12', '', 0, '', 'Préfecture de Mohammédia'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1208, 'MA13', '', 0, '', 'Province de Médiouna'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1208, 'MA14', '', 0, '', 'Province de Nouaceur'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1214, 'MA15', '', 0, '', 'Province d''Assa-Zag'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1214, 'MA16', '', 0, '', 'Province d''Es-Semara'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1214, 'MA17A','', 0, '', 'Province de Guelmim'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1214, 'MA18', '', 0, '', 'Province de Tata'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1214, 'MA19', '', 0, '', 'Province de Tan-Tan'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1215, 'MA15', '', 0, '', 'Province de Boujdour'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1215, 'MA16', '', 0, '', 'Province de Lâayoune'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1215, 'MA17', '', 0, '', 'Province de Tarfaya'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1211, 'MA18', '', 0, '', 'Préfecture de Marrakech'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1211, 'MA19', '', 0, '', 'Province d''Al Haouz'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1211, 'MA20', '', 0, '', 'Province de Chichaoua'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1211, 'MA21', '', 0, '', 'Province d''El Kelâa des Sraghna'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1211, 'MA22', '', 0, '', 'Province d''Essaouira'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1211, 'MA23', '', 0, '', 'Province de Rehamna'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1206, 'MA24', '', 0, '', 'Préfecture de Meknès'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1206, 'MA25', '', 0, '', 'Province d’El Hajeb'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1206, 'MA26', '', 0, '', 'Province d''Errachidia'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1206, 'MA27', '', 0, '', 'Province d’Ifrane'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1206, 'MA28', '', 0, '', 'Province de Khénifra'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1206, 'MA29', '', 0, '', 'Province de Midelt'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1204, 'MA30', '', 0, '', 'Préfecture d''Oujda-Angad'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1204, 'MA31', '', 0, '', 'Province de Berkane'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1204, 'MA32', '', 0, '', 'Province de Driouch'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1204, 'MA33', '', 0, '', 'Province de Figuig'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1204, 'MA34', '', 0, '', 'Province de Jerada'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1204, 'MA35', '', 0, '', 'Province de Nador'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1204, 'MA36', '', 0, '', 'Province de Taourirt'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1216, 'MA37', '', 0, '', 'Province d''Aousserd'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1216, 'MA38', '', 0, '', 'Province d''Oued Ed-Dahab'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1207, 'MA39', '', 0, '', 'Préfecture de Rabat'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1207, 'MA40', '', 0, '', 'Préfecture de Skhirat-Témara'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1207, 'MA41', '', 0, '', 'Préfecture de Salé'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1207, 'MA42', '', 0, '', 'Province de Khémisset'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1213, 'MA43', '', 0, '', 'Préfecture d''Agadir Ida-Outanane'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1213, 'MA44', '', 0, '', 'Préfecture d''Inezgane-Aït Melloul'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1213, 'MA45', '', 0, '', 'Province de Chtouka-Aït Baha'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1213, 'MA46', '', 0, '', 'Province d''Ouarzazate'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1213, 'MA47', '', 0, '', 'Province de Sidi Ifni'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1213, 'MA48', '', 0, '', 'Province de Taroudant'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1213, 'MA49', '', 0, '', 'Province de Tinghir'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1213, 'MA50', '', 0, '', 'Province de Tiznit'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1213, 'MA51', '', 0, '', 'Province de Zagora'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1212, 'MA52', '', 0, '', 'Province d''Azilal'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1212, 'MA53', '', 0, '', 'Province de Beni Mellal'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1212, 'MA54', '', 0, '', 'Province de Fquih Ben Salah'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1201, 'MA55', '', 0, '', 'Préfecture de M''diq-Fnideq'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1201, 'MA56', '', 0, '', 'Préfecture de Tanger-Asilah'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1201, 'MA57', '', 0, '', 'Province de Chefchaouen'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1201, 'MA58', '', 0, '', 'Province de Fahs-Anjra'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1201, 'MA59', '', 0, '', 'Province de Larache'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1201, 'MA60', '', 0, '', 'Province d''Ouezzane'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1201, 'MA61', '', 0, '', 'Province de Tétouan'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1203, 'MA62', '', 0, '', 'Province de Guercif'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1203, 'MA63', '', 0, '', 'Province d''Al Hoceïma'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1203, 'MA64', '', 0, '', 'Province de Taounate'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1203, 'MA65', '', 0, '', 'Province de Taza'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1205, 'MA6A', '', 0, '', 'Préfecture de Fès'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1205, 'MA7A', '', 0, '', 'Province de Boulemane'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1214, 'MA15A','', 0, '', 'Province d''Assa-Zag'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1214, 'MA16A','', 0, '', 'Province d''Es-Semara'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1211, 'MA18A','', 0, '', 'Préfecture de Marrakech'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1214, 'MA19A','', 0, '', 'Province de Tan-Tan'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1214, 'MA19B','', 0, '', 'Province de Tan-Tan'); + + -- Netherlands/Nederland Provinces (id country=17) INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1701, 'GR', NULL, NULL, NULL, 'Groningen'); INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1701, 'FR', NULL, NULL, NULL, 'Friesland'); @@ -678,91 +763,6 @@ INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1701, 'LB', NULL, NULL, NULL, 'Limburg'); --- Provinces Maroc - Moroco (id country=12) -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA', 1209, '', 0, '', 'Province de Benslimane', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA1', 1209, '', 0, '', 'Province de Berrechid', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA2', 1209, '', 0, '', 'Province de Khouribga', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA3', 1209, '', 0, '', 'Province de Settat', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA4', 1210, '', 0, '', 'Province d''El Jadida', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA5', 1210, '', 0, '', 'Province de Safi', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA6', 1210, '', 0, '', 'Province de Sidi Bennour', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA7', 1210, '', 0, '', 'Province de Youssoufia', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA6B', 1205, '', 0, '', 'Préfecture de Fès', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA7B', 1205, '', 0, '', 'Province de Boulemane', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA8', 1205, '', 0, '', 'Province de Moulay Yacoub', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA9', 1205, '', 0, '', 'Province de Sefrou', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA8A', 1202, '', 0, '', 'Province de Kénitra', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA9A', 1202, '', 0, '', 'Province de Sidi Kacem', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA10', 1202, '', 0, '', 'Province de Sidi Slimane', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA11', 1208, '', 0, '', 'Préfecture de Casablanca', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA12', 1208, '', 0, '', 'Préfecture de Mohammédia', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA13', 1208, '', 0, '', 'Province de Médiouna', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA14', 1208, '', 0, '', 'Province de Nouaceur', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA15', 1214, '', 0, '', 'Province d''Assa-Zag', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA16', 1214, '', 0, '', 'Province d''Es-Semara', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA17A', 1214, '', 0, '', 'Province de Guelmim', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA18', 1214, '', 0, '', 'Province de Tata', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA19', 1214, '', 0, '', 'Province de Tan-Tan', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA15', 1215, '', 0, '', 'Province de Boujdour', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA16', 1215, '', 0, '', 'Province de Lâayoune', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA17', 1215, '', 0, '', 'Province de Tarfaya', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA18', 1211, '', 0, '', 'Préfecture de Marrakech', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA19', 1211, '', 0, '', 'Province d''Al Haouz', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA20', 1211, '', 0, '', 'Province de Chichaoua', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA21', 1211, '', 0, '', 'Province d''El Kelâa des Sraghna', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA22', 1211, '', 0, '', 'Province d''Essaouira', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA23', 1211, '', 0, '', 'Province de Rehamna', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA24', 1206, '', 0, '', 'Préfecture de Meknès', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA25', 1206, '', 0, '', 'Province d’El Hajeb', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA26', 1206, '', 0, '', 'Province d''Errachidia', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA27', 1206, '', 0, '', 'Province d’Ifrane', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA28', 1206, '', 0, '', 'Province de Khénifra', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA29', 1206, '', 0, '', 'Province de Midelt', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA30', 1204, '', 0, '', 'Préfecture d''Oujda-Angad', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA31', 1204, '', 0, '', 'Province de Berkane', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA32', 1204, '', 0, '', 'Province de Driouch', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA33', 1204, '', 0, '', 'Province de Figuig', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA34', 1204, '', 0, '', 'Province de Jerada', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA35', 1204, '', 0, '', 'Province de Nador', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA36', 1204, '', 0, '', 'Province de Taourirt', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA37', 1216, '', 0, '', 'Province d''Aousserd', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA38', 1216, '', 0, '', 'Province d''Oued Ed-Dahab', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA39', 1207, '', 0, '', 'Préfecture de Rabat', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA40', 1207, '', 0, '', 'Préfecture de Skhirat-Témara', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA41', 1207, '', 0, '', 'Préfecture de Salé', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA42', 1207, '', 0, '', 'Province de Khémisset', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA43', 1213, '', 0, '', 'Préfecture d''Agadir Ida-Outanane', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA44', 1213, '', 0, '', 'Préfecture d''Inezgane-Aït Melloul', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA45', 1213, '', 0, '', 'Province de Chtouka-Aït Baha', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA46', 1213, '', 0, '', 'Province d''Ouarzazate', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA47', 1213, '', 0, '', 'Province de Sidi Ifni', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA48', 1213, '', 0, '', 'Province de Taroudant', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA49', 1213, '', 0, '', 'Province de Tinghir', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA50', 1213, '', 0, '', 'Province de Tiznit', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA51', 1213, '', 0, '', 'Province de Zagora', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA52', 1212, '', 0, '', 'Province d''Azilal', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA53', 1212, '', 0, '', 'Province de Beni Mellal', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA54', 1212, '', 0, '', 'Province de Fquih Ben Salah', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA55', 1201, '', 0, '', 'Préfecture de M''diq-Fnideq', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA56', 1201, '', 0, '', 'Préfecture de Tanger-Asilah', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA57', 1201, '', 0, '', 'Province de Chefchaouen', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA58', 1201, '', 0, '', 'Province de Fahs-Anjra', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA59', 1201, '', 0, '', 'Province de Larache', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA60', 1201, '', 0, '', 'Province d''Ouezzane', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA61', 1201, '', 0, '', 'Province de Tétouan', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA62', 1203, '', 0, '', 'Province de Guercif', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA63', 1203, '', 0, '', 'Province d''Al Hoceïma', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA64', 1203, '', 0, '', 'Province de Taounate', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA65', 1203, '', 0, '', 'Province de Taza', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA6A', 1205, '', 0, '', 'Préfecture de Fès', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA7A', 1205, '', 0, '', 'Province de Boulemane', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA15A', 1214, '', 0, '', 'Province d''Assa-Zag', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA16A', 1214, '', 0, '', 'Province d''Es-Semara', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA18A', 1211, '', 0, '', 'Préfecture de Marrakech', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA19A', 1214, '', 0, '', 'Province de Tan-Tan', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA19B', 1214, '', 0, '', 'Province de Tan-Tan', 1); - - -- Panama - 10 Provinces (id country=178) INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom) VALUES (17801, 'PA-1', '', 0, '', 'Bocas del Toro'); INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom) VALUES (17801, 'PA-2', '', 0, '', 'Coclé'); From 5408671f8e71c7fa6dae3e3e5f3dc1934dba5451 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Sun, 2 May 2021 13:44:06 +0200 Subject: [PATCH 092/147] Update llx_10_c_regions.sql Morocco - changed its regions in 2015 insert at first only a comment check how to change for migration of old user datasets --- htdocs/install/mysql/data/llx_10_c_regions.sql | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/htdocs/install/mysql/data/llx_10_c_regions.sql b/htdocs/install/mysql/data/llx_10_c_regions.sql index d55455a215a..daf6e16ea9e 100644 --- a/htdocs/install/mysql/data/llx_10_c_regions.sql +++ b/htdocs/install/mysql/data/llx_10_c_regions.sql @@ -327,7 +327,22 @@ INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 1 insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 154, 15401, '', 0, 'Mexique'); --- Morocco / Maroc - Regions (id country=12) +-- Morocco / Maroc - Regions since 2015 (id country=12) +-- INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 12, 1201, '', 0, 'Tanger-Tétouan-Al Hoceima'); +-- INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 12, 1202, '', 0, 'Oriental'); +-- INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 12, 1203, '', 0, 'Fès-Meknès'); +-- INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 12, 1204, '', 0, 'Rabat-Salé-Kénitra'); +-- INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 12, 1205, '', 0, 'Béni Mellal-Khénifra'); +-- INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 12, 1206, '', 0, 'Casablanca-Settat'); +-- INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 12, 1207, '', 0, 'Marrakech-Safi'); +-- INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 12, 1208, '', 0, 'Drâa-Tafilalet'); +-- INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 12, 1209, '', 0, 'Souss-Massa'); +-- INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 12, 1210, '', 0, 'Guelmim-Oued Noun'); +-- INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 12, 1211, '', 0, 'Laâyoune-Sakia El Hamra'); +-- INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 12, 1212, '', 0, 'Dakhla-Oued Ed Dahab'); + + +-- Morocco / Maroc - History 1997-2015 - Regions 13 +3 of Moroccan Sahara (id country=12) INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 12, 1201, '', 0, 'Tanger-Tétouan'); INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 12, 1202, '', 0, 'Gharb-Chrarda-Beni Hssen'); INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 12, 1203, '', 0, 'Taza-Al Hoceima-Taounate'); @@ -346,6 +361,7 @@ INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 12, 1216, '', 0, 'Oued Ed-Dahab Lagouira'); + -- Netherlands Regions (id country=17) INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 17, 1701, '', 0,'Provincies van Nederland '); From 81768984303fb8d69efd85f5d180c4de5f3d9010 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 2 May 2021 14:31:03 +0200 Subject: [PATCH 093/147] Fix lang --- htdocs/core/tpl/filemanager.tpl.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/core/tpl/filemanager.tpl.php b/htdocs/core/tpl/filemanager.tpl.php index c98dcec2a43..bf5a33c22fc 100644 --- a/htdocs/core/tpl/filemanager.tpl.php +++ b/htdocs/core/tpl/filemanager.tpl.php @@ -171,6 +171,8 @@ if ($action == 'delete_section') { // Ask confirmation to build webp images if ($action == 'confirmconvertimgwebp') { + $langs->load("ecm"); + $section_dir=GETPOST('section_dir', 'alpha'); $section=GETPOST('section', 'alpha'); $form = new Form($db); From 92c1022b8edce3508dc38ef7b18483df3a265d6e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 2 May 2021 14:49:07 +0200 Subject: [PATCH 094/147] Fix duplicate in webp --- htdocs/core/tpl/filemanager.tpl.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/core/tpl/filemanager.tpl.php b/htdocs/core/tpl/filemanager.tpl.php index bf5a33c22fc..d8bbe0c7cc0 100644 --- a/htdocs/core/tpl/filemanager.tpl.php +++ b/htdocs/core/tpl/filemanager.tpl.php @@ -197,19 +197,23 @@ if ($action == 'convertimgwebp' && $permtoadd) { $regeximgext = getListOfPossibleImageExt(); - $filelist = dol_dir_list($imagefolder, "all", 0, $regeximgext); + $filelist = dol_dir_list($imagefolder, "files", 0, $regeximgext); + + $nbconverted = 0; foreach ($filelist as $filename) { $filepath = $filename['fullname']; if (!(substr_compare($filepath, 'webp', -strlen('webp')) === 0)) { if (image_format_supported($filepath) == 1) { - $filepathnoext = preg_replace("/\..*/", "", $filepath); + $filepathnoext = preg_replace("/\.[a-z0-9]+$/i", "", $filepath); if (! dol_is_file($filepathnoext.'.webp')) { // If file does not exists yet $result = dol_imageResizeOrCrop($filepath, 0, 0, 0, 0, 0, $filepathnoext.'.webp', 90); if (!dol_is_file($result)) { $error++; setEventMessages($result, null, 'errors'); + } else { + $nbconverted++; } } } From 39f7d0bed83e897a3c92cf8487e309fbd176caf4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 2 May 2021 15:15:27 +0200 Subject: [PATCH 095/147] Fix conversion of images --- htdocs/core/lib/images.lib.php | 69 +++++++++++++++++----------------- 1 file changed, 35 insertions(+), 34 deletions(-) diff --git a/htdocs/core/lib/images.lib.php b/htdocs/core/lib/images.lib.php index 25833df624f..311fa0049b2 100644 --- a/htdocs/core/lib/images.lib.php +++ b/htdocs/core/lib/images.lib.php @@ -182,10 +182,13 @@ function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x = 0, $filetoread = realpath(dol_osencode($file)); // Chemin canonique absolu de l'image - $infoImg = getimagesize($filetoread); // Recuperation des infos de l'image + $infoImg = getimagesize($filetoread); // Get data about src image $imgWidth = $infoImg[0]; // Largeur de l'image $imgHeight = $infoImg[1]; // Hauteur de l'image + $imgTargetName = ($filetowrite ? $filetowrite : $file); + $infoImgTarget = getimagesize($imgTargetName); // Get data about target image + if ($mode == 0) { // If resize, we check parameters if (!empty($filetowrite) && $filetowrite != $file && $newWidth <= 0 && $newHeight <= 0) { $newWidth = $imgWidth; @@ -214,93 +217,86 @@ function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x = 0, case 4: // IMG_WBMP $imgfonction = 'imagecreatefromwbmp'; break; - case 17: // IMG_WBMP + case 17: // IMG_WBMP $imgfonction = 'imagecreatefromwebp'; break; } if ($imgfonction) { if (!function_exists($imgfonction)) { // Fonctions de conversion non presente dans ce PHP - return 'Resize not possible. This PHP does not support GD functions '.$imgfonction; + return 'Read of image not possible. This PHP does not support GD functions '.$imgfonction; } } - // Initialisation des variables selon l'extension de l'image + // Read source image file switch ($infoImg[2]) { case 1: // Gif $img = imagecreatefromgif($filetoread); $extImg = '.gif'; // File name extension of image - $newquality = 'NU'; // Quality is not used for this format break; case 2: // Jpg $img = imagecreatefromjpeg($filetoread); $extImg = '.jpg'; - $newquality = ($newquality ? $newquality : '100'); // % quality maximum break; case 3: // Png $img = imagecreatefrompng($filetoread); $extImg = '.png'; - $newquality = 0; // No compression (0-9) break; case 4: // Bmp $img = imagecreatefromwbmp($filetoread); $extImg = '.bmp'; - $newquality = 'NU'; // Quality is not used for this format break; case 18: // Webp $img = imagecreatefromwebp($filetoread); $extImg = '.webp'; - $newquality = ($newquality ? $newquality : '100'); // % quality maximum break; } - // Create empty image + // Create empty image for target if ($infoImg[2] == 1) { - // Compatibilite image GIF - $imgThumb = imagecreate($newWidth, $newHeight); + // Compatibility image GIF + $imgTarget = imagecreate($newWidth, $newHeight); } else { - $imgThumb = imagecreatetruecolor($newWidth, $newHeight); + $imgTarget = imagecreatetruecolor($newWidth, $newHeight); } // Activate antialiasing for better quality if (function_exists('imageantialias')) { - imageantialias($imgThumb, true); + imageantialias($imgTarget, true); } // This is to keep transparent alpha channel if exists (PHP >= 4.2) if (function_exists('imagesavealpha')) { - imagesavealpha($imgThumb, true); + imagesavealpha($imgTarget, true); } // Initialisation des variables selon l'extension de l'image switch ($infoImg[2]) { case 1: // Gif - $trans_colour = imagecolorallocate($imgThumb, 255, 255, 255); // On procede autrement pour le format GIF - imagecolortransparent($imgThumb, $trans_colour); + $trans_colour = imagecolorallocate($imgTarget, 255, 255, 255); // On procede autrement pour le format GIF + imagecolortransparent($imgTarget, $trans_colour); break; case 2: // Jpg - $trans_colour = imagecolorallocatealpha($imgThumb, 255, 255, 255, 0); + $trans_colour = imagecolorallocatealpha($imgTarget, 255, 255, 255, 0); break; case 3: // Png - imagealphablending($imgThumb, false); // Pour compatibilite sur certain systeme - $trans_colour = imagecolorallocatealpha($imgThumb, 255, 255, 255, 127); // Keep transparent channel + imagealphablending($imgTarget, false); // Pour compatibilite sur certain systeme + $trans_colour = imagecolorallocatealpha($imgTarget, 255, 255, 255, 127); // Keep transparent channel break; case 4: // Bmp - $trans_colour = imagecolorallocatealpha($imgThumb, 255, 255, 255, 0); + $trans_colour = imagecolorallocatealpha($imgTarget, 255, 255, 255, 0); break; case 18: // Webp - $trans_colour = imagecolorallocatealpha($imgThumb, 255, 255, 255, 127); + $trans_colour = imagecolorallocatealpha($imgTarget, 255, 255, 255, 127); break; } if (function_exists("imagefill")) { - imagefill($imgThumb, 0, 0, $trans_colour); + imagefill($imgTarget, 0, 0, $trans_colour); } - dol_syslog("dol_imageResizeOrCrop: convert image from ($imgWidth x $imgHeight) at position ($src_x x $src_y) to ($newWidth x $newHeight) as $extImg, newquality=$newquality"); - //imagecopyresized($imgThumb, $img, 0, 0, 0, 0, $thumbWidth, $thumbHeight, $imgWidth, $imgHeight); // Insere l'image de base redimensionnee - imagecopyresampled($imgThumb, $img, 0, 0, $src_x, $src_y, $newWidth, $newHeight, ($mode == 0 ? $imgWidth : $newWidth), ($mode == 0 ? $imgHeight : $newHeight)); // Insere l'image de base redimensionnee - - $imgTargetName = ($filetowrite ? $filetowrite : $file); + dol_syslog("dol_imageResizeOrCrop: convert image from ($imgWidth x $imgHeight) at position ($src_x x $src_y) to ($newWidth x $newHeight) as $extImg"); + //imagecopyresized($imgTarget, $img, 0, 0, 0, 0, $thumbWidth, $thumbHeight, $imgWidth, $imgHeight); // Insere l'image de base redimensionnee + imagecopyresampled($imgTarget, $img, 0, 0, $src_x, $src_y, $newWidth, $newHeight, ($mode == 0 ? $imgWidth : $newWidth), ($mode == 0 ? $imgHeight : $newHeight)); // Insere l'image de base redimensionnee // Check if permission are ok //$fp = fopen($imgTargetName, "w"); @@ -311,19 +307,24 @@ function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x = 0, // Create image on disk (overwrite file if exists) switch ($newExt) { case 'gif': // Gif - imagegif($imgThumb, $imgTargetName); + $newquality = 'NU'; // Quality is not used for this format + imagegif($imgTarget, $imgTargetName); break; case 'jpg': // Jpg - imagejpeg($imgThumb, $imgTargetName, $newquality); + $newquality = ($newquality ? $newquality : '100'); // % quality maximum + imagejpeg($imgTarget, $imgTargetName, $newquality); break; case 'png': // Png - imagepng($imgThumb, $imgTargetName, $newquality); + $newquality = 0; // No compression (0-9) + imagepng($imgTarget, $imgTargetName, $newquality); break; case 'bmp': // Bmp - imagewbmp($imgThumb, $imgTargetName); + $newquality = 'NU'; // Quality is not used for this format + imagewbmp($imgTarget, $imgTargetName); break; case 'webp': // Webp - imagewebp($imgThumb, $imgTargetName, $newquality); + $newquality = ($newquality ? $newquality : '100'); // % quality maximum + imagewebp($imgTarget, $imgTargetName, $newquality); break; } @@ -334,7 +335,7 @@ function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x = 0, // Free memory. This does not delete image. imagedestroy($img); - imagedestroy($imgThumb); + imagedestroy($imgTarget); clearstatcache(); // File was replaced by a modified one, so we clear file caches. From efda17657d43cdd6b6cabf197f60adf2be909771 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 2 May 2021 15:29:52 +0200 Subject: [PATCH 096/147] Fix conversion in webp --- htdocs/core/lib/images.lib.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/lib/images.lib.php b/htdocs/core/lib/images.lib.php index 311fa0049b2..3a0aef1239f 100644 --- a/htdocs/core/lib/images.lib.php +++ b/htdocs/core/lib/images.lib.php @@ -217,7 +217,7 @@ function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x = 0, case 4: // IMG_WBMP $imgfonction = 'imagecreatefromwbmp'; break; - case 17: // IMG_WBMP + case 18: // IMG_WEBP $imgfonction = 'imagecreatefromwebp'; break; } @@ -253,7 +253,7 @@ function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x = 0, } // Create empty image for target - if ($infoImg[2] == 1) { + if ($infoImgTarget[2] == 1) { // Compatibility image GIF $imgTarget = imagecreate($newWidth, $newHeight); } else { @@ -270,8 +270,8 @@ function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x = 0, imagesavealpha($imgTarget, true); } - // Initialisation des variables selon l'extension de l'image - switch ($infoImg[2]) { + // Set transparent color according to image extension + switch ($infoImgTarget[2]) { case 1: // Gif $trans_colour = imagecolorallocate($imgTarget, 255, 255, 255); // On procede autrement pour le format GIF imagecolortransparent($imgTarget, $trans_colour); From 6c4d0f439762c395758726793693580ac28cb261 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 2 May 2021 15:44:15 +0200 Subject: [PATCH 097/147] css for croping with alpha channel --- htdocs/theme/eldy/global.inc.php | 7 +++++++ htdocs/theme/md/style.css.php | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index f96844e1655..8002946fa23 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -6735,6 +6735,13 @@ div.phpdebugbar-widgets-templates a.phpdebugbar-widgets-editor-link:before font-family: "Font Awesome 5 Free" !important; } +/* ============================================================================== */ +/* CSS style used for jCrop */ +/* ============================================================================== */ + +.jcrop-holder { background: unset !important; } + + /* ============================================================================== */ /* CSS style used for jFlot */ /* ============================================================================== */ diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 17b166d373c..0b09b141258 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -6586,6 +6586,14 @@ div.phpdebugbar-widgets-templates a.phpdebugbar-widgets-editor-link:before font-family: "Font Awesome 5 Free" !important; } + +/* ============================================================================== */ +/* CSS style used for jCrop */ +/* ============================================================================== */ + +.jcrop-holder { background: unset !important; } + + /* ============================================================================== */ /* CSS style used for jFlot */ /* ============================================================================== */ From 2bef4472294646bd0505a5b9d68483d67a02a4b3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 2 May 2021 16:24:52 +0200 Subject: [PATCH 098/147] Clean code --- htdocs/core/lib/admin.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index b9ba7b96efc..66ceae8a198 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -519,7 +519,7 @@ function dolibarr_del_const($db, $name, $entity = 1) } $sql .= ")"; if ($entity >= 0) { - $sql .= " AND entity = ".$entity; + $sql .= " AND entity = ".((int) $entity); } dol_syslog("admin.lib::dolibarr_del_const", LOG_DEBUG); From 2400da497c9b911677df9f7f74e04aadfdf59cbb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 2 May 2021 16:42:22 +0200 Subject: [PATCH 099/147] Exclude binary zip files --- htdocs/modulebuilder/template/.gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/modulebuilder/template/.gitignore b/htdocs/modulebuilder/template/.gitignore index 150a55149b6..70479d0eb63 100644 --- a/htdocs/modulebuilder/template/.gitignore +++ b/htdocs/modulebuilder/template/.gitignore @@ -1,5 +1,6 @@ # Generated binaries /build/*.zip +/bin/*.zip # Doxygen generated documentation /build/doxygen/doxygen_warnings.log /doc/code/doxygen From b7954b12e209c3b25b57a4f013249d22e072de8b Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Sun, 2 May 2021 18:55:23 +0200 Subject: [PATCH 100/147] Update README.howto alioth.debian.org is outdated --> https://alioth-archive.debian.org/ --> https://salsa.debian.org/public --- build/debian/README.howto | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/build/debian/README.howto b/build/debian/README.howto index c38a53718ae..45df1e9df70 100644 --- a/build/debian/README.howto +++ b/build/debian/README.howto @@ -51,16 +51,17 @@ export DEBEMAIL="eldy@destailleur.fr" export QUILT_PATCHES=debian/patches -# To use Alioth.debian.org -* Create an account login -* Update your ~/.ssh/config file to add: -Host svn.debian.org git.debian.org bzr.debian.org hg.debian.org darcs.debian.org arch.debian.org + +# Note: alioth.debian.org is outdated --> https://alioth-archive.debian.org/ --> https://salsa.debian.org/public + * Create an account login + * Update your ~/.ssh/config file to add: + Host svn.debian.org git.debian.org bzr.debian.org hg.debian.org darcs.debian.org arch.debian.org User eldy-guest IdentityFile ~/.ssh/id_rsa -* Check login on page https://alioth.debian.org/users/login -Ex: https://alioth.debian.org/users/eldy-guest -* Setup your ssh as described into page: http://wiki.debian.org/Alioth/SSH -* Ask to be included into project collab-maint: http://alioth.debian.org/projects/collab-maint/ + * Check login on page https://alioth.debian.org/users/login + Ex: https://alioth.debian.org/users/eldy-guest + * Setup your ssh as described into page: http://wiki.debian.org/Alioth/SSH + * Ask to be included into project collab-maint: http://alioth.debian.org/projects/collab-maint/ @@ -82,7 +83,7 @@ Ex: https://alioth.debian.org/users/eldy-guest # dpkg -c package.deb List content of package # dpkg -I package.deb Give informations on package # dpkg -i package.deb Install a package -# dpkg-reconfigure -plow package Reconfigure package +# dpkg-reconfigure -plow package Reconfigure package # dpkg -L packagename List content of installed package # dpkg -r packagename Remove config files and interactive saved answers # dpkg -s packagename Give status of installed package @@ -90,7 +91,7 @@ Ex: https://alioth.debian.org/users/eldy-guest # # dpkg-buildpackage -us -uc Build a source and binary package # -# gdebi package.deb Install a package + dependencies +# gdebi package.deb Install a package + dependencies @@ -98,21 +99,21 @@ Ex: https://alioth.debian.org/users/eldy-guest - Post an ITP with reportbugs : > reportbug -B debian --email username@domain.tld wnpp -See page http://www.debian.org/devel/wnpp/#l1 for example of ITP requests contents. +See page https://www.debian.org/devel/wnpp/#l1 for example of ITP requests contents. - Wait until you received bug number. For first ITP submission of Dolibarr, bug id was 634783. - Check bug is into database by searching with id on - http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=634783 + https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=634783 - Add a line for upstream into file changelog with bug number - Call for a mentor on ML debian-mentors to upload packages - Once package is uploaded, following URL are available: -http://packages.qa.debian.org/package.html -http://bugs.debian.org/package +https://packages.qa.debian.org/package.html +https://bugs.debian.org/package ##### Modify severity of a bug ticket From 0aef431c2a3f2a407ed642b24d4fc2cf37eab838 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 2 May 2021 18:56:40 +0200 Subject: [PATCH 101/147] Move language keys --- htdocs/langs/en_US/products.lang | 2 ++ htdocs/langs/en_US/stocks.lang | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index 0875be0dc07..9638dfe5a25 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -396,3 +396,5 @@ ActionAvailableOnVariantProductOnly=Action only available on the variant of prod ProductsPricePerCustomer=Product prices per customers ProductSupplierExtraFields=Additional Attributes (Supplier Prices) DeleteLinkedProduct=Delete the child product linked to the combination +PMPValue=Weighted average price +PMPValueShort=WAP diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index 8654e9c5b11..5960f900cca 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -56,8 +56,6 @@ UnitPurchaseValue=Unit purchase price StockTooLow=Stock too low StockLowerThanLimit=Stock lower than alert limit (%s) EnhancedValue=Value -PMPValue=Weighted average price -PMPValueShort=WAP EnhancedValueOfWarehouses=Warehouses value UserWarehouseAutoCreate=Create a user warehouse automatically when creating a user AllowAddLimitStockByWarehouse=Manage also value for minimum and desired stock per pairing (product-warehouse) in addition to the value for minimum and desired stock per product From 8bc23088b1517f241fef8187ba11edc4034da1b2 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Sun, 2 May 2021 19:22:52 +0200 Subject: [PATCH 102/147] Update README http://www.trustonme.net/didactels/273.html is empty fedoraproject.org has been moved --- build/rpm/README | 64 ++++++++++++++++++++++++++---------------------- 1 file changed, 35 insertions(+), 29 deletions(-) diff --git a/build/rpm/README b/build/rpm/README index 99f871e882a..ab7be252ccb 100644 --- a/build/rpm/README +++ b/build/rpm/README @@ -3,48 +3,54 @@ README (English) RPM Package tools ################################################## -This directory contains files used by makepack-dolibarr.pl -script to build a package, ready to be distributed, -with format RPM (for Redhat, OpenSuse, Mandriva, ...). +This directory contains files used by makepack-dolibarr.pl script to build a package, +ready to be distributed with format RPM (https://rpm.org) +for Linux Distributions like Redhat, Fedora, CentOS, OpenSuse, OpenMandriva, Mageia ... # This is standard command to work on RPM packaging: -# + # To install all packagers tools: -# Fedora: yum -y install rpmlint fedora-packager mock koji hunspell-en hunspell-es hunspell-fr hunspell-it -# OpenSuse: yast --install update-desktop-files -# + - Fedora: yum -y install rpmlint fedora-packager mock koji hunspell-en hunspell-es hunspell-fr hunspell-it + - OpenSuse: yast --install update-desktop-files + # rpmlint file.rpm Test a package # mock -r fedora-15-i386 --rebuild ../SRPMS/hello-2.7-1.fc15.src.rpm -# + + # On Fedora -# rpm -i --test dolibarr-...rpm To list dependencies of RPM -# yum -v install dolibarr-...rpm To install package and dependencies -# yum -v erase dolibarr To remove package -# chcon -R -h -t httpd_sys_script_rw_t /file To add temporary context rw for httpd on /file -# semanage fcontext -a -t httpd_sys_script_rw_t "/dir/(.*)?" To add persistent context rw for httpd on /dir (this add file_contexts.local) -# restorecon -R -v /file Restore values into files (cancel chcon, validate semanage) -# +# ========= +# rpm -i --test dolibarr-...rpm to list dependencies of RPM +# yum -v install dolibarr-...rpm to install package and dependencies +# yum -v erase dolibarr to remove package +# chcon -R -h -t httpd_sys_script_rw_t /file to add temporary context rw for httpd on /file +# restorecon -R -v /file to restore values into files (cancel chcon, validate semanage) +# semanage fcontext -a -t httpd_sys_script_rw_t "/dir/(.*)?" to add persistent context rw for httpd on /dir (this add file_contexts.local) + + # On OpenSuse -# zypper install dolibarr-...rpm To install package and dependencies -# zypper remove dolibarr To remove package -# zypper search xxx To search a package -# +# =========== +# zypper install dolibarr-...rpm to install package and dependencies +# zypper remove dolibarr to remove package +# zypper search xxx to search a package + + # On Mageia (after su - root) -# urpmi dolibarr-...rpm To install package and dependencies -# urpme dolibarr To remove package +# =========================== +# urpmi dolibarr-...rpm to install package and dependencies +# urpme dolibarr to remove package # -# More on rpm on page http://www.trustonme.net/didactels/273.html To submit a package to Fedora: -- Create account on bugzilla.redhat.com -- Create account on fedoraproject.org -- Create SRPMS package. -- Upload package onf http://fedorapeople.org -- Create a bug with form https://bugzilla.redhat.com/bugzilla/enter_bug.cgi?product=Fedora&format=fedora-review +- Create account on https://bugzilla.redhat.com +- Create account on https://developer.fedoraproject.org/ +- Create SRPMS package +- Upload package on https://fedorapeople.org +- Create a bug with form https://bugzilla.redhat.com/bugzilla/enter_bug.cgi?product=Fedora&format=fedora-review + This is example of content of review field (used for Bug 723326 - https://bugzilla.redhat.com/show_bug.cgi?id=723326): -SRPMS URL: http://www.dolibarr.org/files/fedora/dolibarr-x.y.z-xxx.src.rpm +SRPMS URL: https://www.dolibarr.org/files/fedora/dolibarr-x.y.z-xxx.src.rpm Description: Dolibarr ERP & CRM is an easy to use open source/free software for small and medium companies, foundations or freelances. It includes different features for Enterprise Resource Planning (ERP) and Customer @@ -56,4 +62,4 @@ is my first package to maintain myself. So i'm seeking a sponsor. - Install fedora packager tools: yum install fedora-packager - Setup fedora packagers tools: fedora-packager-setup - Send your package: koji build --scratch f16 path_to_source_RPM -- Check if package is available: http://koji.fedoraproject.org/koji/ \ No newline at end of file +- Check if package is available: https://koji.fedoraproject.org/koji/ From d74359a4e46a9cb7a5fe3ae61047c6f00fd3b729 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Sun, 2 May 2021 19:28:58 +0200 Subject: [PATCH 103/147] Create REAME --- build/phpstan/REAME | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 build/phpstan/REAME diff --git a/build/phpstan/REAME b/build/phpstan/REAME new file mode 100644 index 00000000000..4ecde9baca5 --- /dev/null +++ b/build/phpstan/REAME @@ -0,0 +1,9 @@ +PHPStan + +https://phpstan.org + +PHPStan requires PHP >= 7.1 + +Install: composer require --dev phpstan/phpstan + +Config File: phpstan.neon From 972776819290ef76ec38eb5ea967fa2835faa484 Mon Sep 17 00:00:00 2001 From: Indelog Date: Mon, 3 May 2021 09:46:51 +0200 Subject: [PATCH 104/147] Fix show table of pdf payments repports in file order Use scandir() rather opendir() and readdir() to get a sorted list of files. --- htdocs/compta/paiement/rapport.php | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/htdocs/compta/paiement/rapport.php b/htdocs/compta/paiement/rapport.php index 0af202016df..7670e03d094 100644 --- a/htdocs/compta/paiement/rapport.php +++ b/htdocs/compta/paiement/rapport.php @@ -136,7 +136,6 @@ if ($year) { if (is_dir($dir.'/'.$year)) { - $handle = opendir($dir.'/'.$year); if ($found) print '
'; print '
'; @@ -147,22 +146,17 @@ if ($year) print '
'.$langs->trans("Date").'
'.img_pdf().' '.$file.''.$formfile->showPreview($file, 'facture_paiement', $relativepath, 0).''.dol_print_size(dol_filesize($tfile)).''.dol_print_date(dol_filemtime($tfile), "dayhour").'
'.img_pdf().' '.$f.''.$formfile->showPreview($f, 'facture_paiement', $relativepath, 0).''.dol_print_size(dol_filesize($tfile)).''.dol_print_date(dol_filemtime($tfile), "dayhour").'
'; } From 2a47128e2d056aa762d19179fb7b535b55147378 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 3 May 2021 11:00:41 +0200 Subject: [PATCH 105/147] Code comment --- htdocs/accountancy/customer/index.php | 2 +- htdocs/core/lib/company.lib.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/customer/index.php b/htdocs/accountancy/customer/index.php index 6874aacb58a..d33f5e12312 100644 --- a/htdocs/accountancy/customer/index.php +++ b/htdocs/accountancy/customer/index.php @@ -170,7 +170,7 @@ if ($action == 'validatehistory') { while ($i < min($num_lines, 10000)) { // No more than 10000 at once $objp = $db->fetch_object($result); - $isBuyerInEEC = isInEEC($objp); + $isBuyerInEEC = isInEEC($objp); // This make a database request but there is a cache into $conf->cache['country_code_in_EEC'] // Level 2: Search suggested account for product/service (similar code exists in page list.php to make manual binding) $suggestedaccountingaccountfor = ''; diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index d197b687876..3a61ea21efb 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -754,7 +754,7 @@ function isInEEC($object) return false; } - $country_code_in_EEC = getCountriesInEEC(); + $country_code_in_EEC = getCountriesInEEC(); // This make a database call but there is a cache done into $conf->cache['country_code_in_EEC'] //print "dd".$object->country_code; return in_array($object->country_code, $country_code_in_EEC); From 3209be7d3d9ce94a5b670498466b07b63cfb965e Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Mon, 3 May 2021 11:19:17 +0200 Subject: [PATCH 106/147] Create EORI.info --- dev/resources/prof-id/EORI.info | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 dev/resources/prof-id/EORI.info diff --git a/dev/resources/prof-id/EORI.info b/dev/resources/prof-id/EORI.info new file mode 100644 index 00000000000..13ff095c693 --- /dev/null +++ b/dev/resources/prof-id/EORI.info @@ -0,0 +1,6 @@ +EORI + +https://en.wikipedia.org/wiki/EORI_number + +in Dolibarr avaiable since v13 +- it is set to field 'profid5' From 9c0d4dd86bbb57f9cef14a69e238a2c8a6f1a299 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 3 May 2021 11:31:16 +0200 Subject: [PATCH 107/147] Small performance enhancement for transfer in accountancy. --- htdocs/accountancy/journal/bankjournal.php | 2 +- htdocs/accountancy/journal/expensereportsjournal.php | 8 +++++--- htdocs/accountancy/journal/purchasesjournal.php | 10 ++++++---- htdocs/accountancy/journal/sellsjournal.php | 12 +++++++----- 4 files changed, 19 insertions(+), 13 deletions(-) diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index e3e2a308cf9..55067905395 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -547,7 +547,7 @@ if (!$error && $action == 'writebookkeeping') { $bookkeeping->fk_docdet = $val["fk_bank"]; $bookkeeping->numero_compte = $k; - $accountingaccount->fetch(null, $k, true); + $accountingaccount->fetch(null, $k, true); // $k is accounting bank account. TODO We should use a cache here to avoid this fetch $bookkeeping->label_compte = $accountingaccount->label; $bookkeeping->label_operation = $reflabel; diff --git a/htdocs/accountancy/journal/expensereportsjournal.php b/htdocs/accountancy/journal/expensereportsjournal.php index 2916d4d1fca..9681ed7eaa0 100644 --- a/htdocs/accountancy/journal/expensereportsjournal.php +++ b/htdocs/accountancy/journal/expensereportsjournal.php @@ -206,6 +206,9 @@ if ($action == 'writebookkeeping') { $now = dol_now(); $error = 0; + $accountingaccountexpense = new AccountingAccount($db); + $accountingaccountexpense->fetch(null, $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT, true); + foreach ($taber as $key => $val) { // Loop on each expense report $errorforline = 0; @@ -227,10 +230,9 @@ if ($action == 'writebookkeeping') { $bookkeeping->fk_docdet = $val["fk_expensereportdet"]; $bookkeeping->subledger_account = $tabuser[$key]['user_accountancy_code']; $bookkeeping->subledger_label = $tabuser[$key]['name']; - $bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT; - $accountingaccount->fetch(null, $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT, true); - $bookkeeping->label_compte = $accountingaccount->label; + $bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT; + $bookkeeping->label_compte = $accountingaccountexpense->label; $bookkeeping->label_operation = $tabuser[$key]['name']; $bookkeeping->montant = $mt; diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index 018cba4ca89..a09b9c305f3 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -248,7 +248,7 @@ foreach ($tabfac as $key => $val) { // Loop on each invoice $sql = "SELECT COUNT(fd.rowid) as nb"; $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn_det as fd"; $sql .= " WHERE fd.product_type <= 2 AND fd.fk_code_ventilation <= 0"; - $sql .= " AND fd.total_ttc <> 0 AND fk_facture_fourn = ".$key; + $sql .= " AND fd.total_ttc <> 0 AND fk_facture_fourn = ".((int) $key); $resql = $db->query($sql); if ($resql) { $obj = $db->fetch_object($resql); @@ -270,6 +270,9 @@ if ($action == 'writebookkeeping') { $companystatic = new Societe($db); $invoicestatic = new FactureFournisseur($db); + $accountingaccountsupplier = new AccountingAccount($db); + + $accountingaccountsupplier->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER, true); foreach ($tabfac as $key => $val) { // Loop on each invoice $errorforline = 0; @@ -333,10 +336,9 @@ if ($action == 'writebookkeeping') { $bookkeeping->thirdparty_code = $companystatic->code_fournisseur; $bookkeeping->subledger_account = $tabcompany[$key]['code_compta_fournisseur']; $bookkeeping->subledger_label = $tabcompany[$key]['name']; - $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER; - $accountingaccount->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER, true); - $bookkeeping->label_compte = $accountingaccount->label; + $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER; + $bookkeeping->label_compte = $accountingaccountsupplier->label; $bookkeeping->label_operation = dol_trunc($companystatic->name, 16).' - '.$invoicestatic->ref_supplier.' - '.$langs->trans("SubledgerAccount"); $bookkeeping->montant = $mt; diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index a9b6f17a9bd..c596df5ec7a 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -148,7 +148,7 @@ if ($in_bookkeeping == 'notyet') { // $sql .= " AND fd.rowid NOT IN (SELECT fk_docdet FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='customer_invoice')"; // Useless, we save one line for all products with same account } $sql .= " ORDER BY f.datef"; -//print $sql; +//print $sql; exit; dol_syslog('accountancy/journal/sellsjournal.php', LOG_DEBUG); $result = $db->query($sql); @@ -264,7 +264,7 @@ foreach ($tabfac as $key => $val) { // Loop on each invoice $sql = "SELECT COUNT(fd.rowid) as nb"; $sql .= " FROM ".MAIN_DB_PREFIX."facturedet as fd"; $sql .= " WHERE fd.product_type <= 2 AND fd.fk_code_ventilation <= 0"; - $sql .= " AND fd.total_ttc <> 0 AND fk_facture = ".$key; + $sql .= " AND fd.total_ttc <> 0 AND fk_facture = ".((int) $key); $resql = $db->query($sql); if ($resql) { $obj = $db->fetch_object($resql); @@ -285,6 +285,9 @@ if ($action == 'writebookkeeping') { $companystatic = new Societe($db); $invoicestatic = new Facture($db); + $accountingaccountcustomer = new AccountingAccount($db); + + $accountingaccountcustomer->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER, true); foreach ($tabfac as $key => $val) { // Loop on each invoice $errorforline = 0; @@ -346,10 +349,9 @@ if ($action == 'writebookkeeping') { $bookkeeping->thirdparty_code = $companystatic->code_client; $bookkeeping->subledger_account = $tabcompany[$key]['code_compta']; $bookkeeping->subledger_label = $tabcompany[$key]['name']; - $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER; - $accountingaccount->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER, true); - $bookkeeping->label_compte = $accountingaccount->label; + $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER; + $bookkeeping->label_compte = $accountingaccountcustomer->label; $bookkeeping->label_operation = dol_trunc($companystatic->name, 16).' - '.$invoicestatic->ref.' - '.$langs->trans("SubledgerAccount"); $bookkeeping->montant = $mt; From d7e445efbd8e459860169b4fed4f1ac5e20df7a8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 3 May 2021 12:01:26 +0200 Subject: [PATCH 108/147] Better doc --- htdocs/accountancy/admin/index.php | 4 +++- htdocs/accountancy/journal/bankjournal.php | 10 +++++++--- htdocs/langs/en_US/accountancy.lang | 2 +- htdocs/langs/en_US/admin.lang | 1 + htdocs/user/class/user.class.php | 5 ++++- 5 files changed, 16 insertions(+), 6 deletions(-) diff --git a/htdocs/accountancy/admin/index.php b/htdocs/accountancy/admin/index.php index a0764a97af2..24d31acddd6 100644 --- a/htdocs/accountancy/admin/index.php +++ b/htdocs/accountancy/admin/index.php @@ -302,7 +302,9 @@ if (!empty($conf->global->BANK_DISABLE_DIRECT_INPUT)) { print '
'.$langs->trans("ACCOUNTANCY_COMBO_FOR_AUX").''.$langs->trans("ACCOUNTANCY_COMBO_FOR_AUX"); +print ' - '.$langs->trans("NotRecommended").''; +print ''; diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index 55067905395..edb5e209df7 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -120,7 +120,8 @@ if (!GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end)) $sql = "SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type, b.fk_account,"; $sql .= " ba.courant, ba.ref as baref, ba.account_number, ba.fk_accountancy_journal,"; $sql .= " soc.code_compta, soc.code_compta_fournisseur, soc.rowid as socid, soc.nom as name, soc.email as email, bu1.type as typeop_company,"; -$sql .= " u.accountancy_code, u.rowid as userid, u.lastname as lastname, u.firstname as firstname, u.email as useremail, bu2.type as typeop_user,"; +$sql .= " u.accountancy_code, u.rowid as userid, u.lastname as lastname, u.firstname as firstname, u.email as useremail, u.statut as userstatus,"; +$sql .= " bu2.type as typeop_user,"; $sql .= " bu3.type as typeop_payment, bu4.type as typeop_payment_supplier"; $sql .= " FROM ".MAIN_DB_PREFIX."bank as b"; $sql .= " JOIN ".MAIN_DB_PREFIX."bank_account as ba on b.fk_account=ba.rowid"; @@ -259,7 +260,8 @@ if ($result) { 'lastname' => $obj->lastname, 'firstname' => $obj->firstname, 'email' => $obj->useremail, - 'accountancy_code' => $compta_user + 'accountancy_code' => $compta_user, + 'status' => $obj->userstatus ); // Variable bookkeeping ($obj->rowid is Bank Id) @@ -328,8 +330,10 @@ if ($result) { $userstatic->email = $tabuser[$obj->rowid]['email']; $userstatic->firstname = $tabuser[$obj->rowid]['firstname']; $userstatic->lastname = $tabuser[$obj->rowid]['lastname']; + $userstatic->statut = $tabuser[$obj->rowid]['status']; + $userstatic->accountancy_code = $tabuser[$obj->rowid]['accountancy_code']; if ($userstatic->id > 0) { - $tabpay[$obj->rowid]["soclib"] = $userstatic->getNomUrl(1, '', 30); + $tabpay[$obj->rowid]["soclib"] = $userstatic->getNomUrl(1, 'accountancy', 0); } else { $tabpay[$obj->rowid]["soclib"] = '???'; // Should not happen, but happens with old data when id of user was not saved on expense report payment. } diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 692c447d610..237c85fe0f9 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -158,7 +158,7 @@ ACCOUNTING_LENGTH_AACCOUNT=Length of the third-party accounting accounts (If you ACCOUNTING_MANAGE_ZERO=Allow to manage different number of zeros at the end of an accounting account. Needed by some countries (like Switzerland). If set to off (default), you can set the following two parameters to ask the application to add virtual zeros. BANK_DISABLE_DIRECT_INPUT=Disable direct recording of transaction in bank account ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL=Enable draft export on journal -ACCOUNTANCY_COMBO_FOR_AUX=Enable combo list for subsidiary account (may be slow if you have a lot of third parties) +ACCOUNTANCY_COMBO_FOR_AUX=Enable combo list for subsidiary account (may be slow if you have a lot of third parties, break ability to search on a part of value) ACCOUNTING_DATE_START_BINDING=Define a date to start binding & transfer in accountancy. Below this date, the transactions will not be transferred to accounting. ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER=On accountancy transfer, select period show by default diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 720532a066e..fcd9e1be0cd 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -2123,6 +2123,7 @@ YouShouldDisablePHPFunctions=You should disable PHP functions IfCLINotRequiredYouShouldDisablePHPFunctions=Except if you need to run system commands (for the module Scheduled job, or to run the external command line Anti-virus for example), you shoud disable PHP functions NoWritableFilesFoundIntoRootDir=No writable files or directories of the common programs were found into your root directory (Good) RecommendedValueIs=Recommended: %s +NotRecommended=Not recommanded ARestrictedPath=A restricted path CheckForModuleUpdate=Check for external modules updates CheckForModuleUpdateHelp=This action will connect to editors of external modules to check if a new version is available. diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 7de7eb5f0bb..de7fad9f133 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -2366,7 +2366,7 @@ class User extends CommonObject * Use this->id,this->lastname, this->firstname * * @param int $withpictoimg Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto, -1=Include photo into link, -2=Only picto photo, -3=Only photo very small) - * @param string $option On what the link point to ('leave', 'nolink', ) + * @param string $option On what the link point to ('leave', 'accountancy', 'nolink', ) * @param integer $infologin 0=Add default info tooltip, 1=Add complete info tooltip, -1=No info tooltip * @param integer $notooltip 1=Disable tooltip on picto and name * @param int $maxlen Max length of visible user name @@ -2417,6 +2417,9 @@ class User extends CommonObject if (!empty($this->admin)) { $label .= '
'.$langs->trans("Administrator").': '.yn($this->admin); } + if (!empty($this->accountancy_code) || $option == 'accountancy') { + $label .= '
'.$langs->trans("AccountancyCode").': '.$this->accountancy_code; + } $company = ''; if (!empty($this->socid)) { // Add thirdparty for external users $thirdpartystatic = new Societe($db); From 18cbe4c93b5ba206fad21c4eb2a465ac14db41e1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 3 May 2021 12:28:29 +0200 Subject: [PATCH 109/147] Doc --- dev/translation/README | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dev/translation/README b/dev/translation/README index 8d6954878b5..3ceedcd4b82 100644 --- a/dev/translation/README +++ b/dev/translation/README @@ -17,3 +17,7 @@ for Linux OS to install or to update transifex client: sudo pip install --upgrade transifex-client + +Comparison of Terms between ERPs +--------------------------------- +https://wiki.dolibarr.org/index.php?title=Comparison_of_Terms_between_ERPs From 39e27b6f384c9a18a6b88480064992ccefc6ccca Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 3 May 2021 12:32:31 +0200 Subject: [PATCH 110/147] Minor perf enhancement --- htdocs/accountancy/bookkeeping/list.php | 12 +- .../core/class/html.formaccounting.class.php | 109 ++++++++++-------- 2 files changed, 65 insertions(+), 56 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 498c513b761..e5edeaa0852 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -750,10 +750,10 @@ if (!empty($arrayfields['t.doc_ref']['checked'])) { if (!empty($arrayfields['t.numero_compte']['checked'])) { print '
'; print '
'; - print $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', $langs->trans('From'), array(), 1, 1, 'maxwidth200', 1); + print $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', $langs->trans('From'), array(), 1, 1, 'maxwidth200', 'account'); print '
'; print '
'; - print $formaccounting->select_account($search_accountancy_code_end, 'search_accountancy_code_end', $langs->trans('to'), array(), 1, 1, 'maxwidth200', 1); + print $formaccounting->select_account($search_accountancy_code_end, 'search_accountancy_code_end', $langs->trans('to'), array(), 1, 1, 'maxwidth200', 'account'); print '
'; print '
'; - print '
'; // TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because it does not // use setup of keypress to select thirdparty and this hang browser on large database. if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) { + print '
'; //print $langs->trans('From').' '; print $formaccounting->select_auxaccount($search_accountancy_aux_code_start, 'search_accountancy_aux_code_start', $langs->trans('From'), 'maxwidth250', 'subledgeraccount'); - } else { - print ''; - } - print '
'; - print '
'; - // TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because it does not - // use setup of keypress to select thirdparty and this hang browser on large database. - if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) { - //print $langs->trans('to').' '; + print '
'; + print '
'; print $formaccounting->select_auxaccount($search_accountancy_aux_code_end, 'search_accountancy_aux_code_end', $langs->trans('to'), 'maxwidth250', 'subledgeraccount'); + print '
'; } else { - print ''; + print ''; } - print '
'; print '
'; // Do not force class=right, or it align also the content of the select box - print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1); + print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1, 'minwidth100 maxwidth300 maxwidthonsmartphone', 'accountsmain'); print '
'.$label.''; // Do not force class=right, or it align also the content of the select box - print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1); + print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1, 'minwidth100 maxwidth300 maxwidthonsmartphone', 'accounts'); print '
'; - print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth125', 'code2', 1, 0, 1); + print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth125', 'code2', 1, 0, 1, null, 1); //print ''; print ''.$objp->tva_intra.''; - $s = '1. '.(($objp->type_l == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': '; + print ''; + $s = '1. '.(($objp->type_l == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': '; $shelp = ''; if ($suggestedaccountingaccountbydefaultfor == 'eec') { $shelp .= $langs->trans("SaleEEC"); @@ -724,7 +724,7 @@ if ($result) { print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1); if ($objp->product_id > 0) { print '
'; - $s = '2. '.(($objp->type_l == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': '; + $s = '2. '.(($objp->type_l == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': '; $shelp = ''; $ttype = 'help'; if ($suggestedaccountingaccountfor == 'eec') { $shelp = $langs->trans("SaleEEC"); @@ -741,7 +741,7 @@ if ($result) { } else { if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) { print '
'; - $s = '2. '.(($objp->type_l == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': '; + $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); @@ -749,7 +749,7 @@ if ($result) { } if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) { print '
'; - $s = '3. '.(($objp->type_l == 1) ? $langs->trans("ServiceForThisThirdparty") : $langs->trans("ProductForThisThirdparty")).': '; + $s = '3. '.(($objp->type_l == 1) ? $langs->trans("ServiceForThisThirdparty") : $langs->trans("ProductForThisThirdparty")).': '; $shelp = ''; $s .= ($objp->code_sell_t > 0 ? length_accountg($objp->code_sell_t) : ''.$langs->trans("NotDefined").''); print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1); diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index cc3430af872..63dd996a546 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -696,8 +696,8 @@ if ($result) { print '
'.$objp->tva_intra.''; - $s = '1. '.(($objp->type_l == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': '; + print ''; + $s = '1. '.(($objp->type_l == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': '; $shelp = ''; if ($suggestedaccountingaccountbydefaultfor == 'eec') { $shelp .= $langs->trans("SaleEEC"); @@ -708,7 +708,7 @@ if ($result) { print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1); if ($objp->product_id > 0) { print '
'; - $s = '2. '.(($objp->type_l == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': '; + $s = '2. '.(($objp->type_l == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': '; $shelp = ''; if ($suggestedaccountingaccountfor == 'eec') { $shelp = $langs->trans("SaleEEC"); @@ -719,13 +719,13 @@ if ($result) { print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1); } else { print '
'; - $s = '2. '.(($objp->type_l == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': '; + $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 = '3. '.(($objp->type_l == 1) ? $langs->trans("ServiceForThisThirdparty") : $langs->trans("ProductForThisThirdparty")).': '; + $s = '3. '.(($objp->type_l == 1) ? $langs->trans("ServiceForThisThirdparty") : $langs->trans("ProductForThisThirdparty")).': '; $shelp = ''; $s .= ($objp->code_buy_t > 0 ? length_accountg($objp->code_buy_t) : ''.$langs->trans("NotDefined").''); print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1); diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 044ba439922..d286d9c7188 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -868,9 +868,10 @@ class Form * @param int $disablefavorites 1=Disable favorites, * @param int $addspecialentries 1=Add dedicated entries for group of countries (like 'European Economic Community', ...) * @param array $exclude_country_code Array of country code (iso2) to exclude + * @param int $hideflags Hide flags * @return string HTML string with select */ - public function select_country($selected = '', $htmlname = 'country_id', $htmloption = '', $maxlength = 0, $morecss = 'minwidth300', $usecodeaskey = '', $showempty = 1, $disablefavorites = 0, $addspecialentries = 0, $exclude_country_code = array()) + public function select_country($selected = '', $htmlname = 'country_id', $htmloption = '', $maxlength = 0, $morecss = 'minwidth300', $usecodeaskey = '', $showempty = 1, $disablefavorites = 0, $addspecialentries = 0, $exclude_country_code = array(), $hideflags = 0) { // phpcs:enable global $conf, $langs, $mysoc; @@ -955,8 +956,10 @@ class Form } if ($row['code_iso']) { $labeltoshow .= ' ('.$row['code_iso'].')'; - $tmpflag = picto_from_langcode($row['code_iso'], 'class="saturatemedium marginrightonly"'); - $labeltoshow = $tmpflag.' '.$labeltoshow; + if (empty($hideflags)) { + $tmpflag = picto_from_langcode($row['code_iso'], 'class="saturatemedium marginrightonly"'); + $labeltoshow = $tmpflag.' '.$labeltoshow; + } } if ($selected && $selected != '-1' && ($selected == $row['rowid'] || $selected == $row['code_iso'] || $selected == $row['code_iso3'] || $selected == $row['label'])) { From 42c2fb5736d3ccfb9fcc942c96deefdbdda73986 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 3 May 2021 13:47:26 +0200 Subject: [PATCH 114/147] Fix sql error on new filter --- htdocs/accountancy/bookkeeping/balance.php | 20 +++++++++---------- .../accountancy/class/bookkeeping.class.php | 3 +-- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index bc0cca4cc1b..bc9de743a07 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -254,6 +254,12 @@ if ($action != 'export_csv') { $moreforfilter .= ': '; $moreforfilter .= ''; + $moreforfilter .= ''; + + $moreforfilter .= '
'; + + $moreforfilter .= $langs->trans("Journal"); + $moreforfilter .= $formaccounting->multi_select_journal($search_ledger_code, 'search_ledger_code', 0, 1, 1, 1); $moreforfilter .= '
'; @@ -266,24 +272,16 @@ if ($action != 'export_csv') { print ''; } + $colspan = (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE) ? 5 : 4); print ''; - print ''; - print ''; - print ''; - print ''; print ''; print ''; } - print ''; print "\n"; From a27b78300209f128e250da6b9932c10ea136d3af Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 3 May 2021 13:55:08 +0200 Subject: [PATCH 116/147] Rename REAME to README --- build/phpstan/{REAME => README} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename build/phpstan/{REAME => README} (100%) diff --git a/build/phpstan/REAME b/build/phpstan/README similarity index 100% rename from build/phpstan/REAME rename to build/phpstan/README From c6a9117a00fa5b7f7669af9aa083dfb4bbc18dbd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 3 May 2021 14:03:50 +0200 Subject: [PATCH 117/147] Graph color --- htdocs/core/lib/invoice.lib.php | 2 +- htdocs/theme/eldy/theme_vars.inc.php | 1 + htdocs/theme/md/theme_vars.inc.php | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/invoice.lib.php b/htdocs/core/lib/invoice.lib.php index 4a1d71de540..6862b6d59e9 100644 --- a/htdocs/core/lib/invoice.lib.php +++ b/htdocs/core/lib/invoice.lib.php @@ -513,7 +513,7 @@ function getNumberInvoicesPieChart($mode) foreach ($dataseries as $key=>$value) { $total+=$value[1]; } - $colorseries = array($badgeStatus8,$badgeStatus1,$badgeStatus3,$badgeStatus2,$badgeStatus4,$badgeStatus0); + $colorseries = array($badgeStatus8, $badgeStatus1, $badgeStatus3, $badgeStatus2, $badgeStatus4, $badgeStatus11); if ($conf->use_javascript_ajax) { $result = '
'; $result .= '
'; - print $langs->trans('Journals'); - print $formaccounting->multi_select_journal($search_ledger_code, 'search_ledger_code', 0, 1, 1, 1); - print '
'; - print $langs->trans('From'); - print $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array(), 1, 1, ''); + print $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', $langs->trans('From'), array(), 1, 1, '', 'accounts'); print ' '; - print $langs->trans('to'); - print $formaccounting->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array(), 1, 1, ''); + print $formaccounting->select_account($search_accountancy_code_end, 'search_accountancy_code_end', $langs->trans('to'), array(), 1, 1, '', 'accounts'); print ''; $searchpicto = $form->showFilterButtons(); diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 06ff8d9cb8c..499ace29b8b 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -1103,8 +1103,7 @@ class BookKeeping extends CommonObject $sql = 'SELECT'; $sql .= " t.numero_compte,"; $sql .= " SUM(t.debit) as debit,"; - $sql .= " SUM(t.credit) as credit,"; - $sql .= " t.code_journal"; + $sql .= " SUM(t.credit) as credit"; $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; // Manage filter $sqlwhere = array(); From 6ef463f6887b4cf8475173e7a2cd9a77de692f2a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 3 May 2021 13:54:26 +0200 Subject: [PATCH 115/147] Code comment --- htdocs/accountancy/bookkeeping/balance.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index bc9de743a07..75283667fcb 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -425,7 +425,8 @@ if ($action != 'export_csv') { } else { print ''.price(price2num($line->debit - $line->credit, 'MT')).''.$link; + print ''; + print $link; print '
'; diff --git a/htdocs/theme/eldy/theme_vars.inc.php b/htdocs/theme/eldy/theme_vars.inc.php index 82cbf9cf2a9..16d4b58663b 100644 --- a/htdocs/theme/eldy/theme_vars.inc.php +++ b/htdocs/theme/eldy/theme_vars.inc.php @@ -115,6 +115,7 @@ $badgeStatus7 = '#25a580'; $badgeStatus8 = '#993013'; $badgeStatus9 = '#e7f0f0'; $badgeStatus10 = '#993013'; +$badgeStatus11 = '#15a540'; // status color ajustement for color blind $colorblind_deuteranopes_badgeStatus4 = $colorblind_deuteranopes_badgeStatus7 = $colorblind_deuteranopes_badgeSuccess; //! text color black diff --git a/htdocs/theme/md/theme_vars.inc.php b/htdocs/theme/md/theme_vars.inc.php index 617f9d1301e..9e98a863737 100644 --- a/htdocs/theme/md/theme_vars.inc.php +++ b/htdocs/theme/md/theme_vars.inc.php @@ -98,3 +98,4 @@ $badgeStatus7 = '#277d1e'; $badgeStatus8 = '#993013'; $badgeStatus9 = '#e7f0f0'; $badgeStatus10 = '#993013'; +$badgeStatus11 = '#15a540'; From 1c95e2b7c70b72a9e74260b163d9952dd275fcfe Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 3 May 2021 14:58:29 +0200 Subject: [PATCH 118/147] FIX #17453 --- htdocs/adherents/class/api_members.class.php | 2 +- .../class/api_memberstypes.class.php | 2 +- .../class/api_subscriptions.class.php | 2 +- htdocs/api/class/api.class.php | 23 +++++++---- htdocs/api/class/api_setup.class.php | 40 +++++++++---------- htdocs/bom/class/api_boms.class.php | 2 +- .../categories/class/api_categories.class.php | 2 +- .../action/class/api_agendaevents.class.php | 2 +- .../comm/propal/class/api_proposals.class.php | 2 +- htdocs/commande/class/api_orders.class.php | 2 +- .../bank/class/api_bankaccounts.class.php | 4 +- .../facture/class/api_invoices.class.php | 2 +- htdocs/contrat/class/api_contracts.class.php | 2 +- htdocs/core/class/html.form.class.php | 2 +- htdocs/don/class/api_donations.class.php | 2 +- .../expedition/class/api_shipments.class.php | 2 +- .../class/api_expensereports.class.php | 2 +- .../class/api_interventions.class.php | 2 +- .../class/api_supplier_invoices.class.php | 2 +- .../fourn/class/api_supplier_orders.class.php | 2 +- .../template/class/api_mymodule.class.php | 2 +- htdocs/mrp/class/api_mos.class.php | 2 +- htdocs/product/class/api_products.class.php | 8 ++-- .../stock/class/api_stockmovements.class.php | 2 +- .../stock/class/api_warehouses.class.php | 2 +- htdocs/projet/class/api_projects.class.php | 2 +- htdocs/projet/class/api_tasks.class.php | 2 +- htdocs/societe/class/api_contacts.class.php | 2 +- .../societe/class/api_thirdparties.class.php | 2 +- .../class/api_supplier_proposals.class.php | 2 +- htdocs/ticket/class/api_tickets.class.php | 2 +- htdocs/user/class/api_users.class.php | 4 +- htdocs/zapier/class/api_zapier.class.php | 2 +- 33 files changed, 73 insertions(+), 62 deletions(-) diff --git a/htdocs/adherents/class/api_members.class.php b/htdocs/adherents/class/api_members.class.php index 68d161d0cf1..5573961456f 100644 --- a/htdocs/adherents/class/api_members.class.php +++ b/htdocs/adherents/class/api_members.class.php @@ -240,7 +240,7 @@ class Members extends DolibarrApi if (!DolibarrApi::_checkFilters($sqlfilters)) { throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); } - $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; } diff --git a/htdocs/adherents/class/api_memberstypes.class.php b/htdocs/adherents/class/api_memberstypes.class.php index 5ab9ad8eead..b02a81dc5c9 100644 --- a/htdocs/adherents/class/api_memberstypes.class.php +++ b/htdocs/adherents/class/api_memberstypes.class.php @@ -105,7 +105,7 @@ class MembersTypes extends DolibarrApi if (!DolibarrApi::_checkFilters($sqlfilters)) { throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); } - $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; } diff --git a/htdocs/adherents/class/api_subscriptions.class.php b/htdocs/adherents/class/api_subscriptions.class.php index 3758885c4a3..831be2882f1 100644 --- a/htdocs/adherents/class/api_subscriptions.class.php +++ b/htdocs/adherents/class/api_subscriptions.class.php @@ -103,7 +103,7 @@ class Subscriptions extends DolibarrApi if (!DolibarrApi::_checkFilters($sqlfilters)) { throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); } - $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; } diff --git a/htdocs/api/class/api.class.php b/htdocs/api/class/api.class.php index c760903aca4..7a9dd908a59 100644 --- a/htdocs/api/class/api.class.php +++ b/htdocs/api/class/api.class.php @@ -309,8 +309,9 @@ class DolibarrApi /** * Function to forge a SQL criteria * - * @param array $matches Array of found string by regex search. Example: "t.ref:like:'SO-%'" or "t.date_creation:<:'20160101'" or "t.nature:is:NULL" - * @return string Forged criteria. Example: "t.field like 'abc%'" + * @param array $matches Array of found string by regex search. + * Example: "t.ref:like:'SO-%'" or "t.date_creation:<:'20160101'" or "t.date_creation:<:'2016-01-01 12:30:00'" or "t.nature:is:NULL" + * @return string Forged criteria. Example: "t.field like 'abc%'" */ protected static function _forge_criteria_callback($matches) { @@ -321,18 +322,26 @@ class DolibarrApi if (empty($matches[1])) { return ''; } - $tmp = explode(':', $matches[1]); + $tmp = explode(':', $matches[1], 3); + if (count($tmp) < 3) { return ''; } - $tmpescaped = $tmp[2]; + $operand = preg_replace('/[^a-z0-9\._]/i', '', trim($tmp[0])); + + $operator = strtoupper(preg_replace('/[^a-z<>=]/i', '', trim($tmp[1]))); + + $tmpescaped = trim($tmp[2]); $regbis = array(); - if (preg_match('/^\'(.*)\'$/', $tmpescaped, $regbis)) { + if ($operator == 'IN') { + $tmpescaped = "(".$db->sanitize($tmpescaped, 1).")"; + } elseif (preg_match('/^\'(.*)\'$/', $tmpescaped, $regbis)) { $tmpescaped = "'".$db->escape($regbis[1])."'"; } else { - $tmpescaped = $db->escape($tmpescaped); + $tmpescaped = $db->sanitize($db->escape($tmpescaped)); } - return $db->escape($tmp[0]).' '.strtoupper($db->escape($tmp[1]))." ".$tmpescaped; + + return $db->escape($operand).' '.$db->escape($operator)." ".$tmpescaped; } } diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index ceaf5f8f7d8..acd39361842 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -79,7 +79,7 @@ class Setup extends DolibarrApi if (!DolibarrApi::_checkFilters($sqlfilters)) { throw new RestException(400, 'error when validating parameter sqlfilters '.$sqlfilters); } - $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; } @@ -142,7 +142,7 @@ class Setup extends DolibarrApi if (!DolibarrApi::_checkFilters($sqlfilters)) { throw new RestException(400, 'error when validating parameter sqlfilters '.$sqlfilters); } - $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; } @@ -206,7 +206,7 @@ class Setup extends DolibarrApi if (!DolibarrApi::_checkFilters($sqlfilters)) { throw new RestException(400, 'error when validating parameter sqlfilters '.$sqlfilters); } - $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; } @@ -270,7 +270,7 @@ class Setup extends DolibarrApi if (!DolibarrApi::_checkFilters($sqlfilters)) { throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); } - $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; } @@ -370,7 +370,7 @@ class Setup extends DolibarrApi if (!DolibarrApi::_checkFilters($sqlfilters)) { throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); } - $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; } @@ -545,7 +545,7 @@ class Setup extends DolibarrApi if (!DolibarrApi::_checkFilters($sqlfilters)) { throw new RestException(400, 'error when validating parameter sqlfilters '.$sqlfilters); } - $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; } @@ -660,7 +660,7 @@ class Setup extends DolibarrApi if (!DolibarrApi::_checkFilters($sqlfilters)) { throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); } - $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; } @@ -723,7 +723,7 @@ class Setup extends DolibarrApi if (!DolibarrApi::_checkFilters($sqlfilters)) { throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); } - $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; } @@ -790,7 +790,7 @@ class Setup extends DolibarrApi if (!DolibarrApi::_checkFilters($sqlfilters)) { throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); } - $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; } @@ -852,7 +852,7 @@ class Setup extends DolibarrApi if (!DolibarrApi::_checkFilters($sqlfilters)) { throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); } - $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; } @@ -924,7 +924,7 @@ class Setup extends DolibarrApi if (!DolibarrApi::_checkFilters($sqlfilters)) { throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); } - $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; } @@ -994,7 +994,7 @@ class Setup extends DolibarrApi if (!DolibarrApi::_checkFilters($sqlfilters)) { throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); } - $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; } @@ -1067,7 +1067,7 @@ class Setup extends DolibarrApi if (!DolibarrApi::_checkFilters($sqlfilters)) { throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); } - $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; } @@ -1131,7 +1131,7 @@ class Setup extends DolibarrApi if (!DolibarrApi::_checkFilters($sqlfilters)) { throw new RestException(400, 'Error when validating parameter sqlfilters '.$sqlfilters); } - $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; } @@ -1189,7 +1189,7 @@ class Setup extends DolibarrApi if (!DolibarrApi::_checkFilters($sqlfilters)) { throw new RestException(400, 'Error when validating parameter sqlfilters '.$sqlfilters); } - $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; } @@ -1248,7 +1248,7 @@ class Setup extends DolibarrApi if (!DolibarrApi::_checkFilters($sqlfilters)) { throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); } - $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; } @@ -1313,7 +1313,7 @@ class Setup extends DolibarrApi if (!DolibarrApi::_checkFilters($sqlfilters)) { throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); } - $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; } @@ -1371,7 +1371,7 @@ class Setup extends DolibarrApi if (!DolibarrApi::_checkFilters($sqlfilters)) { throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); } - $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; } @@ -1429,7 +1429,7 @@ class Setup extends DolibarrApi if (!DolibarrApi::_checkFilters($sqlfilters)) { throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); } - $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; } @@ -1489,7 +1489,7 @@ class Setup extends DolibarrApi if (!DolibarrApi::_checkFilters($sqlfilters)) { throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); } - $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; } diff --git a/htdocs/bom/class/api_boms.class.php b/htdocs/bom/class/api_boms.class.php index 1fe104987a3..0eeefda9b3d 100644 --- a/htdocs/bom/class/api_boms.class.php +++ b/htdocs/bom/class/api_boms.class.php @@ -151,7 +151,7 @@ class Boms extends DolibarrApi if (!DolibarrApi::_checkFilters($sqlfilters)) { throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); } - $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; } diff --git a/htdocs/categories/class/api_categories.class.php b/htdocs/categories/class/api_categories.class.php index 65483a561af..158627e274c 100644 --- a/htdocs/categories/class/api_categories.class.php +++ b/htdocs/categories/class/api_categories.class.php @@ -148,7 +148,7 @@ class Categories extends DolibarrApi if (!DolibarrApi::_checkFilters($sqlfilters)) { throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); } - $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; } diff --git a/htdocs/comm/action/class/api_agendaevents.class.php b/htdocs/comm/action/class/api_agendaevents.class.php index c2961db7bbb..fd57dd3c81b 100644 --- a/htdocs/comm/action/class/api_agendaevents.class.php +++ b/htdocs/comm/action/class/api_agendaevents.class.php @@ -161,7 +161,7 @@ class AgendaEvents extends DolibarrApi if (!DolibarrApi::_checkFilters($sqlfilters)) { throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); } - $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; } diff --git a/htdocs/comm/propal/class/api_proposals.class.php b/htdocs/comm/propal/class/api_proposals.class.php index 3c3447f3697..e4b9a266198 100644 --- a/htdocs/comm/propal/class/api_proposals.class.php +++ b/htdocs/comm/propal/class/api_proposals.class.php @@ -199,7 +199,7 @@ class Proposals extends DolibarrApi if (!DolibarrApi::_checkFilters($sqlfilters)) { throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); } - $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; } diff --git a/htdocs/commande/class/api_orders.class.php b/htdocs/commande/class/api_orders.class.php index 763fb061446..745fea5ab76 100644 --- a/htdocs/commande/class/api_orders.class.php +++ b/htdocs/commande/class/api_orders.class.php @@ -202,7 +202,7 @@ class Orders extends DolibarrApi if (!DolibarrApi::_checkFilters($sqlfilters)) { throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); } - $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; } diff --git a/htdocs/compta/bank/class/api_bankaccounts.class.php b/htdocs/compta/bank/class/api_bankaccounts.class.php index 762bcc506da..10357155295 100644 --- a/htdocs/compta/bank/class/api_bankaccounts.class.php +++ b/htdocs/compta/bank/class/api_bankaccounts.class.php @@ -84,7 +84,7 @@ class BankAccounts extends DolibarrApi if (!DolibarrApi::_checkFilters($sqlfilters)) { throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); } - $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; } @@ -441,7 +441,7 @@ class BankAccounts extends DolibarrApi if (!DolibarrApi::_checkFilters($sqlfilters)) { throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); } - $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; } diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index a8f640a61ec..84b4df207a5 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -224,7 +224,7 @@ class Invoices extends DolibarrApi if (!DolibarrApi::_checkFilters($sqlfilters)) { throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); } - $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; } diff --git a/htdocs/contrat/class/api_contracts.class.php b/htdocs/contrat/class/api_contracts.class.php index c52aeeb30e8..ea7886f022c 100644 --- a/htdocs/contrat/class/api_contracts.class.php +++ b/htdocs/contrat/class/api_contracts.class.php @@ -150,7 +150,7 @@ class Contracts extends DolibarrApi if (!DolibarrApi::_checkFilters($sqlfilters)) { throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); } - $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index d286d9c7188..625e8e23d57 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -6794,7 +6794,7 @@ class Form { throw new RestException(503, 'Error when validating parameter sqlfilters '.$objecttmp->filter); }*/ - $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'Form::forgeCriteriaCallback', $objecttmp->filter).")"; } } diff --git a/htdocs/don/class/api_donations.class.php b/htdocs/don/class/api_donations.class.php index 2773ab62c14..b960a2fdb8f 100644 --- a/htdocs/don/class/api_donations.class.php +++ b/htdocs/don/class/api_donations.class.php @@ -131,7 +131,7 @@ class Donations extends DolibarrApi if (!DolibarrApi::_checkFilters($sqlfilters)) { throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); } - $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; } diff --git a/htdocs/expedition/class/api_shipments.class.php b/htdocs/expedition/class/api_shipments.class.php index 1d47921e423..dcd619da76e 100644 --- a/htdocs/expedition/class/api_shipments.class.php +++ b/htdocs/expedition/class/api_shipments.class.php @@ -147,7 +147,7 @@ class Shipments extends DolibarrApi if (!DolibarrApi::_checkFilters($sqlfilters)) { throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); } - $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; } diff --git a/htdocs/expensereport/class/api_expensereports.class.php b/htdocs/expensereport/class/api_expensereports.class.php index 027bb148b3c..907e1001439 100644 --- a/htdocs/expensereport/class/api_expensereports.class.php +++ b/htdocs/expensereport/class/api_expensereports.class.php @@ -120,7 +120,7 @@ class ExpenseReports extends DolibarrApi if (!DolibarrApi::_checkFilters($sqlfilters)) { throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); } - $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; } diff --git a/htdocs/fichinter/class/api_interventions.class.php b/htdocs/fichinter/class/api_interventions.class.php index 423bb31f348..0c03da526a8 100644 --- a/htdocs/fichinter/class/api_interventions.class.php +++ b/htdocs/fichinter/class/api_interventions.class.php @@ -154,7 +154,7 @@ class Interventions extends DolibarrApi if (!DolibarrApi::_checkFilters($sqlfilters)) { throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); } - $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; } diff --git a/htdocs/fourn/class/api_supplier_invoices.class.php b/htdocs/fourn/class/api_supplier_invoices.class.php index 55518997d5e..34939bb599a 100644 --- a/htdocs/fourn/class/api_supplier_invoices.class.php +++ b/htdocs/fourn/class/api_supplier_invoices.class.php @@ -162,7 +162,7 @@ class SupplierInvoices extends DolibarrApi if (!DolibarrApi::_checkFilters($sqlfilters)) { throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); } - $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; } diff --git a/htdocs/fourn/class/api_supplier_orders.class.php b/htdocs/fourn/class/api_supplier_orders.class.php index c20efa2e651..09c9209629f 100644 --- a/htdocs/fourn/class/api_supplier_orders.class.php +++ b/htdocs/fourn/class/api_supplier_orders.class.php @@ -178,7 +178,7 @@ class SupplierOrders extends DolibarrApi if (!DolibarrApi::_checkFilters($sqlfilters)) { throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); } - $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; } diff --git a/htdocs/modulebuilder/template/class/api_mymodule.class.php b/htdocs/modulebuilder/template/class/api_mymodule.class.php index 769c1529aff..bc52cf7378f 100644 --- a/htdocs/modulebuilder/template/class/api_mymodule.class.php +++ b/htdocs/modulebuilder/template/class/api_mymodule.class.php @@ -158,7 +158,7 @@ class MyModuleApi extends DolibarrApi if (!DolibarrApi::_checkFilters($sqlfilters)) { throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); } - $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; } diff --git a/htdocs/mrp/class/api_mos.class.php b/htdocs/mrp/class/api_mos.class.php index 48f93976d29..a2558fe6252 100644 --- a/htdocs/mrp/class/api_mos.class.php +++ b/htdocs/mrp/class/api_mos.class.php @@ -150,7 +150,7 @@ class Mos extends DolibarrApi if (!DolibarrApi::_checkFilters($sqlfilters)) { throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); } - $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; } diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index 0c70af86c9c..3749dae28c5 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -216,7 +216,8 @@ class Products extends DolibarrApi if (!DolibarrApi::_checkFilters($sqlfilters)) { throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); } - $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + //var_dump($sqlfilters);exit; + $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; // We must accept datc:<:2020-01-01 10:10:10 $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; } @@ -849,9 +850,10 @@ class Products extends DolibarrApi if (!DolibarrApi::_checkFilters($sqlfilters)) { throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); } - $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; } + $sql .= $this->db->order($sortfield, $sortorder); if ($limit) { if ($page < 0) { @@ -975,7 +977,7 @@ class Products extends DolibarrApi if (!DolibarrApi::_checkFilters($sqlfilters)) { throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); } - $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; } diff --git a/htdocs/product/stock/class/api_stockmovements.class.php b/htdocs/product/stock/class/api_stockmovements.class.php index 90b3895c0f2..9b022a840fc 100644 --- a/htdocs/product/stock/class/api_stockmovements.class.php +++ b/htdocs/product/stock/class/api_stockmovements.class.php @@ -112,7 +112,7 @@ class StockMovements extends DolibarrApi if (!DolibarrApi::_checkFilters($sqlfilters)) { throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); } - $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; } diff --git a/htdocs/product/stock/class/api_warehouses.class.php b/htdocs/product/stock/class/api_warehouses.class.php index 34338232169..806114b73ec 100644 --- a/htdocs/product/stock/class/api_warehouses.class.php +++ b/htdocs/product/stock/class/api_warehouses.class.php @@ -119,7 +119,7 @@ class Warehouses extends DolibarrApi if (!DolibarrApi::_checkFilters($sqlfilters)) { throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); } - $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; } diff --git a/htdocs/projet/class/api_projects.class.php b/htdocs/projet/class/api_projects.class.php index c5430b655b1..b0b94264fb0 100644 --- a/htdocs/projet/class/api_projects.class.php +++ b/htdocs/projet/class/api_projects.class.php @@ -153,7 +153,7 @@ class Projects extends DolibarrApi if (!DolibarrApi::_checkFilters($sqlfilters)) { throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); } - $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; } diff --git a/htdocs/projet/class/api_tasks.class.php b/htdocs/projet/class/api_tasks.class.php index 2c3fd107d53..e3d6af2de53 100644 --- a/htdocs/projet/class/api_tasks.class.php +++ b/htdocs/projet/class/api_tasks.class.php @@ -153,7 +153,7 @@ class Tasks extends DolibarrApi if (!DolibarrApi::_checkFilters($sqlfilters)) { throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); } - $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; } diff --git a/htdocs/societe/class/api_contacts.class.php b/htdocs/societe/class/api_contacts.class.php index 5a6513ef6e5..f62fb894bd0 100644 --- a/htdocs/societe/class/api_contacts.class.php +++ b/htdocs/societe/class/api_contacts.class.php @@ -219,7 +219,7 @@ class Contacts extends DolibarrApi if (!DolibarrApi::_checkFilters($sqlfilters)) { throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); } - $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; } diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index 1de2f436ca7..af9122cba9d 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -205,7 +205,7 @@ class Thirdparties extends DolibarrApi if (!DolibarrApi::_checkFilters($sqlfilters)) { throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); } - $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; } diff --git a/htdocs/supplier_proposal/class/api_supplier_proposals.class.php b/htdocs/supplier_proposal/class/api_supplier_proposals.class.php index 3e38ac10b41..61ba9c48de3 100644 --- a/htdocs/supplier_proposal/class/api_supplier_proposals.class.php +++ b/htdocs/supplier_proposal/class/api_supplier_proposals.class.php @@ -142,7 +142,7 @@ class Supplierproposals extends DolibarrApi if (!DolibarrApi::_checkFilters($sqlfilters)) { throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); } - $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; } diff --git a/htdocs/ticket/class/api_tickets.class.php b/htdocs/ticket/class/api_tickets.class.php index f814beb3398..7f2d2cf1be0 100644 --- a/htdocs/ticket/class/api_tickets.class.php +++ b/htdocs/ticket/class/api_tickets.class.php @@ -277,7 +277,7 @@ class Tickets extends DolibarrApi if (!DolibarrApi::_checkFilters($sqlfilters)) { throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); } - $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; } diff --git a/htdocs/user/class/api_users.class.php b/htdocs/user/class/api_users.class.php index f06cf2c09ba..784a61d5fa8 100644 --- a/htdocs/user/class/api_users.class.php +++ b/htdocs/user/class/api_users.class.php @@ -100,7 +100,7 @@ class Users extends DolibarrApi if (!DolibarrApi::_checkFilters($sqlfilters)) { throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); } - $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; } @@ -537,7 +537,7 @@ class Users extends DolibarrApi if (!DolibarrApi::_checkFilters($sqlfilters)) { throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); } - $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; } diff --git a/htdocs/zapier/class/api_zapier.class.php b/htdocs/zapier/class/api_zapier.class.php index c141588a7f9..db1073c6299 100644 --- a/htdocs/zapier/class/api_zapier.class.php +++ b/htdocs/zapier/class/api_zapier.class.php @@ -199,7 +199,7 @@ class ZapierApi extends DolibarrApi if (!DolibarrApi::_checkFilters($sqlfilters)) { throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); } - $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; } From be8b866b39df0f2d9e65bab975dd5883dfc8a132 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 3 May 2021 15:24:19 +0200 Subject: [PATCH 119/147] Add test to detect bad value for DIRECTION in lang file --- test/phpunit/LangTest.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/phpunit/LangTest.php b/test/phpunit/LangTest.php index ad76667d560..99f74dbd4fa 100644 --- a/test/phpunit/LangTest.php +++ b/test/phpunit/LangTest.php @@ -184,6 +184,10 @@ class LangTest extends PHPUnit\Framework\TestCase $tmplangs->setDefaultLang($langcode); $tmplangs->load("main"); + $result=$tmplangs->transnoentitiesnoconv("DIRECTION"); + print __METHOD__." DIRECTION=".$result."\n"; + $this->assertTrue(in_array($result, array('rtl', 'ltr')), 'Error for vale of DIRECTION in main.lang file '.$code); + $result=$tmplangs->transnoentitiesnoconv("SeparatorDecimal"); print __METHOD__." SeparatorDecimal=".$result."\n"; $this->assertContains($result, array('.',',','/',' ','','None'), 'Error for decimal separator for lang code '.$code); // Note that ، that is coma for RTL languages is not supported From 52035287f31bcf27113ed1ad9efd2c84504f177c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 3 May 2021 15:29:06 +0200 Subject: [PATCH 120/147] Rename file --- dev/resources/{prof-id/EORI.info => iso-normes/EORI.txt} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename dev/resources/{prof-id/EORI.info => iso-normes/EORI.txt} (100%) diff --git a/dev/resources/prof-id/EORI.info b/dev/resources/iso-normes/EORI.txt similarity index 100% rename from dev/resources/prof-id/EORI.info rename to dev/resources/iso-normes/EORI.txt From 5d870d5802129119557b7a769dc29e6e0f51b027 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 3 May 2021 15:36:34 +0200 Subject: [PATCH 121/147] FIx #17447 --- htdocs/core/modules/modPropale.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/modPropale.class.php b/htdocs/core/modules/modPropale.class.php index ea9f9548cb7..048f8fcb508 100644 --- a/htdocs/core/modules/modPropale.class.php +++ b/htdocs/core/modules/modPropale.class.php @@ -157,7 +157,8 @@ class modPropale extends DolibarrModules $this->rights[$r][1] = 'Close commercial proposals'; // Set proposal to signed or refused $this->rights[$r][2] = 'd'; // type de la permission (deprecie a ce jour) $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut - $this->rights[$r][4] = 'cloturer'; + $this->rights[$r][4] = 'propal_advance'; + $this->rights[$r][5] = 'close'; $r++; $this->rights[$r][0] = 27; // id de la permission From 7b706d6fe5efc649c995bf00e309b0ef2ba8b3de Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 3 May 2021 15:56:56 +0200 Subject: [PATCH 122/147] Fix phpunit for crop of image --- htdocs/core/lib/images.lib.php | 18 ++++++++---------- test/phpunit/ImagesLibTest.php | 11 ++++++++++- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/htdocs/core/lib/images.lib.php b/htdocs/core/lib/images.lib.php index 3a0aef1239f..a1a6e97c8d2 100644 --- a/htdocs/core/lib/images.lib.php +++ b/htdocs/core/lib/images.lib.php @@ -187,7 +187,7 @@ function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x = 0, $imgHeight = $infoImg[1]; // Hauteur de l'image $imgTargetName = ($filetowrite ? $filetowrite : $file); - $infoImgTarget = getimagesize($imgTargetName); // Get data about target image + $newExt = strtolower(pathinfo($imgTargetName, PATHINFO_EXTENSION)); if ($mode == 0) { // If resize, we check parameters if (!empty($filetowrite) && $filetowrite != $file && $newWidth <= 0 && $newHeight <= 0) { @@ -253,7 +253,7 @@ function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x = 0, } // Create empty image for target - if ($infoImgTarget[2] == 1) { + if ($newExt == 'gif') { // Compatibility image GIF $imgTarget = imagecreate($newWidth, $newHeight); } else { @@ -271,22 +271,22 @@ function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x = 0, } // Set transparent color according to image extension - switch ($infoImgTarget[2]) { - case 1: // Gif + switch ($newExt) { + case 'gif': // Gif $trans_colour = imagecolorallocate($imgTarget, 255, 255, 255); // On procede autrement pour le format GIF imagecolortransparent($imgTarget, $trans_colour); break; - case 2: // Jpg + case 'jpg': // Jpg $trans_colour = imagecolorallocatealpha($imgTarget, 255, 255, 255, 0); break; - case 3: // Png + case 'png': // Png imagealphablending($imgTarget, false); // Pour compatibilite sur certain systeme $trans_colour = imagecolorallocatealpha($imgTarget, 255, 255, 255, 127); // Keep transparent channel break; - case 4: // Bmp + case 'bmp': // Bmp $trans_colour = imagecolorallocatealpha($imgTarget, 255, 255, 255, 0); break; - case 18: // Webp + case 'webp': // Webp $trans_colour = imagecolorallocatealpha($imgTarget, 255, 255, 255, 127); break; } @@ -302,8 +302,6 @@ function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x = 0, //$fp = fopen($imgTargetName, "w"); //fclose($fp); - $newExt = strtolower(pathinfo($imgTargetName, PATHINFO_EXTENSION)); - // Create image on disk (overwrite file if exists) switch ($newExt) { case 'gif': // Gif diff --git a/test/phpunit/ImagesLibTest.php b/test/phpunit/ImagesLibTest.php index 4835a8afd76..95704b2a51b 100644 --- a/test/phpunit/ImagesLibTest.php +++ b/test/phpunit/ImagesLibTest.php @@ -29,6 +29,7 @@ global $conf,$user,$langs,$db; //require_once 'PHPUnit/Autoload.php'; require_once dirname(__FILE__).'/../../htdocs/master.inc.php'; require_once dirname(__FILE__).'/../../htdocs/core/lib/images.lib.php'; +require_once dirname(__FILE__).'/../../htdocs/core/lib/files.lib.php'; if (empty($user->id)) { print "Load permissions for admin user nb 1\n"; @@ -164,8 +165,16 @@ class ImagesLibTest extends PHPUnit\Framework\TestCase $file=dirname(__FILE__).'/img250x20.png'; $filetarget=$conf->admin->dir_temp.'/img250x20.jpg'; + dol_delete_file($filetarget); $result = dol_imageResizeOrCrop($file, 0, 0, 0, 0, 0, $filetarget); print __METHOD__." result=".$result."\n"; - $this->assertEquals($filetarget, $result, 'Failed to convert into '.$filetarget); + $this->assertEquals($filetarget, $result, 'Failed to convert PNG '.$file.' into '.$filetarget); + + $file=dirname(__FILE__).'/img250x20.png'; + $filetarget=$conf->admin->dir_temp.'/img250x20.webp'; + dol_delete_file($filetarget); + $result = dol_imageResizeOrCrop($file, 0, 0, 0, 0, 0, $filetarget); + print __METHOD__." result=".$result."\n"; + $this->assertEquals($filetarget, $result, 'Failed to convert PNG '.$file.' into WEBP '.$filetarget); } } From dba9b17275a2e53da6e4102b5381c7800b1be390 Mon Sep 17 00:00:00 2001 From: Indelog Date: Mon, 3 May 2021 16:00:14 +0200 Subject: [PATCH 123/147] Fix forgot payment filter on file name --- htdocs/compta/paiement/rapport.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/paiement/rapport.php b/htdocs/compta/paiement/rapport.php index 7670e03d094..a640ef1f8fe 100644 --- a/htdocs/compta/paiement/rapport.php +++ b/htdocs/compta/paiement/rapport.php @@ -150,7 +150,7 @@ if ($year) foreach ($files as $f) { $tfile = $dir.'/'.$year.'/'.$f; $relativepath = $year.'/'.$f; - if (is_file($tfile)) { + if (is_file($tfile) && preg_match('/^payment/i', $f)) { print ''; print ''; print ''; From 33a20ae9a1f43dc7adcecdd32bf140ccf3973c8d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 3 May 2021 16:16:44 +0200 Subject: [PATCH 124/147] Update extrafields.class.php --- htdocs/core/class/extrafields.class.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 07d80acd9aa..3d55b12c35c 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1340,8 +1340,7 @@ class ExtraFields elseif ($type == 'checkbox') { $value_arr = $value; - if (!is_array($value)) - { + if (!is_array($value)) { $value_arr = explode(',', $value); } $out = $form->multiselectarray($keyprefix.$key.$keysuffix, (empty($param['options']) ?null:$param['options']), $value_arr, '', 0, '', 0, '100%'); From 49a0304071d99becffa35a9aab891a6d3c4c39fe Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 3 May 2021 16:48:40 +0200 Subject: [PATCH 125/147] Add TODO --- htdocs/accountancy/journal/sellsjournal.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index c596df5ec7a..88398901fa4 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -460,7 +460,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->numero_compte = $k; $accountingaccount->fetch($k, null, true); - $bookkeeping->label_compte = $accountingaccount->label; + $bookkeeping->label_compte = $accountingaccount->label; // TODO Use a cache for each label from $k. $bookkeeping->label_operation = dol_trunc($companystatic->name, 16).' - '.$invoicestatic->ref.' - '.$langs->trans("VAT").' '.join(', ', $def_tva[$key][$k]).' %'.($numtax ? ' - Localtax '.$numtax : ''); $bookkeeping->montant = $mt; From c18848c9444c0a607838ec347cb22057d26b6e55 Mon Sep 17 00:00:00 2001 From: Indelog Date: Mon, 3 May 2021 17:17:44 +0200 Subject: [PATCH 126/147] Fix: simplify code with dol_dir_list() --- htdocs/compta/paiement/rapport.php | 44 ++++++++---------------------- 1 file changed, 12 insertions(+), 32 deletions(-) diff --git a/htdocs/compta/paiement/rapport.php b/htdocs/compta/paiement/rapport.php index a640ef1f8fe..c76697c8401 100644 --- a/htdocs/compta/paiement/rapport.php +++ b/htdocs/compta/paiement/rapport.php @@ -109,35 +109,18 @@ print '
'; clearstatcache(); // Show link on other years -$linkforyear = array(); -$found = 0; -if (is_dir($dir)) +$year_dirs = dol_dir_list($dir, 'directories', 0, '^[0-9]{4}$', '', 'DESC'); +foreach ($year_dirs as $d) { - $handle = opendir($dir); - if (is_resource($handle)) - { - while (($file = readdir($handle)) !== false) - { - if (is_dir($dir.'/'.$file) && !preg_match('/^\./', $file) && is_numeric($file)) - { - $found = 1; - $linkforyear[] = $file; - } - } - } -} -asort($linkforyear); -foreach ($linkforyear as $cursoryear) -{ - print ''.$cursoryear.'  '; + print ''.$d['name'].'  '; } +$found = true; if ($year) { if (is_dir($dir.'/'.$year)) { - - if ($found) print '
'; + if (!empty($year_dirs)) print '
'; print '
'; print '
'.img_pdf().' '.$f.''.$formfile->showPreview($f, 'facture_paiement', $relativepath, 0).''.dol_print_size(dol_filesize($tfile)).'
'; print ''; @@ -146,17 +129,14 @@ if ($year) print ''; print ''; - $files = (scandir($dir.'/'.$year)); + $files = (dol_dir_list($dir.'/'.$year, 'files', 0, '^payments-[0-9]{4}-[0-9]{2}\.pdf$', '', 'name', 'DESC', 1)); foreach ($files as $f) { - $tfile = $dir.'/'.$year.'/'.$f; - $relativepath = $year.'/'.$f; - if (is_file($tfile) && preg_match('/^payment/i', $f)) { - print ''; - print ''; - print ''; - print ''; - print ''; - } + $relativepath = $f['level1name'].'/'.$f['name']; + print ''; + print ''; + print ''; + print ''; + print ''; } print '
'.$langs->trans("Date").'
'.img_pdf().' '.$f.''.$formfile->showPreview($f, 'facture_paiement', $relativepath, 0).''.dol_print_size(dol_filesize($tfile)).''.dol_print_date(dol_filemtime($tfile), "dayhour").'
'.img_pdf().' '.$f['name'].''.$formfile->showPreview($f['name'], 'facture_paiement', $relativepath, 0).''.dol_print_size($f['size']).''.dol_print_date($f['date'], "dayhour").'
'; } From 9278228e2027671a4612534409d9b63be04e3d50 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 3 May 2021 18:08:49 +0200 Subject: [PATCH 127/147] FIX: create event from contact card preselect contact correctly --- htdocs/comm/action/card.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index b3cb6d60a23..2a0371d4615 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -1143,6 +1143,7 @@ if ($action == 'create') print '
'.$langs->trans("ActionOnContact").''; $preselectedids = GETPOST('socpeopleassigned', 'array'); if (GETPOST('contactid', 'int')) $preselectedids[GETPOST('contactid', 'int')] = GETPOST('contactid', 'int'); + if ($origin=='contact') $preselectedids[GETPOST('originid', 'int')] = GETPOST('originid', 'int'); print img_picto('', 'contact', 'class="paddingrightonly"'); print $form->selectcontacts(GETPOST('socid', 'int'), $preselectedids, 'socpeopleassigned[]', 1, '', '', 0, 'minwidth300 quatrevingtpercent', false, 0, array(), false, 'multiple', 'contactid'); print '
'; diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index c9bd35f7326..99bcd2c3921 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -938,7 +938,7 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '') //E-mail 't.email', ); - //Social media + //Social media // foreach ($socialnetworks as $key => $value) { // if ($value['active']) { // $searchAddressPhoneDBFields['t.'.$key] = "t.socialnetworks->'$.".$key."'"; diff --git a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php index 64fbdeaafd8..97777adc4cd 100644 --- a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php @@ -395,8 +395,7 @@ class pdf_espadon extends ModelePdfExpedition // Notes $pagenb = $pdf->getPage(); - if (!empty($notetoshow)) - { + if (!empty($notetoshow)) { $tab_top -= 2; $tab_width = $this->page_largeur - $this->marge_gauche - $this->marge_droite; @@ -415,8 +414,7 @@ class pdf_espadon extends ModelePdfExpedition $pageposafternote = $pdf->getPage(); $posyafter = $pdf->GetY(); - if ($pageposafternote > $pageposbeforenote) - { + if ($pageposafternote > $pageposbeforenote) { $pdf->rollbackTransaction(true); // prepare pages to receive notes @@ -440,8 +438,7 @@ class pdf_espadon extends ModelePdfExpedition $posyafter = $pdf->GetY(); - if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + 20))) // There is no space left for total+free text - { + if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + 20))) { // There is no space left for total+free text $pdf->AddPage('', '', true); $pagenb++; $pageposafternote++; @@ -490,8 +487,7 @@ class pdf_espadon extends ModelePdfExpedition $pdf->Rect($this->marge_gauche, $tab_top - 1, $tab_width, $height_note + 1); - if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + 20))) - { + if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + 20))) { // not enough space, need to add page $pdf->AddPage('', '', true); $pagenb++; @@ -526,8 +522,7 @@ class pdf_espadon extends ModelePdfExpedition // Loop on each lines $pageposbeforeprintlines = $pdf->getPage(); $pagenb = $pageposbeforeprintlines; - for ($i = 0; $i < $nblines; $i++) - { + for ($i = 0; $i < $nblines; $i++) { $curY = $nexY; $pdf->SetFont('', '', $default_font_size - 1); // Into loop to work with multipage $pdf->SetTextColor(0, 0, 0); From 6644fd3a739e1b222731cf8f351031bfa11c1e7d Mon Sep 17 00:00:00 2001 From: daraelmin Date: Mon, 3 May 2021 22:15:40 +0200 Subject: [PATCH 136/147] Fix undefined translation key --- htdocs/adherents/type.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 4bde256c8f8..6c4f63725e1 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -796,7 +796,7 @@ if ($rowid > 0) { print $form->selectyesno("subscription", $object->subscription, 1); print ''; - print ''; From 9ef49a15e40dd539a6e2b7f2fc07e42bf951a0e4 Mon Sep 17 00:00:00 2001 From: Anthony Berton <34568357+bb2a@users.noreply.github.com> Date: Mon, 3 May 2021 22:28:40 +0200 Subject: [PATCH 137/147] Update pdf.php --- htdocs/admin/pdf.php | 66 ++++++++++++++++++++++++++++++++++++-------- 1 file changed, 55 insertions(+), 11 deletions(-) diff --git a/htdocs/admin/pdf.php b/htdocs/admin/pdf.php index 348f1e30cb5..01645c6cccc 100644 --- a/htdocs/admin/pdf.php +++ b/htdocs/admin/pdf.php @@ -224,7 +224,11 @@ print ''; // Show prof id in address into pdf @@ -240,7 +244,11 @@ for ($i = 1; $i <= 6; $i++) { if ($pid) { print ''; } } @@ -259,7 +267,11 @@ if ($mysoc->useLocalTax(1) || $mysoc->useLocalTax(2)) { if ($mysoc->useLocalTax(1)) { $locales = $langs->transcountry("LT1", $mysoc->country_code); $text = ''; } @@ -267,7 +279,11 @@ if ($mysoc->useLocalTax(1) || $mysoc->useLocalTax(2)) { $locales .= ($locales ? ' & ' : '').$langs->transcountry("LT2", $mysoc->country_code); $text .= ''; } } @@ -285,7 +301,11 @@ print ''; // Locataxes @@ -321,13 +341,21 @@ if (!empty($conf->projet->enabled)) { //Invert sender and recipient print ''; // Place customer adress to the ISO location print ''; // Use 2 languages into PDF @@ -345,25 +373,41 @@ print ''; //Desc print ''; //Ref print ''; //Details print ''; // SHOW_SUBPRODUCT_REF_IN_PDF - Option to show the detail of product ref for kits. print ''; // Show more details in footer From 9e5fdfdec36f97a3bf76e16b223e71f9e3a8405d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 3 May 2021 23:01:05 +0200 Subject: [PATCH 138/147] Update multicurrency_rate.php --- htdocs/multicurrency/multicurrency_rate.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/multicurrency/multicurrency_rate.php b/htdocs/multicurrency/multicurrency_rate.php index 3e99a19cc57..d0ad3419090 100644 --- a/htdocs/multicurrency/multicurrency_rate.php +++ b/htdocs/multicurrency/multicurrency_rate.php @@ -515,7 +515,7 @@ while ($i < min($num, $limit)) { // Fields from hook - $parameters = ['arrayfields' => $arrayfields, 'obj' => $obj]; + $parameters = array('arrayfields' => $arrayfields, 'obj' => $obj); $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; From b3af6666975d520bc397eaf86ebcdbc8b657325c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 3 May 2021 23:09:11 +0200 Subject: [PATCH 139/147] Clean code --- htdocs/admin/multicurrency.php | 9 +- htdocs/multicurrency/multicurrency_rate.php | 165 ++++++++++---------- 2 files changed, 88 insertions(+), 86 deletions(-) diff --git a/htdocs/admin/multicurrency.php b/htdocs/admin/multicurrency.php index 3a479480812..373ab0e0f48 100644 --- a/htdocs/admin/multicurrency.php +++ b/htdocs/admin/multicurrency.php @@ -156,8 +156,9 @@ if ($resql) { $form = new Form($db); $page_name = "MultiCurrencySetup"; +$help_url = ''; -llxHeader('', $langs->trans($page_name)); +llxHeader('', $langs->trans($page_name), $help_url); // Subheader $linkback = ''.$langs->trans("BackToModuleList").''; @@ -165,7 +166,7 @@ print load_fiche_titre($langs->trans($page_name), $linkback); // Configuration header $head = multicurrencyAdminPrepareHead(); -print dol_get_fiche_head($head, 'settings', $langs->trans("ModuleSetup"), -1, "multicurrency"); +print dol_get_fiche_head($head, 'settings', $langs->trans($page_name), -1, "multicurrency"); print '
'.$langs->trans("DefineAmountMemberType").''; + print '
'.$langs->trans("Amount").''; print ''; print '
'.$langs->trans("Parameter").''.$langs->trans("ShowVATIntaInAddress").''; -print $form->selectyesno('MAIN_TVAINTRA_NOT_IN_ADDRESS', (!empty($conf->global->MAIN_TVAINTRA_NOT_IN_ADDRESS)) ? $conf->global->MAIN_TVAINTRA_NOT_IN_ADDRESS : 0, 1); +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('MAIN_TVAINTRA_NOT_IN_ADDRESS'); +} else { + print $form->selectyesno('MAIN_TVAINTRA_NOT_IN_ADDRESS', (!empty($conf->global->MAIN_TVAINTRA_NOT_IN_ADDRESS)) ? $conf->global->MAIN_TVAINTRA_NOT_IN_ADDRESS : 0, 1); +} print '
'.$langs->trans("ShowProfIdInAddress").' - '.$pid.''; $keyforconstant = 'MAIN_PROFID'.$i.'_IN_ADDRESS'; - print $form->selectyesno($keyforconstant, isset($conf->global->$keyforconstant) ? $conf->global->$keyforconstant : 0, 1, $noCountryCode); + if ($conf->use_javascript_ajax) { + print ajax_constantonoff($keyforconstant); + } else { + print $form->selectyesno($keyforconstant, isset($conf->global->$keyforconstant) ? $conf->global->$keyforconstant : 0, 1, $noCountryCode); + } print '
'.$langs->trans("HideLocalTaxOnPDF", $langs->transcountry("LT1", $mysoc->country_code)).''; - $text .= $form->selectyesno('MAIN_PDF_MAIN_HIDE_SECOND_TAX', (!empty($conf->global->MAIN_PDF_MAIN_HIDE_SECOND_TAX)) ? $conf->global->MAIN_PDF_MAIN_HIDE_SECOND_TAX : 0, 1); + if ($conf->use_javascript_ajax) { + $text .= ajax_constantonoff('MAIN_PDF_MAIN_HIDE_SECOND_TAX'); + } else { + $text .= $form->selectyesno('MAIN_PDF_MAIN_HIDE_SECOND_TAX', (!empty($conf->global->MAIN_PDF_MAIN_HIDE_SECOND_TAX)) ? $conf->global->MAIN_PDF_MAIN_HIDE_SECOND_TAX : 0, 1); + } $text .= '
'.$langs->trans("HideLocalTaxOnPDF", $langs->transcountry("LT2", $mysoc->country_code)).''; - $text .= $form->selectyesno('MAIN_PDF_MAIN_HIDE_THIRD_TAX', (!empty($conf->global->MAIN_PDF_MAIN_HIDE_THIRD_TAX)) ? $conf->global->MAIN_PDF_MAIN_HIDE_THIRD_TAX : 0, 1); + if ($conf->use_javascript_ajax) { + $text .= ajax_constantonoff('MAIN_PDF_MAIN_HIDE_THIRD_TAX'); + } else { + $text .= $form->selectyesno('MAIN_PDF_MAIN_HIDE_THIRD_TAX', (!empty($conf->global->MAIN_PDF_MAIN_HIDE_THIRD_TAX)) ? $conf->global->MAIN_PDF_MAIN_HIDE_THIRD_TAX : 0, 1); + } $text .= '
'.$langs->trans("Parameter").''.$langs->trans("HideAnyVATInformationOnPDF").''; -print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT', (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) ? $conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT : 0, 1); +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT'); +} else { + print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT', (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) ? $conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT : 0, 1); +} print '
'.$langs->trans("SwapSenderAndRecipientOnPDF").''; -print $form->selectyesno('MAIN_INVERT_SENDER_RECIPIENT', (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) ? $conf->global->MAIN_INVERT_SENDER_RECIPIENT : 0, 1); +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('MAIN_INVERT_SENDER_RECIPIENT'); +} else { + print $form->selectyesno('MAIN_INVERT_SENDER_RECIPIENT', (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) ? $conf->global->MAIN_INVERT_SENDER_RECIPIENT : 0, 1); +} print '
'.$langs->trans("PlaceCustomerAddressToIsoLocation").''; -print $form->selectyesno('MAIN_PDF_USE_ISO_LOCATION', (!empty($conf->global->MAIN_PDF_USE_ISO_LOCATION)) ? $conf->global->MAIN_PDF_USE_ISO_LOCATION : 0, 1); +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('MAIN_PDF_USE_ISO_LOCATION'); +} else { + print $form->selectyesno('MAIN_PDF_USE_ISO_LOCATION', (!empty($conf->global->MAIN_PDF_USE_ISO_LOCATION)) ? $conf->global->MAIN_PDF_USE_ISO_LOCATION : 0, 1); +} print '
'.$langs->trans("HideDescOnPDF").''; -print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_HIDE_DESC', (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC)) ? $conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC : 0, 1); +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('MAIN_GENERATE_DOCUMENTS_HIDE_DESC'); +} else { + print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_HIDE_DESC', (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC)) ? $conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC : 0, 1); +} print '
'.$langs->trans("HideRefOnPDF").''; -print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_HIDE_REF', (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF)) ? $conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF : 0, 1); +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('MAIN_GENERATE_DOCUMENTS_HIDE_REF'); +} else { + print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_HIDE_REF', (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF)) ? $conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF : 0, 1); +} print '
'.$langs->trans("HideDetailsOnPDF").''; -print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS', (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS)) ? $conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS : 0, 1); +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS'); +} else { + print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS', (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS)) ? $conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS : 0, 1); +} print '
'.$langs->trans("SHOW_SUBPRODUCT_REF_IN_PDF", $langs->transnoentitiesnoconv("AssociatedProductsAbility"), $langs->transnoentitiesnoconv("Products")).''; -print $form->selectyesno('SHOW_SUBPRODUCT_REF_IN_PDF', (!empty($conf->global->SHOW_SUBPRODUCT_REF_IN_PDF)) ? $conf->global->SHOW_SUBPRODUCT_REF_IN_PDF : 0, 1); +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('SHOW_SUBPRODUCT_REF_IN_PDF'); +} else { + print $form->selectyesno('SHOW_SUBPRODUCT_REF_IN_PDF', (!empty($conf->global->SHOW_SUBPRODUCT_REF_IN_PDF)) ? $conf->global->SHOW_SUBPRODUCT_REF_IN_PDF : 0, 1); +} print '
'; @@ -303,7 +304,7 @@ print ''; print ''; print ''; print ''; print ''; @@ -328,7 +329,7 @@ foreach ($TCurrency as &$currency) { print ''; print ''; print '1 '.$conf->currency.' = '; - print ' '.$currency->code.' '; + print ' '.$currency->code.' '; print ' '; print ''; print ''; diff --git a/htdocs/multicurrency/multicurrency_rate.php b/htdocs/multicurrency/multicurrency_rate.php index d0ad3419090..3a8c1be819e 100644 --- a/htdocs/multicurrency/multicurrency_rate.php +++ b/htdocs/multicurrency/multicurrency_rate.php @@ -232,7 +232,7 @@ if (empty($reshook)) { $htmlother = new FormOther($db); $title = $langs->trans("CurrencyRate"); -$page_name = "ListCurrencyRate"; +$page_name = "MultiCurrencySetup"; $help_url = ''; llxHeader('', $title, $help_url, ''); @@ -417,24 +417,24 @@ if ($resql) { print ''; // date -if (!empty($arrayfields['cr.date_sync']['checked'])) { - print ''; -} - // code -if (!empty($arrayfields['m.code']['checked'])) { - print ''; -} - // rate -if (!empty($arrayfields['cr.rate']['checked'])) { - print ''; -} + if (!empty($arrayfields['cr.date_sync']['checked'])) { + print ''; + } + // code + if (!empty($arrayfields['m.code']['checked'])) { + print ''; + } + // rate + if (!empty($arrayfields['cr.rate']['checked'])) { + print ''; + } // Fields from hook $parameters = array('arrayfields'=>$arrayfields); @@ -469,74 +469,75 @@ if (!empty($arrayfields['cr.rate']['checked'])) { $i = 0; $totalarray = array(); -while ($i < min($num, $limit)) { - $obj = $db->fetch_object($resql); + while ($i < min($num, $limit)) { + $obj = $db->fetch_object($resql); - print ''; + print ''; - // USER REQUEST UPDATE FOR THIS LINE - if ($action == "updateRate" && $obj->rowid == $id_rate_selected) { - // var_dump($obj); - print ' '; - print ''; - print ' '; + // USER REQUEST UPDATE FOR THIS LINE + if ($action == "updateRate" && $obj->rowid == $id_rate_selected) { + // var_dump($obj); + print ' '; + print ''; + print ' '; - print ''; - } else { - // date_sync - if (!empty($arrayfields['cr.date_sync']['checked'])) { - print '\n"; - if (!$i) $totalarray['nbfield']++; - } - - // code - if (! empty($arrayfields['m.code']['checked'])) { - print '\n"; - - if (! $i) $totalarray['nbfield']++; - } - - // rate - if (! empty($arrayfields['cr.rate']['checked'])) { - print '\n"; - if (! $i) $totalarray['nbfield']++; - } - - - // Fields from hook - $parameters = array('arrayfields' => $arrayfields, 'obj' => $obj); - $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - - // Action - print ''; + } else { + // date_sync + if (!empty($arrayfields['cr.date_sync']['checked'])) { + print '\n"; + if (!$i) $totalarray['nbfield']++; } - print 'rowid.'">'.img_picto('edit', 'edit').''; - print 'rowid.'">'.img_picto('delete', 'delete').''; - print ''; - } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - print "\n"; - $i++; + // code + if (! empty($arrayfields['m.code']['checked'])) { + print '\n"; + + if (! $i) $totalarray['nbfield']++; + } + + // rate + if (! empty($arrayfields['cr.rate']['checked'])) { + print '\n"; + if (! $i) $totalarray['nbfield']++; + } + + + // Fields from hook + $parameters = array('arrayfields' => $arrayfields, 'obj' => $obj); + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + + // Action + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + + print "\n"; + $i++; + } } $db->free($resql); From 04930c2a9831c735f79118e8e2703571fc42765e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 3 May 2021 23:21:39 +0200 Subject: [PATCH 140/147] Fix filter --- htdocs/cron/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/cron/list.php b/htdocs/cron/list.php index e5d779d8e10..2132cbc141b 100644 --- a/htdocs/cron/list.php +++ b/htdocs/cron/list.php @@ -68,7 +68,7 @@ $mode = GETPOST('mode', 'aZ09'); $search_status = (GETPOSTISSET('search_status') ?GETPOST('search_status', 'int') : GETPOST('status', 'int')); $search_label = GETPOST("search_label", 'alpha'); $search_module_name = GETPOST("search_module_name", 'alpha'); -$search_lastresult = GETPOST("search_lastresult", "alpha"); +$search_lastresult = GETPOST("search_lastresult", "alphawithlgt"); $securitykey = GETPOST('securitykey', 'alpha'); $outputdir = $conf->cron->dir_output; From 16f1651d4e8c977b5fb08387735278b15449e43b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 4 May 2021 00:04:44 +0200 Subject: [PATCH 141/147] Add missing action events in trigger --- ...terface_50_modAgenda_ActionsAuto.class.php | 22 +++++++++++++++++++ htdocs/langs/en_US/agenda.lang | 2 ++ 2 files changed, 24 insertions(+) diff --git a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php index 7f7cd5a77be..cdb490e330c 100644 --- a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php +++ b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php @@ -110,6 +110,17 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->sendtoid = 0; $object->socid = $object->id; + } elseif ($action == 'COMPANY_MODIFY') { + // Load translation files required by the page + $langs->loadLangs(array("agenda", "other", "companies")); + + if (empty($object->actionmsg2)) { + $object->actionmsg2 = $langs->transnoentities("COMPANY_MODIFYInDolibarr", $object->name); + } + $object->actionmsg = $langs->transnoentities("COMPANY_MODIFYInDolibarr", $object->name); + + $object->sendtoid = 0; + $object->socid = $object->id; } elseif ($action == 'COMPANY_SENTBYMAIL') { // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "orders")); @@ -129,6 +140,17 @@ class InterfaceActionsAuto extends DolibarrTriggers } $object->actionmsg = $langs->transnoentities("CONTACT_CREATEInDolibarr", $object->getFullName($langs)); + $object->sendtoid = array($object->id => $object->id); + $object->socid = $object->socid; + } elseif ($action == 'CONTACT_MODIFY') { + // Load translation files required by the page + $langs->loadLangs(array("agenda", "other", "companies")); + + if (empty($object->actionmsg2)) { + $object->actionmsg2 = $langs->transnoentities("CONTACT_MODIFYInDolibarr", $object->name); + } + $object->actionmsg = $langs->transnoentities("CONTACT_MODIFYInDolibarr", $object->name); + $object->sendtoid = array($object->id => $object->id); $object->socid = $object->socid; } elseif ($action == 'CONTRACT_VALIDATE') { diff --git a/htdocs/langs/en_US/agenda.lang b/htdocs/langs/en_US/agenda.lang index d16188d40d4..bab409dd036 100644 --- a/htdocs/langs/en_US/agenda.lang +++ b/htdocs/langs/en_US/agenda.lang @@ -38,6 +38,7 @@ ActionsEvents=Events for which Dolibarr will create an action in agenda automati EventRemindersByEmailNotEnabled=Event reminders by email was not enabled into %s module setup. ##### Agenda event labels ##### NewCompanyToDolibarr=Third party %s created +COMPANY_MODIFYInDolibarr=Third party %s modified COMPANY_DELETEInDolibarr=Third party %s deleted ContractValidatedInDolibarr=Contract %s validated CONTRACT_DELETEInDolibarr=Contract %s deleted @@ -87,6 +88,7 @@ OrderDeleted=Order deleted InvoiceDeleted=Invoice deleted DraftInvoiceDeleted=Draft invoice deleted CONTACT_CREATEInDolibarr=Contact %s created +CONTACT_MODIFYInDolibarr=Contact %s modified CONTACT_DELETEInDolibarr=Contact %s deleted PRODUCT_CREATEInDolibarr=Product %s created PRODUCT_MODIFYInDolibarr=Product %s modified From b2901bfae03f124187e8c72c23acb240e7774fc9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 4 May 2021 00:15:06 +0200 Subject: [PATCH 142/147] Make code simpler --- htdocs/admin/pdf_adherent.php | 110 ------------------ htdocs/admin/pdf_contrat.php | 110 ------------------ htdocs/admin/pdf_expensereport.php | 110 ------------------ htdocs/admin/pdf_holiday.php | 110 ------------------ htdocs/admin/pdf_intervention.php | 110 ------------------ htdocs/admin/pdf_invoice.php | 110 ------------------ htdocs/admin/pdf_order.php | 110 ------------------ .../admin/{pdf_proposal.php => pdf_other.php} | 6 +- htdocs/admin/pdf_project.php | 110 ------------------ htdocs/admin/pdf_reception.php | 110 ------------------ htdocs/admin/pdf_recruitment.php | 110 ------------------ htdocs/admin/pdf_shipment.php | 110 ------------------ htdocs/admin/pdf_stock.php | 110 ------------------ htdocs/admin/pdf_supplierinvoice.php | 110 ------------------ htdocs/admin/pdf_supplierorder.php | 110 ------------------ htdocs/admin/pdf_supplierproposal.php | 110 ------------------ htdocs/admin/pdf_ticket.php | 110 ------------------ htdocs/core/lib/pdf.lib.php | 103 +--------------- htdocs/langs/en_US/admin.lang | 18 +-- 19 files changed, 9 insertions(+), 1878 deletions(-) delete mode 100644 htdocs/admin/pdf_adherent.php delete mode 100644 htdocs/admin/pdf_contrat.php delete mode 100644 htdocs/admin/pdf_expensereport.php delete mode 100644 htdocs/admin/pdf_holiday.php delete mode 100644 htdocs/admin/pdf_intervention.php delete mode 100644 htdocs/admin/pdf_invoice.php delete mode 100644 htdocs/admin/pdf_order.php rename htdocs/admin/{pdf_proposal.php => pdf_other.php} (95%) delete mode 100644 htdocs/admin/pdf_project.php delete mode 100644 htdocs/admin/pdf_reception.php delete mode 100644 htdocs/admin/pdf_recruitment.php delete mode 100644 htdocs/admin/pdf_shipment.php delete mode 100644 htdocs/admin/pdf_stock.php delete mode 100644 htdocs/admin/pdf_supplierinvoice.php delete mode 100644 htdocs/admin/pdf_supplierorder.php delete mode 100644 htdocs/admin/pdf_supplierproposal.php delete mode 100644 htdocs/admin/pdf_ticket.php diff --git a/htdocs/admin/pdf_adherent.php b/htdocs/admin/pdf_adherent.php deleted file mode 100644 index af570117492..00000000000 --- a/htdocs/admin/pdf_adherent.php +++ /dev/null @@ -1,110 +0,0 @@ - - * Copyright (C) 2004-2012 Laurent Destailleur - * Copyright (C) 2005-2011 Regis Houssin - * Copyright (C) 2012-2107 Juanjo Menent - * Copyright (C) 2019 Ferran Marcet - * Copyright (C) 2021 Anthony Berton - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file htdocs/admin/pdf.php - * \brief Page to setup PDF options - */ - -require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; - -// Load translation files required by the page -$langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'stocks', 'Trips')); - -if (!$user->admin) { - accessforbidden(); -} - -$action = GETPOST('action', 'aZ09'); -$cancel = GETPOST('cancel', 'alpha'); - - -/* - * Actions - */ - -if ($cancel) { - $action = ''; -} - -if ($action == 'update') { - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - - header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup"); - exit; -} - - - -/* - * View - */ - -$wikihelp = 'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones'; -llxHeader('', $langs->trans("Setup"), $wikihelp); - -$form = new Form($db); -$formother = new FormOther($db); -$formadmin = new FormAdmin($db); - -print load_fiche_titre($langs->trans("PDF"), '', 'title_setup'); - -$head = pdf_admin_prepare_head(); - -print dol_get_fiche_head($head, 'adherent', $langs->trans("Adherent"), -1, 'pdf'); - -print ''.$form->textwithpicto($langs->trans("PDFAdherentDesc"), $s)."
\n"; -print "
\n"; - -print '
'; -print ''; -print ''; - -print '
'; -print '
'.$form->selectCurrency('', 'code', 1).''; -print ' '; +print ' '; print ''; print '
'; - print $form->selectDate(dol_print_date($search_date_sync, "%Y-%m-%d"), 'search_date_sync', 0, 0, 1); - print $form->selectDate(dol_print_date($search_date_sync_end, "%Y-%m-%d"), 'search_date_sync_end', 0, 0, 1); - print ''; - print $form->selectMultiCurrency($multicurrency_code, 'search_code', 1, " code != '".$conf->currency."'", true); - print ''; - print ''; - print ''; + print $form->selectDate(dol_print_date($search_date_sync, "%Y-%m-%d"), 'search_date_sync', 0, 0, 1); + print $form->selectDate(dol_print_date($search_date_sync_end, "%Y-%m-%d"), 'search_date_sync_end', 0, 0, 1); + print ''; + print $form->selectMultiCurrency($multicurrency_code, 'search_code', 1, " code != '".$conf->currency."'", true); + print ''; + print ''; + print '
' . $form->selectMultiCurrency($obj->code, 'multicurrency_code', 1, " code != '".$conf->currency."'", true) . '' . $form->selectMultiCurrency($obj->code, 'multicurrency_code', 1, " code != '".$conf->currency."'", true) . ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print $obj->date_sync; - print "'; - print $obj->code." ".$obj->name; - print "'; - print $obj->rate; - print "'; - if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined - $selected = 0; - if (in_array($obj->rowid, $arrayofselected)) { - $selected = 1; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print $obj->date_sync; + print "
'; + print $obj->code." ".$obj->name; + print "'; + print $obj->rate; + print "'; + if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + $selected = 0; + if (in_array($obj->rowid, $arrayofselected)) { + $selected = 1; + } + print 'rowid.'">'.img_picto('edit', 'edit').''; + print 'rowid.'">'.img_picto('delete', 'delete').''; + print ''; + } + print '
'; -print ''; - - -print ''; - -print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("").''; - -print '
'; -print ''; - - -print '
'; -print ''; -print '
'; - -print ''; - - -// End of page -llxFooter(); -$db->close(); diff --git a/htdocs/admin/pdf_contrat.php b/htdocs/admin/pdf_contrat.php deleted file mode 100644 index b6624ba59d6..00000000000 --- a/htdocs/admin/pdf_contrat.php +++ /dev/null @@ -1,110 +0,0 @@ - - * Copyright (C) 2004-2012 Laurent Destailleur - * Copyright (C) 2005-2011 Regis Houssin - * Copyright (C) 2012-2107 Juanjo Menent - * Copyright (C) 2019 Ferran Marcet - * Copyright (C) 2021 Anthony Berton - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file htdocs/admin/pdf.php - * \brief Page to setup PDF options - */ - -require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; - -// Load translation files required by the page -$langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'stocks', 'Trips')); - -if (!$user->admin) { - accessforbidden(); -} - -$action = GETPOST('action', 'aZ09'); -$cancel = GETPOST('cancel', 'alpha'); - - -/* - * Actions - */ - -if ($cancel) { - $action = ''; -} - -if ($action == 'update') { - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - - header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup"); - exit; -} - - - -/* - * View - */ - -$wikihelp = 'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones'; -llxHeader('', $langs->trans("Setup"), $wikihelp); - -$form = new Form($db); -$formother = new FormOther($db); -$formadmin = new FormAdmin($db); - -print load_fiche_titre($langs->trans("PDF"), '', 'title_setup'); - -$head = pdf_admin_prepare_head(); - -print dol_get_fiche_head($head, 'contrat', $langs->trans("Contrat"), -1, 'pdf'); - -print ''.$form->textwithpicto($langs->trans("PDFContratDesc"), $s)."
\n"; -print "
\n"; - -print '
'; -print ''; -print ''; - -print '
'; -print ''; -print ''; - - -print ''; - -print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("").''; - -print '
'; -print '
'; - - -print '
'; -print ''; -print '
'; - -print '
'; - - -// End of page -llxFooter(); -$db->close(); diff --git a/htdocs/admin/pdf_expensereport.php b/htdocs/admin/pdf_expensereport.php deleted file mode 100644 index 3620679f525..00000000000 --- a/htdocs/admin/pdf_expensereport.php +++ /dev/null @@ -1,110 +0,0 @@ - - * Copyright (C) 2004-2012 Laurent Destailleur - * Copyright (C) 2005-2011 Regis Houssin - * Copyright (C) 2012-2107 Juanjo Menent - * Copyright (C) 2019 Ferran Marcet - * Copyright (C) 2021 Anthony Berton - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file htdocs/admin/pdf.php - * \brief Page to setup PDF options - */ - -require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; - -// Load translation files required by the page -$langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'stocks', 'Trips')); - -if (!$user->admin) { - accessforbidden(); -} - -$action = GETPOST('action', 'aZ09'); -$cancel = GETPOST('cancel', 'alpha'); - - -/* - * Actions - */ - -if ($cancel) { - $action = ''; -} - -if ($action == 'update') { - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - - header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup"); - exit; -} - - - -/* - * View - */ - -$wikihelp = 'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones'; -llxHeader('', $langs->trans("Setup"), $wikihelp); - -$form = new Form($db); -$formother = new FormOther($db); -$formadmin = new FormAdmin($db); - -print load_fiche_titre($langs->trans("PDF"), '', 'title_setup'); - -$head = pdf_admin_prepare_head(); - -print dol_get_fiche_head($head, 'expensereport', $langs->trans("Expensereport"), -1, 'pdf'); - -print ''.$form->textwithpicto($langs->trans("PDFExpensereportDesc"), $s)."
\n"; -print "
\n"; - -print '
'; -print ''; -print ''; - -print '
'; -print ''; -print ''; - - -print ''; - -print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("").''; - -print '
'; -print '
'; - - -print '
'; -print ''; -print '
'; - -print '
'; - - -// End of page -llxFooter(); -$db->close(); diff --git a/htdocs/admin/pdf_holiday.php b/htdocs/admin/pdf_holiday.php deleted file mode 100644 index 7b6074b31aa..00000000000 --- a/htdocs/admin/pdf_holiday.php +++ /dev/null @@ -1,110 +0,0 @@ - - * Copyright (C) 2004-2012 Laurent Destailleur - * Copyright (C) 2005-2011 Regis Houssin - * Copyright (C) 2012-2107 Juanjo Menent - * Copyright (C) 2019 Ferran Marcet - * Copyright (C) 2021 Anthony Berton - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file htdocs/admin/pdf.php - * \brief Page to setup PDF options - */ - -require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; - -// Load translation files required by the page -$langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'stocks', 'Trips')); - -if (!$user->admin) { - accessforbidden(); -} - -$action = GETPOST('action', 'aZ09'); -$cancel = GETPOST('cancel', 'alpha'); - - -/* - * Actions - */ - -if ($cancel) { - $action = ''; -} - -if ($action == 'update') { - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - - header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup"); - exit; -} - - - -/* - * View - */ - -$wikihelp = 'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones'; -llxHeader('', $langs->trans("Setup"), $wikihelp); - -$form = new Form($db); -$formother = new FormOther($db); -$formadmin = new FormAdmin($db); - -print load_fiche_titre($langs->trans("PDF"), '', 'title_setup'); - -$head = pdf_admin_prepare_head(); - -print dol_get_fiche_head($head, 'holiday', $langs->trans("Holiday"), -1, 'pdf'); - -print ''.$form->textwithpicto($langs->trans("PDFHolidaytDesc"), $s)."
\n"; -print "
\n"; - -print '
'; -print ''; -print ''; - -print '
'; -print ''; -print ''; - - -print ''; - -print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("").''; - -print '
'; -print '
'; - - -print '
'; -print ''; -print '
'; - -print '
'; - - -// End of page -llxFooter(); -$db->close(); diff --git a/htdocs/admin/pdf_intervention.php b/htdocs/admin/pdf_intervention.php deleted file mode 100644 index 993e1f1f5b1..00000000000 --- a/htdocs/admin/pdf_intervention.php +++ /dev/null @@ -1,110 +0,0 @@ - - * Copyright (C) 2004-2012 Laurent Destailleur - * Copyright (C) 2005-2011 Regis Houssin - * Copyright (C) 2012-2107 Juanjo Menent - * Copyright (C) 2019 Ferran Marcet - * Copyright (C) 2021 Anthony Berton - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file htdocs/admin/pdf.php - * \brief Page to setup PDF options - */ - -require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; - -// Load translation files required by the page -$langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'stocks', 'Trips')); - -if (!$user->admin) { - accessforbidden(); -} - -$action = GETPOST('action', 'aZ09'); -$cancel = GETPOST('cancel', 'alpha'); - - -/* - * Actions - */ - -if ($cancel) { - $action = ''; -} - -if ($action == 'update') { - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - - header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup"); - exit; -} - - - -/* - * View - */ - -$wikihelp = 'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones'; -llxHeader('', $langs->trans("Setup"), $wikihelp); - -$form = new Form($db); -$formother = new FormOther($db); -$formadmin = new FormAdmin($db); - -print load_fiche_titre($langs->trans("PDF"), '', 'title_setup'); - -$head = pdf_admin_prepare_head(); - -print dol_get_fiche_head($head, 'intervention', $langs->trans("Intervention"), -1, 'pdf'); - -print ''.$form->textwithpicto($langs->trans("PDFInterventionDesc"), $s)."
\n"; -print "
\n"; - -print '
'; -print ''; -print ''; - -print '
'; -print ''; -print ''; - - -print ''; - -print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("").''; - -print '
'; -print '
'; - - -print '
'; -print ''; -print '
'; - -print '
'; - - -// End of page -llxFooter(); -$db->close(); diff --git a/htdocs/admin/pdf_invoice.php b/htdocs/admin/pdf_invoice.php deleted file mode 100644 index 9064d2fd499..00000000000 --- a/htdocs/admin/pdf_invoice.php +++ /dev/null @@ -1,110 +0,0 @@ - - * Copyright (C) 2004-2012 Laurent Destailleur - * Copyright (C) 2005-2011 Regis Houssin - * Copyright (C) 2012-2107 Juanjo Menent - * Copyright (C) 2019 Ferran Marcet - * Copyright (C) 2021 Anthony Berton - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file htdocs/admin/pdf.php - * \brief Page to setup PDF options - */ - -require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; - -// Load translation files required by the page -$langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'stocks', 'Trips')); - -if (!$user->admin) { - accessforbidden(); -} - -$action = GETPOST('action', 'aZ09'); -$cancel = GETPOST('cancel', 'alpha'); - - -/* - * Actions - */ - -if ($cancel) { - $action = ''; -} - -if ($action == 'update') { - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - - header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup"); - exit; -} - - - -/* - * View - */ - -$wikihelp = 'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones'; -llxHeader('', $langs->trans("Setup"), $wikihelp); - -$form = new Form($db); -$formother = new FormOther($db); -$formadmin = new FormAdmin($db); - -print load_fiche_titre($langs->trans("PDF"), '', 'title_setup'); - -$head = pdf_admin_prepare_head(); - -print dol_get_fiche_head($head, 'invoice', $langs->trans("Invoice"), -1, 'pdf'); - -print ''.$form->textwithpicto($langs->trans("PDFInvoiceDesc"), $s)."
\n"; -print "
\n"; - -print '
'; -print ''; -print ''; - -print '
'; -print ''; -print ''; - - -print ''; - -print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("").''; - -print '
'; -print '
'; - - -print '
'; -print ''; -print '
'; - -print '
'; - - -// End of page -llxFooter(); -$db->close(); diff --git a/htdocs/admin/pdf_order.php b/htdocs/admin/pdf_order.php deleted file mode 100644 index b81cc649d61..00000000000 --- a/htdocs/admin/pdf_order.php +++ /dev/null @@ -1,110 +0,0 @@ - - * Copyright (C) 2004-2012 Laurent Destailleur - * Copyright (C) 2005-2011 Regis Houssin - * Copyright (C) 2012-2107 Juanjo Menent - * Copyright (C) 2019 Ferran Marcet - * Copyright (C) 2021 Anthony Berton - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file htdocs/admin/pdf.php - * \brief Page to setup PDF options - */ - -require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; - -// Load translation files required by the page -$langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'stocks', 'Trips')); - -if (!$user->admin) { - accessforbidden(); -} - -$action = GETPOST('action', 'aZ09'); -$cancel = GETPOST('cancel', 'alpha'); - - -/* - * Actions - */ - -if ($cancel) { - $action = ''; -} - -if ($action == 'update') { - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - - header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup"); - exit; -} - - - -/* - * View - */ - -$wikihelp = 'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones'; -llxHeader('', $langs->trans("Setup"), $wikihelp); - -$form = new Form($db); -$formother = new FormOther($db); -$formadmin = new FormAdmin($db); - -print load_fiche_titre($langs->trans("PDF"), '', 'title_setup'); - -$head = pdf_admin_prepare_head(); - -print dol_get_fiche_head($head, 'order', $langs->trans("Order"), -1, 'pdf'); - -print ''.$form->textwithpicto($langs->trans("PDFOrderDesc"), $s)."
\n"; -print "
\n"; - -print '
'; -print ''; -print ''; - -print '
'; -print ''; -print ''; - - -print ''; - -print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("").''; - -print '
'; -print '
'; - - -print '
'; -print ''; -print '
'; - -print '
'; - - -// End of page -llxFooter(); -$db->close(); diff --git a/htdocs/admin/pdf_proposal.php b/htdocs/admin/pdf_other.php similarity index 95% rename from htdocs/admin/pdf_proposal.php rename to htdocs/admin/pdf_other.php index 06d7bc6f15c..9120e101232 100644 --- a/htdocs/admin/pdf_proposal.php +++ b/htdocs/admin/pdf_other.php @@ -76,11 +76,13 @@ print load_fiche_titre($langs->trans("PDF"), '', 'title_setup'); $head = pdf_admin_prepare_head(); -print dol_get_fiche_head($head, 'proposal', $langs->trans("Proposals"), -1, 'pdf'); +print dol_get_fiche_head($head, 'other', $langs->trans("other"), -1, 'pdf'); -print ''.$form->textwithpicto($langs->trans("PDFProposalDesc"), $s)."
\n"; +print ''.$form->textwithpicto($langs->trans("PDFOtherDesc"), $s)."
\n"; print "
\n"; +print load_fiche_titre($langs->trans("Proposal"), '', ''); + print '
'; print ''; print ''; diff --git a/htdocs/admin/pdf_project.php b/htdocs/admin/pdf_project.php deleted file mode 100644 index 3a85f0ea258..00000000000 --- a/htdocs/admin/pdf_project.php +++ /dev/null @@ -1,110 +0,0 @@ - - * Copyright (C) 2004-2012 Laurent Destailleur - * Copyright (C) 2005-2011 Regis Houssin - * Copyright (C) 2012-2107 Juanjo Menent - * Copyright (C) 2019 Ferran Marcet - * Copyright (C) 2021 Anthony Berton - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file htdocs/admin/pdf.php - * \brief Page to setup PDF options - */ - -require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; - -// Load translation files required by the page -$langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'stocks', 'Trips')); - -if (!$user->admin) { - accessforbidden(); -} - -$action = GETPOST('action', 'aZ09'); -$cancel = GETPOST('cancel', 'alpha'); - - -/* - * Actions - */ - -if ($cancel) { - $action = ''; -} - -if ($action == 'update') { - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - - header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup"); - exit; -} - - - -/* - * View - */ - -$wikihelp = 'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones'; -llxHeader('', $langs->trans("Setup"), $wikihelp); - -$form = new Form($db); -$formother = new FormOther($db); -$formadmin = new FormAdmin($db); - -print load_fiche_titre($langs->trans("PDF"), '', 'title_setup'); - -$head = pdf_admin_prepare_head(); - -print dol_get_fiche_head($head, 'project', $langs->trans("Project"), -1, 'pdf'); - -print ''.$form->textwithpicto($langs->trans("PDFProjectDesc"), $s)."
\n"; -print "
\n"; - -print ''; -print ''; -print ''; - -print '
'; -print ''; -print ''; - - -print ''; - -print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("").''; - -print '
'; -print '
'; - - -print '
'; -print ''; -print '
'; - -print ''; - - -// End of page -llxFooter(); -$db->close(); diff --git a/htdocs/admin/pdf_reception.php b/htdocs/admin/pdf_reception.php deleted file mode 100644 index 32003e51f30..00000000000 --- a/htdocs/admin/pdf_reception.php +++ /dev/null @@ -1,110 +0,0 @@ - - * Copyright (C) 2004-2012 Laurent Destailleur - * Copyright (C) 2005-2011 Regis Houssin - * Copyright (C) 2012-2107 Juanjo Menent - * Copyright (C) 2019 Ferran Marcet - * Copyright (C) 2021 Anthony Berton - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file htdocs/admin/pdf.php - * \brief Page to setup PDF options - */ - -require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; - -// Load translation files required by the page -$langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'stocks', 'Trips')); - -if (!$user->admin) { - accessforbidden(); -} - -$action = GETPOST('action', 'aZ09'); -$cancel = GETPOST('cancel', 'alpha'); - - -/* - * Actions - */ - -if ($cancel) { - $action = ''; -} - -if ($action == 'update') { - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - - header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup"); - exit; -} - - - -/* - * View - */ - -$wikihelp = 'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones'; -llxHeader('', $langs->trans("Setup"), $wikihelp); - -$form = new Form($db); -$formother = new FormOther($db); -$formadmin = new FormAdmin($db); - -print load_fiche_titre($langs->trans("PDF"), '', 'title_setup'); - -$head = pdf_admin_prepare_head(); - -print dol_get_fiche_head($head, 'reception', $langs->trans("reception"), -1, 'pdf'); - -print ''.$form->textwithpicto($langs->trans("PDFReceptionDesc"), $s)."
\n"; -print "
\n"; - -print '
'; -print ''; -print ''; - -print '
'; -print ''; -print ''; - - -print ''; - -print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("").''; - -print '
'; -print '
'; - - -print '
'; -print ''; -print '
'; - -print '
'; - - -// End of page -llxFooter(); -$db->close(); diff --git a/htdocs/admin/pdf_recruitment.php b/htdocs/admin/pdf_recruitment.php deleted file mode 100644 index 575d3bc23cc..00000000000 --- a/htdocs/admin/pdf_recruitment.php +++ /dev/null @@ -1,110 +0,0 @@ - - * Copyright (C) 2004-2012 Laurent Destailleur - * Copyright (C) 2005-2011 Regis Houssin - * Copyright (C) 2012-2107 Juanjo Menent - * Copyright (C) 2019 Ferran Marcet - * Copyright (C) 2021 Anthony Berton - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file htdocs/admin/pdf.php - * \brief Page to setup PDF options - */ - -require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; - -// Load translation files required by the page -$langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'stocks', 'Trips')); - -if (!$user->admin) { - accessforbidden(); -} - -$action = GETPOST('action', 'aZ09'); -$cancel = GETPOST('cancel', 'alpha'); - - -/* - * Actions - */ - -if ($cancel) { - $action = ''; -} - -if ($action == 'update') { - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - - header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup"); - exit; -} - - - -/* - * View - */ - -$wikihelp = 'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones'; -llxHeader('', $langs->trans("Setup"), $wikihelp); - -$form = new Form($db); -$formother = new FormOther($db); -$formadmin = new FormAdmin($db); - -print load_fiche_titre($langs->trans("PDF"), '', 'title_setup'); - -$head = pdf_admin_prepare_head(); - -print dol_get_fiche_head($head, 'recruitment', $langs->trans("recruitment"), -1, 'pdf'); - -print ''.$form->textwithpicto($langs->trans("PDFRecruitmentDesc"), $s)."
\n"; -print "
\n"; - -print '
'; -print ''; -print ''; - -print '
'; -print ''; -print ''; - - -print ''; - -print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("").''; - -print '
'; -print '
'; - - -print '
'; -print ''; -print '
'; - -print '
'; - - -// End of page -llxFooter(); -$db->close(); diff --git a/htdocs/admin/pdf_shipment.php b/htdocs/admin/pdf_shipment.php deleted file mode 100644 index d456a6fb2ea..00000000000 --- a/htdocs/admin/pdf_shipment.php +++ /dev/null @@ -1,110 +0,0 @@ - - * Copyright (C) 2004-2012 Laurent Destailleur - * Copyright (C) 2005-2011 Regis Houssin - * Copyright (C) 2012-2107 Juanjo Menent - * Copyright (C) 2019 Ferran Marcet - * Copyright (C) 2021 Anthony Berton - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file htdocs/admin/pdf.php - * \brief Page to setup PDF options - */ - -require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; - -// Load translation files required by the page -$langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'stocks', 'Trips')); - -if (!$user->admin) { - accessforbidden(); -} - -$action = GETPOST('action', 'aZ09'); -$cancel = GETPOST('cancel', 'alpha'); - - -/* - * Actions - */ - -if ($cancel) { - $action = ''; -} - -if ($action == 'update') { - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - - header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup"); - exit; -} - - - -/* - * View - */ - -$wikihelp = 'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones'; -llxHeader('', $langs->trans("Setup"), $wikihelp); - -$form = new Form($db); -$formother = new FormOther($db); -$formadmin = new FormAdmin($db); - -print load_fiche_titre($langs->trans("PDF"), '', 'title_setup'); - -$head = pdf_admin_prepare_head(); - -print dol_get_fiche_head($head, 'shipment', $langs->trans("shipment"), -1, 'pdf'); - -print ''.$form->textwithpicto($langs->trans("PDFShipmentDesc"), $s)."
\n"; -print "
\n"; - -print '
'; -print ''; -print ''; - -print '
'; -print ''; -print ''; - - -print ''; - -print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("").''; - -print '
'; -print '
'; - - -print '
'; -print ''; -print '
'; - -print '
'; - - -// End of page -llxFooter(); -$db->close(); diff --git a/htdocs/admin/pdf_stock.php b/htdocs/admin/pdf_stock.php deleted file mode 100644 index e6b0af587b0..00000000000 --- a/htdocs/admin/pdf_stock.php +++ /dev/null @@ -1,110 +0,0 @@ - - * Copyright (C) 2004-2012 Laurent Destailleur - * Copyright (C) 2005-2011 Regis Houssin - * Copyright (C) 2012-2107 Juanjo Menent - * Copyright (C) 2019 Ferran Marcet - * Copyright (C) 2021 Anthony Berton - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file htdocs/admin/pdf.php - * \brief Page to setup PDF options - */ - -require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; - -// Load translation files required by the page -$langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'stocks', 'Trips')); - -if (!$user->admin) { - accessforbidden(); -} - -$action = GETPOST('action', 'aZ09'); -$cancel = GETPOST('cancel', 'alpha'); - - -/* - * Actions - */ - -if ($cancel) { - $action = ''; -} - -if ($action == 'update') { - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - - header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup"); - exit; -} - - - -/* - * View - */ - -$wikihelp = 'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones'; -llxHeader('', $langs->trans("Setup"), $wikihelp); - -$form = new Form($db); -$formother = new FormOther($db); -$formadmin = new FormAdmin($db); - -print load_fiche_titre($langs->trans("PDF"), '', 'title_setup'); - -$head = pdf_admin_prepare_head(); - -print dol_get_fiche_head($head, 'stock', $langs->trans("Stock"), -1, 'pdf'); - -print ''.$form->textwithpicto($langs->trans("PDFStockDesc"), $s)."
\n"; -print "
\n"; - -print '
'; -print ''; -print ''; - -print '
'; -print ''; -print ''; - - -print ''; - -print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("").''; - -print '
'; -print '
'; - - -print '
'; -print ''; -print '
'; - -print '
'; - - -// End of page -llxFooter(); -$db->close(); diff --git a/htdocs/admin/pdf_supplierinvoice.php b/htdocs/admin/pdf_supplierinvoice.php deleted file mode 100644 index 57dd647139d..00000000000 --- a/htdocs/admin/pdf_supplierinvoice.php +++ /dev/null @@ -1,110 +0,0 @@ - - * Copyright (C) 2004-2012 Laurent Destailleur - * Copyright (C) 2005-2011 Regis Houssin - * Copyright (C) 2012-2107 Juanjo Menent - * Copyright (C) 2019 Ferran Marcet - * Copyright (C) 2021 Anthony Berton - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file htdocs/admin/pdf.php - * \brief Page to setup PDF options - */ - -require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; - -// Load translation files required by the page -$langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'stocks', 'Trips')); - -if (!$user->admin) { - accessforbidden(); -} - -$action = GETPOST('action', 'aZ09'); -$cancel = GETPOST('cancel', 'alpha'); - - -/* - * Actions - */ - -if ($cancel) { - $action = ''; -} - -if ($action == 'update') { - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - - header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup"); - exit; -} - - - -/* - * View - */ - -$wikihelp = 'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones'; -llxHeader('', $langs->trans("Setup"), $wikihelp); - -$form = new Form($db); -$formother = new FormOther($db); -$formadmin = new FormAdmin($db); - -print load_fiche_titre($langs->trans("PDF"), '', 'title_setup'); - -$head = pdf_admin_prepare_head(); - -print dol_get_fiche_head($head, 'supplierinvoice', $langs->trans("supplierinvoice"), -1, 'pdf'); - -print ''.$form->textwithpicto($langs->trans("PDFSupplierinvoiceDesc"), $s)."
\n"; -print "
\n"; - -print '
'; -print ''; -print ''; - -print '
'; -print ''; -print ''; - - -print ''; - -print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("").''; - -print '
'; -print '
'; - - -print '
'; -print ''; -print '
'; - -print '
'; - - -// End of page -llxFooter(); -$db->close(); diff --git a/htdocs/admin/pdf_supplierorder.php b/htdocs/admin/pdf_supplierorder.php deleted file mode 100644 index ecf0ad4cae8..00000000000 --- a/htdocs/admin/pdf_supplierorder.php +++ /dev/null @@ -1,110 +0,0 @@ - - * Copyright (C) 2004-2012 Laurent Destailleur - * Copyright (C) 2005-2011 Regis Houssin - * Copyright (C) 2012-2107 Juanjo Menent - * Copyright (C) 2019 Ferran Marcet - * Copyright (C) 2021 Anthony Berton - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file htdocs/admin/pdf.php - * \brief Page to setup PDF options - */ - -require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; - -// Load translation files required by the page -$langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'stocks', 'Trips')); - -if (!$user->admin) { - accessforbidden(); -} - -$action = GETPOST('action', 'aZ09'); -$cancel = GETPOST('cancel', 'alpha'); - - -/* - * Actions - */ - -if ($cancel) { - $action = ''; -} - -if ($action == 'update') { - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - - header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup"); - exit; -} - - - -/* - * View - */ - -$wikihelp = 'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones'; -llxHeader('', $langs->trans("Setup"), $wikihelp); - -$form = new Form($db); -$formother = new FormOther($db); -$formadmin = new FormAdmin($db); - -print load_fiche_titre($langs->trans("PDF"), '', 'title_setup'); - -$head = pdf_admin_prepare_head(); - -print dol_get_fiche_head($head, 'supplierorder', $langs->trans("supplierorder"), -1, 'pdf'); - -print ''.$form->textwithpicto($langs->trans("PDFSupplierorderDesc"), $s)."
\n"; -print "
\n"; - -print '
'; -print ''; -print ''; - -print '
'; -print ''; -print ''; - - -print ''; - -print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("").''; - -print '
'; -print '
'; - - -print '
'; -print ''; -print '
'; - -print '
'; - - -// End of page -llxFooter(); -$db->close(); diff --git a/htdocs/admin/pdf_supplierproposal.php b/htdocs/admin/pdf_supplierproposal.php deleted file mode 100644 index 3fb929ed797..00000000000 --- a/htdocs/admin/pdf_supplierproposal.php +++ /dev/null @@ -1,110 +0,0 @@ - - * Copyright (C) 2004-2012 Laurent Destailleur - * Copyright (C) 2005-2011 Regis Houssin - * Copyright (C) 2012-2107 Juanjo Menent - * Copyright (C) 2019 Ferran Marcet - * Copyright (C) 2021 Anthony Berton - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file htdocs/admin/pdf.php - * \brief Page to setup PDF options - */ - -require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; - -// Load translation files required by the page -$langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'stocks', 'Trips')); - -if (!$user->admin) { - accessforbidden(); -} - -$action = GETPOST('action', 'aZ09'); -$cancel = GETPOST('cancel', 'alpha'); - - -/* - * Actions - */ - -if ($cancel) { - $action = ''; -} - -if ($action == 'update') { - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - - header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup"); - exit; -} - - - -/* - * View - */ - -$wikihelp = 'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones'; -llxHeader('', $langs->trans("Setup"), $wikihelp); - -$form = new Form($db); -$formother = new FormOther($db); -$formadmin = new FormAdmin($db); - -print load_fiche_titre($langs->trans("PDF"), '', 'title_setup'); - -$head = pdf_admin_prepare_head(); - -print dol_get_fiche_head($head, 'supplierproposal', $langs->trans("supplierproposal"), -1, 'pdf'); - -print ''.$form->textwithpicto($langs->trans("PDFSupplierproposalDesc"), $s)."
\n"; -print "
\n"; - -print '
'; -print ''; -print ''; - -print '
'; -print ''; -print ''; - - -print ''; - -print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("").''; - -print '
'; -print '
'; - - -print '
'; -print ''; -print '
'; - -print '
'; - - -// End of page -llxFooter(); -$db->close(); diff --git a/htdocs/admin/pdf_ticket.php b/htdocs/admin/pdf_ticket.php deleted file mode 100644 index 5ca775e2447..00000000000 --- a/htdocs/admin/pdf_ticket.php +++ /dev/null @@ -1,110 +0,0 @@ - - * Copyright (C) 2004-2012 Laurent Destailleur - * Copyright (C) 2005-2011 Regis Houssin - * Copyright (C) 2012-2107 Juanjo Menent - * Copyright (C) 2019 Ferran Marcet - * Copyright (C) 2021 Anthony Berton - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file htdocs/admin/pdf.php - * \brief Page to setup PDF options - */ - -require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; - -// Load translation files required by the page -$langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'stocks', 'Trips')); - -if (!$user->admin) { - accessforbidden(); -} - -$action = GETPOST('action', 'aZ09'); -$cancel = GETPOST('cancel', 'alpha'); - - -/* - * Actions - */ - -if ($cancel) { - $action = ''; -} - -if ($action == 'update') { - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - - header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup"); - exit; -} - - - -/* - * View - */ - -$wikihelp = 'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones'; -llxHeader('', $langs->trans("Setup"), $wikihelp); - -$form = new Form($db); -$formother = new FormOther($db); -$formadmin = new FormAdmin($db); - -print load_fiche_titre($langs->trans("PDF"), '', 'title_setup'); - -$head = pdf_admin_prepare_head(); - -print dol_get_fiche_head($head, 'ticket', $langs->trans("Ticket"), -1, 'pdf'); - -print ''.$form->textwithpicto($langs->trans("PDFTicketDesc"), $s)."
\n"; -print "
\n"; - -print '
'; -print ''; -print ''; - -print '
'; -print ''; -print ''; - - -print ''; - -print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("").''; - -print '
'; -print '
'; - - -print '
'; -print ''; -print '
'; - -print '
'; - - -// End of page -llxFooter(); -$db->close(); diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 755f292132e..086152a974b 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -49,7 +49,7 @@ function pdf_admin_prepare_head() $head = array(); $head[$h][0] = DOL_URL_ROOT.'/admin/pdf.php'; - $head[$h][1] = $langs->trans("Général"); + $head[$h][1] = $langs->trans("Common"); $head[$h][2] = 'general'; $h++; @@ -59,105 +59,10 @@ function pdf_admin_prepare_head() // $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab complete_head_from_modules($conf, $langs, null, $head, $h, 'pdf_admin'); - if (1 == 2 && !empty($conf->adherent->enabled)) { - $head[$h][0] = DOL_URL_ROOT.'/admin/pdf_adherent.php'; - $head[$h][1] = $langs->trans("Adherent"); - $head[$h][2] = 'adherent'; - $h++; - } - if (1 == 2 && !empty($conf->projet->enabled)) { - $head[$h][0] = DOL_URL_ROOT.'/admin/pdf_project.php'; - $head[$h][1] = $langs->trans("Project"); - $head[$h][2] = 'project'; - $h++; - } if (!empty($conf->propal->enabled)) { - $head[$h][0] = DOL_URL_ROOT.'/admin/pdf_proposal.php'; - $head[$h][1] = $langs->trans("Proposal"); - $head[$h][2] = 'proposal'; - $h++; - } - if (1 == 2 && !empty($conf->commande->enabled)) { - $head[$h][0] = DOL_URL_ROOT.'/admin/pdf_order.php'; - $head[$h][1] = $langs->trans("Order"); - $head[$h][2] = 'order'; - $h++; - } - if (1 == 2 && !empty($conf->facture->enabled)) { - $head[$h][0] = DOL_URL_ROOT.'/admin/pdf_invoice.php'; - $head[$h][1] = $langs->trans("Invoice"); - $head[$h][2] = 'invoice'; - $h++; - } - if (1 == 2 && !empty($conf->expedition->enabled)) { - $head[$h][0] = DOL_URL_ROOT.'/admin/pdf_shipment.php'; - $head[$h][1] = $langs->trans("Sendings"); - $head[$h][2] = 'shipment'; - $h++; - } - if (1 == 2 && !empty($conf->reception->enabled)) { - $head[$h][0] = DOL_URL_ROOT.'/admin/pdf_reception.php'; - $head[$h][1] = $langs->trans("Reception"); - $head[$h][2] = 'reception'; - $h++; - } - if (1 == 2 && !empty($conf->ticket->enabled)) { - $head[$h][0] = DOL_URL_ROOT.'/admin/pdf_ticket.php'; - $head[$h][1] = $langs->trans("Ticket"); - $head[$h][2] = 'ticket'; - $h++; - } - if (1 == 2 && !empty($conf->ficheinter->enabled)) { - $head[$h][0] = DOL_URL_ROOT.'/admin/pdf_intervention.php'; - $head[$h][1] = $langs->trans("Intervention"); - $head[$h][2] = 'intervention'; - $h++; - } - if (1 == 2 && !empty($conf->supplier_proposal->enabled)) { - $head[$h][0] = DOL_URL_ROOT.'/admin/pdf_supplierproposal.php'; - $head[$h][1] = $langs->trans("SupplierProposal"); - $head[$h][2] = 'supplierproposal'; - $h++; - } - if (1 == 2 && !empty($conf->fournisseur->enabled)) { - $head[$h][0] = DOL_URL_ROOT.'/admin/pdf_supplierorder.php'; - $head[$h][1] = $langs->trans("SupplierOrder"); - $head[$h][2] = 'supplierorder'; - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/admin/pdf_supplierinvoice.php'; - $head[$h][1] = $langs->trans("SuppliersInvoice"); - $head[$h][2] = 'supplierinvoice'; - $h++; - } - if (1 == 2 && !empty($conf->recruitment->enabled)) { - $head[$h][0] = DOL_URL_ROOT.'/admin/pdf_recruitment.php'; - $head[$h][1] = $langs->trans("Recruitment"); - $head[$h][2] = 'recruitment'; - $h++; - } - if (1 == 2 && !empty($conf->contrat->enabled)) { - $head[$h][0] = DOL_URL_ROOT.'/admin/pdf_contrat.php'; - $head[$h][1] = $langs->trans("Contrat"); - $head[$h][2] = 'contrat'; - $h++; - } - if (1 == 2 && !empty($conf->stock->enabled)) { - $head[$h][0] = DOL_URL_ROOT.'/admin/pdf_stock.php'; - $head[$h][1] = $langs->trans("Stock"); - $head[$h][2] = 'stock'; - $h++; - } - if (1 == 2 && !empty($conf->holiday->enabled)) { - $head[$h][0] = DOL_URL_ROOT.'/admin/pdf_holiday.php'; - $head[$h][1] = $langs->trans("Holidays"); - $head[$h][2] = 'holiday'; - $h++; - } - if (1 == 2 && !empty($conf->expensereport->enabled)) { - $head[$h][0] = DOL_URL_ROOT.'/admin/pdf_expensereport.php'; - $head[$h][1] = $langs->trans("Trips"); - $head[$h][2] = 'expensereport'; + $head[$h][0] = DOL_URL_ROOT.'/admin/pdf_other.php'; + $head[$h][1] = $langs->trans("Other"); + $head[$h][2] = 'other'; $h++; } diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index ef1573645a2..d803593bc3e 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -399,23 +399,7 @@ SecurityToken=Key to secure URLs NoSmsEngine=No SMS sender manager available. A SMS sender manager is not installed with the default distribution because they depend on an external vendor, but you can find some on %s PDF=PDF PDFDesc=Global options for PDF generation -PDFProjectDesc=PDF Option for project -PDFProposalDesc=PDF Option for proposal -PDFOrderDesc=PDF Option for order -PDFInvoiceDesc=PDF Option for invoice -PDFShipmentDesc=PDF Option for shipment -PDFReceptionDesc=PDF Option for reception -PDFTicketDesc=PDF Option for ticket -PDFInterventionDesc=PDF option for intervention -PDFSupplierproposalDesc=PDF Option for supplier proposal -PDFSupplierorderDesc=PDF Option for supplier order -PDFSupplierinvoiceDesc=PDF Option for supplier invoice -PDFRecruitmentDesc=PDF Option for recrutment -PDFContratDesc=PDF Option for contrat -PDFStockDesc=PDF Option for stock -PDFHolidaytDesc=PDF Option for holiday -PDFExpensereportDesc=PDF Option for Expensereport -PDFAdherentDescPDF Option for Adhrent +PDFOtherDesc=PDF Option specific to some modules PDFAddressForging=Rules for address section HideAnyVATInformationOnPDF=Hide all information related to Sales Tax / VAT PDFRulesForSalesTax=Rules for Sales Tax / VAT From 816acaa4c22493e3c6d8a996565c25b3f814a147 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 4 May 2021 00:17:47 +0200 Subject: [PATCH 143/147] css --- htdocs/admin/pdf.php | 11 ++++++----- htdocs/admin/pdf_other.php | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/htdocs/admin/pdf.php b/htdocs/admin/pdf.php index 01645c6cccc..7d7b5e36a40 100644 --- a/htdocs/admin/pdf.php +++ b/htdocs/admin/pdf.php @@ -182,7 +182,7 @@ print load_fiche_titre($langs->trans("DictionaryPaperFormat"), '', ''); print '
'; print ''; -print ''; +print ''; $selected = (isset($conf->global->MAIN_PDF_FORMAT) ? $conf->global->MAIN_PDF_FORMAT : ''); if (empty($selected)) { @@ -219,7 +219,7 @@ print load_fiche_titre($langs->trans("PDFAddressForging"), '', ''); print '
'; print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'; -print ''; +print ''; // Hide VAT Intra on address @@ -266,7 +266,7 @@ $text = ''; if ($mysoc->useLocalTax(1) || $mysoc->useLocalTax(2)) { if ($mysoc->useLocalTax(1)) { $locales = $langs->transcountry("LT1", $mysoc->country_code); - $text = '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("HideLocalTaxOnPDF", $langs->transcountry("LT1", $mysoc->country_code)).''; + $text = '
'.$langs->trans("HideLocalTaxOnPDF", $langs->transcountry("LT1", $mysoc->country_code)).''; if ($conf->use_javascript_ajax) { $text .= ajax_constantonoff('MAIN_PDF_MAIN_HIDE_SECOND_TAX'); } else { @@ -278,7 +278,7 @@ if ($mysoc->useLocalTax(1) || $mysoc->useLocalTax(2)) { if ($mysoc->useLocalTax(2)) { $locales .= ($locales ? ' & ' : '').$langs->transcountry("LT2", $mysoc->country_code); - $text .= '
'.$langs->trans("HideLocalTaxOnPDF", $langs->transcountry("LT2", $mysoc->country_code)).''; + $text .= '
'.$langs->trans("HideLocalTaxOnPDF", $langs->transcountry("LT2", $mysoc->country_code)).''; if ($conf->use_javascript_ajax) { $text .= ajax_constantonoff('MAIN_PDF_MAIN_HIDE_THIRD_TAX'); } else { @@ -293,10 +293,11 @@ if ($mysoc->useLocalTax(1) || $mysoc->useLocalTax(2)) { $title .= ' - '.$langs->trans("PDFLocaltax", $locales); } + print load_fiche_titre($title, '', ''); print ''; -print ''; +print ''; // Hide any information on Sale tax / VAT diff --git a/htdocs/admin/pdf_other.php b/htdocs/admin/pdf_other.php index 9120e101232..8a757a7d34c 100644 --- a/htdocs/admin/pdf_other.php +++ b/htdocs/admin/pdf_other.php @@ -89,7 +89,7 @@ print ''; print '
'; print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'; -print ''; +print ''; print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("MAIN_GENERATE_PROPOSALS_WITH_PICTURE").''; if ($conf->use_javascript_ajax) { From da08670a3dd3685ad42d5942dd47f3d190ee78a3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 4 May 2021 00:24:32 +0200 Subject: [PATCH 144/147] Update 13.0.0-14.0.0.sql --- htdocs/install/mysql/migration/13.0.0-14.0.0.sql | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql index 956e0824754..af6c2f48f50 100644 --- a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql +++ b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql @@ -449,7 +449,6 @@ ALTER TABLE llx_payment_donation ADD COLUMN ext_payment_id varchar(128) AFTER n -- Rebuild sequence for postgres only after query INSERT INTO llx_salary(rowid, ... -- VPGSQL8.2 SELECT dol_util_rebuild_sequences(); -UPDATE llx_const SET value = 'github' WHERE __DECRYPT('name')__ = 'MAIN_BUGTRACK_ENABLELINK' AND __DECRYPT('value')__ = 1; UPDATE llx_const SET value = 'github' WHERE __DECRYPT('name')__ = 'MAIN_BUGTRACK_ENABLELINK' AND __DECRYPT('value')__ = 1; ALTER TABLE llx_facture_fourn_det ADD COLUMN fk_remise_except integer DEFAULT NULL after remise_percent; From 1d0c0a8d2a7af5d4db370d201497f5a287f9c0fb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 4 May 2021 00:35:36 +0200 Subject: [PATCH 145/147] Fix phpcs --- .../interface_50_modAgenda_ActionsAuto.class.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php index cdb490e330c..8e98030b484 100644 --- a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php +++ b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php @@ -111,16 +111,16 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->sendtoid = 0; $object->socid = $object->id; } elseif ($action == 'COMPANY_MODIFY') { - // Load translation files required by the page - $langs->loadLangs(array("agenda", "other", "companies")); + // Load translation files required by the page + $langs->loadLangs(array("agenda", "other", "companies")); - if (empty($object->actionmsg2)) { - $object->actionmsg2 = $langs->transnoentities("COMPANY_MODIFYInDolibarr", $object->name); - } - $object->actionmsg = $langs->transnoentities("COMPANY_MODIFYInDolibarr", $object->name); + if (empty($object->actionmsg2)) { + $object->actionmsg2 = $langs->transnoentities("COMPANY_MODIFYInDolibarr", $object->name); + } + $object->actionmsg = $langs->transnoentities("COMPANY_MODIFYInDolibarr", $object->name); - $object->sendtoid = 0; - $object->socid = $object->id; + $object->sendtoid = 0; + $object->socid = $object->id; } elseif ($action == 'COMPANY_SENTBYMAIL') { // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "orders")); From 08dbe74643e93220dbf6fe33418d52b136e194c1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 4 May 2021 01:10:53 +0200 Subject: [PATCH 146/147] Fix code not reachable --- htdocs/user/class/api_users.class.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/htdocs/user/class/api_users.class.php b/htdocs/user/class/api_users.class.php index 784a61d5fa8..f5f0b73a70f 100644 --- a/htdocs/user/class/api_users.class.php +++ b/htdocs/user/class/api_users.class.php @@ -312,7 +312,6 @@ class Users extends DolibarrApi if (in_array($field, array('pass_crypted', 'pass_indatabase', 'pass_indatabase_crypted', 'pass_temp', 'api_key'))) { // This properties can't be set/modified with API throw new RestException(401, 'The property '.$field." can't be set/modified using the APIs"); - continue; } /*if ($field == 'pass') { if (empty(DolibarrApiAccess::$user->rights->user->user->password)) { @@ -366,7 +365,6 @@ class Users extends DolibarrApi if (in_array($field, array('pass_crypted', 'pass_indatabase', 'pass_indatabase_crypted', 'pass_temp', 'api_key'))) { // This properties can't be set/modified with API throw new RestException(401, 'The property '.$field." can't be set/modified using the APIs"); - continue; } if ($field == 'pass') { if ($this->useraccount->id != DolibarrApiAccess::$user->id && empty(DolibarrApiAccess::$user->rights->user->user->password)) { From 36c6a41b1bd6b86aaaaf81d3bd571a3504210002 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 4 May 2021 01:14:44 +0200 Subject: [PATCH 147/147] Fix non traversable case --- htdocs/blockedlog/ajax/check_signature.php | 6 ++++-- htdocs/blockedlog/class/authority.class.php | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/htdocs/blockedlog/ajax/check_signature.php b/htdocs/blockedlog/ajax/check_signature.php index cc91182293e..ba164e3e715 100644 --- a/htdocs/blockedlog/ajax/check_signature.php +++ b/htdocs/blockedlog/ajax/check_signature.php @@ -55,8 +55,10 @@ $blocks = $block_static->getLog('just_certified', 0, 0, 'rowid', 'ASC'); $auth->signature = $block_static->getSignature(); -foreach ($blocks as &$b) { - $auth->blockchain .= $b->signature; +if (is_array($bocks)) { + foreach ($blocks as &$b) { + $auth->blockchain .= $b->signature; + } } $hash = $auth->getBlockchainHash(); diff --git a/htdocs/blockedlog/class/authority.class.php b/htdocs/blockedlog/class/authority.class.php index 2071eb03c47..4ec3fc6d07e 100644 --- a/htdocs/blockedlog/class/authority.class.php +++ b/htdocs/blockedlog/class/authority.class.php @@ -71,8 +71,10 @@ class BlockedLogAuthority $this->blockchain = ''; - foreach ($blocks as &$b) { - $this->blockchain .= $b->signature; + if (is_array($bocks)) { + foreach ($blocks as &$b) { + $this->blockchain .= $b->signature; + } } return $this->blockchain;