diff --git a/htdocs/accountancy/admin/export.php b/htdocs/accountancy/admin/export.php index cdec35415fd00..5ffcbfe92ba0a 100644 --- a/htdocs/accountancy/admin/export.php +++ b/htdocs/accountancy/admin/export.php @@ -47,7 +47,7 @@ // Parameters ACCOUNTING_EXPORT_* $main_option = array ( - 'ACCOUNTING_EXPORT_PREFIX_SPEC' + 'ACCOUNTING_EXPORT_PREFIX_SPEC' ); $model_option = array ( @@ -67,10 +67,10 @@ */ if ($action == 'update') { $error = 0; - + $format = GETPOST('format', 'alpha'); $modelcsv = GETPOST('modelcsv', 'int'); - + if (! empty($format)) { if (! dolibarr_set_const($db, 'ACCOUNTING_EXPORT_FORMAT', $format, 'chaine', 0, '', $conf->entity)) { $error ++; @@ -78,7 +78,7 @@ } else { $error ++; } - + if (! empty($modelcsv)) { if (! dolibarr_set_const($db, 'ACCOUNTING_EXPORT_MODELCSV', $modelcsv, 'chaine', 0, '', $conf->entity)) { $error ++; @@ -89,23 +89,23 @@ } else { $error ++; } - + foreach ( $main_option as $constname ) { $constvalue = GETPOST($constname, 'alpha'); - + if (! dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) { $error ++; } } - + foreach ( $model_option as $constname ) { $constvalue = GETPOST($constname, 'alpha'); - + if (! dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) { $error ++; } } - + if (! $error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { @@ -148,13 +148,13 @@ $num = count($main_option); if ($num) { foreach ( $main_option as $key ) { - + print ''; - + // Param $label = $langs->trans($key); print '' . $label . ''; - + // Value print ''; print ''; @@ -187,7 +187,7 @@ print ''; $listmodelcsv = AccountancyExport::getType(); print $form->selectarray("modelcsv", $listmodelcsv, $conf->global->ACCOUNTING_EXPORT_MODELCSV, 0); - + print ''; } print ""; @@ -205,12 +205,12 @@ print ''; print '' . $langs->trans('OtherOptions') . ''; print "\n"; - - if ($conf->global->ACCOUNTING_EXPORT_MODELCSV > 1) + + if ($conf->global->ACCOUNTING_EXPORT_MODELCSV > AccountancyExport::EXPORT_TYPE_NORMAL) { print '' . $langs->trans('OptionsDeactivatedForThisExportModel') . ''; } - + print ''; print '' . $langs->trans("Selectformat") . ''; if (! $conf->use_javascript_ajax) { @@ -224,24 +224,24 @@ 'txt' => $langs->trans("txt") ); print $form->selectarray("format", $listformat, $conf->global->ACCOUNTING_EXPORT_FORMAT, 0); - + print ''; } print ""; - - foreach ( $model_option as $key ) { + + foreach ( $model_option as $key ) { print ''; - + // Param $label = $langs->trans($key); print '' . $label . ''; - + // Value print ''; print ''; print ''; } - + print "\n"; } diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index a32b739752a28..55960776c6da2 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -51,7 +51,7 @@ $search_accountancy_code_end = ''; } -if (GETPOST("button_export_csv_x") || GETPOST("button_export_csv")) { +if (GETPOST("button_export_csv_x") || GETPOST("button_export_csv.x") || GETPOST("button_export_csv")) { $action = 'export_csv'; } @@ -112,7 +112,10 @@ */ if ($action == 'export_csv') { + $sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV; + if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == AccountancyExport::EXPORT_TYPE_CEGID) $sep = ";"; // For CEGID, we force separator. + $journal = 'bookkepping'; include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php'; @@ -122,11 +125,7 @@ setEventMessages($object->error, $object->errors, 'errors'); } - foreach ( $object->lines as $line ) { - - if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2) { - $sep = ";"; - } + foreach ($object->lines as $line) { print length_accountg($line->numero_compte) . $sep; print $line->debit . $sep; print $line->credit . $sep; @@ -157,7 +156,7 @@ print '
'; - $button = ''; + $button = 'global->ACCOUNTING_EXPORT_FORMAT.')" />'; print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $options, $sortfield, $sortorder, '', $result, $result, 'title_accountancy', 0, $button); $moreforfilter = ''; diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 16d27df15fd01..6f994eb11101f 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -25,8 +25,7 @@ * \brief List operation of book keeping */ require '../../main.inc.php'; - -// Class +require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountancyexport.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php'; require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php'; @@ -47,11 +46,11 @@ $search_date_end = dol_mktime(0, 0, 0, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int')); $search_doc_date = dol_mktime(0, 0, 0, GETPOST('doc_datemonth', 'int'), GETPOST('doc_dateday', 'int'), GETPOST('doc_dateyear', 'int')); -if (GETPOST("button_delmvt_x") || GETPOST("button_delmvt")) { +if (GETPOST("button_delmvt_x") || GETPOST("button_delmvt.x") || GETPOST("button_delmvt")) { $action = 'delbookkeepingyear'; } -if (GETPOST("button_export_csv_x") || GETPOST("button_export_csv")) { - $action = 'export_csv'; +if (GETPOST("button_export_file_x") || GETPOST("button_export_file.x") || GETPOST("button_export_file")) { + $action = 'export_file'; } $search_accountancy_code = GETPOST("search_accountancy_code"); @@ -99,7 +98,7 @@ $form = new Form($db); -if ($action != 'export_csv' && ! isset($_POST['begin']) && ! isset($_GET['begin']) && ! isset($_POST['formfilteraction']) && empty($page)) { +if ($action != 'export_file' && ! isset($_POST['begin']) && ! isset($_GET['begin']) && ! isset($_POST['formfilteraction']) && empty($page)) { $search_date_start = dol_mktime(0, 0, 0, 1, 1, dol_print_date(dol_now(), '%Y')); $search_date_end = dol_mktime(0, 0, 0, 12, 31, dol_print_date(dol_now(), '%Y')); } @@ -261,9 +260,8 @@ } } -if ($action == 'export_csv') { - - include DOL_DOCUMENT_ROOT . '/accountancy/class/accountancyexport.class.php'; +// Export into a file with format defined into setup +if ($action == 'export_file') { $result = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter); @@ -356,9 +354,11 @@ print ''; print ''; -$button = ''; +$listofformat=AccountancyExport::getType(); +$button = ''; if (count($filter)) $button.= $langs->trans("ExportFilteredList"); else $button.= $langs->trans("ExportList"); +$button.=' ('.$listofformat[$conf->global->ACCOUNTING_EXPORT_MODELCSV].')'; $button.= ''; $groupby = ' ' . $langs->trans("GroupByAccountAccounting") . ''; diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index a3358337889fa..e9ad42858aa39 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -32,14 +32,15 @@ * * Manage the different format accountancy export */ + require_once DOL_DOCUMENT_ROOT . '/core/lib/functions.lib.php'; + class AccountancyExport { /** - * - * @var Type of export + * @var Type of export. Defined by $conf->global->ACCOUNTING_EXPORT_MODELCSV */ - public static $EXPORT_TYPE_NORMAL = 1; + public static $EXPORT_TYPE_NORMAL = 1; // Classic CSV public static $EXPORT_TYPE_CEGID = 2; public static $EXPORT_TYPE_COALA = 3; public static $EXPORT_TYPE_BOB50 = 4; @@ -81,7 +82,7 @@ public function __construct(DoliDB &$db) { } /** - * Get all export type are available + * Array wit all export type available (key + label) * * @return array of type */ diff --git a/htdocs/accountancy/journal/expensereportsjournal.php b/htdocs/accountancy/journal/expensereportsjournal.php index 1a18e89792ad1..8d6f8ca4dcdd7 100644 --- a/htdocs/accountancy/journal/expensereportsjournal.php +++ b/htdocs/accountancy/journal/expensereportsjournal.php @@ -52,6 +52,7 @@ $date_endmonth = GETPOST('date_endmonth'); $date_endday = GETPOST('date_endday'); $date_endyear = GETPOST('date_endyear'); +$in_bookkeeping = GETPOST('in_bookkeeping'); $now = dol_now(); @@ -104,6 +105,8 @@ $sql .= " AND er.entity IN (" . getEntity('expensereport', 0) . ")"; // We don't share object for accountancy if ($date_start && $date_end) $sql .= " AND er.date_debut >= '" . $db->idate($date_start) . "' AND er.date_debut <= '" . $db->idate($date_end) . "'"; +if ($in_bookkeeping == 'yes') + $sql .= " AND (er.rowid NOT IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='expense_report') )"; $sql .= " ORDER BY er.date_debut"; dol_syslog('accountancy/journal/expensereportsjournal.php:: $sql=' . $sql); @@ -466,7 +469,7 @@ $builddate = time(); $description.= $langs->trans("DescJournalOnlyBindedVisible").'
'; - $period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1); + $period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1). ' - ' .$langs->trans("AlreadyInGeneralLedger").' '. $form->selectyesno('in_bookkeeping',$in_bookkeeping,0); $varlink = 'id_journal=' . $id_journal; diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index e023e14a8171e..963ae4f19afc3 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -43,7 +43,7 @@ $langs->load("accountancy"); $id_journal = GETPOST('id_journal', 'int'); -$action = GETPOST('action','alpha'); +$action = GETPOST('action','aZ09'); $date_startmonth = GETPOST('date_startmonth'); $date_startday = GETPOST('date_startday'); diff --git a/htdocs/compta/salaries/document.php b/htdocs/compta/salaries/document.php index 678442453c6d4..03cef9c07e874 100644 --- a/htdocs/compta/salaries/document.php +++ b/htdocs/compta/salaries/document.php @@ -91,7 +91,7 @@ $head=salaries_prepare_head($object); - dol_fiche_head($head, 'documents', $langs->trans("SalaryPayment"), 0, 'payment'); + dol_fiche_head($head, 'documents', $langs->trans("SalaryPayment"), -1, 'payment'); // Construit liste des fichiers $filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview.*\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); diff --git a/htdocs/compta/salaries/index.php b/htdocs/compta/salaries/index.php index e87fc932c50a4..baf991829939d 100644 --- a/htdocs/compta/salaries/index.php +++ b/htdocs/compta/salaries/index.php @@ -73,6 +73,12 @@ $typeid=$_REQUEST['typeid']; } + + +/* + * Actions + */ + if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers { $search_ref=""; @@ -82,6 +88,7 @@ $typeid=""; } + /* * View */ @@ -151,23 +158,23 @@ print ''; print ''; print ''; - + print_barre_liste($langs->trans("SalariesPayments"),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num, $totalnboflines, 'title_accountancy.png', 0, '', '', $limit); - + print '
'; print ''."\n"; print ''; // Ref print ''; // Employee print ''; // Label - print ''; + print ''; // Date print ''; // Type @@ -182,13 +189,13 @@ print ''; } // Amount - print ''; + print ''; print ''; - + print ''; print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"s.rowid","",$param,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Employee"),$_SERVER["PHP_SELF"],"u.rowid","",$param,"",$sortfield,$sortorder); @@ -199,13 +206,13 @@ print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"s.amount","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch '); print "\n"; - + print "\n"; while ($i < min($num,$limit)) { $obj = $db->fetch_object($result); - + print ''; $userstatic->id=$obj->uid; @@ -238,11 +245,11 @@ $accountstatic->id=$obj->bid; $accountstatic->ref=$obj->bref; $accountstatic->number=$obj->bnumber; - + if (! empty($conf->accounting->enabled)) { $accountstatic->account_number=$obj->account_number; - + $accountingjournal = new AccountingJournal($db); $accountingjournal->fetch($obj->fk_accountancy_journal); diff --git a/htdocs/compta/salaries/info.php b/htdocs/compta/salaries/info.php index 05dc7835b6864..ddb7984574868 100644 --- a/htdocs/compta/salaries/info.php +++ b/htdocs/compta/salaries/info.php @@ -55,7 +55,7 @@ $head = salaries_prepare_head($object); -dol_fiche_head($head, 'info', $langs->trans("SalaryPayment"), 0, 'payment'); +dol_fiche_head($head, 'info', $langs->trans("SalaryPayment"), -1, 'payment'); $linkback = ''.$langs->trans("BackToList").''; @@ -72,6 +72,8 @@ print '
'; print '
'; +print '
'; + print '
'; - print ''; + print ''; print ''; - print ''; + print ''; print ' '; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print '
'; dol_print_object_info($object); print '
'; diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index 76d58132caf68..7bf98cf6ec0c0 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -220,7 +220,7 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2458__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_default', 2451__+MAX_llx_menu__, '/accountancy/admin/defaultaccounts.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuDefaultAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 50, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2459__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_vat', 2451__+MAX_llx_menu__, '/admin/dict.php?id=10&from=accountancy&search_country_id=__MYCOUNTRYID__&mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuVatAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 60, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2460__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_tax', 2451__+MAX_llx_menu__, '/admin/dict.php?id=7&from=accountancy&search_country_id=__MYCOUNTRYID__&mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuTaxAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 70, __ENTITY__); - insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2461__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_expensereport', 2451__+MAX_llx_menu__, '/admin/dict.php?id=17&from=accountancy&mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuExpenseReportAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 80, __ENTITY__); + insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $conf->expensereport->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2461__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_expensereport', 2451__+MAX_llx_menu__, '/admin/dict.php?id=17&from=accountancy&mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuExpenseReportAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 80, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2462__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_product', 2451__+MAX_llx_menu__, '/accountancy/admin/productaccount.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuProductsAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 90, __ENTITY__); -- Accounting period insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin" && $conf->global->MAIN_FEATURES_LEVEL > 0', __HANDLER__, 'left', 2450__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_period', 2451__+MAX_llx_menu__, '/accountancy/admin/fiscalyear.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'FiscalPeriod', 1, 'admin', '', '', 2, 80, __ENTITY__); diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index b479f02619c03..5ec7bf6667230 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1007,11 +1007,12 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu $objp = $db->fetch_object($resql); $nature=''; + // Must match array $sourceList defined into journals_list.php - if ($objp->nature == 2) $nature="sells"; - if ($objp->nature == 3) $nature="purchases"; - if ($objp->nature == 4) $nature="bank"; - if ($objp->nature == 5) $nature="expensereports"; + if ($objp->nature == 2 && ! empty($conf->facture->enabled)) $nature="sells"; + if ($objp->nature == 3 && ! empty($conf->fournisseur->enabled)) $nature="purchases"; + if ($objp->nature == 4 && ! empty($conf->banque->enabled)) $nature="bank"; + if ($objp->nature == 5 && ! empty($conf->expensereport->enabled)) $nature="expensereports"; if ($objp->nature == 1) $nature="various"; if ($objp->nature == 9) $nature="hasnew"; diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index bcbac85c17d1d..b5f4620762687 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -28,6 +28,7 @@ OverviewOfAmountOfLinesBound=Overview of amount of lines already bound to accoun OtherInfo=Other information DeleteCptCategory=Remove accounting account from group ConfirmDeleteCptCategory=Are you sure you want to remove this accounting account from the accounting account group ? +AlreadyInGeneralLedger=Already journalized in ledgers AccountancyArea=Accountancy area AccountancyAreaDescIntro=Usage of the accountancy module is done in several step: