From a005408d8310d9435f53ca85d33a443cc95b937a Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 23 Sep 2019 20:42:50 +0200 Subject: [PATCH 1/7] NEW Accountancy - Add an option to hide FAQ on index and add widget in area --- htdocs/accountancy/admin/index.php | 36 ++- .../class/accountingjournal.class.php | 2 +- .../accountancy/class/bookkeeping.class.php | 16 +- htdocs/accountancy/index.php | 289 +++++++++++------- htdocs/admin/boxes.php | 2 +- .../box_accountancy_last_manual_entries.php | 183 +++++++++++ .../box_accountancy_suspense_account.php | 135 ++++++++ htdocs/core/class/html.formother.class.php | 4 +- htdocs/core/class/infobox.class.php | 10 +- htdocs/core/modules/modAccounting.class.php | 5 +- htdocs/langs/en_US/accountancy.lang | 6 +- htdocs/langs/en_US/boxes.lang | 9 +- 12 files changed, 557 insertions(+), 140 deletions(-) create mode 100644 htdocs/core/boxes/box_accountancy_last_manual_entries.php create mode 100644 htdocs/core/boxes/box_accountancy_suspense_account.php diff --git a/htdocs/accountancy/admin/index.php b/htdocs/accountancy/admin/index.php index b842c8115da..e11355b1f50 100644 --- a/htdocs/accountancy/admin/index.php +++ b/htdocs/accountancy/admin/index.php @@ -83,6 +83,19 @@ if ($action == 'update') { } // TO DO Mutualize code for yes/no constants +if ($action == 'setdisablefaq') { + $setdisablefaq = GETPOST('value', 'int'); + $res = dolibarr_set_const($db, "ACCOUNTING_DISABLE_FAQ", $setdisablefaq, 'yesno', 0, '', $conf->entity); + if (! $res > 0) + $error ++; + + if (! $error) { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } else { + setEventMessages($langs->trans("Error"), null, 'mesgs'); + } +} + if ($action == 'setlistsorttodo') { $setlistsorttodo = GETPOST('value', 'int'); $res = dolibarr_set_const($db, "ACCOUNTING_LIST_SORT_VENTILATION_TODO", $setlistsorttodo, 'yesno', 0, '', $conf->entity); @@ -212,6 +225,19 @@ if (! empty($user->admin)) { // TO DO Mutualize code for yes/no constants print ''; + print '' . $langs->trans("ACCOUNTING_DISABLE_FAQ") . ''; + if (! empty($conf->global->ACCOUNTING_DISABLE_FAQ)) { + print ''; + print img_picto($langs->trans("Activated"), 'switch_on'); + print ''; + } else { + print ''; + print img_picto($langs->trans("Disabled"), 'switch_off'); + print ''; + } + print ''; + + print ''; print '' . $langs->trans("ACCOUNTING_LIST_SORT_VENTILATION_TODO") . ''; if (! empty($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO)) { print ''; @@ -224,7 +250,7 @@ if (! empty($user->admin)) } print ''; - print ''; + print ''; print '' . $langs->trans("ACCOUNTING_LIST_SORT_VENTILATION_DONE") . ''; if (! empty($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE)) { print ''; @@ -237,7 +263,7 @@ if (! empty($user->admin)) } print ''; - print ''; + print ''; print '' . $langs->trans("ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL") . ''; if (! empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL)) { print ''; @@ -250,7 +276,7 @@ if (! empty($user->admin)) } print ''; - print ''; + print ''; print '' . $langs->trans("BANK_DISABLE_DIRECT_INPUT") . ''; if (! empty($conf->global->BANK_DISABLE_DIRECT_INPUT)) { print ''; @@ -263,7 +289,7 @@ if (! empty($user->admin)) } print ''; - print ''; + print ''; print '' . $langs->trans("ACCOUNTANCY_COMBO_FOR_AUX") . ''; if (! empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) { print ''; @@ -276,7 +302,7 @@ if (! empty($user->admin)) } print ''; - print ''; + print ''; print '' . $langs->trans("ACCOUNTING_MANAGE_ZERO") . ''; if (! empty($conf->global->ACCOUNTING_MANAGE_ZERO)) { print ''; diff --git a/htdocs/accountancy/class/accountingjournal.class.php b/htdocs/accountancy/class/accountingjournal.class.php index e8caaab8a89..5f44c0d32b7 100644 --- a/htdocs/accountancy/class/accountingjournal.class.php +++ b/htdocs/accountancy/class/accountingjournal.class.php @@ -235,7 +235,7 @@ class AccountingJournal extends CommonObject { if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { - $label=$langs->trans("ShowAccoutingJournal"); + $label=$langs->trans("ShowAccountingJournal"); $linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"'; } $linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"'; diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 9e59093b885..f442730355c 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -406,7 +406,7 @@ class BookKeeping extends CommonObject } /** - * Return a link to the object card (with optionaly the picto) + * Return a link to the object card (with optionally the picto) * * @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto) * @param string $option On what the link point to ('nolink', ...) @@ -1309,7 +1309,7 @@ class BookKeeping extends CommonObject } /** - * Delete bookkepping by importkey + * Delete bookkeeping by importkey * * @param string $importkey Import key * @return int Result @@ -1337,7 +1337,7 @@ class BookKeeping extends CommonObject } /** - * Delete bookkepping by year + * Delete bookkeeping by year * * @param string $delyear Year to delete * @param string $journal Journal to delete @@ -1379,7 +1379,7 @@ class BookKeeping extends CommonObject } /** - * Delete bookkepping by piece number + * Delete bookkeeping by piece number * * @param int $piecenum Piecenum to delete * @return int Result @@ -1624,12 +1624,12 @@ class BookKeeping extends CommonObject // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Export bookkeping + * Export bookkeeping * * @param string $model Model * @return int Result */ - public function export_bookkeping($model = 'ebp') + public function export_bookkeeping($model = 'ebp') { // phpcs:enable global $conf; @@ -1641,7 +1641,7 @@ class BookKeeping extends CommonObject $sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element; $sql .= " WHERE entity IN (" . getEntity('accountancy') . ")"; - dol_syslog(get_class($this) . "::export_bookkeping", LOG_DEBUG); + dol_syslog(get_class($this) . "::export_bookkeeping", LOG_DEBUG); $resql = $this->db->query($sql); @@ -1679,7 +1679,7 @@ class BookKeeping extends CommonObject return $num; } else { $this->error = "Error " . $this->db->lasterror(); - dol_syslog(get_class($this) . "::export_bookkeping " . $this->error, LOG_ERR); + dol_syslog(get_class($this) . "::export_bookkeeping " . $this->error, LOG_ERR); return - 1; } } diff --git a/htdocs/accountancy/index.php b/htdocs/accountancy/index.php index 0bede00d86d..d3ea4ccfb24 100644 --- a/htdocs/accountancy/index.php +++ b/htdocs/accountancy/index.php @@ -26,6 +26,7 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php'; // Load translation files required by the page $langs->loadLangs(array("compta","bills","other","accountancy","loans","banks","admin","dict")); @@ -41,8 +42,17 @@ $hookmanager->initHooks(array('accountancyindex')); * Actions */ -// None +if (GETPOST('addbox')) // Add box (when submit is done from a form when ajax disabled) +{ + require_once DOL_DOCUMENT_ROOT.'/core/class/infobox.class.php'; + $zone=GETPOST('areacode', 'aZ09'); + $userid=GETPOST('userid', 'int'); + $boxorder=GETPOST('boxorder', 'aZ09'); + $boxorder.=GETPOST('boxcombo', 'aZ09'); + $result=InfoBox::saveboxorder($db, $zone, $boxorder, $userid); + if ($result > 0) setEventMessages($langs->trans("BoxAdded"), null); +} /* * View @@ -50,134 +60,185 @@ $hookmanager->initHooks(array('accountancyindex')); llxHeader('', $langs->trans("AccountancyArea")); -print load_fiche_titre($langs->trans("AccountancyArea"), '', 'title_accountancy'); -//dol_fiche_head(); - -$step = 0; - if ($conf->accounting->enabled) { - print ''.$langs->trans("AccountancyAreaDescIntro")."
\n"; - print "
\n";print "
\n"; + $resultboxes=FormOther::getBoxesArea($user, "1"); // Load $resultboxes (selectboxlist + boxactivated + boxlista + boxlistb) - print load_fiche_titre(' '.$langs->trans("AccountancyAreaDescActionOnce"), '', '')."\n"; - print '
'; - print "
\n"; + print load_fiche_titre($langs->trans("AccountancyArea"), $resultboxes['selectboxlist'], 'title_accountancy'); - // STEPS - $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescJournalSetup", $step, '
'.''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("AccountingJournals").''.''); - print "
\n"; - $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChartModel", $step, ''.''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Pcg_version").''.''); - print "
\n"; - $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChart", $step, ''.''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Chartofaccounts").''.''); - print "
\n"; + // FAQ + if (empty($conf->global->ACCOUNTING_DISABLE_FAQ)) { + $step = 0; - print "
\n"; - print $langs->trans("AccountancyAreaDescActionOnceBis"); - print "
\n"; - print "
\n"; + print '' . $langs->trans("AccountancyAreaDescIntro") . "
\n"; + print "
\n"; + print "
\n"; + print load_fiche_titre(' ' . $langs->trans("AccountancyAreaDescActionOnce"), + '', '') . "\n"; + print '
'; + print "
\n"; - $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDefault", $step, ''.''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").''.''); - print "
\n"; - - $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBank", $step, ''.''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuBankAccounts").''.'')."\n"; - print "
\n"; - - $step++; - $textlink = ''.''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuVatAccounts").''.''; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescVat", $step, $textlink); - print "
\n"; - if (! empty($conf->tax->enabled)) - { - $textlink = ''.''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuTaxAccounts").''.''; - $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescContrib", $step, $textlink); - print "
\n"; - } - /*if (! empty($conf->salaries->enabled)) - { - $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescSal", $step, ''.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); - // htdocs/admin/salaries.php - print "
\n"; - print "
\n"; - }*/ - if (! empty($conf->expensereport->enabled)) // TODO Move this in the default account page because this is only one accounting account per purpose, not several. - { - $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescExpenseReport", $step, ''.''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuExpenseReportAccounts").''.''); - print "
\n"; - } - /* - if (! empty($conf->loan->enabled)) - { - $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescLoan", $step, ''.$langs->transnoentitiesnoconv("MenuSpecialExpenses").' - '.$langs->transnoentitiesnoconv("Loans").' '.$langs->transnoentitiesnoconv("or").' '.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); - print "
\n"; - } - if (! empty($conf->don->enabled)) - { - $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDonation", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); - print "
\n"; - } - if (! empty($conf->adherents->enabled)) - { - $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescSubscription", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); - print "
\n"; - }*/ - - $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescProd", $step, ''.''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("ProductsBinding").''.''); - print "
\n"; - - - print '
'; - - // Step A - E - - print "
\n"; - print load_fiche_titre(' '.$langs->trans("AccountancyAreaDescActionFreq"), '', ''); - print '
'; - print "
\n"; - $step = 0; - - $langs->loadLangs(array('bills', 'trips')); - - $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64+$step), $langs->transnoentitiesnoconv("BillsCustomers"), ''.''.$langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("CustomersVentilation").''.'')."\n"; - print "
\n"; - - $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64+$step), $langs->transnoentitiesnoconv("BillsSuppliers"), ''.''.$langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("SuppliersVentilation").''.'')."\n"; - print "
\n"; - - if (! empty($conf->expensereport->enabled) || ! empty($conf->deplacement->enabled)) - { + // STEPS $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64+$step), $langs->transnoentitiesnoconv("ExpenseReports"), ''.''.$langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("ExpenseReportsVentilation").''.'')."\n"; - print "
\n"; + print img_picto('', 'puce') . ' ' . $langs->trans("AccountancyAreaDescJournalSetup", $step, + '' . '' . $langs->transnoentitiesnoconv("Setup") . ' - ' . $langs->transnoentitiesnoconv("AccountingJournals") . '' . ''); + print "
\n"; + $step++; + print img_picto('', 'puce') . ' ' . $langs->trans("AccountancyAreaDescChartModel", $step, + '' . '' . $langs->transnoentitiesnoconv("Setup") . ' - ' . $langs->transnoentitiesnoconv("Pcg_version") . '' . ''); + print "
\n"; + $step++; + print img_picto('', 'puce') . ' ' . $langs->trans("AccountancyAreaDescChart", $step, + '' . '' . $langs->transnoentitiesnoconv("Setup") . ' - ' . $langs->transnoentitiesnoconv("Chartofaccounts") . '' . ''); + print "
\n"; + + print "
\n"; + print $langs->trans("AccountancyAreaDescActionOnceBis"); + print "
\n"; + print "
\n"; + + $step++; + print img_picto('', 'puce') . ' ' . $langs->trans("AccountancyAreaDescDefault", $step, + '' . '' . $langs->transnoentitiesnoconv("Setup") . ' - ' . $langs->transnoentitiesnoconv("MenuDefaultAccounts") . '' . ''); + print "
\n"; + + $step++; + print img_picto('', 'puce') . ' ' . $langs->trans("AccountancyAreaDescBank", $step, + '' . '' . $langs->transnoentitiesnoconv("Setup") . ' - ' . $langs->transnoentitiesnoconv("MenuBankAccounts") . '' . '') . "\n"; + print "
\n"; + + $step++; + $textlink = '' . '' . $langs->transnoentitiesnoconv("Setup") . ' - ' . $langs->transnoentitiesnoconv("MenuVatAccounts") . '' . ''; + print img_picto('', 'puce') . ' ' . $langs->trans("AccountancyAreaDescVat", $step, $textlink); + print "
\n"; + if (!empty($conf->tax->enabled)) { + $textlink = '' . '' . $langs->transnoentitiesnoconv("Setup") . ' - ' . $langs->transnoentitiesnoconv("MenuTaxAccounts") . '' . ''; + $step++; + print img_picto('', 'puce') . ' ' . $langs->trans("AccountancyAreaDescContrib", $step, $textlink); + print "
\n"; + } + /*if (! empty($conf->salaries->enabled)) + { + $step++; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescSal", $step, ''.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); + // htdocs/admin/salaries.php + print "
\n"; + print "
\n"; + }*/ + if (!empty($conf->expensereport->enabled)) // TODO Move this in the default account page because this is only one accounting account per purpose, not several. + { + $step++; + print img_picto('', 'puce') . ' ' . $langs->trans("AccountancyAreaDescExpenseReport", $step, + '' . '' . $langs->transnoentitiesnoconv("Setup") . ' - ' . $langs->transnoentitiesnoconv("MenuExpenseReportAccounts") . '' . ''); + print "
\n"; + } + /* + if (! empty($conf->loan->enabled)) + { + $step++; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescLoan", $step, ''.$langs->transnoentitiesnoconv("MenuSpecialExpenses").' - '.$langs->transnoentitiesnoconv("Loans").' '.$langs->transnoentitiesnoconv("or").' '.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); + print "
\n"; + } + if (! empty($conf->don->enabled)) + { + $step++; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDonation", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); + print "
\n"; + } + if (! empty($conf->adherents->enabled)) + { + $step++; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescSubscription", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); + print "
\n"; + }*/ + + $step++; + print img_picto('', 'puce') . ' ' . $langs->trans("AccountancyAreaDescProd", $step, + '' . '' . $langs->transnoentitiesnoconv("Setup") . ' - ' . $langs->transnoentitiesnoconv("ProductsBinding") . '' . ''); + print "
\n"; + + print '
'; + + // Step A - E + + print "
\n"; + print load_fiche_titre(' ' . $langs->trans("AccountancyAreaDescActionFreq"), + '', ''); + print '
'; + print "
\n"; + $step = 0; + + $langs->loadLangs(array('bills', 'trips')); + + $step++; + print img_picto('', 'puce') . ' ' . $langs->trans("AccountancyAreaDescBind", chr(64 + $step), + $langs->transnoentitiesnoconv("BillsCustomers"), + '' . '' . $langs->transnoentitiesnoconv("TransferInAccounting") . ' - ' . $langs->transnoentitiesnoconv("CustomersVentilation") . '' . '') . "\n"; + print "
\n"; + + $step++; + print img_picto('', 'puce') . ' ' . $langs->trans("AccountancyAreaDescBind", chr(64 + $step), + $langs->transnoentitiesnoconv("BillsSuppliers"), + '' . '' . $langs->transnoentitiesnoconv("TransferInAccounting") . ' - ' . $langs->transnoentitiesnoconv("SuppliersVentilation") . '' . '') . "\n"; + print "
\n"; + + if (!empty($conf->expensereport->enabled) || !empty($conf->deplacement->enabled)) { + $step++; + print img_picto('', 'puce') . ' ' . $langs->trans("AccountancyAreaDescBind", chr(64 + $step), + $langs->transnoentitiesnoconv("ExpenseReports"), + '' . '' . $langs->transnoentitiesnoconv("TransferInAccounting") . ' - ' . $langs->transnoentitiesnoconv("ExpenseReportsVentilation") . '' . '') . "\n"; + print "
\n"; + } + + $step++; + print img_picto('', 'puce') . ' ' . $langs->trans("AccountancyAreaDescWriteRecords", chr(64 + $step), + $langs->transnoentitiesnoconv("TransferInAccounting") . ' - ' . $langs->transnoentitiesnoconv("RegistrationInAccounting"), + $langs->transnoentitiesnoconv("WriteBookKeeping")) . "\n"; + print "
\n"; + + $step++; + print img_picto('', 'puce') . ' ' . $langs->trans("AccountancyAreaDescAnalyze", chr(64 + $step)) . "
\n"; + print "
\n"; } - $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescWriteRecords", chr(64+$step), $langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("RegistrationInAccounting"), $langs->transnoentitiesnoconv("WriteBookKeeping"))."\n"; - print "
\n"; + print '
'; - $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescAnalyze", chr(64+$step))."
\n"; - print "
\n"; + print '
'; + + /* + * Show boxes + */ + $boxlist.='
'; + + $boxlist.='
'; + if(!empty($nbworkboardcount)) + { + $boxlist.=$boxwork; + } + + $boxlist.=$resultboxes['boxlista']; + + $boxlist.= '
'; + + $boxlist.= '
'; + + $boxlist.=$boxstat; + $boxlist.=$resultboxes['boxlistb']; + + $boxlist.= '
'; + $boxlist.= "\n"; + + $boxlist.='
'; + + + print $boxlist; + + print '
'; } else { print $langs->trans("Module10Desc")."
\n"; } -//dol_fiche_end(); // End of page llxFooter(); diff --git a/htdocs/admin/boxes.php b/htdocs/admin/boxes.php index 2e81a2c6dad..da400cf6764 100644 --- a/htdocs/admin/boxes.php +++ b/htdocs/admin/boxes.php @@ -29,7 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/infobox.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; // Load translation files required by the page -$langs->loadLangs(array('admin', 'boxes')); +$langs->loadLangs(array('admin', 'boxes', 'accountancy')); if (! $user->admin) accessforbidden(); diff --git a/htdocs/core/boxes/box_accountancy_last_manual_entries.php b/htdocs/core/boxes/box_accountancy_last_manual_entries.php new file mode 100644 index 00000000000..d87f2f6cc50 --- /dev/null +++ b/htdocs/core/boxes/box_accountancy_last_manual_entries.php @@ -0,0 +1,183 @@ + + * Copyright (C) 2004-2009 Laurent Destailleur + * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2019 Alexandre Spangaro + * + * 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/boxes/box_accountancy_last_manual_entries.php + * \ingroup Accountancy + * \brief Module to generated widget of last manual entries + */ + +include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php'; + + +/** + * Class to manage the box to show last manual entries + */ +class box_accountancy_last_manual_entries extends ModeleBoxes +{ + public $boxcode="accountancy_last_manual_entries"; + public $boximg="object_invoice"; + public $boxlabel="BoxLastManualEntries"; + public $depends = array("accounting"); + + /** + * @var DoliDB Database handler. + */ + public $db; + + public $param; + + public $info_box_head = array(); + public $info_box_contents = array(); + + + /** + * Constructor + * + * @param DoliDB $db Database handler + * @param string $param More parameters + */ + public function __construct($db, $param) + { + global $user; + + $this->db = $db; + + $this->hidden = ! ($user->rights->accounting->mouvements->lire); + } + + /** + * Load data for box to show them later + * + * @param int $max Maximum number of records to load + * @return void + */ + public function loadBox($max = 5) + { + global $user, $langs, $db, $conf; + + $this->max = $max; + + include_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php'; + + $bookkeepingstatic = new BookKeeping($db); + + $this->info_box_head = array('text' => $langs->trans("BoxTitleLastManualEntries", $max)); + + if ($user->rights->accounting->mouvements->lire) + { + $sql = "SELECT DISTINCT b.piece_num"; + $sql.= ", b.doc_date as date_movement"; + $sql.= ", b.label_operation"; + $sql.= ", b.montant"; + $sql.= ", b.code_journal"; + $sql.= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as b"; + $sql.= " WHERE b.fk_doc = 0"; + $sql.= " AND b.entity = ".$conf->entity; + $sql.= " ORDER BY b.piece_num DESC "; + $sql.= $db->plimit($max, 0); + + $result = $db->query($sql); + if ($result) { + $num = $db->num_rows($result); + + $line = 0; + + while ($line < $num) { + $objp = $db->fetch_object($result); + $date = $db->jdate($objp->date_movement); + $journal = $objp->code_journal; + $label = $objp->label_operation; + $amount = $objp->montant; + + $bookkeepingstatic->id = $objp->id; + $bookkeepingstatic->piece_num = $objp->piece_num; + + $this->info_box_contents[$line][] = array( + 'td' => '', + 'text' => $bookkeepingstatic->getNomUrl(1), + 'asis' => 1, + ); + + $this->info_box_contents[$line][] = array( + 'td' => 'class="right"', + 'text' => dol_print_date($date, 'day'), + 'asis' => 1, + ); + + $this->info_box_contents[$line][] = array( + 'td' => 'class="center"', + 'text' => $journal, + 'asis' => 1, + ); + + $this->info_box_contents[$line][] = array( + 'td' => 'class="tdoverflowmax150 maxwidth150onsmartphone"', + 'text' => $label, + 'asis' => 1, + ); + + /* + $this->info_box_contents[$line][] = array( + 'td' => 'class="tdoverflowmax150 maxwidth150onsmartphone"', + 'text' => $societestatic->getNomUrl(1), + 'asis' => 1, + ); + */ + + $this->info_box_contents[$line][] = array( + 'td' => 'class="nowrap right"', + 'text' => price($amount, 0, $langs, 0, -1, -1, $conf->currency), + ); + + $line++; + } + + if ($num==0) $this->info_box_contents[$line][0] = array('td' => 'class="center"','text'=>$langs->trans("NoRecordedManualEntries")); + + $db->free($result); + } else { + $this->info_box_contents[0][0] = array( + 'td' => '', + 'maxlength'=>500, + 'text' => ($db->error().' sql='.$sql), + ); + } + } else { + $this->info_box_contents[0][0] = array( + 'td' => 'class="nohover opacitymedium left"', + 'text' => $langs->trans("ReadPermissionNotAllowed") + ); + } + } + + /** + * Method to show box + * + * @param array $head Array with properties of box title + * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string + * @return string + */ + public function showBox($head = null, $contents = null, $nooutput = 0) + { + return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); + } +} diff --git a/htdocs/core/boxes/box_accountancy_suspense_account.php b/htdocs/core/boxes/box_accountancy_suspense_account.php new file mode 100644 index 00000000000..8f2851bc823 --- /dev/null +++ b/htdocs/core/boxes/box_accountancy_suspense_account.php @@ -0,0 +1,135 @@ + + * Copyright (C) 2004-2009 Laurent Destailleur + * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2019 Alexandre Spangaro + * + * 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/boxes/box_accountancy_suspense_account.php + * \ingroup Accountancy + * \brief Module to generated widget of suspense account + */ + +include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php'; + + +/** + * Class to manage the box to show suspense account + */ +class box_accountancy_suspense_account extends ModeleBoxes +{ + public $boxcode="accountancy_suspense_account"; + public $boximg="object_invoice"; + public $boxlabel="BoxSuspenseAccount"; + public $depends = array("accounting"); + + /** + * @var DoliDB Database handler. + */ + public $db; + + public $param; + + public $info_box_head = array(); + public $info_box_contents = array(); + + + /** + * Constructor + * + * @param DoliDB $db Database handler + * @param string $param More parameters + */ + public function __construct($db, $param) + { + global $user; + + $this->db = $db; + + $this->hidden = ! ($user->rights->accounting->mouvements->lire); + } + + /** + * Load data for box to show them later + * + * @param int $max Maximum number of records to load + * @return void + */ + public function loadBox() + { + global $user, $langs, $db, $conf; + + include_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php'; + + $bookkeepingstatic = new BookKeeping($db); + + $this->info_box_head = array('text' => $langs->trans("BoxTitleSuspenseAccount")); + + if ($user->rights->accounting->mouvements->lire) + { + $suspenseAccount = $conf->global->ACCOUNTING_ACCOUNT_SUSPENSE; + if (! empty($suspenseAccount) && $suspenseAccount > 0) + { + $sql = "SELECT COUNT(*) as nb_suspense_account"; + $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as b"; + $sql .= " WHERE b.numero_compte = ". $suspenseAccount; + $sql .= " AND b.entity = " . $conf->entity; + + $result = $db->query($sql); + if ($result) + { + $obj=$db->fetch_object($result); + $nbSuspenseAccount = $obj->nb_suspense_account; + } + + $this->info_box_contents[0][0] = array( + 'td' => '', + 'text' => $langs->trans("NumberOfLinesInSuspenseAccount") . ':' + ); + + $this->info_box_contents[0][1] = array( + 'td' => 'class="right"', + 'text' => '' . $nbSuspenseAccount . '', + 'asis' => 1 + ); + } else { + $this->info_box_contents[0][0] = array( + 'td' => 'class="nohover opacitymedium left"', + 'text' => $langs->trans("SuspenseAccountNotDefined") + ); + } + } else { + $this->info_box_contents[0][0] = array( + 'td' => 'class="nohover opacitymedium left"', + 'text' => $langs->trans("ReadPermissionNotAllowed") + ); + } + } + + /** + * Method to show box + * + * @param array $head Array with properties of box title + * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string + * @return string + */ + public function showBox($head = null, $contents = null, $nooutput = 0) + { + return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); + } +} diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index c6a138b2a02..01dfbb6e985 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -989,8 +989,8 @@ class FormOther * Class 'Form' must be known. * * @param User $user Object User - * @param String $areacode Code of area for pages ('0'=value for Home page) - * @return array array('selectboxlist'=>, 'boxactivated'=>, 'boxlista'=>, 'boxlistb'=>) + * @param String $areacode Code of area for pages - 0 = Home page / 1 = Accountancy page + * @return array array('selectboxlist'=>, 'boxactivated'=>, 'boxlista'=>, 'boxlistb'=>) */ public static function getBoxesArea($user, $areacode) { diff --git a/htdocs/core/class/infobox.class.php b/htdocs/core/class/infobox.class.php index 1138e3a69ad..f2257f8f894 100644 --- a/htdocs/core/class/infobox.class.php +++ b/htdocs/core/class/infobox.class.php @@ -28,13 +28,13 @@ class InfoBox { /** - * Name of positions 0=Home, 1=... + * Name of positions 0=Home, 1=Accountancy, 2=xxx * * @return string[] Array with list of zones */ public static function getListOfPagesForBoxes() { - return array(0=>'Home'); + return array(0=>'Home',1=>'Accountancy'); } /** @@ -42,7 +42,7 @@ class InfoBox * * @param DoliDB $db Database handler * @param string $mode 'available' or 'activated' - * @param string $zone Name or area (-1 for all, 0 for Homepage, 1 for xxx, ...) + * @param string $zone Name or area (-1 for all, 0 for Homepage, 1 for Accountancy, 2 for xxx, ...) * @param User|null $user Object user to filter * @param array $excludelist Array of box id (box.box_id = boxes_def.rowid) to exclude * @param int $includehidden Include also hidden boxes @@ -71,7 +71,7 @@ class InfoBox { $sql = "SELECT d.rowid as box_id, d.file, d.note, d.tms"; $sql.= " FROM ".MAIN_DB_PREFIX."boxes_def as d"; - $sql.= " WHERE d.entity IN (0,".$conf->entity.")"; + $sql.= " WHERE d.entity IN (0,".$conf->entity.")"; } dol_syslog(get_class()."::listBoxes get default box list for mode=".$mode." userid=".(is_object($user)?$user->id:'')."", LOG_DEBUG); @@ -113,7 +113,7 @@ class InfoBox // box properties $box->rowid = (empty($obj->rowid) ? '' : $obj->rowid); $box->id = (empty($obj->box_id) ? '' : $obj->box_id); - $box->position = ($obj->position == '' ? '' : $obj->position); // '0' must staty '0' + $box->position = ($obj->position == '' ? '' : $obj->position); // '0' must stay '0' $box->box_order = (empty($obj->box_order) ? '' : $obj->box_order); $box->fk_user = (empty($obj->fk_user) ? 0 : $obj->fk_user); $box->sourcefile= $relsourcefile; diff --git a/htdocs/core/modules/modAccounting.class.php b/htdocs/core/modules/modAccounting.class.php index 12f95053dc0..48e6e7df400 100644 --- a/htdocs/core/modules/modAccounting.class.php +++ b/htdocs/core/modules/modAccounting.class.php @@ -162,7 +162,10 @@ class modAccounting extends DolibarrModules $this->module_parts = array(); // Boxes - $this->boxes = array(); + $this->boxes = array( + 0=>array('file'=>'box_accountancy_last_manual_entries.php', 'enabledbydefaulton'=>'Accountancy'), + 1=>array('file'=>'box_accountancy_suspense_account.php', 'enabledbydefaulton'=>'Accountancy') + ); // Permissions $this->rights_class = 'accounting'; diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 8e44c378ba6..ce056b1f981 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -1,4 +1,5 @@ -# Dolibarr language file - en_US - Accounting Expert +# Dolibarr language file - en_US - Accountancy (Double entries) +Accountancy=Accountancy Accounting=Accounting ACCOUNTING_EXPORT_SEPARATORCSV=Column separator for export file ACCOUNTING_EXPORT_DATE=Date format for export file @@ -133,6 +134,7 @@ NotVentilatedinAccount=Not bound to the accounting account XLineSuccessfullyBinded=%s products/services successfully bound to an accounting account XLineFailedToBeBinded=%s products/services were not bound to any accounting account +ACCOUNTING_DISABLE_FAQ=Disable FAQ on accountancy area ACCOUNTING_LIMIT_LIST_VENTILATION=Number of elements to bind shown by page (maximum recommended: 50) ACCOUNTING_LIST_SORT_VENTILATION_TODO=Begin the sorting of the page "Binding to do" by the most recent elements ACCOUNTING_LIST_SORT_VENTILATION_DONE=Begin the sorting of the page "Binding done" by the most recent elements @@ -264,7 +266,7 @@ CategoryDeleted=Category for the accounting account has been removed AccountingJournals=Accounting journals AccountingJournal=Accounting journal NewAccountingJournal=New accounting journal -ShowAccoutingJournal=Show accounting journal +ShowAccountingJournal=Show accounting journal NatureOfJournal=Nature of Journal AccountingJournalType1=Miscellaneous operations AccountingJournalType2=Sales diff --git a/htdocs/langs/en_US/boxes.lang b/htdocs/langs/en_US/boxes.lang index b1ab8e41fbc..eedc75e7ca0 100644 --- a/htdocs/langs/en_US/boxes.lang +++ b/htdocs/langs/en_US/boxes.lang @@ -84,4 +84,11 @@ ForProposals=Proposals LastXMonthRolling=The latest %s month rolling ChooseBoxToAdd=Add widget to your dashboard BoxAdded=Widget was added in your dashboard -BoxTitleUserBirthdaysOfMonth=Birthdays of this month \ No newline at end of file +BoxTitleUserBirthdaysOfMonth=Birthdays of this month +BoxLastManualEntries=Last manual entries in accountancy +BoxTitleLastManualEntries=%s last manual entries +NoRecordedManualEntries=No manual entries record in accountancy +BoxSuspenseAccount=Count accountancy operation with suspense account +BoxTitleSuspenseAccount=Number of unallocated lines +NumberOfLinesInSuspenseAccount=Number of line in suspense account +SuspenseAccountNotDefined=Suspense account isn't defined From e5268f98c2a4e3f715774402c06f8ad431daed34 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 23 Sep 2019 20:48:30 +0200 Subject: [PATCH 2/7] Correct Stickler --- htdocs/core/boxes/box_accountancy_suspense_account.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/core/boxes/box_accountancy_suspense_account.php b/htdocs/core/boxes/box_accountancy_suspense_account.php index 8f2851bc823..dd2d9a17695 100644 --- a/htdocs/core/boxes/box_accountancy_suspense_account.php +++ b/htdocs/core/boxes/box_accountancy_suspense_account.php @@ -66,7 +66,6 @@ class box_accountancy_suspense_account extends ModeleBoxes /** * Load data for box to show them later * - * @param int $max Maximum number of records to load * @return void */ public function loadBox() From 1b2558bb1f7002e837161d1f054042f1b05fe5cf Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 23 Sep 2019 21:43:11 +0200 Subject: [PATCH 3/7] typo --- .../core/boxes/box_accountancy_last_manual_entries.php | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/htdocs/core/boxes/box_accountancy_last_manual_entries.php b/htdocs/core/boxes/box_accountancy_last_manual_entries.php index d87f2f6cc50..1f2b8d634d9 100644 --- a/htdocs/core/boxes/box_accountancy_last_manual_entries.php +++ b/htdocs/core/boxes/box_accountancy_last_manual_entries.php @@ -15,7 +15,7 @@ * 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 . + * along with this program. If not, see . */ /** @@ -134,14 +134,6 @@ class box_accountancy_last_manual_entries extends ModeleBoxes 'asis' => 1, ); - /* - $this->info_box_contents[$line][] = array( - 'td' => 'class="tdoverflowmax150 maxwidth150onsmartphone"', - 'text' => $societestatic->getNomUrl(1), - 'asis' => 1, - ); - */ - $this->info_box_contents[$line][] = array( 'td' => 'class="nowrap right"', 'text' => price($amount, 0, $langs, 0, -1, -1, $conf->currency), From f91513937af5ee563fae27e0e1f4d4526880d0f5 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 30 Sep 2019 21:37:20 +0200 Subject: [PATCH 4/7] Remove option to hide FAQ --- htdocs/accountancy/admin/index.php | 29 +---------------------------- htdocs/accountancy/index.php | 2 +- htdocs/langs/en_US/accountancy.lang | 1 - 3 files changed, 2 insertions(+), 30 deletions(-) diff --git a/htdocs/accountancy/admin/index.php b/htdocs/accountancy/admin/index.php index e11355b1f50..7f4ce79e165 100644 --- a/htdocs/accountancy/admin/index.php +++ b/htdocs/accountancy/admin/index.php @@ -82,20 +82,6 @@ if ($action == 'update') { } } -// TO DO Mutualize code for yes/no constants -if ($action == 'setdisablefaq') { - $setdisablefaq = GETPOST('value', 'int'); - $res = dolibarr_set_const($db, "ACCOUNTING_DISABLE_FAQ", $setdisablefaq, 'yesno', 0, '', $conf->entity); - if (! $res > 0) - $error ++; - - if (! $error) { - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } else { - setEventMessages($langs->trans("Error"), null, 'mesgs'); - } -} - if ($action == 'setlistsorttodo') { $setlistsorttodo = GETPOST('value', 'int'); $res = dolibarr_set_const($db, "ACCOUNTING_LIST_SORT_VENTILATION_TODO", $setlistsorttodo, 'yesno', 0, '', $conf->entity); @@ -225,20 +211,7 @@ if (! empty($user->admin)) { // TO DO Mutualize code for yes/no constants print ''; - print '' . $langs->trans("ACCOUNTING_DISABLE_FAQ") . ''; - if (! empty($conf->global->ACCOUNTING_DISABLE_FAQ)) { - print ''; - print img_picto($langs->trans("Activated"), 'switch_on'); - print ''; - } else { - print ''; - print img_picto($langs->trans("Disabled"), 'switch_off'); - print ''; - } - print ''; - - print ''; - print '' . $langs->trans("ACCOUNTING_LIST_SORT_VENTILATION_TODO") . ''; + print '' . $langs->trans("ACCOUNTING_LIST_SORT_VENTILATION_TODO") . ''; if (! empty($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO)) { print ''; print img_picto($langs->trans("Activated"), 'switch_on'); diff --git a/htdocs/accountancy/index.php b/htdocs/accountancy/index.php index d3ea4ccfb24..e5189a11540 100644 --- a/htdocs/accountancy/index.php +++ b/htdocs/accountancy/index.php @@ -64,7 +64,7 @@ if ($conf->accounting->enabled) { $resultboxes=FormOther::getBoxesArea($user, "1"); // Load $resultboxes (selectboxlist + boxactivated + boxlista + boxlistb) - print load_fiche_titre($langs->trans("AccountancyArea"), $resultboxes['selectboxlist'], 'title_accountancy'); + print load_fiche_titre($langs->trans("AccountancyArea"), $resultboxes['selectboxlist'], 'accountancy'); // FAQ if (empty($conf->global->ACCOUNTING_DISABLE_FAQ)) { diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index ce056b1f981..38b0798d47d 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -134,7 +134,6 @@ NotVentilatedinAccount=Not bound to the accounting account XLineSuccessfullyBinded=%s products/services successfully bound to an accounting account XLineFailedToBeBinded=%s products/services were not bound to any accounting account -ACCOUNTING_DISABLE_FAQ=Disable FAQ on accountancy area ACCOUNTING_LIMIT_LIST_VENTILATION=Number of elements to bind shown by page (maximum recommended: 50) ACCOUNTING_LIST_SORT_VENTILATION_TODO=Begin the sorting of the page "Binding to do" by the most recent elements ACCOUNTING_LIST_SORT_VENTILATION_DONE=Begin the sorting of the page "Binding done" by the most recent elements From 4d5547636d16da36b6e947205f2db6db1162958b Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Wed, 2 Oct 2019 08:43:35 +0200 Subject: [PATCH 5/7] Accountancy FAQ - Move to toggle() --- htdocs/accountancy/index.php | 334 ++++++++++++++-------------- htdocs/langs/en_US/accountancy.lang | 1 + 2 files changed, 170 insertions(+), 165 deletions(-) diff --git a/htdocs/accountancy/index.php b/htdocs/accountancy/index.php index e5189a11540..8076264655b 100644 --- a/htdocs/accountancy/index.php +++ b/htdocs/accountancy/index.php @@ -1,7 +1,7 @@ - * Copyright (C) 2016-2019 Alexandre Spangaro - * Copyright (C) 2019 Frédéric France +/* Copyright (C) 2016 Laurent Destailleur + * Copyright (C) 2016-2019 Alexandre Spangaro + * Copyright (C) 2019 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 @@ -44,14 +44,14 @@ $hookmanager->initHooks(array('accountancyindex')); if (GETPOST('addbox')) // Add box (when submit is done from a form when ajax disabled) { - require_once DOL_DOCUMENT_ROOT.'/core/class/infobox.class.php'; - $zone=GETPOST('areacode', 'aZ09'); - $userid=GETPOST('userid', 'int'); - $boxorder=GETPOST('boxorder', 'aZ09'); - $boxorder.=GETPOST('boxcombo', 'aZ09'); + require_once DOL_DOCUMENT_ROOT.'/core/class/infobox.class.php'; + $zone=GETPOST('areacode', 'aZ09'); + $userid=GETPOST('userid', 'int'); + $boxorder=GETPOST('boxorder', 'aZ09'); + $boxorder.=GETPOST('boxcombo', 'aZ09'); - $result=InfoBox::saveboxorder($db, $zone, $boxorder, $userid); - if ($result > 0) setEventMessages($langs->trans("BoxAdded"), null); + $result=InfoBox::saveboxorder($db, $zone, $boxorder, $userid); + if ($result > 0) setEventMessages($langs->trans("BoxAdded"), null); } /* @@ -62,181 +62,185 @@ llxHeader('', $langs->trans("AccountancyArea")); if ($conf->accounting->enabled) { - $resultboxes=FormOther::getBoxesArea($user, "1"); // Load $resultboxes (selectboxlist + boxactivated + boxlista + boxlistb) + $step = 0; - print load_fiche_titre($langs->trans("AccountancyArea"), $resultboxes['selectboxlist'], 'accountancy'); + $resultboxes=FormOther::getBoxesArea($user, "1"); // Load $resultboxes (selectboxlist + boxactivated + boxlista + boxlistb) - // FAQ - if (empty($conf->global->ACCOUNTING_DISABLE_FAQ)) { - $step = 0; + print load_fiche_titre($langs->trans("AccountancyArea"), $resultboxes['selectboxlist'], 'accountancy'); - print '' . $langs->trans("AccountancyAreaDescIntro") . "
\n"; - print "
\n"; - print "
\n"; - print load_fiche_titre(' ' . $langs->trans("AccountancyAreaDescActionOnce"), - '', '') . "\n"; - print '
'; - print "
\n"; + print '
'; - // STEPS - $step++; - print img_picto('', 'puce') . ' ' . $langs->trans("AccountancyAreaDescJournalSetup", $step, - '' . '' . $langs->transnoentitiesnoconv("Setup") . ' - ' . $langs->transnoentitiesnoconv("AccountingJournals") . '' . ''); - print "
\n"; - $step++; - print img_picto('', 'puce') . ' ' . $langs->trans("AccountancyAreaDescChartModel", $step, - '' . '' . $langs->transnoentitiesnoconv("Setup") . ' - ' . $langs->transnoentitiesnoconv("Pcg_version") . '' . ''); - print "
\n"; - $step++; - print img_picto('', 'puce') . ' ' . $langs->trans("AccountancyAreaDescChart", $step, - '' . '' . $langs->transnoentitiesnoconv("Setup") . ' - ' . $langs->transnoentitiesnoconv("Chartofaccounts") . '' . ''); - print "
\n"; + print ''; - print "
\n"; - print $langs->trans("AccountancyAreaDescActionOnceBis"); - print "
\n"; - print "
\n"; + print '
'; // hideobject is to start hidden + print "
\n"; + print ''.$langs->trans("AccountancyAreaDescIntro")."
\n"; + print "
\n";print "
\n"; - $step++; - print img_picto('', 'puce') . ' ' . $langs->trans("AccountancyAreaDescDefault", $step, - '' . '' . $langs->transnoentitiesnoconv("Setup") . ' - ' . $langs->transnoentitiesnoconv("MenuDefaultAccounts") . '' . ''); - print "
\n"; + print load_fiche_titre(' '.$langs->trans("AccountancyAreaDescActionOnce"), '', '')."\n"; + print '
'; + print "
\n"; - $step++; - print img_picto('', 'puce') . ' ' . $langs->trans("AccountancyAreaDescBank", $step, - '' . '' . $langs->transnoentitiesnoconv("Setup") . ' - ' . $langs->transnoentitiesnoconv("MenuBankAccounts") . '' . '') . "\n"; - print "
\n"; + // STEPS + $step++; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescJournalSetup", $step, ''.''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("AccountingJournals").''.''); + print "
\n"; + $step++; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChartModel", $step, ''.''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Pcg_version").''.''); + print "
\n"; + $step++; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChart", $step, ''.''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Chartofaccounts").''.''); + print "
\n"; - $step++; - $textlink = '' . '' . $langs->transnoentitiesnoconv("Setup") . ' - ' . $langs->transnoentitiesnoconv("MenuVatAccounts") . '' . ''; - print img_picto('', 'puce') . ' ' . $langs->trans("AccountancyAreaDescVat", $step, $textlink); - print "
\n"; - if (!empty($conf->tax->enabled)) { - $textlink = '' . '' . $langs->transnoentitiesnoconv("Setup") . ' - ' . $langs->transnoentitiesnoconv("MenuTaxAccounts") . '' . ''; - $step++; - print img_picto('', 'puce') . ' ' . $langs->trans("AccountancyAreaDescContrib", $step, $textlink); - print "
\n"; - } - /*if (! empty($conf->salaries->enabled)) - { - $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescSal", $step, ''.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); - // htdocs/admin/salaries.php - print "
\n"; - print "
\n"; - }*/ - if (!empty($conf->expensereport->enabled)) // TODO Move this in the default account page because this is only one accounting account per purpose, not several. - { - $step++; - print img_picto('', 'puce') . ' ' . $langs->trans("AccountancyAreaDescExpenseReport", $step, - '' . '' . $langs->transnoentitiesnoconv("Setup") . ' - ' . $langs->transnoentitiesnoconv("MenuExpenseReportAccounts") . '' . ''); - print "
\n"; - } - /* - if (! empty($conf->loan->enabled)) - { - $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescLoan", $step, ''.$langs->transnoentitiesnoconv("MenuSpecialExpenses").' - '.$langs->transnoentitiesnoconv("Loans").' '.$langs->transnoentitiesnoconv("or").' '.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); - print "
\n"; - } - if (! empty($conf->don->enabled)) - { - $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDonation", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); - print "
\n"; - } - if (! empty($conf->adherents->enabled)) - { - $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescSubscription", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); - print "
\n"; - }*/ + print "
\n"; + print $langs->trans("AccountancyAreaDescActionOnceBis"); + print "
\n"; + print "
\n"; - $step++; - print img_picto('', 'puce') . ' ' . $langs->trans("AccountancyAreaDescProd", $step, - '' . '' . $langs->transnoentitiesnoconv("Setup") . ' - ' . $langs->transnoentitiesnoconv("ProductsBinding") . '' . ''); - print "
\n"; + $step++; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDefault", $step, ''.''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").''.''); + print "
\n"; - print '
'; + $step++; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBank", $step, ''.''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuBankAccounts").''.'')."\n"; + print "
\n"; - // Step A - E - - print "
\n"; - print load_fiche_titre(' ' . $langs->trans("AccountancyAreaDescActionFreq"), - '', ''); - print '
'; - print "
\n"; - $step = 0; - - $langs->loadLangs(array('bills', 'trips')); - - $step++; - print img_picto('', 'puce') . ' ' . $langs->trans("AccountancyAreaDescBind", chr(64 + $step), - $langs->transnoentitiesnoconv("BillsCustomers"), - '' . '' . $langs->transnoentitiesnoconv("TransferInAccounting") . ' - ' . $langs->transnoentitiesnoconv("CustomersVentilation") . '' . '') . "\n"; - print "
\n"; - - $step++; - print img_picto('', 'puce') . ' ' . $langs->trans("AccountancyAreaDescBind", chr(64 + $step), - $langs->transnoentitiesnoconv("BillsSuppliers"), - '' . '' . $langs->transnoentitiesnoconv("TransferInAccounting") . ' - ' . $langs->transnoentitiesnoconv("SuppliersVentilation") . '' . '') . "\n"; - print "
\n"; - - if (!empty($conf->expensereport->enabled) || !empty($conf->deplacement->enabled)) { - $step++; - print img_picto('', 'puce') . ' ' . $langs->trans("AccountancyAreaDescBind", chr(64 + $step), - $langs->transnoentitiesnoconv("ExpenseReports"), - '' . '' . $langs->transnoentitiesnoconv("TransferInAccounting") . ' - ' . $langs->transnoentitiesnoconv("ExpenseReportsVentilation") . '' . '') . "\n"; - print "
\n"; - } - - $step++; - print img_picto('', 'puce') . ' ' . $langs->trans("AccountancyAreaDescWriteRecords", chr(64 + $step), - $langs->transnoentitiesnoconv("TransferInAccounting") . ' - ' . $langs->transnoentitiesnoconv("RegistrationInAccounting"), - $langs->transnoentitiesnoconv("WriteBookKeeping")) . "\n"; - print "
\n"; - - $step++; - print img_picto('', 'puce') . ' ' . $langs->trans("AccountancyAreaDescAnalyze", chr(64 + $step)) . "
\n"; - print "
\n"; - } - - print '
'; - - print '
'; - - /* - * Show boxes - */ - $boxlist.='
'; - - $boxlist.='
'; - if(!empty($nbworkboardcount)) + $step++; + $textlink = ''.''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuVatAccounts").''.''; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescVat", $step, $textlink); + print "
\n"; + if (! empty($conf->tax->enabled)) { - $boxlist.=$boxwork; + $textlink = ''.''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuTaxAccounts").''.''; + $step++; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescContrib", $step, $textlink); + print "
\n"; + } + /*if (! empty($conf->salaries->enabled)) + { + $step++; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescSal", $step, ''.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); + // htdocs/admin/salaries.php + print "
\n"; + print "
\n"; + }*/ + if (! empty($conf->expensereport->enabled)) // TODO Move this in the default account page because this is only one accounting account per purpose, not several. + { + $step++; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescExpenseReport", $step, ''.''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuExpenseReportAccounts").''.''); + print "
\n"; + } + /* + if (! empty($conf->loan->enabled)) + { + $step++; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescLoan", $step, ''.$langs->transnoentitiesnoconv("MenuSpecialExpenses").' - '.$langs->transnoentitiesnoconv("Loans").' '.$langs->transnoentitiesnoconv("or").' '.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); + print "
\n"; + } + if (! empty($conf->don->enabled)) + { + $step++; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDonation", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); + print "
\n"; + } + if (! empty($conf->adherents->enabled)) + { + $step++; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescSubscription", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); + print "
\n"; + }*/ + + $step++; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescProd", $step, ''.''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("ProductsBinding").''.''); + print "
\n"; + + + print '
'; + + // Step A - E + + print "
\n"; + print load_fiche_titre(' '.$langs->trans("AccountancyAreaDescActionFreq"), '', ''); + print '
'; + print "
\n"; + $step = 0; + + $langs->loadLangs(array('bills', 'trips')); + + $step++; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64+$step), $langs->transnoentitiesnoconv("BillsCustomers"), ''.''.$langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("CustomersVentilation").''.'')."\n"; + print "
\n"; + + $step++; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64+$step), $langs->transnoentitiesnoconv("BillsSuppliers"), ''.''.$langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("SuppliersVentilation").''.'')."\n"; + print "
\n"; + + if (! empty($conf->expensereport->enabled) || ! empty($conf->deplacement->enabled)) + { + $step++; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64+$step), $langs->transnoentitiesnoconv("ExpenseReports"), ''.''.$langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("ExpenseReportsVentilation").''.'')."\n"; + print "
\n"; } - $boxlist.=$resultboxes['boxlista']; + $step++; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescWriteRecords", chr(64+$step), $langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("RegistrationInAccounting"), $langs->transnoentitiesnoconv("WriteBookKeeping"))."\n"; + print "
\n"; - $boxlist.= '
'; - - $boxlist.= '
'; - - $boxlist.=$boxstat; - $boxlist.=$resultboxes['boxlistb']; - - $boxlist.= '
'; - $boxlist.= "\n"; - - $boxlist.='
'; - - - print $boxlist; + $step++; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescAnalyze", chr(64+$step))."
\n"; + print "
\n"; print '
'; + + print '
'; + + print '
'; + + /* + * Show boxes + */ + $boxlist.='
'; + + $boxlist.='
'; + if(!empty($nbworkboardcount)) + { + $boxlist.=$boxwork; + } + + $boxlist.=$resultboxes['boxlista']; + + $boxlist.= '
'; + + $boxlist.= '
'; + + $boxlist.=$boxstat; + $boxlist.=$resultboxes['boxlistb']; + + $boxlist.= '
'; + $boxlist.= "\n"; + + $boxlist.='
'; + + + print $boxlist; + + print '
'; } else { + print load_fiche_titre($langs->trans("AccountancyArea"), '', 'accountancy'); + print $langs->trans("Module10Desc")."
\n"; } diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 38b0798d47d..30b060fb4d3 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -257,6 +257,7 @@ ListOfProductsWithoutAccountingAccount=List of products not bound to any account ChangeBinding=Change the binding Accounted=Accounted in ledger NotYetAccounted=Not yet accounted in ledger +ShowFAQ=Show FAQ ## Admin ApplyMassCategories=Apply mass categories From 848acb6096c5b370da5890e4e13e959a1b704f2a Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Wed, 2 Oct 2019 08:49:33 +0200 Subject: [PATCH 6/7] Update index --- htdocs/core/modules/modAccounting.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/modAccounting.class.php b/htdocs/core/modules/modAccounting.class.php index cd117bd4d96..a806cab111f 100644 --- a/htdocs/core/modules/modAccounting.class.php +++ b/htdocs/core/modules/modAccounting.class.php @@ -163,8 +163,8 @@ class modAccounting extends DolibarrModules // Boxes $this->boxes = array( - 0=>array('file'=>'box_accountancy_last_manual_entries.php', 'enabledbydefaulton'=>'Accountancy'), - 1=>array('file'=>'box_accountancy_suspense_account.php', 'enabledbydefaulton'=>'Accountancy') + 0=>array('file'=>'box_accountancy_last_manual_entries.php', 'enabledbydefaulton'=>'accountancyindex'), + 1=>array('file'=>'box_accountancy_suspense_account.php', 'enabledbydefaulton'=>'accountancyindex') ); // Permissions From 94179f712d33e8a8fc951fa25580a0c7bdf9f7ff Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Wed, 2 Oct 2019 08:58:25 +0200 Subject: [PATCH 7/7] Update areacode --- htdocs/accountancy/index.php | 2 +- htdocs/core/class/html.formother.class.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/index.php b/htdocs/accountancy/index.php index 25e9a1fecd3..36ebaf07c94 100644 --- a/htdocs/accountancy/index.php +++ b/htdocs/accountancy/index.php @@ -64,7 +64,7 @@ if ($conf->accounting->enabled) { $step = 0; - $resultboxes=FormOther::getBoxesArea($user, "1"); // Load $resultboxes (selectboxlist + boxactivated + boxlista + boxlistb) + $resultboxes=FormOther::getBoxesArea($user, "27"); // Load $resultboxes (selectboxlist + boxactivated + boxlista + boxlistb) print load_fiche_titre($langs->trans("AccountancyArea"), $resultboxes['selectboxlist'], 'accountancy'); diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index e890a2e05e7..48db977255f 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -989,7 +989,7 @@ class FormOther * Class 'Form' must be known. * * @param User $user Object User - * @param String $areacode Code of area for pages - 0 = Home page / 1 = Accountancy page + * @param String $areacode Code of area for pages - 0 = Home page ... See getListOfPagesForBoxes() * @return array array('selectboxlist'=>, 'boxactivated'=>, 'boxlista'=>, 'boxlistb'=>) */ public static function getBoxesArea($user, $areacode)