From e8b33e3dbad394857eec43292b6cb4e8cc45759d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 29 Jun 2017 15:32:36 +0200 Subject: [PATCH 01/21] To provide solution to get thirdparty when name is not unique. Conflicts: htdocs/societe/class/societe.class.php --- htdocs/societe/class/societe.class.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 8069f59c372..ce92103f927 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1002,21 +1002,22 @@ class Societe extends CommonObject * @param int $rowid Id of third party to load * @param string $ref Reference of third party, name (Warning, this can return several records) * @param string $ref_ext External reference of third party (Warning, this information is a free field not provided by Dolibarr) - * @param string $ref_int Internal reference of third party + * @param string $ref_int Internal reference of third party (not used by dolibarr) * @param string $idprof1 Prof id 1 of third party (Warning, this can return several records) * @param string $idprof2 Prof id 2 of third party (Warning, this can return several records) * @param string $idprof3 Prof id 3 of third party (Warning, this can return several records) * @param string $idprof4 Prof id 4 of third party (Warning, this can return several records) * @param string $idprof5 Prof id 5 of third party (Warning, this can return several records) * @param string $idprof6 Prof id 6 of third party (Warning, this can return several records) + * @param string $email Email (Warning, this can return several records) * @return int >0 if OK, <0 if KO or if two records found for same ref or idprof, 0 if not found. */ - function fetch($rowid, $ref='', $ref_ext='', $ref_int='', $idprof1='',$idprof2='',$idprof3='',$idprof4='',$idprof5='',$idprof6='') + function fetch($rowid, $ref='', $ref_ext='', $ref_int='', $idprof1='',$idprof2='',$idprof3='',$idprof4='',$idprof5='',$idprof6='', $email='') { global $langs; global $conf; - if (empty($rowid) && empty($ref) && empty($ref_ext) && empty($ref_int) && empty($idprof1) && empty($idprof2) && empty($idprof3) && empty($idprof4) && empty($idprof5) && empty($idprof6)) return -1; + if (empty($rowid) && empty($ref) && empty($ref_ext) && empty($ref_int) && empty($idprof1) && empty($idprof2) && empty($idprof3) && empty($idprof4) && empty($idprof5) && empty($idprof6) && empty($email)) return -1; $sql = 'SELECT s.rowid, s.nom as name, s.name_alias, s.entity, s.ref_ext, s.ref_int, s.address, s.datec as date_creation, s.prefix_comm'; $sql .= ', s.status'; @@ -1060,6 +1061,7 @@ class Societe extends CommonObject else if ($idprof4) $sql .= " WHERE s.idprof4 = '".$this->db->escape($idprof4)."' AND s.entity IN (".getEntity($this->element, 1).")"; else if ($idprof5) $sql .= " WHERE s.idprof5 = '".$this->db->escape($idprof5)."' AND s.entity IN (".getEntity($this->element, 1).")"; else if ($idprof6) $sql .= " WHERE s.idprof6 = '".$this->db->escape($idprof6)."' AND s.entity IN (".getEntity($this->element, 1).")"; + else if ($email) $sql .= " WHERE email = '".$this->db->escape($email)."' AND s.entity IN (".getEntity($this->element, 1).")"; $resql=$this->db->query($sql); if ($resql) From f7ba3ddc078cf89ad4fc2d9bfbb67bf713db6aff Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 29 Jun 2017 15:59:46 +0200 Subject: [PATCH 02/21] Fix translation --- htdocs/langs/en_US/stocks.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index 97ddedc3231..460665255b1 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -53,7 +53,7 @@ IndependantSubProductStock=Product stock and subproduct stock are independant QtyDispatched=Quantity dispatched QtyDispatchedShort=Qty dispatched QtyToDispatchShort=Qty to dispatch -OrderDispatch=Stock dispatching +OrderDispatch=Goods Receptions RuleForStockManagementDecrease=Rule for automatic stock management decrease (manual decrease is always possible, even if an automatic decrease rule is activated) RuleForStockManagementIncrease=Rule for automatic stock management increase (manual increase is always possible, even if an automatic increase rule is activated) DeStockOnBill=Decrease real stocks on customers invoices/credit notes validation From 727085f3ecf82a7e1cab5969b0f695ae5cfb0ef3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 30 Jun 2017 19:01:49 +0200 Subject: [PATCH 03/21] Fix missing migration column zip --- htdocs/install/mysql/migration/5.0.0-6.0.0.sql | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/install/mysql/migration/5.0.0-6.0.0.sql b/htdocs/install/mysql/migration/5.0.0-6.0.0.sql index 0867aba9c38..75a45f72142 100644 --- a/htdocs/install/mysql/migration/5.0.0-6.0.0.sql +++ b/htdocs/install/mysql/migration/5.0.0-6.0.0.sql @@ -46,6 +46,9 @@ ALTER TABLE llx_opensurvey_sondage ADD COLUMN allow_spy tinyint NOT NULL DEFAULT ALTER TABLE llx_opensurvey_sondage ADD COLUMN sujet TEXT; +ALTER TABLE llx_socpeople MODIFY COLUMN zip varchar(25); + + ALTER TABLE llx_extrafields ADD COLUMN fieldcomputed text; ALTER TABLE llx_extrafields ADD COLUMN fielddefault varchar(255); From 2b0b2096f6dbe20cd37c5ed0f9b6c289102e283f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 30 Jun 2017 22:40:08 +0200 Subject: [PATCH 04/21] Fix test on mandatory field --- htdocs/contrat/card.php | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index f502e8023f3..c13571dd6cb 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -1782,7 +1782,7 @@ else { $dateactstart = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); $dateactend = dol_mktime(12, 0, 0, GETPOST('endmonth'), GETPOST('endday'), GETPOST('endyear')); - $comment = GETPOST('comment'); + $comment = GETPOST('comment','alpha'); $form->form_confirm($_SERVER["PHP_SELF"]."?id=".$object->id."&ligne=".GETPOST('ligne')."&date=".$dateactstart."&dateend=".$dateactend."&comment=".urlencode($comment),$langs->trans("ActivateService"),$langs->trans("ConfirmActivateService",dol_print_date($dateactstart,"%A %d %B %Y")),"confirm_active", '', 0, 1); print '
'; } @@ -1794,8 +1794,16 @@ else { $dateactstart = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); $dateactend = dol_mktime(12, 0, 0, GETPOST('endmonth'), GETPOST('endday'), GETPOST('endyear')); - $comment = GETPOST('comment'); - $form->form_confirm($_SERVER["PHP_SELF"]."?id=".$object->id."&ligne=".GETPOST('ligne')."&date=".$dateactstart."&dateend=".$dateactend."&comment=".urlencode($comment), $langs->trans("CloseService"), $langs->trans("ConfirmCloseService",dol_print_date($dateactend,"%A %d %B %Y")), "confirm_closeline", '', 0, 1); + $comment = GETPOST('comment','alpha'); + + if (empty($dateactend)) + { + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DateEndReal")), null, 'errors'); + } + else + { + $form->form_confirm($_SERVER["PHP_SELF"]."?id=".$object->id."&ligne=".GETPOST('ligne','int')."&date=".$dateactstart."&dateend=".$dateactend."&comment=".urlencode($comment), $langs->trans("CloseService"), $langs->trans("ConfirmCloseService",dol_print_date($dateactend,"%A %d %B %Y")), "confirm_closeline", '', 0, 1); + } print '
'; } @@ -1918,9 +1926,11 @@ else /** * Disable a contract line */ - print '
'; + print ''."\n"; + print ''; print ''; + print ''; print ''; @@ -1957,7 +1967,7 @@ else print ''; print ''; - print ''; + print ''; print ''; - + // Param $label = $langs->trans($key); print ''; - + // Value print ''; } print ""; @@ -205,12 +205,12 @@ if ($num2) { print ''; print ''; print "\n"; - - if ($conf->global->ACCOUNTING_EXPORT_MODELCSV > 1) + + if ($conf->global->ACCOUNTING_EXPORT_MODELCSV > AccountancyExport::EXPORT_TYPE_NORMAL) { print ''; } - + print ''; print ''; if (! $conf->use_javascript_ajax) { @@ -224,24 +224,24 @@ if ($num2) { '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 ''; - + // Value print ''; } - + print "
'.$langs->trans("Comment").''.$langs->trans("Comment").''; print '   '; print ''; From 31fe8ebcee21bf261aa9b3ee8f8ede9e5b249df8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 1 Jul 2017 02:22:08 +0200 Subject: [PATCH 05/21] Debug v6 --- htdocs/accountancy/admin/export.php | 44 +++++++++---------- htdocs/accountancy/bookkeeping/balance.php | 13 +++--- htdocs/accountancy/bookkeeping/list.php | 20 ++++----- .../class/accountancyexport.class.php | 9 ++-- .../journal/expensereportsjournal.php | 5 ++- .../accountancy/journal/purchasesjournal.php | 2 +- htdocs/compta/salaries/document.php | 2 +- htdocs/compta/salaries/index.php | 29 +++++++----- htdocs/compta/salaries/info.php | 4 +- htdocs/core/menus/init_menu_auguria.sql | 2 +- htdocs/core/menus/standard/eldy.lib.php | 9 ++-- htdocs/langs/en_US/accountancy.lang | 1 + 12 files changed, 77 insertions(+), 63 deletions(-) diff --git a/htdocs/accountancy/admin/export.php b/htdocs/accountancy/admin/export.php index cdec35415fd..5ffcbfe92ba 100644 --- a/htdocs/accountancy/admin/export.php +++ b/htdocs/accountancy/admin/export.php @@ -47,7 +47,7 @@ $action = GETPOST('action', 'alpha'); // Parameters ACCOUNTING_EXPORT_* $main_option = array ( - 'ACCOUNTING_EXPORT_PREFIX_SPEC' + 'ACCOUNTING_EXPORT_PREFIX_SPEC' ); $model_option = array ( @@ -67,10 +67,10 @@ $model_option = array ( */ 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 @@ if ($action == 'update') { } else { $error ++; } - + if (! empty($modelcsv)) { if (! dolibarr_set_const($db, 'ACCOUNTING_EXPORT_MODELCSV', $modelcsv, 'chaine', 0, '', $conf->entity)) { $error ++; @@ -89,23 +89,23 @@ if ($action == 'update') { } 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 @@ $var = ! $var; $num = count($main_option); if ($num) { foreach ( $main_option as $key ) { - + print '
' . $label . ''; print ''; @@ -187,7 +187,7 @@ if (! $conf->use_javascript_ajax) { print ''; $listmodelcsv = AccountancyExport::getType(); print $form->selectarray("modelcsv", $listmodelcsv, $conf->global->ACCOUNTING_EXPORT_MODELCSV, 0); - + print '
' . $langs->trans('OtherOptions') . '
' . $langs->trans('OptionsDeactivatedForThisExportModel') . '
' . $langs->trans("Selectformat") . '
' . $label . ''; print ''; print '
\n"; } diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index a32b739752a..55960776c6d 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -51,7 +51,7 @@ if ($search_accountancy_code_end == - 1) { $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 (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP */ 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 @@ if ($action == 'export_csv') { 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 @@ else { 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 16d27df15fd..6f994eb1110 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_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETP $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 @@ $formother = new FormOther($db); $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 == 'delmouvconfirm') { } } -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 ''; 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 a3358337889..e9ad42858aa 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 @@ class AccountancyExport } /** - * 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 1a18e89792a..8d6f8ca4dcd 100644 --- a/htdocs/accountancy/journal/expensereportsjournal.php +++ b/htdocs/accountancy/journal/expensereportsjournal.php @@ -52,6 +52,7 @@ $date_startyear = GETPOST('date_startyear'); $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 erd.fk_code_ventilation > 0"; $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 @@ if (empty($action) || $action == 'view') { $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 e023e14a817..963ae4f19af 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -43,7 +43,7 @@ $langs->load("main"); $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 678442453c6..03cef9c07e8 100644 --- a/htdocs/compta/salaries/document.php +++ b/htdocs/compta/salaries/document.php @@ -91,7 +91,7 @@ if ($object->id) $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 e87fc932c50..baf99182993 100644 --- a/htdocs/compta/salaries/index.php +++ b/htdocs/compta/salaries/index.php @@ -73,6 +73,12 @@ else $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 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP $typeid=""; } + /* * View */ @@ -151,23 +158,23 @@ if ($result) 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 @@ if ($result) 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 @@ if ($result) 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 @@ if ($result) $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 05dc7835b68..ddb79845748 100644 --- a/htdocs/compta/salaries/info.php +++ b/htdocs/compta/salaries/info.php @@ -55,7 +55,7 @@ $object->info($id); $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 @@ dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, 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 76d58132caf..7bf98cf6ec0 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 b479f02619c..5ec7bf66672 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 bcbac85c17d..b5f46207626 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: From b7218c1bcd80b77370e26ba1815316c774e67b29 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 1 Jul 2017 02:35:12 +0200 Subject: [PATCH 06/21] Fix menu consistency --- htdocs/accountancy/admin/export.php | 2 +- htdocs/accountancy/bookkeeping/balance.php | 2 +- htdocs/accountancy/report/result.php | 80 +++++++++++----------- htdocs/core/menus/init_menu_auguria.sql | 36 +++++----- htdocs/core/menus/standard/eldy.lib.php | 6 +- htdocs/langs/en_US/accountancy.lang | 1 + 6 files changed, 64 insertions(+), 63 deletions(-) diff --git a/htdocs/accountancy/admin/export.php b/htdocs/accountancy/admin/export.php index 5ffcbfe92ba..7a209be45b1 100644 --- a/htdocs/accountancy/admin/export.php +++ b/htdocs/accountancy/admin/export.php @@ -206,7 +206,7 @@ if ($num2) { print '' . $langs->trans('OtherOptions') . ''; print "\n"; - if ($conf->global->ACCOUNTING_EXPORT_MODELCSV > AccountancyExport::EXPORT_TYPE_NORMAL) + if ($conf->global->ACCOUNTING_EXPORT_MODELCSV > AccountancyExport::$EXPORT_TYPE_NORMAL) { print '' . $langs->trans('OptionsDeactivatedForThisExportModel') . ''; } diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index 55960776c6d..e742f4651cf 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -114,7 +114,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP 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. + if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == AccountancyExport::$EXPORT_TYPE_CEGID) $sep = ";"; // For CEGID, we force separator. $journal = 'bookkepping'; diff --git a/htdocs/accountancy/report/result.php b/htdocs/accountancy/report/result.php index b8335e2d8f7..fad1fcd4b9b 100644 --- a/htdocs/accountancy/report/result.php +++ b/htdocs/accountancy/report/result.php @@ -80,16 +80,14 @@ $form = new Form($db); $textprevyear = '' . img_previous() . ''; $textnextyear = ' ' . img_next() . ''; - $nom = $langs->trans("ReportInOut"); - $nomlink = ''; - $periodlink = ''; - $exportlink = ''; - $builddate = time(); - $description = ''; - $period = $langs->trans("Detail").' '. $form->selectyesno('simple_report',$simple_report,0) . " " .$textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear ; -report_header($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array ( - 'action' => '' - )); +$nom = $langs->trans("ReportInOut").', '.$langs->trans("ByAccounts"); +$nomlink = ''; +$periodlink = ''; +$exportlink = ''; +$builddate = time(); +$description = ''; +$period = $langs->trans("Detail").' '. $form->selectyesno('simple_report',$simple_report,0) . " " .$textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear ; +report_header($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => '')); $moreforfilter=''; @@ -131,7 +129,7 @@ $sommes = array(); foreach($cats as $cat ){ if(!empty($cat['category_type'])){ // category calculed - + $formula = $cat['formula']; print ""; @@ -143,13 +141,13 @@ foreach($cats as $cat ){ foreach($sommes as $code => $det){ $vars[$code] = $det['NP']; } - - + + $result = strtr($formula, $vars); - - + + $r = $AccCat->calculate($result); - + print '' . price($r) . ''; $code = $cat['code']; // code categorie de calcule $sommes[$code]['NP'] += $r; @@ -160,11 +158,11 @@ foreach($cats as $cat ){ $vars[$code] = $det['N']; } } - + $result = strtr($formula, $vars); - + $r = $AccCat->calculate($result); - + print '' . price($r) . ''; $sommes[$code]['N'] += $r; @@ -179,37 +177,37 @@ foreach($cats as $cat ){ $sommes[$code]['M'][$k] += $r; } - + print "\n"; - - + + }else{ // normal category - + $totCat = array(); $totCat['M'] = array(); - + // get cpts of category $cpts = $AccCat->getCptsCat($cat['rowid']); - - + + print ""; print '' . $cat['label'] . ''; - + foreach($cpts as $i => $cpt){ $var = ! $var; $code = $cat['code']; - + // N-1 $return = $AccCat->getResult($cpt['account_number'], 0, $year_current -1, $cpt['dc']); - + if ($return < 0) { setEventMessages(null, $AccCat->errors, 'errors'); $resultNP=0; } else { $resultNP=$AccCat->sdc; } - + //N $return = $AccCat->getResult($cpt['account_number'], 0, $year_current, $cpt['dc']); if ($return < 0) { @@ -218,7 +216,7 @@ foreach($cats as $cat ){ } else { $resultN=$AccCat->sdc; } - + $totCat['NP'] += $resultNP; $totCat['N'] += $resultN; @@ -231,33 +229,33 @@ foreach($cats as $cat ){ $resultM=$AccCat->sdc; } $totCat['M'][$k] += $resultM; - + } } - + print '' . price($totCat['NP']) . ''; print '' . price($totCat['N']) . ''; - + foreach($totCat['M'] as $k => $v){ print '' . price($v) . ''; - } + } print "\n"; - + foreach($cpts as $i => $cpt){ $var = ! $var; $code = $cat['code']; - + // N-1 $return = $AccCat->getResult($cpt['account_number'], 0, $year_current -1, $cpt['dc']); - + if ($return < 0) { setEventMessages(null, $AccCat->errors, 'errors'); $resultNP=0; } else { $resultNP=$AccCat->sdc; } - + //N $return = $AccCat->getResult($cpt['account_number'], 0, $year_current, $cpt['dc']); if ($return < 0) { @@ -266,7 +264,7 @@ foreach($cats as $cat ){ } else { $resultN=$AccCat->sdc; } - + $sommes[$code]['NP'] += $resultNP; $sommes[$code]['N'] += $resultN; print ''; @@ -294,7 +292,7 @@ foreach($cats as $cat ){ print "\n"; } } - + } print ""; diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index 7bf98cf6ec0..193c74d3ee3 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -235,30 +235,32 @@ 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 && $conf->expensereport->enabled && $leftmenu=="dispatch_expensereport"', __HANDLER__, 'left', 2421__+MAX_llx_menu__, 'accountancy', '', 2420__+MAX_llx_menu__, '/accountancy/expensereport/list.php', 'ToDispatch', 2, 'accountancy', '$user->rights->accounting->bind->write', '', 0, 6, __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=="dispatch_expensereport"', __HANDLER__, 'left', 2422__+MAX_llx_menu__, 'accountancy', '', 2420__+MAX_llx_menu__, '/accountancy/expensereport/lines.php', 'Dispatched', 2, 'accountancy', '$user->rights->accounting->bind->write', '', 0, 7, __ENTITY__); -- Journals - -- 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', 2420__+MAX_llx_menu__, 'accountancy', 'journal', 2400__+MAX_llx_menu__, '/accountancy/journal/index.php?leftmenu=journal', 'Journaux', 1, 'accountancy', '$user->rights->accounting->comptarapport->lire', '', 0, 7, __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', __HANDLER__, 'left', 2705__+MAX_llx_menu__, 'accountancy', '', 2400__+MAX_llx_menu__, '', 'Journalization', 1, 'main', '$user->rights->accounting->comptarapport->lire', '', 0, 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 ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2707__+MAX_llx_menu__, 'accountancy', '', 2705__+MAX_llx_menu__, '/accountancy/journal/bankjournal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal=3', 'BankJournal', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 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 ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2708__+MAX_llx_menu__, 'accountancy', '', 2705__+MAX_llx_menu__, '/accountancy/journal/expensereportsjournal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal=6', 'ExpenseReportJournal', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 2, __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', __HANDLER__, 'left', 2709__+MAX_llx_menu__, 'accountancy', '', 2705__+MAX_llx_menu__, '/accountancy/journal/purchasesjournal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal=2', 'PurchasesJournal', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 3, __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', __HANDLER__, 'left', 2706__+MAX_llx_menu__, 'accountancy', '', 2705__+MAX_llx_menu__, '/accountancy/journal/sellsjournal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal=1', 'SellsJournal', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 4, __ENTITY__); -- General Ledger 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', 2430__+MAX_llx_menu__, 'accountancy', 'bookkeeping', 2400__+MAX_llx_menu__, '/accountancy/bookkeeping/list.php', 'Bookkeeping', 1, 'accountancy', '$user->rights->accounting->mouvements->lire', '', 0, 15, __ENTITY__); -- Balance 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', 2435__+MAX_llx_menu__, 'accountancy', 'balance', 2400__+MAX_llx_menu__, '/accountancy/bookkeeping/balance.php', 'AccountBalance', 1, 'accountancy', '$user->rights->accounting->mouvements->lire', '', 0, 16, __ENTITY__); -- Reports - 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', 2440__+MAX_llx_menu__, 'accountancy', 'report', 2400__+MAX_llx_menu__, '/accountancy/report/result.php?leftmenu=ca&mainmenu=accountancy', 'Reportings', 1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 17, __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=="ca"', __HANDLER__, 'left', 2441__+MAX_llx_menu__, 'accountancy', '', 2440__+MAX_llx_menu__, '/accountancy/report/result.php?leftmenu=ca', 'ReportInOut', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 18, __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=="ca"', __HANDLER__, 'left', 2442__+MAX_llx_menu__, 'accountancy', '', 2440__+MAX_llx_menu__, '/compta/resultat/index.php?leftmenu=ca', 'ByExpenseIncome', 3, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 19, __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=="ca"', __HANDLER__, 'left', 2443__+MAX_llx_menu__, 'accountancy', '', 2440__+MAX_llx_menu__, '/compta/resultat/clientfourn.php?leftmenu=ca', 'ByCompanies', 3, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 20, __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=="ca"', __HANDLER__, 'left', 2444__+MAX_llx_menu__, 'accountancy', '', 2440__+MAX_llx_menu__, '/compta/stats/index.php?leftmenu=ca', 'ReportTurnover', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 21, __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=="ca"', __HANDLER__, 'left', 2445__+MAX_llx_menu__, 'accountancy', '', 2440__+MAX_llx_menu__, '/compta/stats/casoc.php?leftmenu=ca', 'ByCompanies', 3, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 22, __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=="ca"', __HANDLER__, 'left', 2446__+MAX_llx_menu__, 'accountancy', '', 2440__+MAX_llx_menu__, '/compta/stats/cabyuser.php?leftmenu=ca', 'ByUsers', 3, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 23, __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=="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__); + 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', 2440__+MAX_llx_menu__, 'accountancy', 'report', 2400__+MAX_llx_menu__, '/accountancy/report/result.php?mainmenu=accountancy&leftmenu=accountancy', 'Reportings', 1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 17, __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"', __HANDLER__, 'left', 2441__+MAX_llx_menu__, 'accountancy', '', 2440__+MAX_llx_menu__, '/compta/resultat/index.php?mainmenu=accountancy&leftmenu=accountancy', 'ReportInOut', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 19, __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"', __HANDLER__, 'left', 2442__+MAX_llx_menu__, 'accountancy', '', 2441__+MAX_llx_menu__, '/accountancy/report/result.php?mainmenu=accountancy&leftmenu=accountancy', 'ByAccounts', 3, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 18, __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"', __HANDLER__, 'left', 2443__+MAX_llx_menu__, 'accountancy', '', 2441__+MAX_llx_menu__, '/compta/resultat/clientfourn.php?mainmenu=accountancy&leftmenu=accountancy', 'ByCompanies', 3, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 20, __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"', __HANDLER__, 'left', 2444__+MAX_llx_menu__, 'accountancy', '', 2440__+MAX_llx_menu__, '/compta/stats/index.php?mainmenu=accountancy&leftmenu=accountancy', 'ReportTurnover', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 21, __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"', __HANDLER__, 'left', 2445__+MAX_llx_menu__, 'accountancy', '', 2444__+MAX_llx_menu__, '/compta/stats/casoc.php?mainmenu=accountancy&leftmenu=accountancy', 'ByCompanies', 3, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 22, __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"', __HANDLER__, 'left', 2446__+MAX_llx_menu__, 'accountancy', '', 2444__+MAX_llx_menu__, '/compta/stats/cabyuser.php?mainmenu=accountancy&leftmenu=accountancy', 'ByUsers', 3, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 23, __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"', __HANDLER__, 'left', 2447__+MAX_llx_menu__, 'accountancy', '', 2444__+MAX_llx_menu__, '/compta/stats/cabyprodserv.php?mainmenu=accountancy&leftmenu=accountancy', 'ByProductsAndServices', 3, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 24, __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__); -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', 2702__+MAX_llx_menu__, 'accountancy', '', 2701__+MAX_llx_menu__, '/compta/resultat/clientfourn.php?leftmenu=ca', 'ByCompanies', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 0, __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', 2703__+MAX_llx_menu__, 'accountancy', '', 2700__+MAX_llx_menu__, '/compta/stats/index.php?leftmenu=ca', 'ReportTurnover', 1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 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 ('', '$conf->comptabilite->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2704__+MAX_llx_menu__, 'accountancy', '', 2703__+MAX_llx_menu__, '/compta/stats/casoc.php?leftmenu=ca', 'ByCompanies', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 0, __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', 2705__+MAX_llx_menu__, 'accountancy', '', 2703__+MAX_llx_menu__, '/compta/stats/cabyuser.php?leftmenu=ca', 'ByUsers', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 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 ('', '$conf->comptabilite->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2708__+MAX_llx_menu__, 'accountancy', '', 2703__+MAX_llx_menu__, '/compta/stats/cabyprodserv.php?leftmenu=ca', 'ByProductsAndServices', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 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 ('', '$conf->comptabilite->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2706__+MAX_llx_menu__, 'accountancy', '', 2700__+MAX_llx_menu__, '/compta/journal/sellsjournal.php?leftmenu=ca', 'SellsJournal', 1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 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 ('', '$conf->comptabilite->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2707__+MAX_llx_menu__, 'accountancy', '', 2700__+MAX_llx_menu__, '/compta/journal/purchasesjournal.php?leftmenu=ca', 'PurchasesJournal', 1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 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 ('', '$conf->comptabilite->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2711__+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__); +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', 2712__+MAX_llx_menu__, 'accountancy', '', 2701__+MAX_llx_menu__, '/compta/resultat/clientfourn.php?leftmenu=ca', 'ByCompanies', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 0, __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', 2713__+MAX_llx_menu__, 'accountancy', '', 2700__+MAX_llx_menu__, '/compta/stats/index.php?leftmenu=ca', 'ReportTurnover', 1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 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 ('', '$conf->comptabilite->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2714__+MAX_llx_menu__, 'accountancy', '', 2703__+MAX_llx_menu__, '/compta/stats/casoc.php?leftmenu=ca', 'ByCompanies', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 0, __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', 2715__+MAX_llx_menu__, 'accountancy', '', 2703__+MAX_llx_menu__, '/compta/stats/cabyuser.php?leftmenu=ca', 'ByUsers', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 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 ('', '$conf->comptabilite->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2716__+MAX_llx_menu__, 'accountancy', '', 2703__+MAX_llx_menu__, '/compta/stats/cabyprodserv.php?leftmenu=ca', 'ByProductsAndServices', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 1, __ENTITY__); -- Check deposit insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'empty($conf->global->BANK_DISABLE_CHECK_DEPOSIT) && ! empty($conf->banque->enabled) && (! empty($conf->facture->enabled) || ! empty($conf->global->MAIN_MENU_CHEQUE_DEPOSIT_ON))', __HANDLER__, 'left', 1711__+MAX_llx_menu__, 'accountancy', 'checks', 14__+MAX_llx_menu__, '/compta/paiement/cheque/index.php?leftmenu=checks&mainmenu=bank', 'MenuChequeDeposits', 0, 'bills', '$user->rights->banque->lire', '', 2, 9, __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 ('', 'empty($conf->global->BANK_DISABLE_CHECK_DEPOSIT) && ! empty($conf->banque->enabled) && (! empty($conf->facture->enabled) || ! empty($conf->global->MAIN_MENU_CHEQUE_DEPOSIT_ON))', __HANDLER__, 'left', 1712__+MAX_llx_menu__, 'accountancy', '', 1711__+MAX_llx_menu__, '/compta/paiement/cheque/card.php?leftmenu=checks&action=new', 'NewCheckDeposit', 1, 'compta', '$user->rights->banque->lire', '', 2, 0, __ENTITY__); diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 5ec7bf66672..66bfdcbce87 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1024,7 +1024,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu if ($nature) { - if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy/',$leftmenu)) $newmenu->add('/accountancy/journal/'.$nature.'journal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal='.$objp->rowid,dol_trunc($objp->label,25),2,$user->rights->accounting->comptarapport->lire); + if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy/',$leftmenu)) $newmenu->add('/accountancy/journal/'.$nature.'journal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal='.$objp->rowid, dol_trunc($objp->label,25), 2, $user->rights->accounting->comptarapport->lire); } $i++; } @@ -1080,8 +1080,8 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/report/result.php?mainmenu=accountancy&leftmenu=accountancy_report",$langs->trans("Reportings"),1,$user->rights->accounting->comptarapport->lire, '', $mainmenu, 'ca'); - if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/accountancy/report/result.php?leftmenu=accountancy_report",$langs->trans("ReportInOut"),2,$user->rights->accounting->comptarapport->lire); - if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/resultat/index.php?leftmenu=accountancy_report",$langs->trans("ByExpenseIncome"),3,$user->rights->accounting->comptarapport->lire); + if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/resultat/index.php?leftmenu=accountancy_report",$langs->trans("ReportInOut"),2,$user->rights->accounting->comptarapport->lire); + if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/accountancy/report/result.php?leftmenu=accountancy_report",$langs->trans("ByAccounts"),3,$user->rights->accounting->comptarapport->lire); if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/resultat/clientfourn.php?leftmenu=accountancy_report",$langs->trans("ByCompanies"),3,$user->rights->accounting->comptarapport->lire); if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/stats/index.php?leftmenu=accountancy_report",$langs->trans("ReportTurnover"),2,$user->rights->accounting->comptarapport->lire); if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/stats/casoc.php?leftmenu=accountancy_report",$langs->trans("ByCompanies"),3,$user->rights->accounting->comptarapport->lire); diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index b5f46207626..87555ef5158 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -143,6 +143,7 @@ NumPiece=Piece number TransactionNumShort=Num. transaction AccountingCategory=Accounting account groups GroupByAccountAccounting=Group by accounting account +ByAccounts=By accounts NotMatch=Not Set DeleteMvt=Delete Ledger lines DelYear=Year to delete From 658fe93d8cb3d67d00ad856ccf82b2a6614aa163 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 1 Jul 2017 12:42:49 +0200 Subject: [PATCH 07/21] Fix menu editor (data not aligned) --- htdocs/admin/menus/index.php | 42 ++++++++++++++----------- htdocs/core/lib/treeview.lib.php | 53 +++++++++++++++++++++++--------- 2 files changed, 63 insertions(+), 32 deletions(-) diff --git a/htdocs/admin/menus/index.php b/htdocs/admin/menus/index.php index ed5f56954c0..5fb19b0b5ec 100644 --- a/htdocs/admin/menus/index.php +++ b/htdocs/admin/menus/index.php @@ -289,11 +289,11 @@ if ($conf->use_javascript_ajax) - la chaine a afficher ie: data[]= array (index, index parent, chaine ) */ - + //il faut d'abord declarer un element racine de l'arbre $data[] = array('rowid'=>0,'fk_menu'=>-1,'title'=>"racine",'mainmenu'=>'','leftmenu'=>'','fk_mainmenu'=>'','fk_leftmenu'=>''); - + //puis tous les elements enfants $sql = "SELECT m.rowid, m.titre, m.langs, m.mainmenu, m.leftmenu, m.fk_menu, m.fk_mainmenu, m.fk_leftmenu, m.module"; @@ -313,6 +313,7 @@ if ($conf->use_javascript_ajax) { if (! empty($menu['langs'])) $langs->load($menu['langs']); $titre = $langs->trans($menu['titre']); + $data[] = array( 'rowid'=>$menu['rowid'], 'module'=>$menu['module'], @@ -329,28 +330,33 @@ if ($conf->use_javascript_ajax) ''.img_edit_add('default').' '. ''.img_delete('default').' '. '     '. - ''.img_picto("Monter","1uparrow").''.img_picto("Descendre","1downarrow").''. - '' + ''.img_picto("Up","1uparrow").''.img_picto("Down","1downarrow").''. + '', + 'buttons'=>''.img_edit('default',0,'class="menuEdit" id="edit'.$menu['rowid'].'"').' '. + ''.img_edit_add('default').' '. + ''.img_delete('default').' '. + '     '. + ''.img_picto("Up","1uparrow").''.img_picto("Down","1downarrow").'' ); $i++; } } global $tree_recur_alreadyadded; // This var was def into tree_recur - + // Appelle de la fonction recursive (ammorce) // avec recherche depuis la racine. //var_dump($data); tree_recur($data, $data[0], 0, 'iddivjstree'); // $data[0] is virtual record 'racine' - + print ''; - + print ''; - + print ''; - - + + // Process remaining records (records that are not linked to root by any path) $remainingdata = array(); foreach($data as $datar) @@ -358,30 +364,30 @@ if ($conf->use_javascript_ajax) if (empty($datar['rowid']) || $tree_recur_alreadyadded[$datar['rowid']]) continue; $remainingdata[] = $datar; } - + if (count($remainingdata)) { print ''; - + print ''; print ''; print ''; print ''; - + print ''; - print ''; - + print ''; - + print '
'.$langs->trans("NotTopTreeMenuPersonalized").'
'; - + print ''; + foreach($remainingdata as $datar) { $father = array('rowid'=>$datar['rowid'],'title'=>"???",'mainmenu'=>$datar['fk_mainmenu'],'leftmenu'=>$datar['fk_leftmenu'],'fk_mainmenu'=>'','fk_leftmenu'=>''); //print 'Start with rowid='.$datar['rowid'].' mainmenu='.$father ['mainmenu'].' leftmenu='.$father ['leftmenu'].'
'."\n"; tree_recur($data, $father, 0, 'iddivjstree'.$datar['rowid'], 1, 1); } - + print '
'; } diff --git a/htdocs/core/lib/treeview.lib.php b/htdocs/core/lib/treeview.lib.php index db0fcd07fae..944520d04d5 100644 --- a/htdocs/core/lib/treeview.lib.php +++ b/htdocs/core/lib/treeview.lib.php @@ -110,15 +110,15 @@ function tree_showpad(&$fulltree,$key,$silent=0) * @param int $rang Level of element * @param string $iddivjstree Id to use for parent ul element * @param int $donoresetalreadyloaded Do not reset global array $donoresetalreadyloaded used to avoid to go down on an aleady processed record - * @param int $showfk Show fk links to parent into label + * @param int $showfk 1=show fk_links to parent into label (used by menu editor only) * @return void */ function tree_recur($tab, $pere, $rang, $iddivjstree='iddivjstree', $donoresetalreadyloaded=0, $showfk=0) { global $tree_recur_alreadyadded; - + if ($rang == 0 && empty($donoresetalreadyloaded)) $tree_recur_alreadyadded=array(); - + if ($rang == 0) { // Test also done with jstree and dynatree (not able to have inside label) @@ -138,8 +138,8 @@ function tree_recur($tab, $pere, $rang, $iddivjstree='iddivjstree', $donoresetal print '
    '; } - - if ($rang > 50) + + if ($rang > 50) { return; // Protect against infinite loop. Max 50 depth } @@ -154,19 +154,31 @@ function tree_recur($tab, $pere, $rang, $iddivjstree='iddivjstree', $donoresetal if ($tab[$x]['fk_menu'] != -1 && $tab[$x]['fk_menu'] == $pere['rowid']) { //print 'rang='.$rang.'-x='.$x." rowid=".$tab[$x]['rowid']." tab[x]['fk_leftmenu'] = ".$tab[$x]['fk_leftmenu']." leftmenu pere = ".$pere['leftmenu']."
    \n"; - if (empty($ulprinted) && ! empty($pere['rowid'])) - { + if (empty($ulprinted) && ! empty($pere['rowid'])) + { if (! empty($tree_recur_alreadyadded[$tab[$x]['rowid']])) { dol_syslog('Error, record with id '.$tab[$x]['rowid'].' seems to be a child of record with id '.$pere['rowid'].' but it was already output. Complete field "leftmenu" and "mainmenu" on ALL records to avoid ambiguity.', LOG_WARNING); continue; } - + print ''; $ulprinted++; } print "\n".'
  • '; - print $tab[$x]['entry']; - if ($showfk) print '  (fk_mainmenu='.$tab[$x]['fk_mainmenu'].' fk_leftmenu='.$tab[$x]['fk_leftmenu'].')'; + if ($showfk) + { + print '
    '; + print '   '; + print $tab[$x]['title']; + print '  (fk_mainmenu='.$tab[$x]['fk_mainmenu'].' fk_leftmenu='.$tab[$x]['fk_leftmenu'].')'; + print ''; + print $tab[$x]['buttons']; + print '
    '; + } + else + { + print $tab[$x]['entry']; + } //print ' -> A '.$tab[$x]['rowid'].' mainmenu='.$tab[$x]['mainmenu'].' leftmenu='.$tab[$x]['leftmenu'].' fk_mainmenu='.$tab[$x]['fk_mainmenu'].' fk_leftmenu='.$tab[$x]['fk_leftmenu'].'
    '."\n"; $tree_recur_alreadyadded[$tab[$x]['rowid']]=($rang + 1); // And now we search all its sons of lower level @@ -176,7 +188,7 @@ function tree_recur($tab, $pere, $rang, $iddivjstree='iddivjstree', $donoresetal elseif (! empty($tab[$x]['rowid']) && $tab[$x]['fk_menu'] == -1 && $tab[$x]['fk_mainmenu'] == $pere['mainmenu'] && $tab[$x]['fk_leftmenu'] == $pere['leftmenu']) { //print 'rang='.$rang.'-x='.$x." rowid=".$tab[$x]['rowid']." tab[x]['fk_leftmenu'] = ".$tab[$x]['fk_leftmenu']." leftmenu pere = ".$pere['leftmenu']."
    \n"; - if (empty($ulprinted) && ! empty($pere['rowid'])) + if (empty($ulprinted) && ! empty($pere['rowid'])) { if (! empty($tree_recur_alreadyadded[$tab[$x]['rowid']])) { @@ -184,12 +196,25 @@ function tree_recur($tab, $pere, $rang, $iddivjstree='iddivjstree', $donoresetal //print 'Error, record with id '.$tab[$x]['rowid'].' seems to be a child of record with id '.$pere['rowid'].' but it was already output. Complete field "leftmenu" and "mainmenu" on ALL records to avoid ambiguity.'; continue; } - + print ''; $ulprinted++; } print "\n".'
  • '; - print $tab[$x]['entry']; - if ($showfk) print '  (fk_mainmenu='.$tab[$x]['fk_mainmenu'].' fk_leftmenu='.$tab[$x]['fk_leftmenu'].')'; + if ($showfk) + { + print '
    '; + print '   '; + print $tab[$x]['title']; + print ''; + print '  (fk_mainmenu='.$tab[$x]['fk_mainmenu'].' fk_leftmenu='.$tab[$x]['fk_leftmenu'].')'; + print ''; + print $tab[$x]['buttons']; + print '
    '; + } + else + { + print $tab[$x]['entry']; + } //print ' -> B '.$tab[$x]['rowid'].' mainmenu='.$tab[$x]['mainmenu'].' leftmenu='.$tab[$x]['leftmenu'].' fk_mainmenu='.$tab[$x]['fk_mainmenu'].' fk_leftmenu='.$tab[$x]['fk_leftmenu'].'
    '."\n"; $tree_recur_alreadyadded[$tab[$x]['rowid']]=($rang + 1); // And now we search all its sons of lower level From b186fa87590ac54664dba60f755c2aab5c98fac4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 1 Jul 2017 13:31:44 +0200 Subject: [PATCH 08/21] Fix pgsql compatibility --- htdocs/accountancy/customer/index.php | 19 +++++------ htdocs/accountancy/expensereport/index.php | 31 +++++++++--------- htdocs/accountancy/supplier/index.php | 38 ++++++++++------------ 3 files changed, 43 insertions(+), 45 deletions(-) diff --git a/htdocs/accountancy/customer/index.php b/htdocs/accountancy/customer/index.php index 9af3d0d19d9..f1bea3bd4a1 100644 --- a/htdocs/accountancy/customer/index.php +++ b/htdocs/accountancy/customer/index.php @@ -23,7 +23,7 @@ /** * \file htdocs/accountancy/customer/index.php * \ingroup Advanced accountancy - * \brief Home customer ventilation + * \brief Home customer journalization page */ require '../../main.inc.php'; @@ -58,7 +58,7 @@ if ($year == 0) { } // Validate History -$action = GETPOST('action','alpha'); +$action = GETPOST('action','aZ09'); @@ -97,7 +97,7 @@ if ($action == 'validatehistory') { $sql1 .= " AND fd.fk_code_ventilation = 0"; } - dol_syslog("htdocs/accountancy/customer/index.php sql=" . $sql, LOG_DEBUG); + dol_syslog('htdocs/accountancy/customer/index.php'); $resql1 = $db->query($sql1); if (! $resql1) { @@ -173,7 +173,7 @@ print $langs->trans("DescVentilCustomer") . '
    '; print $langs->trans("DescVentilMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToBind")) . '
    '; print '
    '; //print '
    '; @@ -189,7 +189,7 @@ if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { } $sql .= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy -dol_syslog("htdocs/accountancy/customer/index.php sql=" . $sql, LOG_DEBUG); +dol_syslog('htdocs/accountancy/customer/index.php'); $result = $db->query($sql); if ($result) { $row = $db->fetch_row($result); @@ -233,7 +233,7 @@ if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { } $sql .= " GROUP BY fd.fk_code_ventilation,aa.account_number,aa.label"; -dol_syslog("htdocs/accountancy/customer/index.php sql=" . $sql, LOG_DEBUG); +dol_syslog('htdocs/accountancy/customer/index.php sql=' . $sql, LOG_DEBUG); $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); @@ -289,7 +289,7 @@ if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { $sql .= " AND aa.account_number IS NOT NULL"; $sql .= " GROUP BY fd.fk_code_ventilation,aa.account_number,aa.label"; -dol_syslog("htdocs/accountancy/customer/index.php sql=" . $sql, LOG_DEBUG); +dol_syslog('htdocs/accountancy/customer/index.php'); $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); @@ -347,7 +347,6 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange. dol_syslog('htdocs/accountancy/customer/index.php'); $resql = $db->query($sql); if ($resql) { - $i = 0; $num = $db->num_rows($resql); while ($row = $db->fetch_row($resql)) { @@ -357,7 +356,6 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange. } print '' . price($row[13]) . ''; print ''; - $i ++; } $db->free($resql); } else { @@ -365,6 +363,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange. } print "\n"; + if (! empty($conf->margin->enabled)) { print "
    \n"; print ''; @@ -390,7 +389,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange. $sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_DEPOSIT . "," . Facture::TYPE_SITUATION . ")"; } - dol_syslog('htdocs/accountancy/customer/index.php:: $sql=' . $sql); + dol_syslog('htdocs/accountancy/customer/index.php'); $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); diff --git a/htdocs/accountancy/expensereport/index.php b/htdocs/accountancy/expensereport/index.php index fdbf4d1ce4b..b17aeedb4bd 100644 --- a/htdocs/accountancy/expensereport/index.php +++ b/htdocs/accountancy/expensereport/index.php @@ -69,7 +69,7 @@ if ($action == 'validatehistory') { // First clean corrupted data $sqlclean = "UPDATE " . MAIN_DB_PREFIX . "expensereport_det as erd"; - $sqlclean .= " SET erd.fk_code_ventilation = 0"; + $sqlclean .= " SET fk_code_ventilation = 0"; $sqlclean .= ' WHERE erd.fk_code_ventilation NOT IN '; $sqlclean .= ' (SELECT accnt.rowid '; $sqlclean .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as accnt'; @@ -93,6 +93,8 @@ if ($action == 'validatehistory') { $sql1 .= " AND erd.fk_code_ventilation = 0"; } + dol_syslog('htdocs/accountancy/expensereport/index.php'); + $resql1 = $db->query($sql1); if (! $resql1) { $error ++; @@ -107,7 +109,7 @@ if ($action == 'validatehistory') { $db->begin(); $sql1 = "UPDATE " . MAIN_DB_PREFIX . "expensereport_det as erd"; - $sql1 .= " SET erd.fk_code_ventilation = 0"; + $sql1 .= " SET fk_code_ventilation = 0"; $sql1 .= ' WHERE erd.fk_code_ventilation NOT IN '; $sql1 .= ' (SELECT accnt.rowid '; $sql1 .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as accnt'; @@ -129,8 +131,9 @@ if ($action == 'validatehistory') { $error = 0; $db->begin(); + // Now clean $sql1 = "UPDATE " . MAIN_DB_PREFIX . "expensereport_det as erd"; - $sql1.= " SET erd.fk_code_ventilation = 0"; + $sql1.= " SET fk_code_ventilation = 0"; $sql1.= " WHERE erd.fk_expensereport IN ( SELECT er.rowid FROM " . MAIN_DB_PREFIX . "expensereport as er"; $sql1.= " WHERE er.date_debut >= '" . $db->idate(dol_get_first_day($year_current, 1, false)) . "'"; $sql1.= " AND er.date_debut <= '" . $db->idate(dol_get_last_day($year_current, 12, false)) . "'"; @@ -166,25 +169,25 @@ print $langs->trans("DescVentilExpenseReportMore", $langs->transnoentitiesnoconv print '
    '; //print '
    '; -// TODO Remove this. Should be done always. +// TODO Remove this. Should be done always or into the repair.php script. if ($conf->global->MAIN_FEATURES_LEVEL > 1) print '' . $langs->trans("CleanFixHistory", $year_current) . ''; //print '
    '; -$buttonbind = '' . $langs->trans("ValidateHistory") . ''; -$buttonreset = '' . $langs->trans("CleanHistory", $year_current) . ''; $y = $year_current; -print '
    '; +$buttonbind = '' . $langs->trans("ValidateHistory") . ''; +$buttonreset = '' . $langs->trans("CleanHistory", $year_current) . ''; + print_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, ''); print '
    '; -print ''; +print ''; print ''; for($i = 1; $i <= 12; $i ++) { print ''; @@ -196,7 +199,7 @@ $sql .= " " . $db->ifsql('aa.label IS NULL', "'".$langs->trans('NotMatch')."'", for($i = 1; $i <= 12; $i ++) { $sql .= " SUM(" . $db->ifsql('MONTH(er.date_debut)=' . $i, 'erd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ","; } -$sql .= " ROUND(SUM(erd.total_ht),2) as total"; +$sql .= " SUM(erd.total_ht) as total"; $sql .= " FROM " . MAIN_DB_PREFIX . "expensereport_det as erd"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "expensereport as er ON er.rowid = erd.fk_expensereport"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = erd.fk_code_ventilation"; @@ -237,7 +240,7 @@ print_fiche_titre($langs->trans("OverviewOfAmountOfLinesBound"), $buttonreset, ' print '
    ' . $langs->trans("Account") . '
    ' . $langs->trans("Account") . '' . $langs->trans("Label") . '' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '
    '; -print ''; +print ''; print ''; for($i = 1; $i <= 12; $i ++) { print ''; @@ -260,7 +263,7 @@ $sql .= " AND er.entity IN (" . getEntity('expensereport', 0) . ")"; // We d $sql .= " AND aa.account_number IS NOT NULL"; $sql .= " GROUP BY erd.fk_code_ventilation,aa.account_number,aa.label"; -dol_syslog('/accountancy/expensereport/index.php:: sql=' . $sql); +dol_syslog('htdocs/accountancy/expensereport/index.php'); $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); @@ -304,7 +307,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange. for($i = 1; $i <= 12; $i ++) { $sql .= " SUM(" . $db->ifsql('MONTH(er.date_create)=' . $i, 'erd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ","; } - $sql .= " ROUND(SUM(erd.total_ht),2) as total"; + $sql .= " SUM(erd.total_ht) as total"; $sql .= " FROM " . MAIN_DB_PREFIX . "expensereport_det as erd"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "expensereport as er ON er.rowid = erd.fk_expensereport"; $sql .= " WHERE er.date_debut >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'"; @@ -312,14 +315,12 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange. $sql .= " AND er.fk_statut > 0 "; $sql .= " AND er.entity IN (" . getEntity('expensereport', 0) . ")"; // We don't share object for accountancy - dol_syslog('/accountancy/expensereport/index.php:: sql=' . $sql); + dol_syslog('htdocs/accountancy/expensereport/index.php'); $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); while ( $row = $db->fetch_row($resql)) { - - print ''; for($i = 1; $i <= 12; $i ++) { print ''; diff --git a/htdocs/accountancy/supplier/index.php b/htdocs/accountancy/supplier/index.php index fb5f28fc27d..f862feb5ba3 100644 --- a/htdocs/accountancy/supplier/index.php +++ b/htdocs/accountancy/supplier/index.php @@ -21,12 +21,13 @@ /** * \file htdocs/accountancy/supplier/index.php * \ingroup Advanced accountancy - * \brief Home supplier ventilation + * \brief Home supplier journalization page */ 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 . '/fourn/class/fournisseur.facture.class.php'; // Langs $langs->load("compta"); @@ -55,7 +56,7 @@ if ($year == 0) { } // Validate History -$action = GETPOST('action', 'alpha'); +$action = GETPOST('action', 'aZ09'); /* @@ -93,6 +94,8 @@ if ($action == 'validatehistory') { $sql1 .= " AND fd.fk_code_ventilation = 0"; } + dol_syslog('htdocs/accountancy/supplier/index.php'); + $resql1 = $db->query($sql1); if (! $resql1) { $error ++; @@ -159,33 +162,28 @@ llxHeader('', $langs->trans("SuppliersVentilation")); $textprevyear = '' . img_previous() . ''; $textnextyear = ' ' . img_next() . ''; -print load_fiche_titre($langs->trans("SuppliersVentilation") . " " . $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear, '', 'title_accountancy'); +print load_fiche_titre($langs->trans("SuppliersVentilation") . " " . $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear, '', 'title_accountancy'); print $langs->trans("DescVentilSupplier") . '
    '; print $langs->trans("DescVentilMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToBind")) . '
    '; print '
    '; //print '
    '; -// TODO Remove this. Should be done always. +// TODO Remove this. Should be done always or into the repair.php script. if ($conf->global->MAIN_FEATURES_LEVEL > 1) print '' . $langs->trans("CleanFixHistory", $year_current) . ''; //print '
    '; + +$y = $year_current; + $buttonbind = '' . $langs->trans("ValidateHistory") . ''; $buttonreset = '' . $langs->trans("CleanHistory", $year_current) . ''; - -$y = $year_current; - -$var = true; - - -print '
    '; - print_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, ''); print '
    ' . $langs->trans("Account") . '
    ' . $langs->trans("Account") . '' . $langs->trans("Label") . '' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '
    ' . $row[0] . '' . price($row[$i]) . '
    '; -print ''; +print ''; print ''; for($i = 1; $i <= 12; $i ++) { print ''; @@ -197,7 +195,7 @@ $sql .= " " . $db->ifsql('aa.label IS NULL', "'".$langs->trans('NotMatch')."'", for($i = 1; $i <= 12; $i ++) { $sql .= " SUM(" . $db->ifsql('MONTH(ff.datef)=' . $i, 'ffd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ","; } -$sql .= " ROUND(SUM(ffd.total_ht),2) as total"; +$sql .= " SUM(ffd.total_ht) as total"; $sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn_det as ffd"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture_fourn as ff ON ff.rowid = ffd.fk_facture_fourn"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = ffd.fk_code_ventilation"; @@ -208,7 +206,7 @@ $sql .= " AND ff.entity IN (" . getEntity('facture_fourn', 0) . ")"; // We d $sql .= " AND aa.account_number IS NULL"; $sql .= " GROUP BY ffd.fk_code_ventilation,aa.account_number,aa.label"; -dol_syslog('/accountancy/supplier/index.php:: sql=' . $sql); +dol_syslog('htdocs/accountancy/supplier/index.php'); $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); @@ -239,7 +237,7 @@ print '
    '; print_fiche_titre($langs->trans("OverviewOfAmountOfLinesBound"), $buttonreset, ''); print '
    ' . $langs->trans("Account") . '
    ' . $langs->trans("Account") . '' . $langs->trans("Label") . '' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '
    '; -print ''; +print ''; print ''; for($i = 1; $i <= 12; $i ++) { print ''; @@ -251,7 +249,7 @@ $sql .= " " . $db->ifsql('aa.label IS NULL', "'".$langs->trans('NotMatch')."'", for($i = 1; $i <= 12; $i ++) { $sql .= " SUM(" . $db->ifsql('MONTH(ff.datef)=' . $i, 'ffd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ","; } -$sql .= " ROUND(SUM(ffd.total_ht),2) as total"; +$sql .= " SUM(ffd.total_ht) as total"; $sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn_det as ffd"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture_fourn as ff ON ff.rowid = ffd.fk_facture_fourn"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = ffd.fk_code_ventilation"; @@ -262,7 +260,7 @@ $sql .= " AND ff.entity IN (" . getEntity('facture_fourn', 0) . ")"; // We d $sql .= " AND aa.account_number IS NOT NULL"; $sql .= " GROUP BY ffd.fk_code_ventilation,aa.account_number,aa.label"; -dol_syslog('/accountancy/supplier/index.php:: sql=' . $sql); +dol_syslog('htdocs/accountancy/supplier/index.php'); $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); @@ -306,7 +304,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange. for($i = 1; $i <= 12; $i ++) { $sql .= " SUM(" . $db->ifsql('MONTH(ff.datef)=' . $i, 'ffd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ","; } - $sql .= " ROUND(SUM(ffd.total_ht),2) as total"; + $sql .= " SUM(ffd.total_ht) as total"; $sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn_det as ffd"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture_fourn as ff ON ff.rowid = ffd.fk_facture_fourn"; $sql .= " WHERE ff.datef >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'"; @@ -314,7 +312,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange. $sql .= " AND ff.fk_statut > 0 "; $sql .= " AND ff.entity IN (" . getEntity('facture_fourn', 0) . ")"; // We don't share object for accountancy - dol_syslog('/accountancy/supplier/index.php:: sql=' . $sql); + dol_syslog('htdocs/accountancy/supplier/index.php'); $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); From 8dda0afc0722ddceda7dea6bb5d9f46d73a4e4b9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 1 Jul 2017 14:18:09 +0200 Subject: [PATCH 09/21] Look and feel v6 --- htdocs/comm/propal/card.php | 2 +- htdocs/comm/propal/class/propal.class.php | 43 +++++++----- htdocs/comm/propal/contact.php | 14 ++-- htdocs/comm/propal/document.php | 2 +- htdocs/comm/propal/info.php | 4 +- htdocs/comm/propal/list.php | 42 ++++++------ htdocs/comm/propal/note.php | 20 +++--- htdocs/commande/card.php | 2 +- htdocs/commande/class/commande.class.php | 37 ++++++---- htdocs/commande/contact.php | 14 ++-- htdocs/commande/document.php | 26 +++---- htdocs/commande/info.php | 2 +- htdocs/commande/list.php | 82 +++++++++++------------ htdocs/commande/note.php | 26 +++---- htdocs/compta/stats/casoc.php | 54 +++++++-------- htdocs/loan/card.php | 9 +-- htdocs/theme/eldy/style.css.php | 4 +- htdocs/theme/md/style.css.php | 4 +- 18 files changed, 204 insertions(+), 183 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 4ee029ee8e8..4668c6a56a4 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1739,7 +1739,7 @@ if ($action == 'create') // Proposal card - $linkback = '' . $langs->trans("BackToList") . ''; + $linkback = '' . $langs->trans("BackToList") . ''; $morehtmlref='
    '; diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index d7f2411f615..a59fefc7a89 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -254,7 +254,7 @@ class Propal extends CommonObject $tva_npr = get_default_npr($mysoc,$this->thirdparty,$prod->id); if (empty($tva_tx)) $tva_npr=0; $vat_src_code = ''; // May be defined into tva_tx - + $localtax1_tx = get_localtax($tva_tx,1,$mysoc,$this->thirdparty,$tva_npr); $localtax2_tx = get_localtax($tva_tx,2,$mysoc,$this->thirdparty,$tva_npr); @@ -433,7 +433,7 @@ class Propal extends CommonObject // Check parameters if ($type < 0) return -1; - + if ($this->statut == self::STATUS_DRAFT) { $this->db->begin(); @@ -1392,17 +1392,17 @@ class Propal extends CommonObject return -1; } } - + /** * Load array lines - * + * * @param int $only_product Return only physical products * @return int <0 if KO, >0 if OK */ function fetch_lines($only_product=0) { $this->lines=array(); - + $sql = 'SELECT d.rowid, d.fk_propal, d.fk_parent_line, d.label as custom_label, d.description, d.price, d.vat_src_code, d.tva_tx, d.localtax1_tx, d.localtax2_tx, d.qty, d.fk_remise_except, d.remise_percent, d.subprice, d.fk_product,'; $sql.= ' d.info_bits, d.total_ht, d.total_tva, d.total_localtax1, d.total_localtax2, d.total_ttc, d.fk_product_fournisseur_price as fk_fournprice, d.buy_price_ht as pa_ht, d.special_code, d.rang, d.product_type,'; $sql.= ' d.fk_unit,'; @@ -1422,7 +1422,7 @@ class Propal extends CommonObject require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; $num = $this->db->num_rows($result); - + $i = 0; while ($i < $num) { @@ -1489,9 +1489,9 @@ class Propal extends CommonObject //print "xx $i ".$this->lines[$i]->fk_product; $i++; } - + $this->db->free($result); - + return 1; } else @@ -2779,7 +2779,7 @@ class Propal extends CommonObject function availability($availability_id, $notrigger=0) { global $user; - + if ($this->statut >= self::STATUS_DRAFT) { $error=0; @@ -3277,13 +3277,14 @@ class Propal extends CommonObject /** * Return clicable link of object (with eventually picto) * - * @param int $withpicto Add picto into link - * @param string $option Where point the link ('expedition', 'document', ...) - * @param string $get_params Parametres added to url - * @param int $notooltip 1=Disable tooltip - * @return string String with URL + * @param int $withpicto Add picto into link + * @param string $option Where point the link ('expedition', 'document', ...) + * @param string $get_params Parametres added to url + * @param int $notooltip 1=Disable tooltip + * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking + * @return string String with URL */ - function getNomUrl($withpicto=0,$option='', $get_params='', $notooltip=0) + function getNomUrl($withpicto=0, $option='', $get_params='', $notooltip=0, $save_lastsearch_value=-1) { global $langs, $conf, $user; @@ -3318,6 +3319,14 @@ class Propal extends CommonObject if ($option == 'document') { $url = DOL_URL_ROOT.'/comm/propal/document.php?id='.$this->id. $get_params; } + + if ($option != 'nolink') + { + // Add param to save lastsearch_values or not + $add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0); + if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1; + if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1'; + } } $linkclose=''; @@ -3352,9 +3361,9 @@ class Propal extends CommonObject function getLinesArray() { // TODO Duplicate with fetch_lines ? Wich one to keep ? - + $this->lines = array(); - + $sql = 'SELECT pt.rowid, pt.label as custom_label, pt.description, pt.fk_product, pt.fk_remise_except,'; $sql.= ' pt.qty, pt.vat_src_code, pt.tva_tx, pt.remise_percent, pt.subprice, pt.info_bits,'; $sql.= ' pt.total_ht, pt.total_tva, pt.total_ttc, pt.fk_product_fournisseur_price as fk_fournprice, pt.buy_price_ht as pa_ht, pt.special_code, pt.localtax1_tx, pt.localtax2_tx,'; diff --git a/htdocs/comm/propal/contact.php b/htdocs/comm/propal/contact.php index 3e9e5a1205d..01e851769a7 100644 --- a/htdocs/comm/propal/contact.php +++ b/htdocs/comm/propal/contact.php @@ -155,10 +155,10 @@ if ($object->id > 0) // Proposal card - - $linkback = '' . $langs->trans("BackToList") . ''; - - + + $linkback = '' . $langs->trans("BackToList") . ''; + + $morehtmlref='
    '; // Ref customer $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); @@ -199,12 +199,12 @@ if ($object->id > 0) } } $morehtmlref.='
    '; - + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '', 1); dol_fiche_end(); - - + + // Contacts lines (modules that overwrite templates must declare this into descriptor) $dirtpls=array_merge($conf->modules_parts['tpl'],array('/core/tpl')); foreach($dirtpls as $reldir) diff --git a/htdocs/comm/propal/document.php b/htdocs/comm/propal/document.php index 0c68a292109..65b8eef5a66 100644 --- a/htdocs/comm/propal/document.php +++ b/htdocs/comm/propal/document.php @@ -103,7 +103,7 @@ if ($object->id > 0) // Proposal card - $linkback = '' . $langs->trans("BackToList") . ''; + $linkback = '' . $langs->trans("BackToList") . ''; $morehtmlref='
    '; diff --git a/htdocs/comm/propal/info.php b/htdocs/comm/propal/info.php index d8af8fb87a8..a94eeaa092c 100644 --- a/htdocs/comm/propal/info.php +++ b/htdocs/comm/propal/info.php @@ -66,7 +66,7 @@ $object->info($object->id); // Proposal card -$linkback = '' . $langs->trans("BackToList") . ''; +$linkback = '' . $langs->trans("BackToList") . ''; $morehtmlref='
    '; @@ -122,6 +122,6 @@ dol_print_object_info($object); print '
    '; dol_fiche_end(); - + llxFooter(); $db->close(); diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 39ee93fd9cd..e9626a638b8 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -80,9 +80,9 @@ $object_statut=GETPOST('propal_statut'); $sall=GETPOST('sall', 'alphanohtml'); $mesg=(GETPOST("msg") ? GETPOST("msg") : GETPOST("mesg")); -$day=GETPOST("day","int"); -$month=GETPOST("month","int"); -$year=GETPOST("year","int"); +$search_day=GETPOST("search_day","int"); +$search_month=GETPOST("search_month","int"); +$search_year=GETPOST("search_year","int"); $limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; $sortfield = GETPOST("sortfield",'alpha'); @@ -197,9 +197,9 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP $search_type=''; $search_country=''; $search_type_thirdparty=''; - $year=''; - $month=''; - $day=''; + $search_year=''; + $search_month=''; + $search_day=''; $viewstatut=''; $object_statut=''; $toselect=''; @@ -295,18 +295,18 @@ if ($viewstatut != '' && $viewstatut != '-1') { $sql.= ' AND p.fk_statut IN ('.$db->escape($viewstatut).')'; } -if ($month > 0) +if ($search_month > 0) { - if ($year > 0 && empty($day)) - $sql.= " AND p.datep BETWEEN '".$db->idate(dol_get_first_day($year,$month,false))."' AND '".$db->idate(dol_get_last_day($year,$month,false))."'"; - else if ($year > 0 && ! empty($day)) - $sql.= " AND p.datep BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year))."'"; + if ($search_year > 0 && empty($search_day)) + $sql.= " AND p.datep BETWEEN '".$db->idate(dol_get_first_day($search_year,$search_month,false))."' AND '".$db->idate(dol_get_last_day($search_year,$search_month,false))."'"; + else if ($search_year > 0 && ! empty($search_day)) + $sql.= " AND p.datep BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_month, $search_day, $search_year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_month, $search_day, $search_year))."'"; else - $sql.= " AND date_format(p.datep, '%m') = '".$db->escape($month)."'"; + $sql.= " AND date_format(p.datep, '%m') = '".$db->escape($search_month)."'"; } -else if ($year > 0) +else if ($search_year > 0) { - $sql.= " AND p.datep BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'"; + $sql.= " AND p.datep BETWEEN '".$db->idate(dol_get_first_day($search_year,1,false))."' AND '".$db->idate(dol_get_last_day($search_year,12,false))."'"; } if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$db->escape($search_sale); if ($search_user > 0) @@ -369,8 +369,8 @@ if ($resql) if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); if ($sall) $param.='&sall='.urlencode($sall); - if ($month) $param.='&month='.urlencode($month); - if ($year) $param.='&year='.urlencode($year); + if ($search_month) $param.='&search_month='.urlencode($search_month); + if ($search_year) $param.='&search_year='.urlencode($search_year); if ($search_ref) $param.='&search_ref='.urlencode($search_ref); if ($search_refcustomer) $param.='&search_refcustomer='.urlencode($search_refcustomer); if ($search_societe) $param.='&search_societe='.urlencode($search_societe); @@ -613,11 +613,10 @@ if ($resql) { print '
    '; } // Date end @@ -755,7 +754,6 @@ if ($resql) { $obj = $db->fetch_object($resql); - $objectstatic->id=$obj->rowid; $objectstatic->ref=$obj->ref; @@ -768,7 +766,7 @@ if ($resql) print '
    ' . $langs->trans("Account") . '
    ' . $langs->trans("Account") . '' . $langs->trans("Label") . '' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . ''; //print $langs->trans('Month').': '; - if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; - print ''; + if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; + print ''; //print ' '.$langs->trans('Year').': '; - $syear = $year; - $formother->select_year($syear,'year',1, 20, 5); + $formother->select_year($search_year,'search_year',1, 20, 5); print '
    '; // Picto + Ref print ''; // Warning $warnornote=''; diff --git a/htdocs/comm/propal/note.php b/htdocs/comm/propal/note.php index ec1dac31c24..29fc43b0899 100644 --- a/htdocs/comm/propal/note.php +++ b/htdocs/comm/propal/note.php @@ -56,7 +56,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, /* - * View + * View */ llxHeader('',$langs->trans('Proposal'),'EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos'); @@ -79,13 +79,13 @@ if ($id > 0 || ! empty($ref)) $cssclass='titlefield'; //if ($action == 'editnote_public') $cssclass='titlefieldcreate'; //if ($action == 'editnote_private') $cssclass='titlefieldcreate'; - - + + // Proposal card - - $linkback = '' . $langs->trans("BackToList") . ''; - - + + $linkback = '' . $langs->trans("BackToList") . ''; + + $morehtmlref='
    '; // Ref customer $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); @@ -126,17 +126,17 @@ if ($id > 0 || ! empty($ref)) } } $morehtmlref.='
    '; - + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); print '
    '; print '
    '; - + $cssclass="titlefield"; include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; print '
    '; - + dol_fiche_end(); } } diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 826046db3ee..13fe07f78df 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1915,7 +1915,7 @@ if ($action == 'create' && $user->rights->commande->creer) // Order card - $linkback = '' . $langs->trans("BackToList") . ''; + $linkback = '' . $langs->trans("BackToList") . ''; $morehtmlref='
    '; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 93df2f1aa0b..0910fedcb9d 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -706,10 +706,10 @@ class Commande extends CommonOrder // Clean parameters $this->brouillon = 1; // set command as draft - + // $date_commande is deprecated $date = ($this->date_commande ? $this->date_commande : $this->date); - + // Multicurrency (test on $this->multicurrency_tx because we sould take the default rate only if not using origin rate) if (!empty($this->multicurrency_code) && empty($this->multicurrency_tx)) list($this->fk_multicurrency,$this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code, $date); else $this->fk_multicurrency = MultiCurrency::getIdFromCode($this->db, $this->multicurrency_code); @@ -1468,7 +1468,7 @@ class Commande extends CommonOrder $tva_npr = get_default_npr($mysoc,$this->thirdparty,$prod->id); if (empty($tva_tx)) $tva_npr=0; $vat_src_code = ''; // May be defined into tva_tx - + $localtax1_tx=get_localtax($tva_tx,1,$this->thirdparty,$mysoc,$tva_npr); $localtax2_tx=get_localtax($tva_tx,2,$this->thirdparty,$mysoc,$tva_npr); @@ -1798,7 +1798,7 @@ class Commande extends CommonOrder $line->product_type = $objp->product_type; $line->qty = $objp->qty; - $line->vat_src_code = $objp->vat_src_code; + $line->vat_src_code = $objp->vat_src_code; $line->tva_tx = $objp->tva_tx; $line->localtax1_tx = $objp->localtax1_tx; $line->localtax2_tx = $objp->localtax2_tx; @@ -3106,7 +3106,7 @@ class Commande extends CommonOrder $error = 0; dol_syslog(get_class($this) . "::delete ".$this->id, LOG_DEBUG); - + $this->db->begin(); if (! $error && ! $notrigger) @@ -3369,24 +3369,33 @@ class Commande extends CommonOrder /** * Return clicable link of object (with eventually picto) * - * @param int $withpicto Add picto into link - * @param int $option Where point the link (0=> main card, 1,2 => shipment) - * @param int $max Max length to show - * @param int $short ??? - * @param int $notooltip 1=Disable tooltip - * @return string String with URL + * @param int $withpicto Add picto into link + * @param int $option Where point the link (0=> main card, 1,2 => shipment) + * @param int $max Max length to show + * @param int $short ??? + * @param int $notooltip 1=Disable tooltip + * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking + * @return string String with URL */ - function getNomUrl($withpicto=0,$option=0,$max=0,$short=0,$notooltip=0) + function getNomUrl($withpicto=0, $option=0, $max=0, $short=0, $notooltip=0, $save_lastsearch_value=-1) { global $conf, $langs, $user; if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips - + $result=''; if (! empty($conf->expedition->enabled) && ($option == 1 || $option == 2)) $url = DOL_URL_ROOT.'/expedition/shipment.php?id='.$this->id; else $url = DOL_URL_ROOT.'/commande/card.php?id='.$this->id; + if ($option !== 'nolink') + { + // Add param to save lastsearch_values or not + $add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0); + if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1; + if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1'; + } + if ($short) return $url; $picto = 'order'; @@ -3418,7 +3427,7 @@ class Commande extends CommonOrder $linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"'; $linkclose.=' class="classfortooltip"'; } - + $linkstart = ''; $linkend=''; diff --git a/htdocs/commande/contact.php b/htdocs/commande/contact.php index fe37a630c5d..0eb4ed2cd63 100644 --- a/htdocs/commande/contact.php +++ b/htdocs/commande/contact.php @@ -142,16 +142,16 @@ if ($id > 0 || ! empty($ref)) if ($object->fetch($id, $ref) > 0) { $object->fetch_thirdparty(); - + $head = commande_prepare_head($object); dol_fiche_head($head, 'contact', $langs->trans("CustomerOrder"), -1, 'order'); - + // Order card - - $linkback = '' . $langs->trans("BackToList") . ''; - - + + $linkback = '' . $langs->trans("BackToList") . ''; + + $morehtmlref='
    '; // Ref customer $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); @@ -191,7 +191,7 @@ if ($id > 0 || ! empty($ref)) } } } - $morehtmlref.='
    '; + $morehtmlref.='
    '; dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '', 1); diff --git a/htdocs/commande/document.php b/htdocs/commande/document.php index 0996907b245..7eea9c95877 100644 --- a/htdocs/commande/document.php +++ b/htdocs/commande/document.php @@ -101,12 +101,12 @@ if ($id > 0 || ! empty($ref)) { $totalsize+=$file['size']; } - + // Order card - - $linkback = '' . $langs->trans("BackToList") . ''; - - + + $linkback = '' . $langs->trans("BackToList") . ''; + + $morehtmlref='
    '; // Ref customer $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); @@ -147,25 +147,25 @@ if ($id > 0 || ! empty($ref)) } } $morehtmlref.='
    '; - + // Order card - + $linkback = '' . $langs->trans("BackToList") . ''; - - dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); - + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + print '
    '; print '
    '; - + print '
    '; - print $objectstatic->getNomUrl(1); + print $objectstatic->getNomUrl(1, '', '', 0, 1); print '
    '; print ''; print ''; print "
    '.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
    '.$langs->trans("TotalSizeOfAttachedFiles").''.$totalsize.' '.$langs->trans("bytes").'
    \n"; - + print "
