From 99cc7cf993dea831bc02d0a904944ba8ebb5f7d3 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 4 Feb 2025 05:12:35 +0100 Subject: [PATCH 1/9] NEW Accountancy - Define fiscal year by default --- htdocs/accountancy/admin/fiscalyear.php | 38 +++++++++++++++++++++++-- htdocs/langs/en_US/compta.lang | 1 + 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/htdocs/accountancy/admin/fiscalyear.php b/htdocs/accountancy/admin/fiscalyear.php index dae6e786fca..4983485ea3e 100644 --- a/htdocs/accountancy/admin/fiscalyear.php +++ b/htdocs/accountancy/admin/fiscalyear.php @@ -1,6 +1,6 @@ - * Copyright (C) 2024 Frédéric France +/* Copyright (C) 2013-2025 Alexandre Spangaro + * Copyright (C) 2024 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 @@ -24,6 +24,8 @@ // Load Dolibarr environment require '../../main.inc.php'; + +require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/fiscalyear.class.php'; @@ -83,7 +85,25 @@ if (!$user->hasRight('accounting', 'fiscalyear', 'write')) { // If /* * Actions */ +if ($action == 'setdefault') { + // Set a fiscal year as default + $error = 0; + $defaultFiscalYear = GETPOSTINT('value'); + $defaultFiscalYearLabel = GETPOST('label', 'alpha'); + + if (!empty($defaultFiscalYear)) { + dolibarr_set_const($db, 'ACCOUNTANCY_FISCALYEAR_DEFAULT', $defaultFiscalYear, 'chaine', 0, '', $conf->entity); + } else { + $error++; + } + + if (!$error) { + setEventMessages($langs->trans("FiscalYearSetAsDefault", $defaultFiscalYearLabel), null, 'mesgs'); + } else { + setEventMessages($langs->trans("Error"), null, 'errors'); + } +} /* @@ -148,6 +168,7 @@ if ($result) { print ''.$langs->trans("DateEnd").''; print ''.$langs->trans("NumberOfAccountancyEntries").''; print ''.$langs->trans("NumberOfAccountancyMovements").''; + print ''.$langs->trans("Default").''; print ''.$langs->trans("Status").''; print ''; @@ -160,6 +181,7 @@ if ($result) { $fiscalyearstatic->ref = $obj->rowid; $fiscalyearstatic->id = $obj->rowid; + $fiscalyearstatic->label = $obj->label; $fiscalyearstatic->date_start = $obj->date_start; $fiscalyearstatic->date_end = $obj->date_end; $fiscalyearstatic->statut = $obj->status; @@ -174,12 +196,22 @@ if ($result) { print ''.dol_print_date($db->jdate($obj->date_end), 'day').''; print ''.$object->getAccountancyEntriesByFiscalYear($obj->date_start, $obj->date_end).''; print ''.$object->getAccountancyMovementsByFiscalYear($obj->date_start, $obj->date_end).''; + + // Default + print ''; + if (getDolGlobalString('ACCOUNTANCY_FISCALYEAR_DEFAULT') == (int) $fiscalyearstatic->ref) { + print img_picto($langs->trans("Default"), 'on'); + } else { + print 'ref).'&label='.urlencode($fiscalyearstatic->label).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("SetAsDefault"), 'off').''; + } + print ''; + print ''.$fiscalyearstatic->LibStatut($obj->status, 5).''; print ''; $i++; } } else { - print ''.$langs->trans("NoRecordFound").''; + print ''.$langs->trans("NoRecordFound").''; } print ''; print ''; diff --git a/htdocs/langs/en_US/compta.lang b/htdocs/langs/en_US/compta.lang index 0e88b2ab2f5..925123b75d9 100644 --- a/htdocs/langs/en_US/compta.lang +++ b/htdocs/langs/en_US/compta.lang @@ -283,6 +283,7 @@ ImportDataset_tax_contrib=Social/fiscal taxes ImportDataset_tax_vat=VAT payments ErrorBankAccountNotFound=Error: Bank account not found FiscalPeriod=Accounting period +FiscalYearSetAsDefault=Fiscal year (%s) defined as default ListSocialContributionAssociatedProject=List of social contributions associated with the project DeleteFromCat=Remove from accounting group AccountingAffectation=Accounting assignment From 72e262ff76f89acc988d2c5084a43255760ccaf8 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sat, 8 Feb 2025 07:52:46 +0100 Subject: [PATCH 2/9] NEW Accountancy - Define fiscal year by default --- htdocs/accountancy/bookkeeping/list.php | 32 +++-- .../core/class/html.formfiscalyear.class.php | 121 ++++++++++++++++++ 2 files changed, 145 insertions(+), 8 deletions(-) create mode 100644 htdocs/core/class/html.formfiscalyear.class.php diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 4b4f57cc3b1..1a39d3ec78d 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -1,12 +1,12 @@ - * Copyright (C) 2013-2016 Florian Henry - * Copyright (C) 2013-2024 Alexandre Spangaro - * Copyright (C) 2022 Lionel Vessiller - * Copyright (C) 2016-2017 Laurent Destailleur - * Copyright (C) 2018-2024 Frédéric France - * Copyright (C) 2022 Progiseize - * Copyright (C) 2024 MDW +/* Copyright (C) 2013-2016 Olivier Geffroy + * Copyright (C) 2013-2016 Florian Henry + * Copyright (C) 2013-2025 Alexandre Spangaro + * Copyright (C) 2022 Lionel Vessiller + * Copyright (C) 2016-2017 Laurent Destailleur + * Copyright (C) 2018-2024 Frédéric France + * Copyright (C) 2022 Progiseize + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -32,6 +32,7 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfiscalyear.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; @@ -170,6 +171,7 @@ if ($sortfield == "") { $object = new BookKeeping($db); $hookmanager->initHooks(array('bookkeepinglist')); +$formfiscalyear = new FormFiscalYear($db); $formaccounting = new FormAccounting($db); $form = new Form($db); @@ -873,7 +875,21 @@ if ($massactionbutton && $contextpage != 'poslist') { $selectedfields .= $form->showCheckAddButtons('checkforselect', 1); } +if (getDolGlobalInt('ACCOUNTANCY_FISCALYEAR_DEFAULT')) { + $fiscalYear = getDolGlobalInt('ACCOUNTANCY_FISCALYEAR_DEFAULT'); + $useempty = 0; +} else { + $fiscalYear = 0; + $useempty = 1; +} + $moreforfilter = ''; +$moreforfilter = '
'; +$moreforfilter .= $langs->trans('FiscalYear').': '; +$moreforfilter .= '
'; +$moreforfilter .= $formfiscalyear->selectFiscalYear($fiscalYear, 'searchfiscalyear', $useempty, 0, 1); +$moreforfilter .= '
'; +$moreforfilter .= '
'; $moreforfilter .= '
'; $moreforfilter .= $langs->trans('AccountingCategory').': '; $moreforfilter .= '
'; diff --git a/htdocs/core/class/html.formfiscalyear.class.php b/htdocs/core/class/html.formfiscalyear.class.php new file mode 100644 index 00000000000..2cacad330ec --- /dev/null +++ b/htdocs/core/class/html.formfiscalyear.class.php @@ -0,0 +1,121 @@ + + * + * 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/core/class/html.formfiscalyear.class.php + * \ingroup Accountancy (Double entries) + * \brief File of class with all html predefined components + */ +require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; + +/** + * Class to manage generation of HTML components for accounting management + */ +class FormFiscalYear extends Form +{ + /** + * @var array> + */ + private $options_cache = array(); + + /** + * @var DoliDB Database handler. + */ + public $db; + + /** + * @var string Error code (or message) + */ + public $error = ''; + + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + public function __construct($db) + { + $this->db = $db; + } + + /** + * Return list of fiscal year + * + * @param int $selected Preselected type + * @param string $htmlname Name of field in form + * @param int $useempty Set to 1 if we want an empty value + * @param int $maxlen Max length of text in combo box + * @param int $help Add or not the admin help picto + * @return void|string HTML component with the select + */ + public function selectFiscalYear($selected = 0, $htmlname = 'fiscalyear', $useempty = 0, $maxlen = 0, $help = 1) + { + global $conf, $langs; + + $out = ''; + + $sql = "SELECT f.rowid, f.label, f.date_start, f.date_end, f.statut as status"; + $sql .= " FROM ".$this->db->prefix()."accounting_fiscalyear as f"; + $sql .= " WHERE f.entity = ".$conf->entity; + $sql .= " ORDER BY f.date_start ASC"; + + $this->nbfiscalyear = 0; + + dol_syslog(get_class($this).'::'.__METHOD__, LOG_DEBUG); + $resql = $this->db->query($sql); + if ($resql) { + $num = $this->db->num_rows($resql); + if ($num) { + $this->nbfiscalyear = $num; + + $out .= ''; + //if ($user->admin && $help) $out .= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); + + $out .= ajax_combobox($htmlname, array()); + } else { + $out .= ''.$langs->trans("ErrorNoFiscalyearDefined", $langs->transnoentitiesnoconv("Accounting"), $langs->transnoentitiesnoconv("Setup"), $langs->transnoentitiesnoconv("FiscalYear")).''; + } + } else { + dol_print_error($this->db); + } + + return $out; + } +} From 8e36ecf4f73cb56883e4bd1fc28cc702a6e95eeb Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sun, 16 Feb 2025 21:29:03 +0100 Subject: [PATCH 3/9] Add default fiscal year on all report --- htdocs/accountancy/bookkeeping/balance.php | 13 +++++++++---- htdocs/accountancy/bookkeeping/export.php | 14 ++++++++++---- htdocs/accountancy/bookkeeping/list.php | 18 +++++++++--------- .../accountancy/bookkeeping/listbyaccount.php | 11 ++++++++--- 4 files changed, 36 insertions(+), 20 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index cd2641ff6be..ab17d51de09 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-2024 Alexandre Spangaro + * Copyright (C) 2016-2025 Alexandre Spangaro * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2024 MDW * @@ -100,9 +100,14 @@ $formother = new FormOther($db); $form = new Form($db); if (empty($search_date_start) && !GETPOSTISSET('formfilteraction')) { - $sql = "SELECT date_start, date_end from ".MAIN_DB_PREFIX."accounting_fiscalyear "; - $sql .= " WHERE date_start < '".$db->idate(dol_now())."' AND date_end > '".$db->idate(dol_now())."'"; - $sql .= $db->plimit(1); + $sql = "SELECT date_start, date_end"; + $sql .=" FROM ".MAIN_DB_PREFIX."accounting_fiscalyear "; + if (getDolGlobalInt('ACCOUNTANCY_FISCALYEAR_DEFAULT')) { + $sql .= " WHERE rowid = " . getDolGlobalInt('ACCOUNTANCY_FISCALYEAR_DEFAULT'); + } else { + $sql .= " WHERE date_start < '" . $db->idate(dol_now()) . "' and date_end > '" . $db->idate(dol_now()) . "'"; + } + $sql .= $db->plimit(1); $res = $db->query($sql); if ($db->num_rows($res) > 0) { diff --git a/htdocs/accountancy/bookkeeping/export.php b/htdocs/accountancy/bookkeeping/export.php index 67a6155ef7c..e866ea95980 100644 --- a/htdocs/accountancy/bookkeeping/export.php +++ b/htdocs/accountancy/bookkeeping/export.php @@ -1,7 +1,7 @@ * Copyright (C) 2013-2016 Florian Henry - * Copyright (C) 2013-2024 Alexandre Spangaro + * Copyright (C) 2013-2025 Alexandre Spangaro * Copyright (C) 2022 Lionel Vessiller * Copyright (C) 2016-2017 Laurent Destailleur * Copyright (C) 2018-2024 Frédéric France @@ -170,9 +170,15 @@ $form = new Form($db); if (!in_array($action, array('export_file', 'delmouv', 'delmouvconfirm')) && !GETPOSTISSET('begin') && !GETPOSTISSET('formfilteraction') && GETPOSTINT('page') == '' && !GETPOSTINT('noreset') && $user->hasRight('accounting', 'mouvements', 'export')) { if (empty($search_date_start) && empty($search_date_end) && !GETPOSTISSET('restore_lastsearch_values') && !GETPOST('search_accountancy_code_start')) { - $query = "SELECT date_start, date_end from ".MAIN_DB_PREFIX."accounting_fiscalyear "; - $query .= " where date_start < '".$db->idate(dol_now())."' and date_end > '".$db->idate(dol_now())."' limit 1"; - $res = $db->query($query); + $sql = "SELECT date_start, date_end"; + $sql .=" FROM ".MAIN_DB_PREFIX."accounting_fiscalyear "; + if (getDolGlobalInt('ACCOUNTANCY_FISCALYEAR_DEFAULT')) { + $sql .= " WHERE rowid = " . getDolGlobalInt('ACCOUNTANCY_FISCALYEAR_DEFAULT'); + } else { + $sql .= " WHERE date_start < '" . $db->idate(dol_now()) . "' and date_end > '" . $db->idate(dol_now()) . "'"; + } + $sql .= $db->plimit(1); + $res = $db->query($sql); if ($db->num_rows($res) > 0) { $fiscalYear = $db->fetch_object($res); diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 1a39d3ec78d..67d62117ba2 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -177,9 +177,15 @@ $form = new Form($db); if (!in_array($action, array('delmouv', 'delmouvconfirm')) && !GETPOSTISSET('begin') && !GETPOSTISSET('formfilteraction') && GETPOST('page', 'alpha') == '' && !GETPOSTINT('noreset') && $user->hasRight('accounting', 'mouvements', 'export')) { if (empty($search_date_start) && empty($search_date_end) && !GETPOSTISSET('restore_lastsearch_values') && !GETPOST('search_accountancy_code_start')) { - $query = "SELECT date_start, date_end from ".MAIN_DB_PREFIX."accounting_fiscalyear "; - $query .= " where date_start < '".$db->idate(dol_now())."' and date_end > '".$db->idate(dol_now())."' limit 1"; - $res = $db->query($query); + $sql = "SELECT date_start, date_end"; + $sql .=" FROM ".MAIN_DB_PREFIX."accounting_fiscalyear "; + if (getDolGlobalInt('ACCOUNTANCY_FISCALYEAR_DEFAULT')) { + $sql .= " WHERE rowid = " . getDolGlobalInt('ACCOUNTANCY_FISCALYEAR_DEFAULT'); + } else { + $sql .= " WHERE date_start < '" . $db->idate(dol_now()) . "' and date_end > '" . $db->idate(dol_now()) . "'"; + } + $sql .= $db->plimit(1); + $res = $db->query($sql); if ($db->num_rows($res) > 0) { $fiscalYear = $db->fetch_object($res); @@ -884,12 +890,6 @@ if (getDolGlobalInt('ACCOUNTANCY_FISCALYEAR_DEFAULT')) { } $moreforfilter = ''; -$moreforfilter = '
'; -$moreforfilter .= $langs->trans('FiscalYear').': '; -$moreforfilter .= '
'; -$moreforfilter .= $formfiscalyear->selectFiscalYear($fiscalYear, 'searchfiscalyear', $useempty, 0, 1); -$moreforfilter .= '
'; -$moreforfilter .= '
'; $moreforfilter .= '
'; $moreforfilter .= $langs->trans('AccountingCategory').': '; $moreforfilter .= '
'; diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index ba17782a8b0..172249debb3 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -2,7 +2,7 @@ /* Copyright (C) 2016 Neil Orley * Copyright (C) 2013-2016 Olivier Geffroy * Copyright (C) 2013-2020 Florian Henry - * Copyright (C) 2013-2024 Alexandre Spangaro + * Copyright (C) 2013-2025 Alexandre Spangaro * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2024 MDW * @@ -152,8 +152,13 @@ $formaccounting = new FormAccounting($db); $form = new Form($db); if (empty($search_date_start) && empty($search_date_end) && !GETPOSTISSET('search_date_startday') && !GETPOSTISSET('search_date_startmonth') && !GETPOSTISSET('search_date_starthour')) { - $sql = "SELECT date_start, date_end from ".MAIN_DB_PREFIX."accounting_fiscalyear "; - $sql .= " where date_start < '".$db->idate(dol_now())."' and date_end > '".$db->idate(dol_now())."'"; + $sql = "SELECT date_start, date_end"; + $sql .=" FROM ".MAIN_DB_PREFIX."accounting_fiscalyear "; + if (getDolGlobalInt('ACCOUNTANCY_FISCALYEAR_DEFAULT')) { + $sql .= " WHERE rowid = " . getDolGlobalInt('ACCOUNTANCY_FISCALYEAR_DEFAULT'); + } else { + $sql .= " WHERE date_start < '" . $db->idate(dol_now()) . "' and date_end > '" . $db->idate(dol_now()) . "'"; + } $sql .= $db->plimit(1); $res = $db->query($sql); From da54ed8e57975bf41f1dca696136da83a8243456 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 17 Feb 2025 06:30:55 +0100 Subject: [PATCH 4/9] Indentation --- htdocs/accountancy/bookkeeping/balance.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index ab17d51de09..5daa02a7364 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -100,14 +100,14 @@ $formother = new FormOther($db); $form = new Form($db); if (empty($search_date_start) && !GETPOSTISSET('formfilteraction')) { - $sql = "SELECT date_start, date_end"; - $sql .=" FROM ".MAIN_DB_PREFIX."accounting_fiscalyear "; - if (getDolGlobalInt('ACCOUNTANCY_FISCALYEAR_DEFAULT')) { - $sql .= " WHERE rowid = " . getDolGlobalInt('ACCOUNTANCY_FISCALYEAR_DEFAULT'); - } else { - $sql .= " WHERE date_start < '" . $db->idate(dol_now()) . "' and date_end > '" . $db->idate(dol_now()) . "'"; - } - $sql .= $db->plimit(1); + $sql = "SELECT date_start, date_end"; + $sql .=" FROM ".MAIN_DB_PREFIX."accounting_fiscalyear "; + if (getDolGlobalInt('ACCOUNTANCY_FISCALYEAR_DEFAULT')) { + $sql .= " WHERE rowid = " . getDolGlobalInt('ACCOUNTANCY_FISCALYEAR_DEFAULT'); + } else { + $sql .= " WHERE date_start < '" . $db->idate(dol_now()) . "' and date_end > '" . $db->idate(dol_now()) . "'"; + } + $sql .= $db->plimit(1); $res = $db->query($sql); if ($db->num_rows($res) > 0) { From 330bd5543a49325eeabd5090437968f1bcd9c44e Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 17 Feb 2025 06:38:07 +0100 Subject: [PATCH 5/9] Add missing trad --- htdocs/langs/en_US/compta.lang | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/langs/en_US/compta.lang b/htdocs/langs/en_US/compta.lang index dd9db3d407c..5608781b538 100644 --- a/htdocs/langs/en_US/compta.lang +++ b/htdocs/langs/en_US/compta.lang @@ -283,6 +283,7 @@ ImportDataset_tax_contrib=Social/fiscal taxes ImportDataset_tax_vat=VAT payments ErrorBankAccountNotFound=Error: Bank account not found FiscalPeriod=Accounting period +ErrorNoFiscalyearDefined=Error, no fiscal year defined (See %s - %s - %s) FiscalYearSetAsDefault=Fiscal year (%s) defined as default FiscalYearOpened=Fiscal year opened FiscalYearClosed=Fiscal year closed From a194d2f0c40f51e045a87d565b279beb634cae83 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 17 Feb 2025 06:41:59 +0100 Subject: [PATCH 6/9] Remove dev code --- htdocs/accountancy/bookkeeping/list.php | 9 --------- 1 file changed, 9 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 67d62117ba2..9821c434329 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -32,7 +32,6 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfiscalyear.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; @@ -881,14 +880,6 @@ if ($massactionbutton && $contextpage != 'poslist') { $selectedfields .= $form->showCheckAddButtons('checkforselect', 1); } -if (getDolGlobalInt('ACCOUNTANCY_FISCALYEAR_DEFAULT')) { - $fiscalYear = getDolGlobalInt('ACCOUNTANCY_FISCALYEAR_DEFAULT'); - $useempty = 0; -} else { - $fiscalYear = 0; - $useempty = 1; -} - $moreforfilter = ''; $moreforfilter .= '
'; $moreforfilter .= $langs->trans('AccountingCategory').': '; From d259b2a65c4c67e2b9bfca100f066c09f3b5142d Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 17 Feb 2025 13:51:47 +0100 Subject: [PATCH 7/9] Update language --- htdocs/core/class/html.formfiscalyear.class.php | 4 ++-- htdocs/langs/en_US/compta.lang | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.formfiscalyear.class.php b/htdocs/core/class/html.formfiscalyear.class.php index 2cacad330ec..ed44ac4b736 100644 --- a/htdocs/core/class/html.formfiscalyear.class.php +++ b/htdocs/core/class/html.formfiscalyear.class.php @@ -91,8 +91,8 @@ class FormFiscalYear extends Form while ($i < $num) { $obj = $this->db->fetch_object($resql); - $titletoshowhtml = ($maxlen ? dol_trunc($obj->label, $maxlen) : $obj->label).' ('.$obj->date_start.' - '.$obj->date_end.')'; - $titletoshow = ($maxlen ? dol_trunc($obj->label, $maxlen) : $obj->label).' ('.$obj->date_start.' - '.$obj->date_end.')'; + $titletoshowhtml = ($maxlen ? dol_trunc($obj->label, $maxlen) : $obj->label).' ('.$obj->date_start . " - " . $obj->date_end.')'; + $titletoshow = ($maxlen ? dol_trunc($obj->label, $maxlen) : $obj->label).' ('.$langs->transnoentitiesnoconv("FiscalYearFromTo", $obj->date_start, $obj->date_end).')'; $out .= '