From 37193557dfc97b62d645fcc02b811e4dedd4e317 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 9 Dec 2020 08:36:52 +0100 Subject: [PATCH 01/18] FIX rename hook to be more explicit and $test = false --- htdocs/main.inc.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 2753a4e1fc8..1b6179fdc81 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -565,12 +565,15 @@ if (!defined('NOLOGIN')) // Hooks for security access $action = ''; $hookmanager->initHooks(array('login')); - $parameters = array('dol_authmode'=>$dol_authmode); - $reshook = $hookmanager->executeHooks('loginCheckSecurityAccess', $parameters, $user, $action); // Note that $action and $object may have been modified by some hooks - if ($reshook < 0) $error++; + $parameters = array(); + $reshook = $hookmanager->executeHooks('beforeLoginAuthentication', $parameters, $user, $action); // Note that $action and $object may have been modified by some hooks + if ($reshook < 0) { + $test = false; + $error++; + } // Verification security graphic code - if (GETPOST("username", "alpha", 2) && !empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA) && !isset($_SESSION['dol_bypass_antispam'])) + if ($test && GETPOST("username", "alpha", 2) && !empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA) && !isset($_SESSION['dol_bypass_antispam'])) { $sessionkey = 'dol_antispam_value'; $ok = (array_key_exists($sessionkey, $_SESSION) === true && (strtolower($_SESSION[$sessionkey]) == strtolower($_POST['code']))); From c18e8ac3173169f31c334f7e42a93d74eb333d97 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 9 Dec 2020 09:28:46 +0100 Subject: [PATCH 02/18] FIX regenerate mycompany logos thumbs if not exists --- htdocs/admin/company.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index 51d7f84aae7..da955a67ea4 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -478,6 +478,14 @@ if (!empty($mysoc->logo_small)) { print '
'; print ''; print '
'; + } elseif (!empty($mysoc->logo)) { + if (!file_exists($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini)) { + $imgThumbMini = vignette($conf->mycompany->dir_output.'/logos/'.$mysoc->logo, $maxwidthmini, $maxheightmini, '_mini', $quality); + } + $imgThumbSmall = vignette($conf->mycompany->dir_output.'/logos/'.$mysoc->logo, $maxwidthmini, $maxheightmini, '_small', $quality); + print '
'; + print ''; + print '
'; } print ''; } elseif (!empty($mysoc->logo)) { @@ -505,6 +513,14 @@ if (!empty($mysoc->logo_squarred_small)) { print '
'; print ''; print '
'; + } elseif (!empty($mysoc->logo_squarred)) { + if (!file_exists($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_squarred_mini)) { + $imgThumbMini = vignette($conf->mycompany->dir_output.'/logos/'.$mysoc->logo_squarred, $maxwidthmini, $maxheightmini, '_mini', $quality); + } + $imgThumbSmall = vignette($conf->mycompany->dir_output.'/logos/'.$mysoc->logo_squarred, $maxwidthmini, $maxheightmini, '_small', $quality); + print '
'; + print ''; + print '
'; } print ''; } elseif (!empty($mysoc->logo_squarred)) { From 29b682d8109161356899b37a9752f3c7a93e0ead Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Wed, 9 Dec 2020 10:35:30 +0100 Subject: [PATCH 03/18] fix extrafield checkbox from table (#CroudFounding_DarkJeff_2021) --- htdocs/core/actions_extrafields.inc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/actions_extrafields.inc.php b/htdocs/core/actions_extrafields.inc.php index 2b5b38441e0..7ba4d7d64b9 100644 --- a/htdocs/core/actions_extrafields.inc.php +++ b/htdocs/core/actions_extrafields.inc.php @@ -159,7 +159,7 @@ if ($action == 'add') $parameters = $param; $parameters_array = explode("\r\n", $parameters); //In sellist we have only one line and it can have come to do SQL expression - if ($type == 'sellist') { + if ($type == 'sellist' || $type == 'chkbxlst') { foreach ($parameters_array as $param_ligne) { $params['options'] = array($parameters=>null); @@ -338,7 +338,7 @@ if ($action == 'update') $parameters = $param; $parameters_array = explode("\r\n", $parameters); //In sellist we have only one line and it can have come to do SQL expression - if ($type == 'sellist') { + if ($type == 'sellist' || $type == 'chkbxlst') { foreach ($parameters_array as $param_ligne) { $params['options'] = array($parameters=>null); From 7459607eb9beb41c0e120eff701e09f2f79a71a3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 9 Dec 2020 12:23:37 +0100 Subject: [PATCH 04/18] Look fix --- htdocs/public/opensurvey/studs.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/public/opensurvey/studs.php b/htdocs/public/opensurvey/studs.php index 95045d2e943..8cc9a82ad3c 100644 --- a/htdocs/public/opensurvey/studs.php +++ b/htdocs/public/opensurvey/studs.php @@ -729,7 +729,7 @@ if ($comments) // Form to add comment if ($object->allow_comments) { - print '
'.$langs->trans("AddACommentForPoll")."
\n"; + print '
'.$langs->trans("AddACommentForPoll")."
\n"; print '
'."\n"; print $langs->trans("Name").': '; From 89828c18d157602761192b03584c8427a1f9091c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 9 Dec 2020 12:32:21 +0100 Subject: [PATCH 05/18] CSS --- htdocs/public/opensurvey/studs.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/public/opensurvey/studs.php b/htdocs/public/opensurvey/studs.php index 8cc9a82ad3c..3f19fb68b7e 100644 --- a/htdocs/public/opensurvey/studs.php +++ b/htdocs/public/opensurvey/studs.php @@ -535,7 +535,7 @@ while ($compteur < $num) // Button edit at end of line if ($compteur != $ligneamodifier && $mod_ok) { - print ''."\n"; + print ''."\n"; } //demande de confirmation pour modification de ligne From d7434ce97ab8c26925498138e150efa5b010ef93 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 9 Dec 2020 12:42:21 +0100 Subject: [PATCH 06/18] Fix css --- 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 fcd196ff122..b0ddba41b5c 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -4613,7 +4613,7 @@ table.cal_event td.cal_event_right { padding: 4px 4px !important; } .cal_event a:link { color: #111111; font-weight: normal !important; } .cal_event a:visited { color: #111111; font-weight: normal !important; } .cal_event a:active { color: #111111; font-weight: normal !important; } -.cal_event_notbusy a.cal_event_title:hover { color: #111111; font-weight: normal !important; color:rgba(255,255,255,.75); } +.cal_event_notbusy a.cal_event_title:hover { color: #111111; font-weight: normal !important; } .cal_event_busy { } .cal_peruserviewname { max-width: 140px; height: 30px !important; } .cal_event span.badge.badge-status { border: 1px solid #aaa; } From 5ef73bf88274d2f9167eee4631058bf6e10c97e9 Mon Sep 17 00:00:00 2001 From: Jools Date: Wed, 9 Dec 2020 16:26:31 +0100 Subject: [PATCH 07/18] Change module_part to modulepart --- htdocs/api/class/api_documents.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/api/class/api_documents.class.php b/htdocs/api/class/api_documents.class.php index 550d78068a4..92404b81a35 100644 --- a/htdocs/api/class/api_documents.class.php +++ b/htdocs/api/class/api_documents.class.php @@ -120,7 +120,7 @@ class Documents extends DolibarrApi /** * Build a document. * - * Test sample 1: { "module_part": "invoice", "original_file": "FA1701-001/FA1701-001.pdf", "doctemplate": "crabe", "langcode": "fr_FR" }. + * Test sample 1: { "modulepart": "invoice", "original_file": "FA1701-001/FA1701-001.pdf", "doctemplate": "crabe", "langcode": "fr_FR" }. * * @param string $modulepart Name of module or area concerned by file download ('invoice', 'order', ...). * @param string $original_file Relative path with filename, relative to modulepart (for example: IN201701-999/IN201701-999.pdf). From 51738e7e60f02d0ce5954073efa6bd0cbd8810be Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 9 Dec 2020 17:02:26 +0100 Subject: [PATCH 08/18] Fix links into translation strings --- htdocs/compta/resultat/clientfourn.php | 22 ++++++++++++----- htdocs/compta/resultat/index.php | 30 ++++++++++++++--------- htdocs/compta/stats/index.php | 2 +- htdocs/compta/stats/supplier_turnover.php | 14 +++++------ 4 files changed, 43 insertions(+), 25 deletions(-) diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index 9b505a20a43..8a1655cdefb 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -144,8 +144,12 @@ if ($modecompta == "CREANCES-DETTES") { $name = $langs->trans("ReportInOut").', '.$langs->trans("ByPredefinedAccountGroups"); $calcmode = $langs->trans("CalcModeDebt"); - $calcmode .= '
('.$langs->trans("SeeReportInInputOutputMode", '', '').')'; - if (!empty($conf->accounting->enabled)) $calcmode .= '
('.$langs->trans("SeeReportInBookkeepingMode", '', '').')'; + $calcmode .= '
('.$langs->trans("SeeReportInInputOutputMode", '{s1}', '{s2}').')'; + $calcmode = str_replace(array('{s1}', '{s2}'), array('', ''), $calcmode); + if (!empty($conf->accounting->enabled)) { + $calcmode .= '
('.$langs->trans("SeeReportInBookkeepingMode", '{s1}', '{s2}').')'; + $calcmode = str_replace(array('{s1}', '{s2}'), array('', ''), $calcmode); + } $period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0); $periodlink = ($year_start ? "".img_previous()." ".img_next()."" : ""); $description = $langs->trans("RulesResultDue"); @@ -157,8 +161,12 @@ if ($modecompta == "CREANCES-DETTES") { $name = $langs->trans("ReportInOut").', '.$langs->trans("ByPredefinedAccountGroups"); $calcmode = $langs->trans("CalcModeEngagement"); - $calcmode .= '
('.$langs->trans("SeeReportInDueDebtMode", '', '').')'; - if (!empty($conf->accounting->enabled)) $calcmode .= '
('.$langs->trans("SeeReportInBookkeepingMode", '', '').')'; + $calcmode .= '
('.$langs->trans("SeeReportInDueDebtMode", '{s1}', '{s2}').')'; + $calcmode = str_replace(array('{s1}', '{s2}'), array('', ''), $calcmode); + if (!empty($conf->accounting->enabled)) { + $calcmode .= '
('.$langs->trans("SeeReportInBookkeepingMode", '{s1}', '{s2}').')'; + $calcmode = str_replace(array('{s1}', '{s2}'), array('', ''), $calcmode); + } $period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0); $periodlink = ($year_start ? "".img_previous()." ".img_next()."" : ""); $description = $langs->trans("RulesResultInOut"); @@ -168,8 +176,10 @@ if ($modecompta == "CREANCES-DETTES") { $name = $langs->trans("ReportInOut").', '.$langs->trans("ByPredefinedAccountGroups"); $calcmode = $langs->trans("CalcModeBookkeeping"); - $calcmode .= '
('.$langs->trans("SeeReportInInputOutputMode", '', '').')'; - $calcmode .= '
('.$langs->trans("SeeReportInDueDebtMode", '', '').')'; + $calcmode .= '
('.$langs->trans("SeeReportInInputOutputMode", '{s1}', '{s2}').')'; + $calcmode = str_replace(array('{s1}', '{s2}'), array('', ''), $calcmode); + $calcmode .= '
('.$langs->trans("SeeReportInDueDebtMode", '{s1}', '{s2}').')'; + $calcmode = str_replace(array('{s1}', '{s2}'), array('', ''), $calcmode); $period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0); $arraylist = array('no'=>$langs->trans("No"), 'yes'=>$langs->trans("AccountWithNonZeroValues"), 'all'=>$langs->trans("All")); $period .= '     '.$langs->trans("DetailByAccount").' '.$form->selectarray('showaccountdetail', $arraylist, $showaccountdetail, 0); diff --git a/htdocs/compta/resultat/index.php b/htdocs/compta/resultat/index.php index 15ec1526260..e5d0c4f85d3 100644 --- a/htdocs/compta/resultat/index.php +++ b/htdocs/compta/resultat/index.php @@ -123,8 +123,12 @@ if ($modecompta == 'CREANCES-DETTES') { $name = $langs->trans("ReportInOut").', '.$langs->trans("ByYear"); $calcmode = $langs->trans("CalcModeDebt"); - $calcmode .= '
('.$langs->trans("SeeReportInInputOutputMode", '', '').')'; - if (!empty($conf->accounting->enabled)) $calcmode .= '
('.$langs->trans("SeeReportInBookkeepingMode", '', '').')'; + $calcmode .= '
('.$langs->trans("SeeReportInInputOutputMode", '{s1}', '{s2}').')'; + $calcmode = str_replace(array('{s1}', '{s2}'), array('', ''), $calcmode); + if (!empty($conf->accounting->enabled)) { + $calcmode .= '
('.$langs->trans("SeeReportInBookkeepingMode", '{s1}', '{s2}').')'; + $calcmode = str_replace(array('{s1}', '{s2}'), array('', ''), $calcmode); + } $period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0); $periodlink = ($year_start ? "".img_previous()." ".img_next()."" : ""); $description = $langs->trans("RulesAmountWithTaxIncluded"); @@ -136,8 +140,12 @@ if ($modecompta == 'CREANCES-DETTES') } elseif ($modecompta == "RECETTES-DEPENSES") { $name = $langs->trans("ReportInOut").', '.$langs->trans("ByYear"); $calcmode = $langs->trans("CalcModeEngagement"); - $calcmode .= '
('.$langs->trans("SeeReportInDueDebtMode", '', '').')'; - if (!empty($conf->accounting->enabled)) $calcmode .= '
('.$langs->trans("SeeReportInBookkeepingMode", '', '').')'; + $calcmode .= '
('.$langs->trans("SeeReportInDueDebtMode", '{s1}', '{s2}').')'; + $calcmode = str_replace(array('{s1}', '{s2}'), array('', ''), $calcmode); + if (!empty($conf->accounting->enabled)) { + $calcmode .= '
('.$langs->trans("SeeReportInBookkeepingMode", '{s1}', '{s2}').')'; + $calcmode = str_replace(array('{s1}', '{s2}'), array('', ''), $calcmode); + } $period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0); $periodlink = ($year_start ? "".img_previous()." ".img_next()."" : ""); $description = $langs->trans("RulesAmountWithTaxIncluded"); @@ -148,8 +156,10 @@ if ($modecompta == 'CREANCES-DETTES') { $name = $langs->trans("ReportInOut").', '.$langs->trans("ByYear"); $calcmode = $langs->trans("CalcModeBookkeeping"); - $calcmode .= '
('.$langs->trans("SeeReportInInputOutputMode", '', '').')'; - $calcmode .= '
('.$langs->trans("SeeReportInDueDebtMode", '', '').')'; + $calcmode .= '
('.$langs->trans("SeeReportInInputOutputMode", '{s1}', '{s2}').')'; + $calcmode = str_replace(array('{s1}', '{s2}'), array('', ''), $calcmode); + $calcmode .= '
('.$langs->trans("SeeReportInDueDebtMode", '{s1}', '{s2}').')'; + $calcmode = str_replace(array('{s1}', '{s2}'), array('', ''), $calcmode); $period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0); $periodlink = ($year_start ? "".img_previous()." ".img_next()."" : ""); $description = $langs->trans("RulesAmountOnInOutBookkeepingRecord"); @@ -818,17 +828,15 @@ if (!empty($conf->global->ACCOUNTING_REPORTS_INCLUDE_LOAN) && !empty($conf->loan if (!empty($conf->accounting->enabled) && ($modecompta == 'BOOKKEEPING')) { $predefinedgroupwhere = "("; - //$predefinedgroupwhere.= " (pcg_type = 'EXPENSE' and pcg_subtype in ('PRODUCT','SERVICE'))"; - $predefinedgroupwhere .= " (pcg_type = 'EXPENSE')"; + $predefinedgroupwhere .= " (aa.pcg_type = 'EXPENSE')"; $predefinedgroupwhere .= " OR "; - //$predefinedgroupwhere.= " (pcg_type = 'INCOME' and pcg_subtype in ('PRODUCT','SERVICE'))"; - $predefinedgroupwhere .= " (pcg_type = 'INCOME')"; + $predefinedgroupwhere .= " (aa.pcg_type = 'INCOME')"; $predefinedgroupwhere .= ")"; $charofaccountstring = $conf->global->CHARTOFACCOUNTS; $charofaccountstring = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version'); - $sql = "SELECT b.doc_ref, b.numero_compte, b.subledger_account, b.subledger_label, pcg_type, date_format(b.doc_date,'%Y-%m') as dm, sum(b.debit) as debit, sum(b.credit) as credit, sum(b.montant) as amount"; + $sql = "SELECT b.doc_ref, b.numero_compte, b.subledger_account, b.subledger_label, aa.pcg_type, date_format(b.doc_date,'%Y-%m') as dm, sum(b.debit) as debit, sum(b.credit) as credit, sum(b.montant) as amount"; $sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as b, ".MAIN_DB_PREFIX."accounting_account as aa"; $sql .= " WHERE b.entity = ".$conf->entity; $sql .= " AND aa.entity = ".$conf->entity; diff --git a/htdocs/compta/stats/index.php b/htdocs/compta/stats/index.php index 93f91b25449..0be6659f7b4 100644 --- a/htdocs/compta/stats/index.php +++ b/htdocs/compta/stats/index.php @@ -122,7 +122,7 @@ if ($modecompta == "CREANCES-DETTES") $name = $langs->trans("Turnover"); $calcmode = $langs->trans("CalcModeDebt"); //$calcmode.='
('.$langs->trans("SeeReportInInputOutputMode",'','').')'; - $calcmode .= '
('.$langs->trans("SeeReportInBookkeepingMode", '{links1}', '{link2}').')'; + $calcmode .= '
('.$langs->trans("SeeReportInBookkeepingMode", '{link1}', '{link2}').')'; $calcmode = str_replace('{link1}', '', $calcmode); $calcmode = str_replace('{link2}', '', $calcmode); $period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0); diff --git a/htdocs/compta/stats/supplier_turnover.php b/htdocs/compta/stats/supplier_turnover.php index f98518ae7ee..eeb1c142712 100644 --- a/htdocs/compta/stats/supplier_turnover.php +++ b/htdocs/compta/stats/supplier_turnover.php @@ -59,7 +59,7 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end { // We define date_start and date_end $year_end = $year_start + ($nbofyear - 1); - $month_start = GETPOST("month") ?GETPOST("month") : ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1); + $month_start = GETPOST("month") ? GETPOST("month", 'int') : ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1); if (!GETPOST('month')) { if (!GETPOST("year") && $month_start > $month_current) @@ -113,8 +113,9 @@ if ($modecompta == "CREANCES-DETTES") { $name = $langs->trans("PurchaseTurnover"); $calcmode = $langs->trans("CalcModeDebt"); - //$calcmode.='
('.$langs->trans("SeeReportInInputOutputMode",'','').')'; - $calcmode .= '
('.$langs->trans("SeeReportInBookkeepingMode", '', '').')'; + $calcmode .= '
('.$langs->trans("SeeReportInBookkeepingMode", '{link1}', '{link2}').')'; + $calcmode = str_replace('{link1}', '', $calcmode); + $calcmode = str_replace('{link2}', '', $calcmode); $period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0); $periodlink = ($year_start ? "".img_previous()." ".img_next()."" : ""); $description = $langs->trans("RulesPurchaseTurnoverDue"); @@ -124,8 +125,6 @@ if ($modecompta == "CREANCES-DETTES") { $name = $langs->trans("PurchaseTurnoverCollected"); $calcmode = $langs->trans("CalcModeEngagement"); - //$calcmode.='
('.$langs->trans("SeeReportInDueDebtMode",'','').')'; - //$calcmode.='
('.$langs->trans("SeeReportInBookkeepingMode",'','').')'; $period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0); $periodlink = ($year_start ? "".img_previous()." ".img_next()."" : ""); $description = $langs->trans("RulesPurchaseTurnoverIn"); @@ -135,8 +134,9 @@ if ($modecompta == "CREANCES-DETTES") { $name = $langs->trans("PurchaseTurnover"); $calcmode = $langs->trans("CalcModeBookkeeping"); - $calcmode .= '
('.$langs->trans("SeeReportInDueDebtMode", '', '').')'; - //$calcmode.='
('.$langs->trans("SeeReportInInputOutputMode",'','').')'; + $calcmode .= '
('.$langs->trans("SeeReportInDueDebtMode", '{link1}', '{link2}').')'; + $calcmode = str_replace('{link1}', '', $calcmode); + $calcmode = str_replace('{link2}', '', $calcmode); $period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0); $periodlink = ($year_start ? "".img_previous()." ".img_next()."" : ""); $description = $langs->trans("RulesPurchaseTurnoverTotalPurchaseJournal"); From f56b46bd3e7e9e4176115d88be1a94394751b680 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 9 Dec 2020 17:14:35 +0100 Subject: [PATCH 09/18] Debug v13 --- htdocs/asset/class/asset.class.php | 4 ++-- htdocs/categories/edit.php | 2 +- htdocs/categories/index.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/asset/class/asset.class.php b/htdocs/asset/class/asset.class.php index ae866ff24ba..f4823ae9b6f 100644 --- a/htdocs/asset/class/asset.class.php +++ b/htdocs/asset/class/asset.class.php @@ -84,9 +84,9 @@ class Asset extends CommonObject 'ref' => array('type'=>'varchar(10)', 'label'=>'Ref', 'visible'=>1, 'enabled'=>1, 'position'=>10, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object", 'showoncombobox'=>1), 'entity' => array('type'=>'integer', 'label'=>'Entity', 'visible'=>0, 'enabled'=>1, 'position'=>20, 'notnull'=>1, 'index'=>1,), 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'visible'=>1, 'enabled'=>1, 'position'=>30, 'notnull'=>-1, 'searchall'=>1), + 'fk_asset_type' => array('type'=>'integer:AssetType:asset/class/asset_type.class.php', 'label'=>'AssetsType', 'visible'=>1, 'enabled'=>1, 'position'=>35, 'notnull'=>1, 'index'=>1, 'searchall'=>1), 'amount_ht' => array('type'=>'double(24,8)', 'label'=>'AmountHTShort', 'visible'=>1, 'enabled'=>1, 'position'=>40, 'notnull'=>-1, 'isameasure'=>'1', 'help'=>"Help text",), - 'amount_vat' => array('type'=>'double(24,8)', 'label'=>'AmountVAT', 'visible'=>1, 'enabled'=>1, 'position'=>40, 'notnull'=>-1, 'isameasure'=>'1', 'help'=>"Help text",), - 'fk_asset_type' => array('type'=>'integer:AssetType:asset/class/asset_type.class.php', 'label'=>'AssetsType', 'visible'=>1, 'enabled'=>1, 'position'=>50, 'notnull'=>1, 'index'=>1, 'searchall'=>1), + 'amount_vat' => array('type'=>'double(24,8)', 'label'=>'AmountVAT', 'visible'=>1, 'enabled'=>1, 'position'=>41, 'notnull'=>-1, 'isameasure'=>'1', 'help'=>"Help text",), 'description' => array('type'=>'text', 'label'=>'Description', 'visible'=>-1, 'enabled'=>1, 'position'=>90, 'notnull'=>-1,), 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'visible'=>-1, 'enabled'=>1, 'position'=>91, 'notnull'=>-1,), 'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'visible'=>-1, 'enabled'=>1, 'position'=>92, 'notnull'=>-1,), diff --git a/htdocs/categories/edit.php b/htdocs/categories/edit.php index f634d62a6e4..f4b7e12cc30 100644 --- a/htdocs/categories/edit.php +++ b/htdocs/categories/edit.php @@ -35,7 +35,7 @@ $langs->load("categories"); $id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alphanohtml'); -$type = (int) GETPOST('type', 'int'); +$type = GETPOST('type', 'aZ09'); // Can be int or string $action = (GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'edit'); $confirm = GETPOST('confirm'); $cancel = GETPOST('cancel', 'alpha'); diff --git a/htdocs/categories/index.php b/htdocs/categories/index.php index 4eac3ec9a08..5adc7bbb17b 100644 --- a/htdocs/categories/index.php +++ b/htdocs/categories/index.php @@ -172,7 +172,7 @@ foreach ($fulltree as $key => $val) $counter = "".(is_countable($elements) ? count($elements) : '0').""; } - $color = $categstatic->color ? ' style="background: #'.$categstatic->color.';"' : ' style="background: #bbb"'; + $color = $categstatic->color ? ' style="background: #'.sprintf("%06s", $categstatic->color).';"' : ' style="background: #bbb"'; $data[] = array( 'rowid'=>$val['rowid'], From 30da1ab8b2eeee3333c675b4acd26441ed25b614 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 9 Dec 2020 17:35:02 +0100 Subject: [PATCH 10/18] Show setup of option SHOW_SUBPRODUCT_REF_IN_PDF --- htdocs/admin/pdf.php | 7 ++++++- htdocs/expedition/class/expedition.class.php | 1 + htdocs/langs/en_US/admin.lang | 3 ++- htdocs/langs/en_US/sendings.lang | 1 + 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/pdf.php b/htdocs/admin/pdf.php index 44f0672a832..47aabfed552 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')); +$langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'stocks')); if (!$user->admin) accessforbidden(); @@ -80,6 +80,7 @@ if ($action == 'update') dolibarr_set_const($db, "MAIN_PDF_MAIN_HIDE_THIRD_TAX", GETPOST("MAIN_PDF_MAIN_HIDE_THIRD_TAX"), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "PDF_USE_ALSO_LANGUAGE_CODE", GETPOST('PDF_USE_ALSO_LANGUAGE_CODE', 'alpha'), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "SHOW_SUBPRODUCT_REF_IN_PDF", GETPOST('SHOW_SUBPRODUCT_REF_IN_PDF', 'alpha'), 'chaine', 0, '', $conf->entity); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); @@ -331,6 +332,10 @@ print $formadmin->select_language(GETPOSTISSET('PDF_USE_ALSO_LANGUAGE_CODE') ? G //} print ''; +// SHOW_SUBPRODUCT_REF_IN_PDF - Option to show the detail of product ref for kits. +print ''.$langs->trans("SHOW_SUBPRODUCT_REF_IN_PDF", $langs->transnoentitiesnoconv("AllowAddLimitStockByWarehouse"), $langs->transnoentitiesnoconv("Module52Name")).''; +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 ''; print ''; print '
'; diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index e652dc5a3c1..023155a706f 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -1868,6 +1868,7 @@ class Expedition extends CommonObject $statusType = 'status'.$status; if ($status == self::STATUS_VALIDATED) $statusType = 'status4'; if ($status == self::STATUS_CLOSED) $statusType = 'status6'; + if ($status == self::STATUS_CANCELED) $statusType = 'status9'; return dolGetStatus($labelStatus, $labelStatusShort, '', $statusType, $mode); } diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 83b5a70de44..23b3b5462c9 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -2084,4 +2084,5 @@ YouMayFindSecurityAdviceHere=You may find security advisory here ModuleActivatedMayExposeInformation=This module may expose sensitive data. If you don't need it, disable it. ModuleActivatedDoNotUseInProduction=A module designed for the development has been enabled. Do not enable it on a production environment. CombinationsSeparator=Separator character for product combinations -SeeLinkToOnlineDocumentation=See link to online documention on top menu for examples \ No newline at end of file +SeeLinkToOnlineDocumentation=See link to online documention on top menu for examples +SHOW_SUBPRODUCT_REF_IN_PDF=If the feature "%s" of module %s is used, show details of subproducts of a kit on PDF. \ No newline at end of file diff --git a/htdocs/langs/en_US/sendings.lang b/htdocs/langs/en_US/sendings.lang index e1cb168500a..73bd9aebd42 100644 --- a/htdocs/langs/en_US/sendings.lang +++ b/htdocs/langs/en_US/sendings.lang @@ -30,6 +30,7 @@ OtherSendingsForSameOrder=Other shipments for this order SendingsAndReceivingForSameOrder=Shipments and receipts for this order SendingsToValidate=Shipments to validate StatusSendingCanceled=Canceled +StatusSendingCanceledShort=Canceled StatusSendingDraft=Draft StatusSendingValidated=Validated (products to ship or already shipped) StatusSendingProcessed=Processed From 075cacb8cfc851794678d00ea1c7badb2e17c1e1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 9 Dec 2020 17:35:02 +0100 Subject: [PATCH 11/18] Show setup of option SHOW_SUBPRODUCT_REF_IN_PDF --- ChangeLog | 1 + htdocs/admin/pdf.php | 7 ++++++- htdocs/expedition/class/expedition.class.php | 1 + htdocs/langs/en_US/admin.lang | 3 ++- htdocs/langs/en_US/sendings.lang | 1 + 5 files changed, 11 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 87535abffce..20b3a514342 100644 --- a/ChangeLog +++ b/ChangeLog @@ -176,6 +176,7 @@ NEW: Weighing Scale compatibility with TakePOS connector NEW: when creating a user from a member linked to a thirdparty, you can choose to create it as external or internal user NEW: add clone button on miscellaneous payment NEW: #15065 Add option to put the product label in bold in the PDF templates if configured +NEW: Add option "If the feature to manage kits of module Stock is used, show details of subproducts of a kit on PDF." For developers: diff --git a/htdocs/admin/pdf.php b/htdocs/admin/pdf.php index 44f0672a832..16a1c42ddaa 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')); +$langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'stocks')); if (!$user->admin) accessforbidden(); @@ -80,6 +80,7 @@ if ($action == 'update') dolibarr_set_const($db, "MAIN_PDF_MAIN_HIDE_THIRD_TAX", GETPOST("MAIN_PDF_MAIN_HIDE_THIRD_TAX"), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "PDF_USE_ALSO_LANGUAGE_CODE", GETPOST('PDF_USE_ALSO_LANGUAGE_CODE', 'alpha'), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "SHOW_SUBPRODUCT_REF_IN_PDF", GETPOST('SHOW_SUBPRODUCT_REF_IN_PDF', 'alpha'), 'chaine', 0, '', $conf->entity); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); @@ -331,6 +332,10 @@ print $formadmin->select_language(GETPOSTISSET('PDF_USE_ALSO_LANGUAGE_CODE') ? G //} print ''; +// SHOW_SUBPRODUCT_REF_IN_PDF - Option to show the detail of product ref for kits. +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); +print ''; print ''; print '
'; diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index e652dc5a3c1..023155a706f 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -1868,6 +1868,7 @@ class Expedition extends CommonObject $statusType = 'status'.$status; if ($status == self::STATUS_VALIDATED) $statusType = 'status4'; if ($status == self::STATUS_CLOSED) $statusType = 'status6'; + if ($status == self::STATUS_CANCELED) $statusType = 'status9'; return dolGetStatus($labelStatus, $labelStatusShort, '', $statusType, $mode); } diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 83b5a70de44..23b3b5462c9 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -2084,4 +2084,5 @@ YouMayFindSecurityAdviceHere=You may find security advisory here ModuleActivatedMayExposeInformation=This module may expose sensitive data. If you don't need it, disable it. ModuleActivatedDoNotUseInProduction=A module designed for the development has been enabled. Do not enable it on a production environment. CombinationsSeparator=Separator character for product combinations -SeeLinkToOnlineDocumentation=See link to online documention on top menu for examples \ No newline at end of file +SeeLinkToOnlineDocumentation=See link to online documention on top menu for examples +SHOW_SUBPRODUCT_REF_IN_PDF=If the feature "%s" of module %s is used, show details of subproducts of a kit on PDF. \ No newline at end of file diff --git a/htdocs/langs/en_US/sendings.lang b/htdocs/langs/en_US/sendings.lang index e1cb168500a..73bd9aebd42 100644 --- a/htdocs/langs/en_US/sendings.lang +++ b/htdocs/langs/en_US/sendings.lang @@ -30,6 +30,7 @@ OtherSendingsForSameOrder=Other shipments for this order SendingsAndReceivingForSameOrder=Shipments and receipts for this order SendingsToValidate=Shipments to validate StatusSendingCanceled=Canceled +StatusSendingCanceledShort=Canceled StatusSendingDraft=Draft StatusSendingValidated=Validated (products to ship or already shipped) StatusSendingProcessed=Processed From a256bfeb468a9d1bb183ea8fd3e25caacaf604e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 9 Dec 2020 17:50:21 +0100 Subject: [PATCH 12/18] fix warnings --- .../core/boxes/box_funnel_of_prospection.php | 36 +++++++++++++++---- 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/htdocs/core/boxes/box_funnel_of_prospection.php b/htdocs/core/boxes/box_funnel_of_prospection.php index c4cebfcf68a..c0218be92e2 100644 --- a/htdocs/core/boxes/box_funnel_of_prospection.php +++ b/htdocs/core/boxes/box_funnel_of_prospection.php @@ -73,7 +73,23 @@ class box_funnel_of_prospection extends ModeleBoxes public function loadBox($max = 5) { global $conf; - include DOL_DOCUMENT_ROOT . '/theme/' . $conf->theme . '/theme_vars.inc.php'; + + // default values + $badgeStatus0 = '#cbd3d3'; // draft + $badgeStatus1 = '#bc9526'; // validated + $badgeStatus1b = '#bc9526'; // validated + $badgeStatus2 = '#9c9c26'; // approved + $badgeStatus3 = '#bca52b'; + $badgeStatus4 = '#25a580'; // Color ok + $badgeStatus4b = '#25a580'; // Color ok + $badgeStatus5 = '#cad2d2'; + $badgeStatus6 = '#cad2d2'; + $badgeStatus7 = '#baa32b'; + $badgeStatus8 = '#993013'; + $badgeStatus9 = '#e7f0f0'; + if (file_exists(DOL_DOCUMENT_ROOT . '/theme/' . $conf->theme . '/theme_vars.inc.php')) { + include DOL_DOCUMENT_ROOT . '/theme/' . $conf->theme . '/theme_vars.inc.php'; + } $listofoppstatus = array(); $listofopplabel = array(); $listofoppcode = array(); @@ -113,7 +129,9 @@ class box_funnel_of_prospection extends ModeleBoxes } $i++; } - } else dol_print_error($this->db); + } else { + dol_print_error($this->db); + } global $conf, $user, $langs; @@ -134,7 +152,7 @@ class box_funnel_of_prospection extends ModeleBoxes $sql .= " GROUP BY p.fk_opp_status, cls.code"; $resql = $this->db->query($sql); - $form = new Form($ths->db); + $form = new Form($this->db); if ($resql) { $num = $this->db->num_rows($resql); $i = 0; @@ -153,7 +171,9 @@ class box_funnel_of_prospection extends ModeleBoxes $valsnb[$obj->opp_status] = $obj->nb; $valsamount[$obj->opp_status] = $obj->opp_amount; $totalnb += $obj->nb; - if ($obj->opp_status) $totaloppnb += $obj->nb; + if ($obj->opp_status) { + $totaloppnb += $obj->nb; + } if (!in_array($obj->code, array('WON', 'LOST'))) { $totalamount += $obj->opp_amount; $ponderated_opp_amount += $obj->ponderated_opp_amount; @@ -171,8 +191,12 @@ class box_funnel_of_prospection extends ModeleBoxes $labelStatus = ''; if ($status != 7) { $code = dol_getIdFromCode($this->db, $status, 'c_lead_status', 'rowid', 'code'); - if ($code) $labelStatus = $langs->transnoentitiesnoconv("OppStatus" . $code); - if (empty($labelStatus)) $labelStatus = $listofopplabel[$status]; + if ($code) { + $labelStatus = $langs->transnoentitiesnoconv("OppStatus" . $code); + } + if (empty($labelStatus)) { + $labelStatus = $listofopplabel[$status]; + } $dataseries[] = array($labelStatus,(isset($valsamount[$status]) ? (float) $valsamount[$status] : 0)); if (!$conf->use_javascript_ajax) { From a0d9d98402ca0295a255a68a27808c807648027b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 9 Dec 2020 18:03:02 +0100 Subject: [PATCH 13/18] Fix phpcs --- htdocs/core/lib/pdf.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index e6637c59549..6e4cc60ce53 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1288,7 +1288,7 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0, $prodser->get_sousproduits_arbo(); if (!empty($prodser->sousprods) && is_array($prodser->sousprods) && count($prodser->sousprods)) { $tmparrayofsubproducts = reset($prodser->sousprods); - foreach($tmparrayofsubproducts as $subprodval) { + foreach ($tmparrayofsubproducts as $subprodval) { $libelleproduitservice .= "\n * ".$subprodval[5].(($subprodval[5] && $subprodval[3]) ? ' - ' : '').$subprodval[3].' ('.$subprodval[1].')'; } } From 10a0c98f942ff6818081a14c53be9f0a8e79ce49 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 9 Dec 2020 19:26:41 +0100 Subject: [PATCH 14/18] Debug v13 --- htdocs/contrat/list.php | 22 +++++++++---------- htdocs/core/lib/functions.lib.php | 6 ++++- htdocs/core/tpl/extrafields_view.tpl.php | 9 ++++++-- .../template/class/myobject.class.php | 2 +- 4 files changed, 24 insertions(+), 15 deletions(-) diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index 18b47b7102a..bd5b39f717b 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -114,17 +114,17 @@ $fieldstosearchall = array( if (empty($user->socid)) $fieldstosearchall["c.note_private"] = "NotePrivate"; $arrayfields = array( - 'c.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1), - 'c.ref_customer'=>array('label'=>$langs->trans("RefCustomer"), 'checked'=>1), - 'c.ref_supplier'=>array('label'=>$langs->trans("RefSupplier"), 'checked'=>1), - 's.nom'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1), - 's.email'=>array('label'=>$langs->trans("ThirdPartyEmail"), 'checked'=>0), - 's.town'=>array('label'=>$langs->trans("Town"), 'checked'=>0), - 's.zip'=>array('label'=>$langs->trans("Zip"), 'checked'=>0), - 'state.nom'=>array('label'=>$langs->trans("StateShort"), 'checked'=>0), - 'country.code_iso'=>array('label'=>$langs->trans("Country"), 'checked'=>0), - 'sale_representative'=>array('label'=>$langs->trans("SaleRepresentativesOfThirdParty"), 'checked'=>1), - 'c.date_contrat'=>array('label'=>$langs->trans("DateContract"), 'checked'=>1), + 'c.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1, 'position'=>10), + 'c.ref_customer'=>array('label'=>$langs->trans("RefCustomer"), 'checked'=>1, 'position'=>12), + 'c.ref_supplier'=>array('label'=>$langs->trans("RefSupplier"), 'checked'=>1, 'position'=>14), + 's.nom'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1, 'position'=>30), + 's.email'=>array('label'=>$langs->trans("ThirdPartyEmail"), 'checked'=>0, 'position'=>30), + 's.town'=>array('label'=>$langs->trans("Town"), 'checked'=>0, 'position'=>31), + 's.zip'=>array('label'=>$langs->trans("Zip"), 'checked'=>0, 'position'=>32), + 'state.nom'=>array('label'=>$langs->trans("StateShort"), 'checked'=>0, 'position'=>33), + 'country.code_iso'=>array('label'=>$langs->trans("Country"), 'checked'=>0, 'position'=>34), + 'sale_representative'=>array('label'=>$langs->trans("SaleRepresentativesOfThirdParty"), 'checked'=>1, 'position'=>80), + 'c.date_contrat'=>array('label'=>$langs->trans("DateContract"), 'checked'=>1, 'position'=>45), 'c.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), 'c.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500), 'lower_planned_end_date'=>array('label'=>$langs->trans("LowerDateEndPlannedShort"), 'checked'=>1, 'position'=>900, 'help'=>$langs->trans("LowerDateEndPlannedShort")), diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index ab3a6dc45a8..41d0ed9362e 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -4282,7 +4282,11 @@ function getTitleFieldOfList($name, $thead = 0, $file = "", $field = "", $begin $out .= '>'; } - if ($tooltip) $out .= $form->textwithpicto($langs->trans($name), $langs->trans($tooltip)); + if ($tooltip) { + // You can also use 'TranslationString:keyfortooltiponlick' for a tooltip on click. + $tmptooltip = explode(':', $tooltip); + $out .= $form->textwithpicto($langs->trans($name), $langs->trans($tmptooltip[0]), 1, 'help', '', 0, 3, (empty($tmptooltip[1]) ? '' : 'extra_'.str_replace('.', '_', $field).'_'.$tmptooltip[1])); + } else $out .= $langs->trans($name); if (empty($thead) && $field && empty($disablesortlink)) // If this is a sort field diff --git a/htdocs/core/tpl/extrafields_view.tpl.php b/htdocs/core/tpl/extrafields_view.tpl.php index bc02e490c34..9db0ae13824 100644 --- a/htdocs/core/tpl/extrafields_view.tpl.php +++ b/htdocs/core/tpl/extrafields_view.tpl.php @@ -128,8 +128,13 @@ if (empty($reshook) && is_array($extrafields->attributes[$object->table_element] print ''; - if (!empty($extrafields->attributes[$object->table_element]['help'][$tmpkeyextra])) print $form->textwithpicto($langs->trans($tmplabelextra), $langs->trans($extrafields->attributes[$object->table_element]['help'][$tmpkeyextra])); - else print $langs->trans($tmplabelextra); + if (!empty($extrafields->attributes[$object->table_element]['help'][$tmpkeyextra])) { + // You can also use 'TranslationString:keyfortooltiponlick' for a tooltip on click. + $tmptooltip = explode(':', $extrafields->attributes[$object->table_element]['help'][$tmpkeyextra]); + print $form->textwithpicto($langs->trans($tmplabelextra), $langs->trans($tmptooltip[0]), 1, 'help', '', 0, 3, (empty($tmptooltip[1]) ? '' : 'extra_'.$tmpkeyextra.'_'.$tmptooltip[1])); + } else { + print $langs->trans($tmplabelextra); + } print ''; //TODO Improve element and rights detection diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index c0798fd52b8..76aeabf2c2b 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -85,7 +85,7 @@ class MyObject extends CommonObject * 'searchall' is 1 if we want to search in this field when making a search from the quick search button. * 'isameasure' must be set to 1 if you want to have a total on list for this field. Field type must be summable like integer or double(24,8). * 'css' and 'cssview' and 'csslist' is the CSS style to use on field. 'css' is used in creation and update. 'cssview' is used in view mode. 'csslist' is used for columns in lists. For example: 'maxwidth200', 'wordbreak', 'tdoverflowmax200' - * 'help' is a string visible as a tooltip on field + * 'help' is a 'TranslationString' to use to show a tooltip on field. You can also use 'TranslationString:keyfortooltiponlick' for a tooltip on click. * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record * 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code. * 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") From dac0267a38a3d80f19f6dbe988429e5f3c59f9c2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 9 Dec 2020 21:51:01 +0100 Subject: [PATCH 15/18] Fix debug various payment module. Fix debug report income/expense (for situation that should not happen but if it happen, result is consistent with other screens). --- htdocs/compta/bank/various_payment/card.php | 105 ++++++++++---------- htdocs/compta/resultat/index.php | 16 ++- htdocs/core/menus/standard/eldy.lib.php | 4 +- htdocs/langs/en_US/accountancy.lang | 3 +- 4 files changed, 69 insertions(+), 59 deletions(-) diff --git a/htdocs/compta/bank/various_payment/card.php b/htdocs/compta/bank/various_payment/card.php index 1212f9c9e16..d7ca7823b25 100644 --- a/htdocs/compta/bank/various_payment/card.php +++ b/htdocs/compta/bank/various_payment/card.php @@ -122,7 +122,7 @@ if (empty($reshook)) $object->accountancy_code = GETPOST("accountancy_code") > 0 ? GETPOST("accountancy_code", "alpha") : ""; $object->subledger_account = $subledger_account; - $object->sens = GETPOST('sens'); + $object->sens = GETPOST('sens', 'int'); $object->fk_project = GETPOST('fk_project', 'int'); if (empty($datep) || empty($datev)) @@ -131,12 +131,6 @@ if (empty($reshook)) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors'); $error++; } - if (empty($object->type_payment) || $object->type_payment < 0) - { - $langs->load('errors'); - setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("PaymentMode")), null, 'errors'); - $error++; - } if (empty($object->amount)) { $langs->load('errors'); @@ -149,13 +143,24 @@ if (empty($reshook)) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BankAccount")), null, 'errors'); $error++; } - // TODO Remove this and allow instead to edit a various payment to enter accounting code + if (empty($object->type_payment) || $object->type_payment < 0) + { + $langs->load('errors'); + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("PaymentMode")), null, 'errors'); + $error++; + } if (!empty($conf->accounting->enabled) && !$object->accountancy_code) { $langs->load('errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("AccountAccounting")), null, 'errors'); $error++; } + if ($object->sens < 0) + { + $langs->load('errors'); + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Sens")), null, 'errors'); + $error++; + } if (!$error) { @@ -358,13 +363,6 @@ if ($action == 'create') print ''; print ''; - // Sens - print ''; - print $form->editfieldkey('Sens', 'sens', '', $object, 0, 'string', '', 1).''; - $sensarray = array('0' => $langs->trans("Debit"), '1' => $langs->trans("Credit")); - print $form->selectarray('sens', $sensarray, $sens); - print ''; - // Amount print ''; print $form->editfieldkey('Amount', 'amount', '', $object, 0, 'string', '', 1).''; @@ -396,6 +394,44 @@ if ($action == 'create') print ''."\n"; } + // Accountancy account + if (!empty($conf->accounting->enabled)) { + // TODO Remove the fieldrequired and allow instead to edit a various payment to enter accounting code + print ''.$langs->trans("AccountAccounting").''; + print ''; + print $formaccounting->select_account($accountancy_code, 'accountancy_code', 1, null, 1, 1); + print ''; + } else { // For external software + print ''.$langs->trans("AccountAccounting").''; + print ''; + print ''; + } + + // Subledger account + if (!empty($conf->accounting->enabled)) { + print ''.$langs->trans("SubledgerAccount").'aaaa'; + print ''; + if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) + { + print $formaccounting->select_auxaccount($subledger_account, 'subledger_account', 1, ''); + } else { + print ''; + } + print ''; + } else { // For external software + print ''.$langs->trans("SubledgerAccount").''; + print ''; + print ''; + } + + // Sens + print ''; + $labelsens = $form->textwithpicto('Sens', $langs->trans("AccountingDirectionHelp")); + print $form->editfieldkey($labelsens, 'sens', '', $object, 0, 'string', '', 1).''; + $sensarray = array('0' => $langs->trans("Debit"), '1' => $langs->trans("Credit")); + print $form->selectarray('sens', $sensarray, $sens, 1, 0, 0, '', 0, 0, 0, '', 'minwidth100', 1); + print ''; + // Project if (!empty($conf->projet->enabled)) { @@ -417,44 +453,9 @@ if ($action == 'create') print $hookmanager->resPrint; // Category - if (is_array($options) && count($options) && $conf->categorie->enabled) - { + if (is_array($options) && count($options) && $conf->categorie->enabled) { print ''.$langs->trans("RubriquesTransactions").''; - print Form::selectarray('category_transaction', $options, GETPOST('category_transaction'), 1); - print ''; - } - - // Accountancy account - if (!empty($conf->accounting->enabled)) - { - // TODO Remove the fieldrequired and allow instead to edit a various payment to enter accounting code - print ''.$langs->trans("AccountAccounting").''; - print ''; - print $formaccounting->select_account($accountancy_code, 'accountancy_code', 1, null, 1, 1); - print ''; - } else // For external software - { - print ''.$langs->trans("AccountAccounting").''; - print ''; - print ''; - } - - // Subledger account - if (!empty($conf->accounting->enabled)) - { - print ''.$langs->trans("SubledgerAccount").'aaaa'; - print ''; - if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) - { - print $formaccounting->select_auxaccount($subledger_account, 'subledger_account', 1, ''); - } else { - print ''; - } - print ''; - } else // For external software - { - print ''.$langs->trans("SubledgerAccount").''; - print ''; + print img_picto('', 'category').Form::selectarray('category_transaction', $options, GETPOST('category_transaction'), 1, 0, 0, '', 0, 0, 0, '', 'minwidth300', 1); print ''; } diff --git a/htdocs/compta/resultat/index.php b/htdocs/compta/resultat/index.php index e5d0c4f85d3..ec2a8bb2623 100644 --- a/htdocs/compta/resultat/index.php +++ b/htdocs/compta/resultat/index.php @@ -863,10 +863,18 @@ if (!empty($conf->accounting->enabled) && ($modecompta == 'BOOKKEEPING')) { $obj = $db->fetch_object($result); - if (!isset($encaiss[$obj->dm])) $encaiss[$obj->dm] = 0; - if (!isset($decaiss[$obj->dm])) $decaiss[$obj->dm] = 0; - $encaiss[$obj->dm] += $obj->credit; - $decaiss[$obj->dm] += $obj->debit; + if ($obj->pcg_type == 'INCOME') { + if (!isset($encaiss[$obj->dm])) $encaiss[$obj->dm] = 0; // To avoid warning of var not defined + $encaiss[$obj->dm] += $obj->credit; + $encaiss[$obj->dm] -= $obj->credit; + } + if ($obj->pcg_type == 'INCOME') { + if (!isset($decaiss[$obj->dm])) $decaiss[$obj->dm] = 0; // To avoid warning of var not defined + $decaiss[$obj->dm] += $obj->debit; + $decaiss[$obj->dm] -= $obj->credit; + } + + // ??? if (!isset($encaiss_ttc[$obj->dm])) $encaiss_ttc[$obj->dm] = 0; if (!isset($decaiss_ttc[$obj->dm])) $decaiss_ttc[$obj->dm] = 0; $encaiss_ttc[$obj->dm] += 0; diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 4e339c4880e..85b63a6f4e3 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1245,14 +1245,14 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM // Journals if (!empty($conf->accounting->enabled) && !empty($user->rights->accounting->comptarapport->lire) && $mainmenu == 'accountancy') { - $newmenu->add('', $langs->trans("RegistrationInAccounting"), 1, $user->rights->accounting->comptarapport->lire); + $newmenu->add('', $langs->trans("RegistrationInAccounting"), 1, $user->rights->accounting->comptarapport->lire, '', '', ''); // Multi journal $sql = "SELECT rowid, code, label, nature"; $sql .= " FROM ".MAIN_DB_PREFIX."accounting_journal"; $sql .= " WHERE entity = ".$conf->entity; $sql .= " AND active = 1"; - $sql .= " ORDER BY label DESC"; + $sql .= " ORDER BY nature ASC, label DESC"; $resql = $db->query($sql); if ($resql) { diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 3211a0b62df..41a4cfa59d5 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -198,7 +198,8 @@ Docdate=Date Docref=Reference LabelAccount=Label account LabelOperation=Label operation -Sens=Sens +Sens=Direction +AccountingDirectionHelp=For an accounting account of a customer, use Credit to record a payment you received
For an accounting account of a supplier, use Debit to record a payment you make LetteringCode=Lettering code Lettering=Lettering Codejournal=Journal From 3fcfcb3e88a31a6359278dbea36b0ba81afa5709 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 9 Dec 2020 23:38:24 +0100 Subject: [PATCH 16/18] Fix field declaration --- htdocs/user/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/user/list.php b/htdocs/user/list.php index ef2ad8c1ed6..e7a8a31af4e 100644 --- a/htdocs/user/list.php +++ b/htdocs/user/list.php @@ -119,7 +119,7 @@ $arrayfields = array( 'u.accountancy_code'=>array('label'=>"AccountancyCode", 'checked'=>0, 'position'=>30), 'u.email'=>array('label'=>"EMail", 'checked'=>1, 'position'=>35), 'u.api_key'=>array('label'=>"ApiKey", 'checked'=>0, 'position'=>40, "enabled"=>($conf->api->enabled && $user->admin)), - 'u.fk_soc'=>array('label'=>"Company", 'checked'=>1, 'position'=>45), + 'u.fk_soc'=>array('label'=>"Company", 'checked'=>($contextpage == 'employeelist' ? 0 : 1), 'position'=>45), 'u.salary'=>array('label'=>"Salary", 'checked'=>1, 'position'=>80, 'enabled'=>($conf->salaries->enabled && !empty($user->rights->salaries->readall))), 'u.datelastlogin'=>array('label'=>"LastConnexion", 'checked'=>1, 'position'=>100), 'u.datepreviouslogin'=>array('label'=>"PreviousConnexion", 'checked'=>0, 'position'=>110), From 2c9eb5417aaba38d5feb6f8221cc85a40146d194 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 10 Dec 2020 00:20:22 +0100 Subject: [PATCH 17/18] Look and feel v13 --- htdocs/user/card.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 4a22b211c5f..be03f9ce0b0 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -956,7 +956,7 @@ if ($action == 'create' || $action == 'adduserldap') // Hierarchy print ''.$langs->trans("HierarchicalResponsible").''; print ''; - print $form->select_dolusers($object->fk_user, 'fk_user', 1, array($object->id), 0, '', 0, $conf->entity, 0, 0, '', 0, '', 'maxwidth300'); + print img_picto('', 'user').$form->select_dolusers($object->fk_user, 'fk_user', 1, array($object->id), 0, '', 0, $conf->entity, 0, 0, '', 0, '', 'maxwidth300'); print ''; print "\n"; @@ -968,7 +968,7 @@ if ($action == 'create' || $action == 'adduserldap') print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help'); print ''; print ''; - print $form->select_dolusers($object->fk_user_expense_validator, 'fk_user_expense_validator', 1, array($object->id), 0, '', 0, $conf->entity, 0, 0, '', 0, '', 'maxwidth300'); + print img_picto('', 'user').$form->select_dolusers($object->fk_user_expense_validator, 'fk_user_expense_validator', 1, array($object->id), 0, '', 0, $conf->entity, 0, 0, '', 0, '', 'maxwidth300'); print ''; print "\n"; } @@ -981,7 +981,7 @@ if ($action == 'create' || $action == 'adduserldap') print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help'); print ''; print ''; - print $form->select_dolusers($object->fk_user_holiday_validator, 'fk_user_holiday_validator', 1, array($object->id), 0, '', 0, $conf->entity, 0, 0, '', 0, '', 'maxwidth300'); + print img_picto('', 'user').$form->select_dolusers($object->fk_user_holiday_validator, 'fk_user_holiday_validator', 1, array($object->id), 0, '', 0, $conf->entity, 0, 0, '', 0, '', 'maxwidth300'); print ''; print "\n"; } From eedaca14761dba8c13976bd2a31293ff9bee719a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 10 Dec 2020 00:43:51 +0100 Subject: [PATCH 18/18] Fix bad encoding of link --- htdocs/societe/list.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 48a01a94390..71f0f08cc9d 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -615,13 +615,12 @@ if ($contextpage == 'poslist' && $type == 't' && (!empty($conf->global->PRODUIT_ // Show the new button only when this page is not opend from the Extended POS (pop-up window) // but allow it too, when a user has the rights to create a new customer -if ($contextpage != 'poslist') -{ +if ($contextpage != 'poslist') { $url = DOL_URL_ROOT.'/societe/card.php?action=create'.$typefilter; if (!empty($socid)) $url .= '&socid='.$socid; $newcardbutton = dolGetButtonTitle($langs->trans($label), '', 'fa fa-plus-circle', $url, '', $user->rights->societe->creer); } elseif ($user->rights->societe->creer) { - $url = DOL_URL_ROOT.'/societe/card.php?action=create&type=t&contextpage=poslist&optioncss=print&backtopage='.$_SERVER["PHP_SELF"].'?type=t&contextpage=poslist&nomassaction=1&optioncss=print&place='.urlencode($place); + $url = DOL_URL_ROOT.'/societe/card.php?action=create&type=t&contextpage=poslist&optioncss=print&backtopage='.urlencode($_SERVER["PHP_SELF"].'?type=t&contextpage=poslist&nomassaction=1&optioncss=print&place='.$place); $label = 'MenuNewCustomer'; $newcardbutton .= dolGetButtonTitle($langs->trans($label), '', 'fa fa-plus-circle', $url); }