\n"; - + print dol_fiche_end(); $modulepart = 'commande'; diff --git a/htdocs/commande/info.php b/htdocs/commande/info.php index 02b631c4c8a..05adc9def54 100644 --- a/htdocs/commande/info.php +++ b/htdocs/commande/info.php @@ -65,7 +65,7 @@ dol_fiche_head($head, 'info', $langs->trans("CustomerOrder"), -1, 'order'); // Order card -$linkback = '' . $langs->trans("BackToList") . ''; +$linkback = '' . $langs->trans("BackToList") . ''; $morehtmlref='
'; // Ref customer diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 73fa9c5b66e..8ce3ba7cd04 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -51,12 +51,12 @@ $show_files=GETPOST('show_files','int'); $confirm=GETPOST('confirm','alpha'); $toselect = GETPOST('toselect', 'array'); -$orderyear=GETPOST("orderyear","int"); -$ordermonth=GETPOST("ordermonth","int"); -$orderday=GETPOST("orderday","int"); -$deliveryyear=GETPOST("deliveryyear","int"); -$deliverymonth=GETPOST("deliverymonth","int"); -$deliveryday=GETPOST("deliveryday","int"); +$search_orderyear=GETPOST("search_orderyear","int"); +$search_ordermonth=GETPOST("search_ordermonth","int"); +$search_orderday=GETPOST("search_orderday","int"); +$search_deliveryyear=GETPOST("search_deliveryyear","int"); +$search_deliverymonth=GETPOST("search_deliverymonth","int"); +$search_deliveryday=GETPOST("search_deliveryday","int"); $search_product_category=GETPOST('search_product_category','int'); $search_ref=GETPOST('search_ref','alpha')!=''?GETPOST('search_ref','alpha'):GETPOST('sref','alpha'); $search_ref_customer=GETPOST('search_ref_customer','alpha'); @@ -180,12 +180,12 @@ if (empty($reshook)) $search_total_ht=''; $search_total_vat=''; $search_total_ttc=''; - $orderyear=''; - $ordermonth=''; - $orderday=''; - $deliveryday=''; - $deliverymonth=''; - $deliveryyear=''; + $search_orderyear=''; + $search_ordermonth=''; + $search_orderday=''; + $search_deliveryday=''; + $search_deliverymonth=''; + $search_deliveryyear=''; $viewstatut=''; $billed=''; $toselect=''; @@ -499,31 +499,31 @@ if ($viewstatut <> '') $sql .= ' AND ((c.fk_statut IN (1,2)) OR (c.fk_statut = 3 AND c.facture = 0))'; // validated, in process or closed but not billed } } -if ($ordermonth > 0) +if ($search_ordermonth > 0) { - if ($orderyear > 0 && empty($orderday)) - $sql.= " AND c.date_commande BETWEEN '".$db->idate(dol_get_first_day($orderyear,$ordermonth,false))."' AND '".$db->idate(dol_get_last_day($orderyear,$ordermonth,false))."'"; - else if ($orderyear > 0 && ! empty($orderday)) - $sql.= " AND c.date_commande BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $ordermonth, $orderday, $orderyear))."' AND '".$db->idate(dol_mktime(23, 59, 59, $ordermonth, $orderday, $orderyear))."'"; + if ($search_orderyear > 0 && empty($search_orderday)) + $sql.= " AND c.date_commande BETWEEN '".$db->idate(dol_get_first_day($search_orderyear,$search_ordermonth,false))."' AND '".$db->idate(dol_get_last_day($search_orderyear,$search_ordermonth,false))."'"; + else if ($search_orderyear > 0 && ! empty($search_orderday)) + $sql.= " AND c.date_commande BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_ordermonth, $search_orderday, $search_orderyear))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_ordermonth, $search_orderday, $search_orderyear))."'"; else - $sql.= " AND date_format(c.date_commande, '%m') = '".$ordermonth."'"; + $sql.= " AND date_format(c.date_commande, '%m') = '".$search_ordermonth."'"; } -else if ($orderyear > 0) +else if ($search_orderyear > 0) { - $sql.= " AND c.date_commande BETWEEN '".$db->idate(dol_get_first_day($orderyear,1,false))."' AND '".$db->idate(dol_get_last_day($orderyear,12,false))."'"; + $sql.= " AND c.date_commande BETWEEN '".$db->idate(dol_get_first_day($search_orderyear,1,false))."' AND '".$db->idate(dol_get_last_day($search_orderyear,12,false))."'"; } -if ($deliverymonth > 0) +if ($search_deliverymonth > 0) { - if ($deliveryyear > 0 && empty($deliveryday)) - $sql.= " AND c.date_livraison BETWEEN '".$db->idate(dol_get_first_day($deliveryyear,$deliverymonth,false))."' AND '".$db->idate(dol_get_last_day($deliveryyear,$deliverymonth,false))."'"; - else if ($deliveryyear > 0 && ! empty($deliveryday)) - $sql.= " AND c.date_livraison BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $deliverymonth, $deliveryday, $deliveryyear))."' AND '".$db->idate(dol_mktime(23, 59, 59, $deliverymonth, $deliveryday, $deliveryyear))."'"; + if ($search_deliveryyear > 0 && empty($search_deliveryday)) + $sql.= " AND c.date_livraison BETWEEN '".$db->idate(dol_get_first_day($search_deliveryyear,$search_deliverymonth,false))."' AND '".$db->idate(dol_get_last_day($search_deliveryyear,$search_deliverymonth,false))."'"; + else if ($search_deliveryyear > 0 && ! empty($search_deliveryday)) + $sql.= " AND c.date_livraison BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_deliverymonth, $search_deliveryday, $search_deliveryyear))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_deliverymonth, $search_deliveryday, $search_deliveryyear))."'"; else - $sql.= " AND date_format(c.date_livraison, '%m') = '".$deliverymonth."'"; + $sql.= " AND date_format(c.date_livraison, '%m') = '".$search_deliverymonth."'"; } -else if ($deliveryyear > 0) +else if ($search_deliveryyear > 0) { - $sql.= " AND c.date_livraison BETWEEN '".$db->idate(dol_get_first_day($deliveryyear,1,false))."' AND '".$db->idate(dol_get_last_day($deliveryyear,12,false))."'"; + $sql.= " AND c.date_livraison BETWEEN '".$db->idate(dol_get_first_day($search_deliveryyear,1,false))."' AND '".$db->idate(dol_get_last_day($search_deliveryyear,12,false))."'"; } if ($search_town) $sql.= natural_search('s.town', $search_town); if ($search_zip) $sql.= natural_search("s.zip",$search_zip); @@ -605,12 +605,12 @@ if ($resql) if ($sall) $param.='&sall='.$sall; if ($socid > 0) $param.='&socid='.$socid; if ($viewstatut != '') $param.='&viewstatut='.$viewstatut; - if ($orderday) $param.='&orderday='.$orderday; - if ($ordermonth) $param.='&ordermonth='.$ordermonth; - if ($orderyear) $param.='&orderyear='.$orderyear; - if ($deliveryday) $param.='&deliveryday='.$deliveryday; - if ($deliverymonth) $param.='&deliverymonth='.$deliverymonth; - if ($deliveryyear) $param.='&deliveryyear='.$deliveryyear; + if ($search_orderday) $param.='&search_orderday='.$search_orderday; + if ($search_ordermonth) $param.='&search_ordermonth='.$search_ordermonth; + if ($search_orderyear) $param.='&search_orderyear='.$search_orderyear; + if ($search_deliveryday) $param.='&search_deliveryday='.$search_deliveryday; + if ($search_deliverymonth) $param.='&search_deliverymonth='.$search_deliverymonth; + if ($search_deliveryyear) $param.='&search_deliveryyear='.$search_deliveryyear; if ($search_ref) $param.='&search_ref='.$search_ref; if ($search_company) $param.='&search_company='.$search_company; if ($search_ref_customer) $param.='&search_ref_customer='.$search_ref_customer; @@ -894,17 +894,17 @@ if ($resql) if (! empty($arrayfields['c.date_commande']['checked'])) { print ''; - if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; - print ''; - $formother->select_year($orderyear?$orderyear:-1,'orderyear',1, 20, 5); + if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; + print ''; + $formother->select_year($search_orderyear?$search_orderyear:-1,'search_orderyear',1, 20, 5); print ''; } if (! empty($arrayfields['c.date_delivery']['checked'])) { print ''; - if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; - print ''; - $formother->select_year($deliveryyear?$deliveryyear:-1,'deliveryyear',1, 20, 5); + if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; + print ''; + $formother->select_year($search_deliveryyear?$search_deliveryyear:-1,'search_deliveryyear',1, 20, 5); print ''; } if (! empty($arrayfields['c.total_ht']['checked'])) @@ -1075,7 +1075,7 @@ if ($resql) print ''; print ''; // Show shippable Icon (create subloop, so may be slow) diff --git a/htdocs/commande/note.php b/htdocs/commande/note.php index 79475c75917..0d42cc69611 100644 --- a/htdocs/commande/note.php +++ b/htdocs/commande/note.php @@ -72,16 +72,16 @@ $form = new Form($db); if ($id > 0 || ! empty($ref)) { $object->fetch_thirdparty(); - + $head = commande_prepare_head($object); - + dol_fiche_head($head, 'note', $langs->trans("CustomerOrder"), -1, 'order'); // Order card - - $linkback = '' . $langs->trans("BackToList") . ''; - - + + $linkback = '' . $langs->trans("BackToList") . ''; + + $morehtmlref='
'; // Ref customer $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); @@ -122,20 +122,20 @@ if ($id > 0 || ! empty($ref)) } } $morehtmlref.='
'; - - + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); - - + + print '
'; print '
'; - - + + $cssclass="titlefield"; include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; print '
'; - + dol_fiche_end(); } diff --git a/htdocs/compta/stats/casoc.php b/htdocs/compta/stats/casoc.php index b9fcf6b7aa3..fdba026ac6f 100644 --- a/htdocs/compta/stats/casoc.php +++ b/htdocs/compta/stats/casoc.php @@ -201,7 +201,7 @@ if ($modecompta == 'CREANCES-DETTES') { $sql = "SELECT DISTINCT s.rowid as socid, s.nom as name, s.zip, s.town, s.fk_pays,"; $sql.= " sum(f.total) as amount, sum(f.total_ttc) as amount_ttc"; $sql.= " FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."societe as s"; - if ($selected_cat === -2) // Without any category + if ($selected_cat === -2) // Without any category { $sql.= " LEFT OUTER JOIN ".MAIN_DB_PREFIX."categorie_societe as cs ON s.rowid = cs.fk_soc"; } @@ -219,7 +219,7 @@ if ($modecompta == 'CREANCES-DETTES') { if ($date_start && $date_end) { $sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'"; } - if ($selected_cat === -2) // Without any category + if ($selected_cat === -2) // Without any category { $sql.=" AND cs.fk_soc is null"; } @@ -239,7 +239,7 @@ if ($modecompta == 'CREANCES-DETTES') { $sql.= ", ".MAIN_DB_PREFIX."paiement_facture as pf"; $sql.= ", ".MAIN_DB_PREFIX."paiement as p"; $sql.= ", ".MAIN_DB_PREFIX."societe as s"; - if ($selected_cat === -2) // Without any category + if ($selected_cat === -2) // Without any category { $sql.= " LEFT OUTER JOIN ".MAIN_DB_PREFIX."categorie_societe as cs ON s.rowid = cs.fk_soc"; } @@ -253,7 +253,7 @@ if ($modecompta == 'CREANCES-DETTES') { if ($date_start && $date_end) { $sql.= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'"; } - if ($selected_cat === -2) // Without any category + if ($selected_cat === -2) // Without any category { $sql.=" AND cs.fk_soc is null"; } @@ -360,7 +360,28 @@ print ''; print ''; - // Array titles + +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; + +// Array titles print ""; print_liste_field_titre( $langs->trans("Company"), @@ -442,27 +463,6 @@ print_liste_field_titre( ); print "\n"; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; - -$var=true; if (count($amount)) { $arrayforsort=$name; @@ -517,7 +517,7 @@ if (count($amount)) { } foreach($arrayforsort as $key=>$value) { - + print ''; // Third party diff --git a/htdocs/loan/card.php b/htdocs/loan/card.php index 557d48be680..29cea1eb019 100644 --- a/htdocs/loan/card.php +++ b/htdocs/loan/card.php @@ -1,6 +1,7 @@ * Copyright (C) 2015 Frederic France + * Copyright (C) 2017 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 @@ -335,7 +336,7 @@ if ($action == 'create') if (! empty($conf->accounting->enabled)) { // Accountancy_account_capital - print ''; + print ''; print ''; @@ -415,7 +416,7 @@ if ($id > 0) print ''; } - dol_fiche_head($head, 'card', $langs->trans("Loan"), 0, 'bill'); + dol_fiche_head($head, 'card', $langs->trans("Loan"), -1, 'bill'); print '
'; - print $generic_commande->getNomUrl(1,($viewstatut != 2?0:$obj->fk_statut)); + print $generic_commande->getNomUrl(1, ($viewstatut != 2?0:$obj->fk_statut), 0, 0, 0, 1); print ''; print ''; print '
'; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print $form->select_country($search_country, 'search_country'); +//print ''; +print '    
'; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print $form->select_country($search_country, 'search_country'); -//print ''; -print '    
'.$langs->trans("LoanAccountancyCapitalCode").'
'.$langs->trans("LoanAccountancyCapitalCode").''; print $formaccounting->select_account($object->accountancy_account_capital, 'accountancy_account_capital', 1, '', 0, 1); print '