From 474a2692fa6f4a4e6cfdfd3927766fa0f418ad19 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 22 Jun 2017 13:54:03 +0200 Subject: [PATCH 1/5] Fix missing /div --- htdocs/core/class/html.formfile.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 44a90794790..6d4d5d38b55 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -690,6 +690,7 @@ class FormFile { $headershown=1; $out.= '
'.$titletoshow.'
'."\n"; + $out.= '
'; $out.= ''."\n"; } From 0fd1308f93f56a0589e5db4b47154a4075a4a5d7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 22 Jun 2017 14:06:48 +0200 Subject: [PATCH 2/5] Add force_disable_of_modules_not_found to clean database and removed false warning when modules files were removed with disabling it before --- htdocs/install/repair.php | 99 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 96 insertions(+), 3 deletions(-) diff --git a/htdocs/install/repair.php b/htdocs/install/repair.php index bab7b5e5da4..895d36d72f1 100644 --- a/htdocs/install/repair.php +++ b/htdocs/install/repair.php @@ -62,12 +62,10 @@ if (! is_object($conf)) dolibarr_install_syslog("repair: conf file not initializ /* * View -*/ + */ pHeader('',"upgrade2",GETPOST('action','aZ09')); -$actiondone=0; - // Action to launch the repair script $actiondone=1; @@ -79,6 +77,7 @@ print 'Option clean_orphelin_dir (0 or \'test\' or \'confirmed\') is '.(GETPOST( print 'Option clean_product_stock_batch (0 or \'test\' or \'confirmed\') is '.(GETPOST('clean_product_stock_batch','alpha')?GETPOST('clean_product_stock_batch','alpha'):'0').'
'."\n"; print 'Option set_empty_time_spent_amount (0 or \'test\' or \'confirmed\') is '.(GETPOST('set_empty_time_spent_amount','alpha')?GETPOST('set_empty_time_spent_amount','alpha'):'0').'
'."\n"; print 'Option rebuild_product_thumbs (0 or \'test\' or \'confirmed\') is '.(GETPOST('rebuild_product_thumbs','alpha')?GETPOST('rebuild_product_thumbs','alpha'):'0').'
'."\n"; +print 'Option force_disable_of_modules_not_found (0 or \'test\' or \'confirmed\') is '.(GETPOST('force_disable_of_modules_not_found','alpha')?GETPOST('force_disable_of_modules_not_found','alpha'):'0').'
'."\n"; print '
'; print '
'; @@ -316,6 +315,7 @@ if ($ok) + /* From here, actions need a parameter */ @@ -795,6 +795,99 @@ if ($ok && GETPOST('set_empty_time_spent_amount','alpha')) } +// clean_old_module_entries: Clean data into const when files of module were removed without being +// clean_linked_elements: Check and clean linked elements +if ($ok && GETPOST('force_disable_of_modules_not_found','alpha')) +{ + print ''; + + $sql ="SELECT DISTINCT name"; + $sql.=" FROM ".MAIN_DB_PREFIX."const as c"; + $sql.=" WHERE name LIKE 'MAIN_MODULE_%_HOOKS'"; + $sql.=" ORDER BY name"; + + $resql = $db->query($sql); + if ($resql) + { + $num = $db->num_rows($resql); + if ($num) + { + $i = 0; + while ($i < $num) + { + $obj=$db->fetch_object($resql); + $majname = $obj->name; + + print ''; + + if ($error) break; + + $i++; + } + } + else + { + print ''; + } + } + else + { + dol_print_error($db); + } + +} + + print '

*** Force modules not found to be disabled
'; + print $majname; + + $db->begin(); + + if (preg_match('/MAIN_MODULE_(.*)_HOOKS/i', $majname, $reg)) + { + $name=strtolower($reg[1]); + + if ($name) + { + $reloffile=$name.'/class/actions_'.$name.'.class.php'; + $result = dol_include_once($reloffile); + if (! $result) + { + print ' - File of hooks ('.$reloffile.') NOT found, we disable the module.'; + if (GETPOST('force_disable_of_modules_not_found') == 'confirmed') + { + $sql2 ="DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = 'MAIN_MODULE_".strtoupper($name)."_HOOKS'"; + $resql2=$db->query($sql2); + if (! $resql2) + { + $error++; + dol_print_error($db); + } + $sql2 ="DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = 'MAIN_MODULE_".strtoupper($name)."'"; + $resql2=$db->query($sql2); + if (! $resql2) + { + $error++; + dol_print_error($db); + } + else + print " - Cleaned"; + } + else + { + print ' - Canceled (test mode)'; + } + } + else + { + print ' - File of hooks ('.$reloffile.') found, we do nothing.'; + } + } + + if (!$error) $db->commit(); + else $db->rollback(); + } + + print'
No active module with missing files found
'; From 1b96bb422128867644618cefcf0c30f55a0f5307 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 22 Jun 2017 14:48:13 +0200 Subject: [PATCH 3/5] Fix usage of constant. No need to have a dedicated setup as it should be supported by the responsive design architecture. --- htdocs/accountancy/admin/index.php | 24 ++--- htdocs/accountancy/admin/productaccount.php | 100 +++++++++--------- htdocs/accountancy/customer/lines.php | 12 +-- htdocs/accountancy/customer/list.php | 12 +-- htdocs/accountancy/expensereport/lines.php | 34 +++--- htdocs/accountancy/expensereport/list.php | 22 ++-- htdocs/accountancy/supplier/lines.php | 64 +++++------ htdocs/accountancy/supplier/list.php | 16 +-- .../core/class/html.formaccounting.class.php | 2 +- 9 files changed, 143 insertions(+), 143 deletions(-) diff --git a/htdocs/accountancy/admin/index.php b/htdocs/accountancy/admin/index.php index 2d6ee046bbc..ead997a5d8c 100644 --- a/htdocs/accountancy/admin/index.php +++ b/htdocs/accountancy/admin/index.php @@ -51,8 +51,8 @@ $action = GETPOST('action', 'alpha'); $list = array ( 'ACCOUNTING_LENGTH_GACCOUNT', 'ACCOUNTING_LENGTH_AACCOUNT' , - 'ACCOUNTING_LENGTH_DESCRIPTION', // adjust size displayed for lines description for dol_trunc - 'ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT', // adjust size displayed for select account description for dol_trunc +// 'ACCOUNTING_LENGTH_DESCRIPTION', // adjust size displayed for lines description for dol_trunc +// 'ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT', // adjust size displayed for select account description for dol_trunc ); @@ -65,28 +65,28 @@ $accounting_mode = defined('ACCOUNTING_MODE') ? ACCOUNTING_MODE : 'RECETTES-DEPE if ($action == 'update') { $error = 0; - + $accounting_modes = array ( 'RECETTES-DEPENSES', - 'CREANCES-DETTES' + 'CREANCES-DETTES' ); - + $accounting_mode = GETPOST('accounting_mode', 'alpha'); - + if (in_array($accounting_mode, $accounting_modes)) { - + if (! dolibarr_set_const($db, 'ACCOUNTING_MODE', $accounting_mode, 'chaine', 0, '', $conf->entity)) { $error ++; } } else { $error ++; } - + if ($error) { setEventMessages($langs->trans("Error"), null, 'errors'); } - foreach ($list as $constname) + foreach ($list as $constname) { $constvalue = GETPOST($constname, 'alpha'); @@ -267,10 +267,10 @@ if (! empty($user->admin)) // Param a user $user->rights->accountancy->chartofaccount can access -foreach ($list as $key) +foreach ($list as $key) { print ''; - + if (! empty($conf->global->ACCOUNTING_MANAGE_ZERO) && ($key == 'ACCOUNTING_LENGTH_GACCOUNT' || $key == 'ACCOUNTING_LENGTH_AACCOUNT')) continue; // Param @@ -280,7 +280,7 @@ foreach ($list as $key) print ''; print ''; print ''; - + print ''; } diff --git a/htdocs/accountancy/admin/productaccount.php b/htdocs/accountancy/admin/productaccount.php index 5b614061dbc..311aab692ff 100644 --- a/htdocs/accountancy/admin/productaccount.php +++ b/htdocs/accountancy/admin/productaccount.php @@ -111,16 +111,16 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP if ($action == 'update') { if (! empty($btn_changetype)) { $error = 0; - + $accounting_product_modes = array ( 'ACCOUNTANCY_SELL', - 'ACCOUNTANCY_BUY' + 'ACCOUNTANCY_BUY' ); - + $accounting_product_mode = GETPOST('accounting_product_mode', 'alpha'); - + if (in_array($accounting_product_mode, $accounting_product_modes)) { - + if (! dolibarr_set_const($db, 'ACCOUNTING_PRODUCT_MODE', $accounting_product_mode, 'chaine', 0, '', $conf->entity)) { $error ++; } @@ -128,26 +128,26 @@ if ($action == 'update') { $error ++; } } - + if (! empty($btn_changeaccount)) { //$msg = '
' . $langs->trans("Processing") . '...
'; if (! empty($chk_prod)) { - + $accounting = new AccountingAccount($db); - + //$msg .= '
' . count($chk_prod) . ' ' . $langs->trans("SelectedLines") . '
'; - + $cpt = 0; $ok = 0; $ko = 0; foreach ( $chk_prod as $productid ) { - + $accounting_account_id = GETPOST('codeventil_' . $productid); - + $result = $accounting->fetch($accounting_account_id, null, 1); if ($result < 0) { // setEventMessages(null, $accounting->errors, 'errors'); $msg .= '
' . $langs->trans("ErrorDB") . ' : ' . $langs->trans("Product") . ' ' . $productid . ' ' . $langs->trans("NotVentilatedinAccount") . ' : id=' . $accounting_account_id . '
' . $sql . '
'; } else { - + $sql = " UPDATE " . MAIN_DB_PREFIX . "product"; if ($accounting_product_mode == 'ACCOUNTANCY_BUY') { $sql .= " SET accountancy_code_buy = " . $accounting->account_number; @@ -156,7 +156,7 @@ if ($action == 'update') { $sql .= " SET accountancy_code_sell = " . $accounting->account_number; } $sql .= " WHERE rowid = " . $productid; - + dol_syslog("/accountancy/admin/productaccount.php sql=" . $sql, LOG_DEBUG); if ($db->query($sql)) { $ok++; @@ -166,7 +166,7 @@ if ($action == 'update') { //$msg .= '
' . $langs->trans("ErrorDB") . ' : ' . $langs->trans("Product") . ' ' . $productid . ' ' . $langs->trans("NotVentilatedinAccount") . ' : ' . length_accountg($accounting->account_number) . '
' . $sql . '
'; } } - + $cpt ++; } } else { @@ -258,11 +258,11 @@ $sql .= $db->plimit($limit + 1, $offset); dol_syslog("/accountancy/admin/productaccount.php:: sql=" . $sql, LOG_DEBUG); $result = $db->query($sql); -if ($result) +if ($result) { $num = $db->num_rows($result); $i = 0; - + $param=''; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; @@ -271,7 +271,7 @@ if ($result) if ($search_desc > 0) $param.="&search_desc=".urlencode($search_desc); if ($search_current_account > 0) $param.="&search_current_account=".urlencode($search_current_account); if ($search_current_account_valid && $search_current_account_valid != '-1') $param.="&search_current_account_valid=".urlencode($search_current_account_valid); - + print '
'; if ($optioncss != '') print ''; print ''; @@ -280,14 +280,14 @@ if ($result) print ''; print ''; print ''; - + print load_fiche_titre($langs->trans("ProductsBinding"), '', 'title_accountancy'); print '
'; - + print $langs->trans("InitAccountancyDesc") . '
'; print '
'; - - // Select mode + + // Select mode print ''; print ''; print ''; @@ -298,20 +298,20 @@ if ($result) print ''; print '\n"; print "
' . $langs->trans('Options') . '' . $langs->trans('Description') . '
' . $langs->trans('OptionModeProductBuy') . ''.$langs->trans('OptionModeProductBuyDesc')."
\n"; - + print '
'; - + print "
\n"; - + // Filter on categories $moreforfilter=''; $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields - + $texte=$langs->trans("ListOfProductsServices"); print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, '', 0, '', '', $limit); - + print ''; print ''; @@ -334,7 +334,7 @@ if ($result) print $searchpicto; print ''; print ''; - + print ''; print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder); @@ -350,9 +350,9 @@ if ($result) $clickpitco=$form->showCheckAddButtons('checkforselect', 1); print_liste_field_titre($clickpitco, '', '', '', '', 'align="center"'); print ''; - + $product_static = new Product($db); - + $var = true; $i=0; while ($i < min($num,$limit)) @@ -367,7 +367,7 @@ if ($result) $product_static->description = $obj->description; $product_static->status = $obj->tosell; $product_static->status_buy = $obj->tobuy; - + if ($obj->product_type == 0) { $compta_prodsell = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef")); $compta_prodsell_id = $aarowid_prodsell; @@ -375,7 +375,7 @@ if ($result) $compta_prodsell = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef")); $compta_prodsell_id = $aarowid_servsell; } - + if ($obj->product_type == 0) { $compta_prodbuy = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef")); $compta_prodbuy_id = $aarowid_prodbuy; @@ -383,41 +383,41 @@ if ($result) $compta_prodbuy = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef")); $compta_prodbuy_id = $aarowid_servbuy; } - + print ''; - + print ''; - + print ''; - - if (! empty($conf->global->ACCOUNTANCY_SHOW_PROD_DESC)) + + if (! empty($conf->global->ACCOUNTANCY_SHOW_PROD_DESC)) { // TODO ADJUST DESCRIPTION SIZE // print ''; // TODO: we shoul set a user defined value to adjust user square / wide screen size - $trunclengh = defined('ACCOUNTING_LENGTH_DESCRIPTION') ? ACCOUNTING_LENGTH_DESCRIPTION : 64; + $trunclengh = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION; print ''; } - + print ''; - + print ''; - + // Current accounting account print ''; - + // Dedicated account $defaultvalue=''; if ($accounting_product_mode == 'ACCOUNTANCY_BUY') { @@ -440,7 +440,7 @@ if ($result) print $form->select_account($defaultvalue, 'codeventil_' . $product_static->id, 1, array(), 1); print ''; } - + // Checkbox select print ''; @@ -448,7 +448,7 @@ if ($result) $i ++; } print '
'; print $product_static->getNomUrl(1); print ''.$obj->label.'' . $obj->description . '' . nl2br(dol_trunc($obj->description, $trunclengh)) . ''.$product_static->getLibStatut(3, 0).''.$product_static->getLibStatut(3, 1).''; if ($accounting_product_mode == 'ACCOUNTANCY_BUY') { print length_accountg($obj->accountancy_code_buy); - if ($obj->accountancy_code_buy && empty($obj->aaid)) print ' '.img_warning($langs->trans("ValueNotIntoChartOfAccount")); + if ($obj->accountancy_code_buy && empty($obj->aaid)) print ' '.img_warning($langs->trans("ValueNotIntoChartOfAccount")); } else { print length_accountg($obj->accountancy_code_sell); - if ($obj->accountancy_code_sell && empty($obj->aaid)) print ' '.img_warning($langs->trans("ValueNotIntoChartOfAccount")); + if ($obj->accountancy_code_sell && empty($obj->aaid)) print ' '.img_warning($langs->trans("ValueNotIntoChartOfAccount")); } print ''; print '
'; - + // Example : Adding jquery code print ''; - - + + print '
'; - + print '
'; - + $db->free($result); } else { dol_print_error($db); diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index b5778ce86f2..d6d006c6556 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -121,7 +121,7 @@ if (is_array($changeaccount) && count($changeaccount) > 0) { $db->rollback(); setEventMessages($db->lasterror(), null, 'errors'); } - + $account_parent = ''; // Protection to avoid to mass apply it a second time } @@ -240,7 +240,7 @@ if ($result) { if ($search_tvaintra) $param .= "&search_tvaintra=" . $search_tvaintra; - + print '
' . "\n"; print ''; if ($optioncss != '') print ''; @@ -249,7 +249,7 @@ if ($result) { print ''; print ''; print ''; - + print_barre_liste($langs->trans("InvoiceLinesDone"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit); print $langs->trans("DescVentilDoneCustomer") . '
'; @@ -317,7 +317,7 @@ if ($result) { print '' . $facture_static->getNomUrl(1) . ''; print '' . dol_print_date($db->jdate($objp->datef), 'day') . ''; - + // Ref Product print ''; if ($product_static->id) @@ -327,7 +327,7 @@ if ($result) { print ''; $text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->description)); - $trunclength = defined('ACCOUNTING_LENGTH_DESCRIPTION') ? ACCOUNTING_LENGTH_DESCRIPTION : 32; + $trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION; print $form->textwithtooltip(dol_trunc($text,$trunclength), $objp->description); print ''; @@ -355,7 +355,7 @@ if ($result) { if ($nbtotalofrecords > $limit) { print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num_lines, $nbtotalofrecords, '', 0, '', '', $limit, 1); } - + print '
'; } else { print $db->lasterror(); diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index 85a97fb3a1e..75c1a59aa30 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -144,10 +144,10 @@ if ($massaction == 'ventil') { $sql = " UPDATE " . MAIN_DB_PREFIX . "facturedet"; $sql .= " SET fk_code_ventilation = " . $monCompte; $sql .= " WHERE rowid = " . $monId; - + $accountventilated = new AccountingAccount($db); $accountventilated->fetch($monCompte, ''); - + dol_syslog("/accountancy/customer/list.php sql=" . $sql, LOG_DEBUG); if ($db->query($sql)) { $msg.= '
' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' - ' . $langs->trans("VentilatedinAccount") . ' : ' . length_accountg($accountventilated->account_number) . '
'; @@ -157,7 +157,7 @@ if ($massaction == 'ventil') { $ko++; } } - + $cpt++; } $msg.='
'; @@ -375,10 +375,10 @@ if ($result) { print ''; $text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->description)); - $trunclength = defined('ACCOUNTING_LENGTH_DESCRIPTION') ? ACCOUNTING_LENGTH_DESCRIPTION : 32; + $trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION; print $form->textwithtooltip(dol_trunc($text,$trunclength), $objp->description); print ''; - + print ''; print price($objp->total_ht); print ''; @@ -404,7 +404,7 @@ if ($result) { print ''; print $formaccounting->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'maxwidth300 maxwidthonsmartphone', 'cachewithshowemptyone'); print ''; - + print ''; print 'aarowid ? "checked" : "") . '/>'; print ''; diff --git a/htdocs/accountancy/expensereport/lines.php b/htdocs/accountancy/expensereport/lines.php index 5a386c82522..2237f578069 100644 --- a/htdocs/accountancy/expensereport/lines.php +++ b/htdocs/accountancy/expensereport/lines.php @@ -1,10 +1,10 @@ * Copyright (C) 2013-2017 Alexandre Spangaro - * Copyright (C) 2014-2015 Ari Elbaz (elarifr) + * Copyright (C) 2014-2015 Ari Elbaz (elarifr) * Copyright (C) 2013-2016 Florian Henry * Copyright (C) 2014 Juanjo Menent - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or @@ -94,13 +94,13 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP if (is_array($changeaccount) && count($changeaccount) > 0) { $error = 0; - + $db->begin(); - + $sql1 = "UPDATE " . MAIN_DB_PREFIX . "expensereport_det as erd"; $sql1 .= " SET erd.fk_code_ventilation=" . GETPOST('account_parent'); $sql1 .= ' WHERE erd.rowid IN (' . implode(',', $changeaccount) . ')'; - + dol_syslog('accountancy/expensereport/lines.php::changeaccount sql= ' . $sql1); $resql1 = $db->query($sql1); if (! $resql1) { @@ -193,7 +193,7 @@ $result = $db->query($sql); if ($result) { $num_lines = $db->num_rows($result); $i = 0; - + $param=''; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; @@ -210,8 +210,8 @@ if ($result) { if ($search_country) $param .= "&search_country=" . $search_country; if ($search_tvaintra) - $param .= "&search_tvaintra=" . $search_tvaintra; - + $param .= "&search_tvaintra=" . $search_tvaintra; + print '
' . "\n"; print ''; if ($optioncss != '') print ''; @@ -220,7 +220,7 @@ if ($result) { print ''; print ''; print ''; - + print_barre_liste($langs->trans("ExpenseReportLinesDone"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit); print $langs->trans("DescVentilDoneExpenseReport") . '
'; @@ -273,7 +273,7 @@ if ($result) { $expensereport_static->ref = $objp->ref; $expensereport_static->id = $objp->erid; - + print ''; print '' . $objp->rowid . ''; @@ -282,12 +282,12 @@ if ($result) { print '' . $expensereport_static->getNomUrl(1) . ''; print '' . dol_print_date($db->jdate($objp->date), 'day') . ''; - + print '' . ($langs->trans($objp->type_fees_code) == $objp->type_fees_code ? $objp->type_fees_label : $langs->trans(($objp->type_fees_code))) . ''; print ''; $text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->comments)); - $trunclength = defined('ACCOUNTING_LENGTH_DESCRIPTION') ? ACCOUNTING_LENGTH_DESCRIPTION : 32; + $trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION; print $form->textwithtooltip(dol_trunc($text,$trunclength), $objp->comments); print ''; @@ -300,20 +300,20 @@ if ($result) { print ''; print img_edit(); print ''; - + print ''; - + print ""; $i ++; } - + print ""; print ""; - + if ($nbtotalofrecords > $limit) { print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num_lines, $nbtotalofrecords, '', 0, '', '', $limit, 1); } - + print '
'; } else { print $db->error(); diff --git a/htdocs/accountancy/expensereport/list.php b/htdocs/accountancy/expensereport/list.php index 7fb5f26b28b..8e7b9c60c92 100644 --- a/htdocs/accountancy/expensereport/list.php +++ b/htdocs/accountancy/expensereport/list.php @@ -139,10 +139,10 @@ if ($massaction == 'ventil') { $sql = " UPDATE " . MAIN_DB_PREFIX . "expensereport_det"; $sql .= " SET fk_code_ventilation = " . $monCompte; $sql .= " WHERE rowid = " . $monId; - + $accountventilated = new AccountingAccount($db); $accountventilated->fetch($monCompte, ''); - + dol_syslog('accountancy/expensereport/list.php:: sql=' . $sql, LOG_DEBUG); if ($db->query($sql)) { $msg.= '
' . $langs->trans("LineOfExpenseReport") . ' ' . $monId . ' - ' . $langs->trans("VentilatedinAccount") . ' : ' . length_accountg($accountventilated->account_number) . '
'; @@ -152,7 +152,7 @@ if ($massaction == 'ventil') { $ko++; } } - + $cpt++; } $msg.=''; @@ -224,7 +224,7 @@ if ($result) { $i = 0; $arrayofselected=is_array($toselect)?$toselect:array(); - + $param=''; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; @@ -237,8 +237,8 @@ if ($result) { //if ($user->rights->mymodule->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete"); //if ($massaction == 'presend') $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('ventil', $arrayofmassactions, 1); - - + + print '
' . "\n"; print ''; if ($optioncss != '') print ''; @@ -247,7 +247,7 @@ if ($result) { print ''; print ''; print ''; - + print_barre_liste($langs->trans("ExpenseReportLines"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit); print $langs->trans("DescVentilTodoExpenseReport") . '

'; @@ -290,8 +290,8 @@ if ($result) { if ($massactionbutton) $checkpicto=$form->showCheckAddButtons('checkforselect', 1); print_liste_field_titre($checkpicto, '', '', '', '', 'align="center"'); print "\n"; - - + + $expensereport_static = new ExpenseReport($db); $form = new Form($db); @@ -323,7 +323,7 @@ if ($result) { // Fees description -- Can be null print ''; $text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->comments)); - $trunclength = defined('ACCOUNTING_LENGTH_DESCRIPTION') ? ACCOUNTING_LENGTH_DESCRIPTION : 32; + $trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION; print $form->textwithtooltip(dol_trunc($text,$trunclength), $objp->comments); print ''; @@ -356,7 +356,7 @@ if ($result) { print ''; print ""; - + print '
'; } else { print $db->error(); diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index dc6b5e7ec20..9c7a72cb94c 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -1,10 +1,10 @@ * Copyright (C) 2013-2017 Alexandre Spangaro - * Copyright (C) 2014-2015 Ari Elbaz (elarifr) + * Copyright (C) 2014-2015 Ari Elbaz (elarifr) * Copyright (C) 2013-2016 Florian Henry * Copyright (C) 2014 Juanjo Menent - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or @@ -98,13 +98,13 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP if (is_array($changeaccount) && count($changeaccount) > 0) { $error = 0; - + $db->begin(); - + $sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det as l"; $sql1 .= " SET l.fk_code_ventilation=" . GETPOST('account_parent'); $sql1 .= ' WHERE l.rowid IN (' . implode(',', $changeaccount) . ')'; - + dol_syslog('accountancy/supplier/lines.php::changeaccount sql= ' . $sql1); $resql1 = $db->query($sql1); if (! $resql1) { @@ -202,7 +202,7 @@ $result = $db->query($sql); if ($result) { $num_lines = $db->num_rows($result); $i = 0; - + $param=''; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; @@ -221,8 +221,8 @@ if ($result) { if ($search_country) $param .= "&search_country=" . $search_country; if ($search_tvaintra) - $param .= "&search_tvaintra=" . $search_tvaintra; - + $param .= "&search_tvaintra=" . $search_tvaintra; + print '
' . "\n"; print ''; if ($optioncss != '') print ''; @@ -231,20 +231,20 @@ if ($result) { print ''; print ''; print ''; - + print_barre_liste($langs->trans("InvoiceLinesDone"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit); - + print $langs->trans("DescVentilDoneSupplier") . '
'; - + print '
' . $langs->trans("ChangeAccount") . '
'; print $formaccounting->select_account(GETPOST('account_parent'), 'account_parent', 1); print '
'; - + $moreforfilter = ''; - + print '
'; print ''."\n"; - + print ''; print ''; print ''; @@ -261,7 +261,7 @@ if ($result) { print $searchpicto; print ''; print "\n"; - + print ''; print_liste_field_titre($langs->trans("LineId"), $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Invoice"), $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder); @@ -276,68 +276,68 @@ if ($result) { $checkpicto=$form->showCheckAddButtons(); print_liste_field_titre($checkpicto, '', '', '', '', 'align="center"'); print "\n"; - + $facturefournisseur_static = new FactureFournisseur($db); $product_static = new Product($db); - + while ($i < min($num_lines, $limit)) { $objp = $db->fetch_object($result); $codecompta = length_accountg($objp->account_number) . ' - ' . $objp->label; - + $facturefournisseur_static->ref = $objp->facnumber; $facturefournisseur_static->id = $objp->facid; - + $product_static->ref = $objp->product_ref; $product_static->id = $objp->product_id; $product_static->type = $objp->type; $product_static->label = $objp->product_label; - + print ''; - + print ''; - + // Ref Invoice print ''; - + print ''; - + print ''; - + // Ref Product print ''; - + print ''; - + print ''; print ''; print ''; - + print ''; - + print ""; $i ++; } print "
' . $objp->rowid . '' . $facturefournisseur_static->getNomUrl(1) . ''; print $objp->invoice_label; print '' . dol_print_date($db->jdate($objp->datef), 'day') . ''; if ($product_static->id) print $product_static->getNomUrl(1); if ($objp->product_label) print '
'.$objp->product_label; print '
'; $text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->description)); - $trunclength = defined('ACCOUNTING_LENGTH_DESCRIPTION') ? ACCOUNTING_LENGTH_DESCRIPTION : 32; + $trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION; print $form->textwithtooltip(dol_trunc($text,$trunclength), $objp->description); print '' . price($objp->total_ht) . '' . price($objp->tva_tx) . ''; print $codecompta . ' '; print img_edit(); print '
"; print "
"; - + if ($nbtotalofrecords > $limit) { print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num_lines, $nbtotalofrecords, '', 0, '', '', $limit, 1); } - + print '
'; } else { print $db->error(); diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index 93aeb1746f5..ff39aad67f4 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -104,7 +104,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP { $search_lineid = ''; $search_ref = ''; - $search_invoice = ''; + $search_invoice = ''; $search_label = ''; $search_desc = ''; $search_amount = ''; @@ -146,10 +146,10 @@ if ($massaction == 'ventil') { $sql = " UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det"; $sql .= " SET fk_code_ventilation = " . $monCompte; $sql .= " WHERE rowid = " . $monId; - + $accountventilated = new AccountingAccount($db); $accountventilated->fetch($monCompte, ''); - + dol_syslog('accountancy/supplier/list.php:: sql=' . $sql, LOG_DEBUG); if ($db->query($sql)) { $msg.= '
' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' - ' . $langs->trans("VentilatedinAccount") . ' : ' . length_accountg($accountventilated->account_number) . '
'; @@ -159,7 +159,7 @@ if ($massaction == 'ventil') { $ko++; } } - + $cpt++; } $msg.=''; @@ -332,7 +332,7 @@ if ($result) { $facturefourn_static->ref = $objp->ref; $facturefourn_static->id = $objp->facid; $facturefourn_static->type = $objp->type; - + $code_buy_p_notset = ''; $objp->aarowid_suggest = $objp->aarowid; @@ -356,7 +356,7 @@ if ($result) { // $objp->code_buy_p is now code of product/service // $objp->code_buy_l is now default code of product/service - + print ''; // Line id @@ -381,7 +381,7 @@ if ($result) { // Description print ''; $text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->description)); - $trunclength = defined('ACCOUNTING_LENGTH_DESCRIPTION') ? ACCOUNTING_LENGTH_DESCRIPTION : 32; + $trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION; print $form->textwithtooltip(dol_trunc($text,$trunclength), $objp->description); print ''; @@ -422,7 +422,7 @@ if ($result) { print ''; print ""; - + print ''; } else { print $db->error(); diff --git a/htdocs/core/class/html.formaccounting.class.php b/htdocs/core/class/html.formaccounting.class.php index 8a348dba57a..e3e6e9a4f20 100644 --- a/htdocs/core/class/html.formaccounting.class.php +++ b/htdocs/core/class/html.formaccounting.class.php @@ -266,7 +266,7 @@ class FormAccounting extends Form } else { - $trunclength = defined('ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT') ? $conf->global->ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT : 50; + $trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT) ? 50 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT; $sql = "SELECT DISTINCT aa.account_number, aa.label, aa.rowid, aa.fk_pcg_version"; $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa"; From 5ed8340d0e5ebfc6655298daf13e73e5dd685cf1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 22 Jun 2017 15:22:44 +0200 Subject: [PATCH 4/5] Fix no record found into lists --- htdocs/expensereport/list.php | 5 ++++- htdocs/holiday/list.php | 13 +++++++------ htdocs/modulebuilder/template/myobject_list.php | 9 +++++++++ 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index d2c5db3426d..34f1cfebf38 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -684,7 +684,10 @@ if ($resql) } else { - print ''.''.$langs->trans("NoRecordFound").''; + $colspan=1; + foreach($arrayfields as $key => $val) { if (! empty($val['checked'])) $colspan++; } + + print ''.''.$langs->trans("NoRecordFound").''; } // Show total line diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index 2b917927067..925a210cb00 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -194,7 +194,7 @@ if (!empty($sall)) if (empty($user->rights->holiday->read_all)) $filter.=' AND cp.fk_user IN ('.join(',',$childids).')'; -if ($type) $filter.=' AND cp.fk_type IN ('.$type.')'; +if ($type > 0) $filter.=' AND cp.fk_type IN ('.$db->escape($type).')'; // Récupération de l'ID de l'utilisateur $user_id = $user->id; @@ -206,17 +206,18 @@ if ($id > 0) $fuser->getrights(); $user_id = $fuser->id; } + // Récupération des congés payés de l'utilisateur ou de tous les users if (empty($user->rights->holiday->read_all) || $id > 0) { - $holiday_payes = $holiday->fetchByUser($user_id,$order,$filter); // Load array $holiday->holiday + $result = $holiday->fetchByUser($user_id,$order,$filter); // Load array $holiday->holiday } else { - $holiday_payes = $holiday->fetchAll($order,$filter); // Load array $holiday->holiday + $result = $holiday->fetchAll($order,$filter); // Load array $holiday->holiday } // Si erreur SQL -if ($holiday_payes == '-1') +if ($result == '-1') { print load_fiche_titre($langs->trans('CPTitreMenu'), '', 'title_hrm.png'); @@ -446,9 +447,9 @@ if (! empty($holiday->holiday)) } // Si il n'y a pas d'enregistrement suite à une recherche -if($holiday_payes == '2') +if ($result == '2') { - print ''; + print ''; print ''.$langs->trans('NoRecordFound').''; print ''; } diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index ef3cb110224..57958bb25b8 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -535,6 +535,15 @@ if (isset($totalarray['totalhtfield'])) print ''; } +// If no record found +if ($num == 0) +{ + $colspan=1; + foreach($arrayfields as $key => $val) { if (! empty($val['checked'])) $colspan++; } + print ''.$langs->trans("NoRecordFound").''; +} + + $db->free($resql); $parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql); From c89e2eb7ea8a34b9fc9b4fcc12c6c62174c2ffaf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 22 Jun 2017 15:31:07 +0200 Subject: [PATCH 5/5] Fix pagination --- htdocs/holiday/list.php | 49 ++++++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index 925a210cb00..5706307a16c 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -233,6 +233,20 @@ $num = count($holiday->holiday); $form = new Form($db); $formother = new FormOther($db); +$param=''; +if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; +if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; +if ($optioncss != '') $param.='&optioncss='.$optioncss; + +print '
'."\n"; +if ($optioncss != '') print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +if ($id > 0) print ''; + if ($id > 0) { $title = $langs->trans("User"); @@ -243,11 +257,9 @@ if ($id > 0) dol_banner_tab($fuser,'id',$linkback,$user->rights->user->user->lire || $user->admin); - print '
'; print '
'; - } else { @@ -274,17 +286,7 @@ print $out; dol_fiche_end(); -if ($id > 0) print '
'; - - -print ''."\n"; -if ($optioncss != '') print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -if ($id > 0) print ''; +if ($id > 0) print '
'; if ($sall) { @@ -382,16 +384,16 @@ print ''; print "\n"; print ''; -print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"cp.rowid","",'','',$sortfield,$sortorder); -print_liste_field_titre($langs->trans("DateCreateCP"),$_SERVER["PHP_SELF"],"cp.date_create","",'','align="center"',$sortfield,$sortorder); -print_liste_field_titre($langs->trans("Employee"),$_SERVER["PHP_SELF"],"cp.fk_user","",'','',$sortfield,$sortorder); -print_liste_field_titre($langs->trans("ValidatorCP"),$_SERVER["PHP_SELF"],"cp.fk_validator","",'','',$sortfield,$sortorder); -print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],'','','','',$sortfield,$sortorder); -print_liste_field_titre($langs->trans("Duration"),$_SERVER["PHP_SELF"],'','','','align="right"',$sortfield,$sortorder); -print_liste_field_titre($langs->trans("DateDebCP"),$_SERVER["PHP_SELF"],"cp.date_debut","",'','align="center"',$sortfield,$sortorder); -print_liste_field_titre($langs->trans("DateFinCP"),$_SERVER["PHP_SELF"],"cp.date_fin","",'','align="center"',$sortfield,$sortorder); -print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"cp.statut","",'','align="right"',$sortfield,$sortorder); -print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch '); +print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"cp.rowid","",$param,'',$sortfield,$sortorder); +print_liste_field_titre($langs->trans("DateCreateCP"),$_SERVER["PHP_SELF"],"cp.date_create","",$param,'align="center"',$sortfield,$sortorder); +print_liste_field_titre($langs->trans("Employee"),$_SERVER["PHP_SELF"],"cp.fk_user","",$param,'',$sortfield,$sortorder); +print_liste_field_titre($langs->trans("ValidatorCP"),$_SERVER["PHP_SELF"],"cp.fk_validator","",$param,'',$sortfield,$sortorder); +print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],'','',$param,'',$sortfield,$sortorder); +print_liste_field_titre($langs->trans("Duration"),$_SERVER["PHP_SELF"],'','',$pram,'align="right"',$sortfield,$sortorder); +print_liste_field_titre($langs->trans("DateDebCP"),$_SERVER["PHP_SELF"],"cp.date_debut","",$param,'align="center"',$sortfield,$sortorder); +print_liste_field_titre($langs->trans("DateFinCP"),$_SERVER["PHP_SELF"],"cp.date_fin","",$param,'align="center"',$sortfield,$sortorder); +print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"cp.statut","",$param,'align="right"',$sortfield,$sortorder); +print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'',$param,'',$sortfield,$sortorder,'maxwidthsearch '); print "\n"; // Lines @@ -456,6 +458,7 @@ if ($result == '2') print ''; print ''; + print '
'; /*if ($user_id == $user->id)