diff --git a/dev/skeletons/skeleton_list.php b/dev/skeletons/skeleton_list.php index 78f17dc1a63..6fbecbf2675 100644 --- a/dev/skeletons/skeleton_list.php +++ b/dev/skeletons/skeleton_list.php @@ -280,7 +280,7 @@ if ($resql) print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $params, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies', 0, '', '', $limit); - print '
'; + print ''; if ($optioncss != '') print ''; print ''; print ''; diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index 5bdaa3c5828..2f7228eb9d4 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -1,6 +1,7 @@ * Copyright (C) 2013-2016 Alexandre Spangaro + * Copyright (C) 2016 Laurent Destailleur * * 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 @@ -48,6 +49,8 @@ if ($user->societe_id > 0) if (! $user->rights->accounting->chartofaccount) accessforbidden(); +// Load variable for pagination +$limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit; $sortfield = GETPOST("sortfield", 'alpha'); $sortorder = GETPOST("sortorder", 'sortorder'); $limit = GETPOST('limit') ? GETPOST('limit', 'int') : $conf->liste_limit; @@ -55,7 +58,7 @@ $page = GETPOST("page", 'int'); if ($page == - 1) { $page = 0; } -$offset = $conf->liste_limit * $page; +$offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; if (! $sortfield) @@ -63,13 +66,31 @@ if (! $sortfield) if (! $sortorder) $sortorder = "ASC"; -if ($action == 'delete') { - $formconfirm = $html->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $id, $langs->trans('DeleteAccount'), $langs->trans('ConfirmDeleteAccount'), 'confirm_delete', '', 0, 1); - print $formconfirm; -} - $accounting = new AccountingAccount($db); + +/* + * Actions + */ + +if (GETPOST('cancel')) { $action='list'; $massaction=''; } +if (! GETPOST('confirmmassaction')) { $massaction=''; } + +$parameters=array(); +$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + +include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; + +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") ||GETPOST("button_removefilter")) // All test are required to be compatible with all browsers +{ + $search_account = ""; + $search_label = ""; + $search_accountparent = ""; + $search_pcgtype = ""; + $search_pcgsubtype = ""; +} + if ($action == 'disable') { if ($accounting->fetch($id)) { $result = $accounting->account_desactivate($id); @@ -89,21 +110,18 @@ if ($action == 'disable') { } } -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers -{ - $search_account = ""; - $search_label = ""; - $search_accountparent = ""; - $search_pcgtype = ""; - $search_pcgsubtype = ""; -} /* * View - * */ + llxHeader('', $langs->trans("ListAccounts")); +if ($action == 'delete') { + $formconfirm = $html->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $id, $langs->trans('DeleteAccount'), $langs->trans('ConfirmDeleteAccount'), 'confirm_delete', '', 0, 1); + print $formconfirm; +} + $pcgver = $conf->global->CHARTOFACCOUNTS; $sql = "SELECT aa.rowid, aa.fk_pcg_version, aa.pcg_type, aa.pcg_subtype, aa.account_number, aa.account_parent , aa.label, aa.active, "; @@ -128,8 +146,16 @@ if (strlen(trim($search_pcgtype))) { if (strlen(trim($search_pcgsubtype))) { $sql .= " AND aa.pcg_subtype like '%" . $search_pcgsubtype . "%'"; } - $sql .= $db->order($sortfield, $sortorder); + +// Count total nb of records +$nbtotalofrecords = 0; +if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) +{ + $result = $db->query($sql); + $nbtotalofrecords = $db->num_rows($result); +} + $sql .= $db->plimit($limit + 1, $offset); dol_syslog('accountancy/admin/account.php:: $sql=' . $sql); @@ -138,7 +164,15 @@ $result = $db->query($sql); if ($result) { $num = $db->num_rows($result); - print_barre_liste($langs->trans('ListAccounts'), $page, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', $num); + $params=''; + if ($search_account != "") $params.= '&search_account='.urlencode($search_account); + if ($search_label != "") $params.= '&search_label='.urlencode($search_label); + if ($search_accountparent != "") $params.= '&search_accountparent='.urlencode($search_accountparent); + if ($search_pcgtype != "") $params.= '&search_pcgtype='.urlencode($search_pcgtype); + if ($search_pcgsubtype != "") $params.= '&search_pcgsubtype='.urlencode($search_pcgsubtype); + if ($optioncss != '') $param.='&optioncss='.$optioncss; + + print_barre_liste($langs->trans('ListAccounts'), $page, $_SERVER["PHP_SELF"], $params, $sortfield, $sortorder, '', $num, $nbtotalofrecords); $i = 0; @@ -154,13 +188,13 @@ if ($result) { print ''; print ''; - print_liste_field_titre($langs->trans("AccountNumber"), $_SERVER["PHP_SELF"], "aa.account_number", "", $param, "", $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"], "aa.label", "", $param, "", $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Accountparent"), $_SERVER["PHP_SELF"], "aa.account_parent", "", $param, "", $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Pcgtype"), $_SERVER["PHP_SELF"], "aa.pcg_type", "", $param, "", $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Pcgsubtype"), $_SERVER["PHP_SELF"], "aa.pcg_subtype", "", $param, "", $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Activated"), $_SERVER["PHP_SELF"], "aa.active", "", $param, "", $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Action"), $_SERVER["PHP_SELF"], "", $param, "", 'width="60" align="center"', $sortfield, $sortorder); + print_liste_field_titre($langs->trans("AccountNumber"), $_SERVER["PHP_SELF"], "aa.account_number", "", $params, "", $sortfield, $sortorder); + print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"], "aa.label", "", $params, "", $sortfield, $sortorder); + print_liste_field_titre($langs->trans("Accountparent"), $_SERVER["PHP_SELF"], "aa.account_parent", "", $params, "", $sortfield, $sortorder); + print_liste_field_titre($langs->trans("Pcgtype"), $_SERVER["PHP_SELF"], "aa.pcg_type", "", $params, "", $sortfield, $sortorder); + print_liste_field_titre($langs->trans("Pcgsubtype"), $_SERVER["PHP_SELF"], "aa.pcg_subtype", "", $params, "", $sortfield, $sortorder); + print_liste_field_titre($langs->trans("Activated"), $_SERVER["PHP_SELF"], "aa.active", "", $params, "", $sortfield, $sortorder); + print_liste_field_titre($langs->trans("Action"), $_SERVER["PHP_SELF"], "", $params, "", 'width="60" align="center"', $sortfield, $sortorder); print ''; print ''; diff --git a/htdocs/accountancy/admin/fiscalyear.php b/htdocs/accountancy/admin/fiscalyear.php index 75411d6402f..00cf70b9e73 100644 --- a/htdocs/accountancy/admin/fiscalyear.php +++ b/htdocs/accountancy/admin/fiscalyear.php @@ -27,6 +27,18 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/fiscalyear.class.php'; $action = GETPOST('action'); +// Load variable for pagination +$limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit; +$sortfield = GETPOST('sortfield','alpha'); +$sortorder = GETPOST('sortorder','alpha'); +$page = GETPOST('page','int'); +if ($page == -1) { $page = 0; } +$offset = $limit * $page; +$pageprev = $page - 1; +$pagenext = $page + 1; +if (! $sortfield) $sortfield="f.rowid"; // Set here default search field +if (! $sortorder) $sortorder="ASC"; + $langs->load("admin"); $langs->load("compta"); @@ -54,6 +66,8 @@ $object = new Fiscalyear($db); * Actions */ + + /* * View */ @@ -66,11 +80,20 @@ $title = $langs->trans('FiscalYears'); llxHeader('', $title, LOG_ERR); -print load_fiche_titre($langs->trans('FiscalYears')); - $sql = "SELECT f.rowid, f.label, f.date_start, f.date_end, f.statut, f.entity"; $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_fiscalyear as f"; $sql .= " WHERE f.entity = " . $conf->entity; +$sql.=$db->order($sortfield,$sortorder); + +// Count total nb of records +$nbtotalofrecords = 0; +if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) +{ + $result = $db->query($sql); + $nbtotalofrecords = $db->num_rows($result); +} + +$sql.= $db->plimit($limit+1, $offset); $result = $db->query($sql); if ($result) { @@ -78,6 +101,9 @@ if ($result) { $num = $db->num_rows($result); $i = 0; + + $title = $langs->trans('FiscalYears'); + print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $params, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_generic', 0, '', '', $limit, 1); // Load attribute_label print '
'; diff --git a/htdocs/accountancy/admin/fiscalyear_card.php b/htdocs/accountancy/admin/fiscalyear_card.php index e663557d22c..c45700ce4f5 100644 --- a/htdocs/accountancy/admin/fiscalyear_card.php +++ b/htdocs/accountancy/admin/fiscalyear_card.php @@ -53,6 +53,7 @@ $object = new Fiscalyear($db); $date_start = dol_mktime(0, 0, 0, GETPOST('fiscalyearmonth', 'int'), GETPOST('fiscalyearday', 'int'), GETPOST('fiscalyearyear', 'int')); $date_end = dol_mktime(0, 0, 0, GETPOST('fiscalyearendmonth', 'int'), GETPOST('fiscalyearendday', 'int'), GETPOST('fiscalyearendyear', 'int')); + /* * Actions */ @@ -143,10 +144,8 @@ llxHeader(); $form = new Form($db); -/* - * Action create - */ -if ($action == 'create') { +if ($action == 'create') +{ print load_fiche_titre($langs->trans("NewFiscalYear")); print ''; @@ -172,7 +171,7 @@ if ($action == 'create') { // Statut print ''; - print ''; + print ''; print ''; @@ -205,7 +204,7 @@ if ($action == 'create') { // Ref print ""; - print ''; diff --git a/htdocs/accountancy/admin/journal.php b/htdocs/accountancy/admin/journal.php index ca4ab67aee8..b511c6dfd1a 100644 --- a/htdocs/accountancy/admin/journal.php +++ b/htdocs/accountancy/admin/journal.php @@ -1,31 +1,32 @@ * Copyright (C) 2013-2015 Alexandre Spangaro - * Copyright (C) 2014 Florian Henry - * Copyright (C) 2014 Marcos García - * Copyright (C) 2014 Juanjo Menent - * Copyright (C) 2015 Jean-François Ferry - * - * 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 . - * - */ +* Copyright (C) 2014 Florian Henry +* Copyright (C) 2014 Marcos García +* Copyright (C) 2014 Juanjo Menent +* Copyright (C) 2015 Jean-François Ferry +* Copyright (C) 2016 Laurent Destailleur +* +* 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/accountancy/admin/journal.php - * \ingroup Advanced accountancy - * \brief Setup page to configure accounting expert module - */ +* \ingroup Advanced accountancy +* \brief Setup page to configure accounting expert module +*/ require '../../main.inc.php'; // Class @@ -48,24 +49,44 @@ $list = array ( 'ACCOUNTING_PURCHASE_JOURNAL', 'ACCOUNTING_SOCIAL_JOURNAL', 'ACCOUNTING_MISCELLANEOUS_JOURNAL', - 'ACCOUNTING_EXPENSEREPORT_JOURNAL' + 'ACCOUNTING_EXPENSEREPORT_JOURNAL' ); /* * Actions - */ +*/ if ($action == 'update') { $error = 0; - - foreach ( $list as $constname ) { + + // Save vars + foreach ($list as $constname) + { $constvalue = GETPOST($constname, 'alpha'); - + if (! dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) { $error ++; } } - + + // Save bank account journals + $arrayofbankaccount = GETPOST('bank_account', 'array'); + foreach($arrayofbankaccount as $key => $code) + { + $bankaccount = new Account($db); + $res = $bankaccount->fetch($key); + if ($res > 0) + { + $bankaccount->accountancy_journal = $code; + $bankaccount->update($user); + } + else + { + $error++; + break; + } + } + if (! $error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { @@ -75,7 +96,7 @@ if ($action == 'update') { /* * View - */ +*/ llxHeader(); @@ -99,13 +120,13 @@ print "\n"; foreach ( $list as $key ) { $var = ! $var; - + print ''; - + // Param $label = $langs->trans($key); print ''; - + // Value print '\n"; diff --git a/htdocs/core/js/select2_locale.js.php b/htdocs/core/js/select2_locale.js.php index 660b41820df..31c6a91bc74 100644 --- a/htdocs/core/js/select2_locale.js.php +++ b/htdocs/core/js/select2_locale.js.php @@ -52,7 +52,10 @@ else header('Cache-Control: no-cache'); $.fn.select2.locales['xx'] = { formatMatches: function (matches) { return matches + " trans("Select2ResultFoundUseArrows")); ?>"; }, formatNoMatches: function () { return "trans("Select2NotFound")); ?>"; }, - formatInputTooShort: function (input, min) { var n = min - input.length; return "trans("Select2Enter")); ?> " + n + " trans("Select2MoreCharacters")); ?>"; }, + formatInputTooShort: function (input, min) { var n = min - input.length; + if (n > 1) return "trans("Select2Enter")); ?> " + n + " trans("Select2MoreCharacters")); ?>"; + else return "trans("Select2Enter")); ?> " + n + " trans("Select2MoreCharacter")); ?>" + }, formatLoadMore: function (pageNumber) { return "trans("Select2LoadingMoreResults")); ?>"; }, formatSearching: function () { return "trans("Select2SearchInProgress")); ?>"; } }; diff --git a/htdocs/core/lib/accounting.lib.php b/htdocs/core/lib/accounting.lib.php index 7a73861e71f..773e68913f9 100644 --- a/htdocs/core/lib/accounting.lib.php +++ b/htdocs/core/lib/accounting.lib.php @@ -37,26 +37,26 @@ function admin_accounting_prepare_head(AccountingAccount $object=null) $head = array (); $head[$h][0] = dol_buildpath('/accountancy/admin/index.php', 1); - $head[$h][1] = $langs->trans("Configuration"); + $head[$h][1] = $langs->trans("Miscellaneous"); $head[$h][2] = 'general'; $h ++; - // Show more tabs from modules - // Entries must be declared in modules descriptor with line - // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab - // $this->tabs = array('entity:-tabname); to remove a tab - complete_head_from_modules($conf, $langs, $object, $head, $h, 'accounting_admin'); - $head[$h][0] = DOL_URL_ROOT.'/accountancy/admin/journal.php'; $head[$h][1] = $langs->trans("Journaux"); $head[$h][2] = 'journal'; $h ++; $head[$h][0] = DOL_URL_ROOT.'/accountancy/admin/export.php'; - $head[$h][1] = $langs->trans("Export"); + $head[$h][1] = $langs->trans("ExportOptions"); $head[$h][2] = 'export'; $h ++; + // Show more tabs from modules + // Entries must be declared in modules descriptor with line + // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab + // $this->tabs = array('entity:-tabname); to remove a tab + complete_head_from_modules($conf, $langs, $object, $head, $h, 'accounting_admin'); + complete_head_from_modules($conf, $langs, $object, $head, $h, 'accounting_admin', 'remove'); return $head; diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index d103bcf84df..98b281d04dd 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -26,7 +26,6 @@ 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 ('', '$user->admin', __HANDLER__, 'left', 100__+MAX_llx_menu__, 'home', 'setup', 1__+MAX_llx_menu__, '/admin/index.php?leftmenu=setup', 'Setup', 0, 'admin', '', '', 2, 1, __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 ('', '$leftmenu=="setup"', __HANDLER__, 'left', 101__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/company.php?leftmenu=setup', 'MenuCompanySetup', 1, 'admin', '', '', 2, 1, __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 ('', '$leftmenu=="setup"', __HANDLER__, 'left', 102__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/ihm.php?leftmenu=setup', 'GUISetup', 1, 'admin', '', '', 2, 4, __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 ('', '$leftmenu=="setup" && $conf->accounting->enabled', __HANDLER__, 'left', 115__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/accountancy/admin/fiscalyear.php?mainmenu=setup', 'Fiscalyear', 1, 'admin', '', '', 2, 4, __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 ('', '$leftmenu=="setup"', __HANDLER__, 'left', 114__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/translation.php?leftmenu=setup', 'Translation', 1, 'admin', '', '', 2, 4, __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 ('', '$leftmenu=="setup"', __HANDLER__, 'left', 103__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/modules.php?leftmenu=setup', 'Modules', 1, 'admin', '', '', 2, 2, __ENTITY__); @@ -235,6 +234,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=="ca"', __HANDLER__, 'left', 2447__+MAX_llx_menu__, 'accountancy', '', 2440__+MAX_llx_menu__, '/compta/stats/cabyprodserv.php?leftmenu=ca', 'ByProductsAndServices', 3, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 24, __ENTITY__); -- Admin 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', __HANDLER__, 'left', 2451__+MAX_llx_menu__, 'home', '', 2400__+MAX_llx_menu__, '/accountancy/admin/account.php?mainmenu=accountancy', 'Chartofaccounts', 1, 'admin', '$user->rights->accounting->chartofaccount', '', 0, 25, __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 ('', '$leftmenu=="setup" && $conf->accounting->enabled', __HANDLER__, 'left', 115__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/accountancy/admin/fiscalyear.php?mainmenu=setup', 'Fiscalyear', 1, 'admin', '', '', 2, 4, __ENTITY__); -- Rapports compta simple 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->comptabilite->enabled', __HANDLER__, 'left', 2700__+MAX_llx_menu__, 'accountancy', 'ca', 6__+MAX_llx_menu__, '/compta/resultat/index.php?leftmenu=ca&mainmenu=accountancy', 'Reportings', 0, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 11, __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->comptabilite->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2701__+MAX_llx_menu__, 'accountancy', '', 2700__+MAX_llx_menu__, '/compta/resultat/index.php?leftmenu=ca', 'ReportInOut', 1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 0, __ENTITY__); diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 2fc166e7625..1ce08a25bba 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -526,11 +526,6 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu $newmenu->add("/admin/menus.php?mainmenu=home", $langs->trans("Menus"),1); $newmenu->add("/admin/ihm.php?mainmenu=home", $langs->trans("GUISetup"),1); - if (! empty($conf->accounting->enabled)) - { - $newmenu->add("/accountancy/admin/fiscalyear.php?mainmenu=home", $langs->trans("Fiscalyear"),1); - } - $newmenu->add("/admin/translation.php", $langs->trans("Translation"),1); $newmenu->add("/admin/boxes.php?mainmenu=home", $langs->trans("Boxes"),1); $newmenu->add("/admin/delais.php?mainmenu=home",$langs->trans("Alerts"),1); @@ -1007,8 +1002,8 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu // Admin $langs->load("admin"); - if (preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/admin/fiscalyear.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("Fiscalyear"),1,$user->rights->accounting->fiscalyear, '', $mainmenu, 'fiscalyear'); if (preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/admin/account.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("Chartofaccounts"),1,$user->rights->accounting->chartofaccount, '', $mainmenu, 'chartofaccount'); + if (preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/admin/fiscalyear.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("Fiscalyear"),1,$user->rights->accounting->fiscalyear, '', $mainmenu, 'fiscalyear'); } // Accountancy (simple) diff --git a/htdocs/core/modules/modAccounting.class.php b/htdocs/core/modules/modAccounting.class.php index f20cf663b2c..03b450aa275 100644 --- a/htdocs/core/modules/modAccounting.class.php +++ b/htdocs/core/modules/modAccounting.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2013-2016 Alexandre Spangaro * Copyright (C) 2014 Ari Elbaz (elarifr) * Copyright (C) 2014 Florian Henry + * Copyright (C) 2016 Laurent Destailleur * * 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 @@ -50,7 +51,7 @@ class modAccounting extends DolibarrModules $this->description = "Advanced accounting management"; // Possible values for version are: 'development', 'experimental', 'dolibarr' or version - $this->version = 'development'; + $this->version = 'experimental'; $this->const_name = 'MAIN_MODULE_' . strtoupper($this->name); $this->special = 0; diff --git a/htdocs/langs/en_US/agenda.lang b/htdocs/langs/en_US/agenda.lang index a01e0c6c412..d4b651b46b5 100644 --- a/htdocs/langs/en_US/agenda.lang +++ b/htdocs/langs/en_US/agenda.lang @@ -8,6 +8,7 @@ Calendar=Calendar Calendars=Calendars LocalAgenda=Internal calendar ActionsOwnedBy=Event owned by +ActionsOwnedByShort=Owner AffectedTo=Assigned to DoneBy=Done by Event=Event diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 90ccde2474a..75023bf9184 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -784,6 +784,7 @@ SetRef=Set ref Select2ResultFoundUseArrows= Select2NotFound=No result found Select2Enter=Enter +Select2MoreCharacter=or more character Select2MoreCharacters=or more characters Select2LoadingMoreResults=Loading more results... Select2SearchInProgress=Search in progress... diff --git a/htdocs/opensurvey/card.php b/htdocs/opensurvey/card.php index ce941a680c7..b1c69268325 100644 --- a/htdocs/opensurvey/card.php +++ b/htdocs/opensurvey/card.php @@ -84,14 +84,14 @@ if (empty($reshook)) if ($action == 'close') { $object->status = Opensurveysondage::STATUS_CLOSED; - $object->update(); + $object->update($user); } // Reopend if ($action == 'reopen') { $object->status = Opensurveysondage::STATUS_VALIDATED; - $object->update(); + $object->update($user); } // Update diff --git a/htdocs/opensurvey/class/opensurveysondage.class.php b/htdocs/opensurvey/class/opensurveysondage.class.php index fecb7904a9c..02952f4bf75 100644 --- a/htdocs/opensurvey/class/opensurveysondage.class.php +++ b/htdocs/opensurvey/class/opensurveysondage.class.php @@ -275,7 +275,7 @@ class Opensurveysondage extends CommonObject * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, >0 if OK */ - function update($user=null, $notrigger=0) + function update($user, $notrigger=0) { global $conf, $langs; $error=0; diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 86a11f57541..e8b32f978cb 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -2897,7 +2897,7 @@ class Product extends CommonObject } /** - * reconstruit l'arborescence des categories sous la forme d'un tableau + * reconstruit l'arborescence des produits sous la forme d'un tableau * * @param int $multiply Because each sublevel must be multiplicated by parent nb * @return array $this->res @@ -2940,7 +2940,6 @@ class Product extends CommonObject * Return all Father products fo current product * * @return array Array of product - * @see getParent */ function getFather() { @@ -2985,6 +2984,8 @@ class Product extends CommonObject */ function getChildsArbo($id, $firstlevelonly=0, $level=1) { + global $alreadyfound; + $sql = "SELECT p.rowid, p.label as label, pa.qty as qty, pa.fk_product_fils as id, p.fk_product_type, pa.incdec"; $sql.= " FROM ".MAIN_DB_PREFIX."product as p"; $sql.= ", ".MAIN_DB_PREFIX."product_association as pa"; @@ -2994,6 +2995,7 @@ class Product extends CommonObject dol_syslog(get_class($this).'::getChildsArbo id='.$id.' level='.$level, LOG_DEBUG); + if ($level == 1) $alreadyfound=array($id=>1); // We init array of found object to start of tree, so if we found it later (should not happened), we stop immediatly // Protection against infinite loop if ($level > 30) return array(); @@ -3003,9 +3005,14 @@ class Product extends CommonObject $prods = array(); while ($rec = $this->db->fetch_array($res)) { - // TODO Add check to not add ne record if already added + if (! empty($alreadyfound[$rec['rowid']])) + { + dol_syslog(get_class($this).'::getChildsArbo the product id='.$rec['rowid'].' was already found at a higher level in tree. We discard to avoid infinite loop', LOG_WARNING); + continue; + } + $alreadyfound[$rec['rowid']]=1; $prods[$rec['rowid']]= array( - 0=>$rec['id'], + 0=>$rec['rowid'], 1=>$rec['qty'], 2=>$rec['fk_product_type'], 3=>$this->db->escape($rec['label']), @@ -3015,7 +3022,7 @@ class Product extends CommonObject //$prods[$this->db->escape($rec['label'])]= array(0=>$rec['id'],1=>$rec['qty']); if (empty($firstlevelonly)) { - $listofchilds=$this->getChildsArbo($rec['id'], 0, $level + 1); + $listofchilds=$this->getChildsArbo($rec['rowid'], 0, $level + 1); foreach($listofchilds as $keyChild => $valueChild) { $prods[$rec['rowid']]['childs'][$keyChild] = $valueChild; @@ -3040,16 +3047,11 @@ class Product extends CommonObject */ function get_sousproduits_arbo() { - //$parent = $this->getParent(); $parent=array(); - $parent[$this->label]=array(0 => $this->id); - foreach($parent as $key => $value) // key=label, value[0]=id + foreach($this->getChildsArbo($this->id) as $keyChild => $valueChild) // Warning. getChildsArbo can call getChildsArbo recursively. Starting point is $value[0]=id of product { - foreach($this->getChildsArbo($value[0]) as $keyChild => $valueChild) // Warning. getChildsArbo can gell getChildsArbo recursively. - { - $parent[$key][$keyChild] = $valueChild; - } + $parent[$this->label][$keyChild] = $valueChild; } foreach($parent as $key => $value) // key=label, value is array of childs { diff --git a/htdocs/product/composition/card.php b/htdocs/product/composition/card.php index 25195f6c167..adfce7d6229 100644 --- a/htdocs/product/composition/card.php +++ b/htdocs/product/composition/card.php @@ -235,8 +235,9 @@ if ($id > 0 || ! empty($ref)) $prodsfather = $object->getFather(); // Parent Products - $object->get_sousproduits_arbo(); // Load $object->sousprod - $prods_arbo=$object->get_arbo_each_prod(); + $object->get_sousproduits_arbo(); // Load $object->sousprods + $prods_arbo=$object->get_arbo_each_prod(); + $nbofsubsubproducts=count($prods_arbo); // This include sub sub product into nb $prodschild = $object->getChildsArbo($id,1); $nbofsubproducts=count($prodschild); // This include only first level of childs @@ -379,10 +380,10 @@ if ($id > 0 || ! empty($ref)) print ''."\n"; } - else // By default, we do not show this. It makes screen very difficult to understand + else { $hide=''; - if (empty($conf->global->PRODUCT_SHOW_SUB_SUB_PRODUCTS)) $hide=' hideobject'; + if (empty($conf->global->PRODUCT_SHOW_SUB_SUB_PRODUCTS)) $hide=' hideobject'; // By default, we do not show this. It makes screen very difficult to understand $class=($class=='impair')?'pair':'impair'; print ''; @@ -394,9 +395,13 @@ if ($id > 0 || ! empty($ref)) print $productstatic->getNomUrl(1,'composition').''; print ''; + // Best buying price print ''; print ''; - + // Best selling price + print ''; + print ''; + if (! empty($conf->stock->enabled)) print ''; // Real stock print ''; print ''; diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 1d63964be1c..d8adf66bcc1 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -145,7 +145,7 @@ $arrayfields=array( 'p.label'=>array('label'=>$langs->trans("Label"), 'checked'=>1), 'p.barcode'=>array('label'=>$langs->trans("Gencod"), 'checked'=>($contextpage != 'servicelist'), 'enabled'=>(! empty($conf->barcode->enabled))), 'p.duration'=>array('label'=>$langs->trans("Duration"), 'checked'=>($contextpage != 'productlist'), 'enabled'=>(! empty($conf->service->enabled))), - 'p.sellprice'=>array('label'=>$titlesellprice, 'checked'=>1, 'enabled'=>empty($conf->global->PRODUIT_MULTIPRICES)), + 'p.sellprice'=>array('label'=>$langs->trans("SellingPrice"), 'checked'=>1, 'enabled'=>empty($conf->global->PRODUIT_MULTIPRICES)), 'p.minbuyprice'=>array('label'=>$langs->trans("BuyingPriceMinShort"), 'checked'=>1, 'enabled'=>(! empty($user->rights->fournisseur->lire))), 'p.seuil_stock_alerte'=>array('label'=>$langs->trans("StockLimit"), 'checked'=>0, 'enabled'=>(! empty($conf->stock->enabled) && $user->rights->stock->lire && $contextpage != 'service')), 'p.desiredstock'=>array('label'=>$langs->trans("DesiredStock"), 'checked'=>1, 'enabled'=>(! empty($conf->stock->enabled) && $user->rights->stock->lire && $contextpage != 'service')), @@ -425,7 +425,7 @@ else $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields - + print '
' . $langs->trans("Statut") . '' . $langs->trans("Status") . ''; print $form->selectarray('statut', $statut2label, GETPOST('statut')); print '
' . $langs->trans("Ref") . ''; + print '' . $langs->trans("Ref") . ''; print $object->ref; print '
'; print ''; @@ -118,11 +139,11 @@ print '
'; print ''; print ''; -print ''; +print ''; print "\n"; // Bank account -$sql = "SELECT rowid, label, accountancy_journal"; +$sql = "SELECT rowid, label, number, accountancy_journal"; $sql .= " FROM " . MAIN_DB_PREFIX . "bank_account"; $sql .= " WHERE entity = " . $conf->entity; $sql .= " AND clos = 0"; @@ -132,29 +153,41 @@ $resql = $db->query($sql); if ($resql) { $numr = $db->num_rows($resql); $i = 0; - + if ($numr > 0) - - while ( $i < $numr ) { - $objp = $db->fetch_object($resql); + + $bankaccountstatic=new Account($db); + + while ( $i < $numr ) { + $objp = $db->fetch_object($resql); - $var = ! $var; + $var = ! $var; - print ''; + $bankaccountstatic->id = $objp->rowid; + $bankaccountstatic->label = $objp->label; + $bankaccountstatic->number = $objp->number; + $bankaccountstatic->accountancy_journal = $objp->accountancy_journal; - // Param - print ''; + print ''; - // Value - print ''; + // Param + print ''; - $i ++; - } -} else + // Value + print ''; + + $i ++; + } + $db->free($resql); +} +else +{ dol_print_error($db); -$db->free($resql); +} print "
' . $langs->trans('JournalFinancial') . '' . $langs->trans('JournalFinancial') . ' ('.$langs->trans('Opened').')
'; - print ''; - print '
'; + print ''; + print '
\n"; diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index f94557ce0b0..973086e95b9 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -100,9 +100,11 @@ if (! empty($search_accountancy_code_end)) { $options .= '&search_accountancy_code_end=' . $search_accountancy_code_end; } + /* * Action */ + if ($action == 'export_csv') { $sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV; $journal = 'bookkepping'; @@ -157,14 +159,26 @@ else { print '
'; print ''; - print '
'; - print $langs->trans('DateStart') . ': '; - print $form->select_date($search_date_start, 'date_start', 0, 0, 1); - print $langs->trans('DateEnd') . ': '; - print $form->select_date($search_date_end, 'date_end', 0, 0, 1); - print '
'; + $moreforfilter=''; + + $moreforfilter.='
'; + $moreforfilter.=$langs->trans('DateStart') . ': '; + $moreforfilter.=$form->select_date($search_date_start, 'date_start', 0, 0, 1, '', 1, 0, 1); + $moreforfilter.=$langs->trans('DateEnd') . ': '; + $moreforfilter.=$form->select_date($search_date_end, 'date_end', 0, 0, 1, '', 1, 0, 1); + $moreforfilter.='
'; - print ''; + if (! empty($moreforfilter)) + { + print '
'; + print $moreforfilter; + $parameters=array(); + $reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + print '
'; + } + + print '
'; print ''; print_liste_field_titre($langs->trans("AccountAccountingShort"), $_SERVER['PHP_SELF'], "t.numero_compte", "", $options, "", $sortfield, $sortorder); print_liste_field_titre($langs->trans("Labelcompte"), $_SERVER['PHP_SELF'], "t.label_compte", "", $options, "", $sortfield, $sortorder); diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index f287c0ad9dd..6100e54c9a3 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -87,24 +87,8 @@ $formventilation = new FormVentilation($db); $formother = new FormOther($db); $form = new Form($db); -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers -{ - $search_mvt_num = ''; - $search_doc_type = ''; - $search_doc_ref = ''; - $search_doc_date = ''; - $search_accountancy_code = ''; - $search_accountancy_code_start = ''; - $search_accountancy_code_end = ''; - $search_accountancy_aux_code = ''; - $search_accountancy_aux_code_start = ''; - $search_accountancy_aux_code_end = ''; - $search_mvt_label = ''; - $search_direction = ''; - $search_ledger_code = ''; - $search_date_start = ''; - $search_date_end = ''; -} + + if (empty($search_date_start)) { $search_date_start = dol_mktime(0, 0, 0, 1, 1, dol_print_date(dol_now(), '%Y')); @@ -178,9 +162,30 @@ if (! empty($search_mvt_num)) { $options .= '&search_mvt_num=' . $search_mvt_num; } + /* * Action */ + +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +{ + $search_mvt_num = ''; + $search_doc_type = ''; + $search_doc_ref = ''; + $search_doc_date = ''; + $search_accountancy_code = ''; + $search_accountancy_code_start = ''; + $search_accountancy_code_end = ''; + $search_accountancy_aux_code = ''; + $search_accountancy_aux_code_start = ''; + $search_accountancy_aux_code_end = ''; + $search_mvt_label = ''; + $search_direction = ''; + $search_ledger_code = ''; + $search_date_start = ''; + $search_date_end = ''; +} + if ($action == 'delbookkeeping') { $import_key = GETPOST('importkey', 'alpha'); @@ -193,7 +198,8 @@ if ($action == 'delbookkeeping') { Header("Location: list.php"); exit(); } -} elseif ($action == 'delbookkeepingyearconfirm') { +} +if ($action == 'delbookkeepingyearconfirm') { $delyear = GETPOST('delyear', 'int'); @@ -205,7 +211,8 @@ if ($action == 'delbookkeeping') { Header("Location: list.php"); exit(); } -} elseif ($action == 'delmouvconfirm') { +} +if ($action == 'delmouvconfirm') { $mvt_num = GETPOST('mvt_num', 'int'); @@ -217,7 +224,8 @@ if ($action == 'delbookkeeping') { Header("Location: list.php"); exit(); } -} elseif ($action == 'export_csv') { +} +if ($action == 'export_csv') { include DOL_DOCUMENT_ROOT . '/accountancy/class/accountancyexport.class.php'; @@ -311,168 +319,166 @@ if ($action == 'delbookkeeping') { print "\n"; } } + + exit; } /* * View */ -else { - $title_page = $langs->trans("Bookkeeping") . ' ' . dol_print_date($search_date_start) . '-' . dol_print_date($search_date_end); +$title_page = $langs->trans("Bookkeeping") . ' ' . dol_print_date($search_date_start) . '-' . dol_print_date($search_date_end); - llxHeader('', $title_page); +llxHeader('', $title_page); - /* - * List - */ +// List - $nbtotalofrecords = 0; - if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { - $nbtotalofrecords = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter); - if ($nbtotalofrecords < 0) { - setEventMessages($object->error, $object->errors, 'errors'); - } - } - - $result = $object->fetchAll($sortorder, $sortfield, $limit, $offset, $filter); - if ($result < 0) { +$nbtotalofrecords = 0; +if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { + $nbtotalofrecords = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter); + if ($nbtotalofrecords < 0) { setEventMessages($object->error, $object->errors, 'errors'); } - - if ($action == 'delmouv') { - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?mvt_num=' . GETPOST('mvt_num'), $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'delmouvconfirm', '', 0, 1); - print $formconfirm; - } - if ($action == 'delbookkeepingyear') { - - $form_question = array (); - $delyear = GETPOST('delyear'); - - if (empty($delyear)) { - $delyear = dol_print_date(dol_now(), '%Y'); - } - $year_array = $formventilation->selectyear_accountancy_bookkepping($delyear, 'delyear', 0, 'array'); - - $form_question['delyear'] = array ( - 'name' => 'delyear', - 'type' => 'select', - 'label' => $langs->trans('DelYear'), - 'values' => $year_array, - 'default' => $delyear - ); - - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'delbookkeepingyearconfirm', $form_question, 0, 1); - print $formconfirm; - } - - print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $options, $sortfield, $sortorder, '', $result, $nbtotalofrecords); - - print ''; - print '
' . "\n"; - print '
'; - print ''; - print '
'; - - print '
'; - - print '
'; - print ''; - print_liste_field_titre($langs->trans("NumPiece"), $_SERVER['PHP_SELF'], "t.piece_num", "", $options, "", $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Docdate"), $_SERVER['PHP_SELF'], "t.doc_date", "", $options, "", $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Docref"), $_SERVER['PHP_SELF'], "t.doc_ref", "", $options, "", $sortfield, $sortorder); - print_liste_field_titre($langs->trans("AccountAccountingShort"), $_SERVER['PHP_SELF'], "t.numero_compte", "", $options, "", $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Code_tiers"), $_SERVER['PHP_SELF'], "t.code_tiers", "", $options, "", $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Labelcompte"), $_SERVER['PHP_SELF'], "bk_label_compte", "", $options, "", $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Debit"), $_SERVER['PHP_SELF'], "t.debit", "", $options, 'align="right"', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Credit"), $_SERVER['PHP_SELF'], "t.credit", "", $options, 'align="right"', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Codejournal"), $_SERVER['PHP_SELF'], "t.code_journal", "", $options, 'align="center"', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Action"), $_SERVER["PHP_SELF"], "", $options, "", 'width="60" align="center"', $sortfield, $sortorder); - print "\n"; - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - print ''; - print ''; - print ''; - print ''; - print ''; - - print ''; - - $var = True; - - $total_debit = 0; - $total_credit = 0; - - foreach ( $object->lines as $line ) { - $var = ! $var; - - $total_debit += $line->debit; - $total_credit += $line->credit; - - print ""; - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print "\n"; - } - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - print "
'; - print $langs->trans('From') . ': '; - print $form->select_date($search_date_start, 'date_start', 0, 0, 1); - print '
'; - print $langs->trans('to') . ': '; - print $form->select_date($search_date_end, 'date_end', 0, 0, 1); - print '
'; - print $langs->trans('From'); - print $formventilation->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array (), 1, 1, ''); - print '
'; - print $langs->trans('to'); - print $formventilation->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array (), 1, 1, ''); - print '
'; - print $langs->trans('From'); - print $formventilation->select_auxaccount($search_accountancy_aux_code_start, 'search_accountancy_aux_code_start', 1); - print '
'; - print $langs->trans('to'); - print $formventilation->select_auxaccount($search_accountancy_aux_code_end, 'search_accountancy_aux_code_end', 1); - print '
'; - print ''; - print '  '; - print ''; - print ' '; - print ''; - print '
' . $line->piece_num . '' . dol_print_date($line->doc_date, 'day') . '' . $line->doc_ref . '' . length_accountg($line->numero_compte) . '' . length_accounta($line->code_tiers) . '' . $line->label_compte . '' . price($line->debit) . '' . price($line->credit) . '' . $line->code_journal . ''; - print '' . img_edit() . ' '; - print '' . img_delete() . ''; - print '
'; - print price($total_debit); - print ''; - print price($total_credit); - print '
"; - print ''; - - llxFooter(); } +$result = $object->fetchAll($sortorder, $sortfield, $limit, $offset, $filter); +if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); +} + +if ($action == 'delmouv') { + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?mvt_num=' . GETPOST('mvt_num'), $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'delmouvconfirm', '', 0, 1); + print $formconfirm; +} +if ($action == 'delbookkeepingyear') { + + $form_question = array (); + $delyear = GETPOST('delyear'); + + if (empty($delyear)) { + $delyear = dol_print_date(dol_now(), '%Y'); + } + $year_array = $formventilation->selectyear_accountancy_bookkepping($delyear, 'delyear', 0, 'array'); + + $form_question['delyear'] = array ( + 'name' => 'delyear', + 'type' => 'select', + 'label' => $langs->trans('DelYear'), + 'values' => $year_array, + 'default' => $delyear + ); + + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'delbookkeepingyearconfirm', $form_question, 0, 1); + print $formconfirm; +} + +print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $options, $sortfield, $sortorder, '', $result, $nbtotalofrecords); + +print '
'; +print '
' . "\n"; +print '
'; +print ''; +print '
'; + +print '
'; + +print ''; +print ''; +print_liste_field_titre($langs->trans("NumPiece"), $_SERVER['PHP_SELF'], "t.piece_num", "", $options, "", $sortfield, $sortorder); +print_liste_field_titre($langs->trans("Docdate"), $_SERVER['PHP_SELF'], "t.doc_date", "", $options, "", $sortfield, $sortorder); +print_liste_field_titre($langs->trans("Docref"), $_SERVER['PHP_SELF'], "t.doc_ref", "", $options, "", $sortfield, $sortorder); +print_liste_field_titre($langs->trans("AccountAccountingShort"), $_SERVER['PHP_SELF'], "t.numero_compte", "", $options, "", $sortfield, $sortorder); +print_liste_field_titre($langs->trans("Code_tiers"), $_SERVER['PHP_SELF'], "t.code_tiers", "", $options, "", $sortfield, $sortorder); +print_liste_field_titre($langs->trans("Labelcompte"), $_SERVER['PHP_SELF'], "bk_label_compte", "", $options, "", $sortfield, $sortorder); +print_liste_field_titre($langs->trans("Debit"), $_SERVER['PHP_SELF'], "t.debit", "", $options, 'align="right"', $sortfield, $sortorder); +print_liste_field_titre($langs->trans("Credit"), $_SERVER['PHP_SELF'], "t.credit", "", $options, 'align="right"', $sortfield, $sortorder); +print_liste_field_titre($langs->trans("Codejournal"), $_SERVER['PHP_SELF'], "t.code_journal", "", $options, 'align="center"', $sortfield, $sortorder); +print_liste_field_titre($langs->trans("Action"), $_SERVER["PHP_SELF"], "", $options, "", 'width="60" align="center"', $sortfield, $sortorder); +print "\n"; + +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; + +print ''; +print ''; +print ''; +print ''; +print ''; + +print ''; + +$var = True; + +$total_debit = 0; +$total_credit = 0; + +foreach ( $object->lines as $line ) { + $var = ! $var; + + $total_debit += $line->debit; + $total_credit += $line->credit; + + print ""; + + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print "\n"; +} + +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; + +print "
'; +print $langs->trans('From') . ': '; +print $form->select_date($search_date_start, 'date_start', 0, 0, 1); +print '
'; +print $langs->trans('to') . ': '; +print $form->select_date($search_date_end, 'date_end', 0, 0, 1); +print '
'; +print $langs->trans('From'); +print $formventilation->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array (), 1, 1, ''); +print '
'; +print $langs->trans('to'); +print $formventilation->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array (), 1, 1, ''); +print '
'; +print $langs->trans('From'); +print $formventilation->select_auxaccount($search_accountancy_aux_code_start, 'search_accountancy_aux_code_start', 1); +print '
'; +print $langs->trans('to'); +print $formventilation->select_auxaccount($search_accountancy_aux_code_end, 'search_accountancy_aux_code_end', 1); +print '
'; +print ''; +print '  '; +$searchpitco=$form->showFilterAndCheckAddButtons(0); +print $searchpitco; +print '
' . $line->piece_num . '' . dol_print_date($line->doc_date, 'day') . '' . $line->doc_ref . '' . length_accountg($line->numero_compte) . '' . length_accounta($line->code_tiers) . '' . $line->label_compte . '' . price($line->debit) . '' . price($line->credit) . '' . $line->code_journal . ''; + print '' . img_edit() . ' '; + print '' . img_delete() . ''; + print '
'; +print price($total_debit); +print ''; +print price($total_credit); +print '
"; +print '
'; + +llxFooter(); + + $db->close(); \ No newline at end of file diff --git a/htdocs/accountancy/class/html.formventilation.class.php b/htdocs/accountancy/class/html.formventilation.class.php index 37f843ec5a6..e3ae592a47f 100644 --- a/htdocs/accountancy/class/html.formventilation.class.php +++ b/htdocs/accountancy/class/html.formventilation.class.php @@ -123,7 +123,7 @@ class FormVentilation extends Form $options[$select_value_out] = $label; } - $out .= Form::selectarray($htmlname, $options, $selected, $showempty); + $out .= Form::selectarray($htmlname, $options, $selected, $showempty, 0, 0, '', 0, 0, 0, '', 'maxwidth300'); $this->db->free($resql); return $out; } @@ -264,7 +264,7 @@ class FormVentilation extends Form // Build select $out = ajax_combobox($htmlname, $event); - $out .= Form::selectarray($htmlname, $aux_account, $selectid, $showempty); + $out .= Form::selectarray($htmlname, $aux_account, $selectid, $showempty, 0, 0, '', 0, 0, 0, '', 'maxwidth300'); return $out; } diff --git a/htdocs/cashdesk/index.php b/htdocs/cashdesk/index.php index 3a5b54519a8..4a892f909e5 100644 --- a/htdocs/cashdesk/index.php +++ b/htdocs/cashdesk/index.php @@ -59,7 +59,7 @@ top_htmlhead('','',0,0,'',$arrayofcss);
diff --git a/htdocs/comm/action/listactions.php b/htdocs/comm/action/listactions.php index 31290318742..1f597ffeddc 100644 --- a/htdocs/comm/action/listactions.php +++ b/htdocs/comm/action/listactions.php @@ -308,7 +308,7 @@ if ($resql) print_liste_field_titre($langs->trans("DateEnd"),$_SERVER["PHP_SELF"],"a.datep2",$param,'','align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom",$param,"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Contact"),$_SERVER["PHP_SELF"],"a.fk_contact",$param,"","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("ActionsOwnedBy"),$_SERVER["PHP_SELF"],"",$param,"","",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("ActionsOwnedByShort"),$_SERVER["PHP_SELF"],"",$param,"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"a.percent",$param,"",'align="center"',$sortfield,$sortorder); print_liste_field_titre(""); print "
'.$productstatic->label.'    '.$value['nb'].' 
'; print ''; if (! empty($arrayfields['p.ref']['checked'])) print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER["PHP_SELF"],"p.ref","",$param,"",$sortfield,$sortorder); diff --git a/htdocs/product/reassort.php b/htdocs/product/reassort.php index a3465480b24..e330e9d8b75 100644 --- a/htdocs/product/reassort.php +++ b/htdocs/product/reassort.php @@ -267,19 +267,16 @@ if ($resql) print_liste_field_titre($langs->trans("StockLimit"), $_SERVER["PHP_SELF"], "p.seuil_stock_alerte",$param,"",'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("DesiredStock"), $_SERVER["PHP_SELF"], "p.desiredstock",$param,"",'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("PhysicalStock"), $_SERVER["PHP_SELF"], "stock_physique",$param,"",'align="right"',$sortfield,$sortorder); - - /* - * Details per warehouse - */ - - if($nb_warehouse>1) { - - foreach($warehouses_list as &$wh) { - print_liste_field_titre($wh['label'], '', '','','','align="right"'); + // Details per warehouse + if (! empty($conf->global->STOCK_DETAIL_ON_WAREHOUSE)) // TODO This should be moved into the selection of fields on page product/list (page product/stock will be removed and replaced with product/list with its own context) + { + if ($nb_warehouse>1) { + foreach($warehouses_list as &$wh) { + print_liste_field_titre($wh['label'], '', '','','','align="right"'); + } + } - } - if ($virtualdiffersfromphysical) print_liste_field_titre($langs->trans("VirtualStock"),$_SERVER["PHP_SELF"], "stock_theorique",$param,"",'align="right"',$sortfield,$sortorder); print_liste_field_titre(''); print_liste_field_titre($langs->trans("Status").' ('.$langs->trans("Sell").')',$_SERVER["PHP_SELF"], "p.tosell",$param,"",'align="right"',$sortfield,$sortorder); @@ -309,8 +306,8 @@ if ($resql) print ''; print ''; print ''; print ''; @@ -349,19 +346,17 @@ if ($resql) print $objp->stock_physique; print ''; - /* - * Details per warehouse - */ - - if($nb_warehouse>1) { - - foreach($warehouses_list as &$wh) { - - print ''; - } - + // Details per warehouse + if (! empty($conf->global->STOCK_DETAIL_ON_WAREHOUSE)) // TODO This should be moved into the selection of fields on page product/list (page product/stock will be removed and replaced with product/list with its own context) + { + if($nb_warehouse>1) { + foreach($warehouses_list as &$wh) { + + print ''; + } + } }
  '; - $searchpitco=$form->showFilterAndCheckAddButtons(0); - print $searchpitco; + $searchpitco=$form->showFilterAndCheckAddButtons(0); + print $searchpitco; print '
'; - print empty($product->stock_warehouse[$wh['id']]->real) ? '0' : $product->stock_warehouse[$wh['id']]->real; - print ''; + print empty($product->stock_warehouse[$wh['id']]->real) ? '0' : $product->stock_warehouse[$wh['id']]->real; + print '