From 54bb784138b17cbd9120f9bde481ce3458d0277c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 2 Mar 2023 19:40:28 +0100 Subject: [PATCH] Debug v18 --- htdocs/adherents/list.php | 3 +- htdocs/adherents/subscription/list.php | 5 +- htdocs/comm/propal/list.php | 2 +- htdocs/compta/bank/list.php | 3 +- htdocs/compta/bank/various_payment/list.php | 966 +++++++++--------- htdocs/compta/facture/list.php | 2 +- htdocs/compta/localtax/list.php | 11 +- htdocs/compta/paiement/cheque/list.php | 5 +- htdocs/compta/prelevement/list.php | 6 +- htdocs/compta/prelevement/orders_list.php | 1 - htdocs/compta/sociales/list.php | 6 +- htdocs/compta/tva/list.php | 6 +- htdocs/contrat/list.php | 1 - htdocs/don/list.php | 5 +- htdocs/expensereport/list.php | 12 +- htdocs/expensereport/payment/list.php | 5 +- htdocs/fichinter/list.php | 3 +- htdocs/fourn/commande/list.php | 2 +- htdocs/fourn/facture/list.php | 5 +- htdocs/holiday/list.php | 5 +- htdocs/hrm/evaluation_list.php | 3 +- htdocs/hrm/skill_list.php | 5 +- htdocs/loan/list.php | 5 +- htdocs/mrp/mo_list.php | 5 +- htdocs/product/stock/list.php | 3 +- .../recruitmentcandidature_list.php | 84 +- .../recruitmentjobposition_list.php | 10 +- htdocs/salaries/list.php | 5 +- htdocs/salaries/payments.php | 10 +- htdocs/supplier_proposal/list.php | 6 +- 30 files changed, 622 insertions(+), 568 deletions(-) diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index b44abce662d..4acafa49b00 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -1014,7 +1014,8 @@ print "\n"; $i = 0; $totalarray = array(); $totalarray['nbfield'] = 0; -while ($i < min($num, $limit)) { +$imaxinloop = ($limit ? min($num, $limit) : $num); +while ($i < $maxinloop) { $obj = $db->fetch_object($resql); $datefin = $db->jdate($obj->datefin); diff --git a/htdocs/adherents/subscription/list.php b/htdocs/adherents/subscription/list.php index 45fbc99b816..4cd21775ae7 100644 --- a/htdocs/adherents/subscription/list.php +++ b/htdocs/adherents/subscription/list.php @@ -502,7 +502,8 @@ print "\n"; $totalarray = array(); $totalarray['nbfield'] = 0; -while ($i < min($num, $limit)) { +$imaxinloop = ($limit ? min($num, $limit) : $num); +while ($i < $imaxinloop) { $obj = $db->fetch_object($result); $subscription->ref = $obj->crowid; @@ -546,7 +547,7 @@ while ($i < min($num, $limit)) { } // Output Kanban print $subscription->getKanbanView(''); - if ($i == (min($num, $limit) - 1)) { + if ($i == ($imaxinloop - 1)) { print ''; print ''; } diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index a6179f93417..5b0fd0bd105 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -1723,7 +1723,7 @@ if ($resql) { $objectstatic->author = $userstatic->getNomUrl(1); $objectstatic->fk_project = $projectstatic->getNomUrl(1); print $objectstatic->getKanbanView(''); - if ($i == (min($num, $limit) - 1)) { + if ($i == ($imaxinloop - 1)) { print ''; print ''; } diff --git a/htdocs/compta/bank/list.php b/htdocs/compta/bank/list.php index bc2c2528d07..073e9de9a15 100644 --- a/htdocs/compta/bank/list.php +++ b/htdocs/compta/bank/list.php @@ -574,6 +574,7 @@ $total = array(); $found = 0; $i = 0; $lastcurrencycode = ''; +$imaxinloop = ($limit ? min($num, $limit) : $num); foreach ($accounts as $key => $type) { if ($i >= $limit) { @@ -600,7 +601,7 @@ foreach ($accounts as $key => $type) { } // Output Kanban print $objecttmp->getKanbanView(''); - if ($i == (min($num, $limit) - 1)) { + if ($i == ($imaxinloop - 1)) { print ''; print ''; } diff --git a/htdocs/compta/bank/various_payment/list.php b/htdocs/compta/bank/various_payment/list.php index 204ea92041f..d72238e3fe6 100644 --- a/htdocs/compta/bank/various_payment/list.php +++ b/htdocs/compta/bank/various_payment/list.php @@ -85,9 +85,10 @@ $search_type_id = GETPOST('search_type_id', 'int'); $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); -if (empty($page) || $page == -1) { +if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { + // If $page is not defined, or '' or -1 or if we click on clear filters $page = 0; -} // If $page is not defined, or '' or -1 +} $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; @@ -174,6 +175,14 @@ $result = restrictedArea($user, 'banque', '', '', ''); * Actions */ +if (GETPOST('cancel', 'alpha')) { + $action = 'list'; + $massaction = ''; +} +if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { + $massaction = ''; +} + $parameters = array(); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { @@ -183,6 +192,23 @@ if ($reshook < 0) { if (empty($reshook)) { // Selection of new fields include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; + + // Purge search criteria + if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers + foreach ($object->fields as $key => $val) { + $search[$key] = ''; + if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) { + $search[$key.'_dtstart'] = ''; + $search[$key.'_dtend'] = ''; + } + } + $toselect = array(); + $search_array_options = array(); + } + if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha') + || GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) { + $massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation + } } /* @@ -282,7 +308,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { dol_print_error($db); } - if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0 + if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller than paging size (filtering), goto and load page 0 $page = 0; $offset = 0; } @@ -296,520 +322,526 @@ if ($limit) { } $resql = $db->query($sql); -if ($resql) { - $num = $db->num_rows($resql); +if (!$resql) { + dol_print_error($db); + exit; +} - // Direct jump if only one record found - if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all) { - $obj = $db->fetch_object($resql); - $id = $obj->rowid; - header("Location: ".DOL_URL_ROOT.'/compta/bank/various_payment/card.php?id='.$id); - exit; - } +$num = $db->num_rows($resql); - // must be place behind the last "header(...)" call - llxHeader('', $langs->trans("VariousPayments")); +// Direct jump if only one record found +if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) { + $obj = $db->fetch_object($resql); + $id = $obj->rowid; + header("Location: ".DOL_URL_ROOT.'/compta/bank/various_payment/card.php?id='.$id); + exit; +} - $i = 0; - $total = 0; +// must be place behind the last "header(...)" call +llxHeader('', $langs->trans("VariousPayments")); - $param = ''; - if (!empty($mode)) { - $param .= '&mode='.urlencode($mode); - } - if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { - $param .= '&contextpage='.urlencode($contextpage); - } - if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); - } - if ($search_ref) { - $param .= '&search_ref='.urlencode($search_ref); - } - if ($search_label) { - $param .= '&search_label='.urlencode($search_label); - } - if ($search_datep_start) { - $param .= '&search_datep_start='.urlencode($search_datep_start); - } - if ($search_datep_end) { - $param .= '&search_datep_end='.urlencode($search_datep_end); - } - if ($search_datev_start) { - $param .= '&search_datev_start='.urlencode($search_datev_start); - } - if ($search_datev_end) { - $param .= '&search_datev_end='.urlencode($search_datev_end); - } - if ($search_type_id > 0) { - $param .= '&search_type_id='.urlencode($search_type_id); - } - if ($search_amount_deb) { - $param .= '&search_amount_deb='.urlencode($search_amount_deb); - } - if ($search_amount_cred) { - $param .= '&search_amount_cred='.urlencode($search_amount_cred); - } - if ($search_bank_account > 0) { - $param .= '&search_account='.urlencode($search_bank_account); - } - if ($search_accountancy_account > 0) { - $param .= '&search_accountancy_account='.urlencode($search_accountancy_account); - } - if ($search_accountancy_subledger > 0) { - $param .= '&search_accountancy_subledger='.urlencode($search_accountancy_subledger); - } - if ($optioncss != '') { - $param .= '&optioncss='.urlencode($optioncss); - } +$i = 0; +$total = 0; - $url = DOL_URL_ROOT.'/compta/bank/various_payment/card.php?action=create'; - if (!empty($socid)) { - $url .= '&socid='.urlencode($socid); - } - $newcardbutton = ''; - $newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition')); - $newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); - $newcardbutton .= dolGetButtonTitle($langs->trans('MenuNewVariousPayment'), '', 'fa fa-plus-circle', $url, '', $user->rights->banque->modifier); +$param = ''; +if (!empty($mode)) { + $param .= '&mode='.urlencode($mode); +} +if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { + $param .= '&contextpage='.urlencode($contextpage); +} +if ($limit > 0 && $limit != $conf->liste_limit) { + $param .= '&limit='.urlencode($limit); +} +if ($search_ref) { + $param .= '&search_ref='.urlencode($search_ref); +} +if ($search_label) { + $param .= '&search_label='.urlencode($search_label); +} +if ($search_datep_start) { + $param .= '&search_datep_start='.urlencode($search_datep_start); +} +if ($search_datep_end) { + $param .= '&search_datep_end='.urlencode($search_datep_end); +} +if ($search_datev_start) { + $param .= '&search_datev_start='.urlencode($search_datev_start); +} +if ($search_datev_end) { + $param .= '&search_datev_end='.urlencode($search_datev_end); +} +if ($search_type_id > 0) { + $param .= '&search_type_id='.urlencode($search_type_id); +} +if ($search_amount_deb) { + $param .= '&search_amount_deb='.urlencode($search_amount_deb); +} +if ($search_amount_cred) { + $param .= '&search_amount_cred='.urlencode($search_amount_cred); +} +if ($search_bank_account > 0) { + $param .= '&search_account='.urlencode($search_bank_account); +} +if ($search_accountancy_account > 0) { + $param .= '&search_accountancy_account='.urlencode($search_accountancy_account); +} +if ($search_accountancy_subledger > 0) { + $param .= '&search_accountancy_subledger='.urlencode($search_accountancy_subledger); +} +if ($optioncss != '') { + $param .= '&optioncss='.urlencode($optioncss); +} - print '
'; +$url = DOL_URL_ROOT.'/compta/bank/various_payment/card.php?action=create'; +if (!empty($socid)) { + $url .= '&socid='.urlencode($socid); +} +$newcardbutton = ''; +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition')); +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); +$newcardbutton .= dolGetButtonTitle($langs->trans('MenuNewVariousPayment'), '', 'fa fa-plus-circle', $url, '', $user->rights->banque->modifier); - if ($optioncss != '') { - print ''; - } - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; +print ''; + +if ($optioncss != '') { + print ''; +} +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; - print_barre_liste($langs->trans("MenuVariousPayment"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'object_payment', 0, $newcardbutton, '', $limit, 0, 0, 1); +print_barre_liste($langs->trans("MenuVariousPayment"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'object_payment', 0, $newcardbutton, '', $limit, 0, 0, 1); - if ($search_all) { - foreach ($fieldstosearchall as $key => $val) { - $fieldstosearchall[$key] = $langs->trans($val); +if ($search_all) { + foreach ($fieldstosearchall as $key => $val) { + $fieldstosearchall[$key] = $langs->trans($val); + } + print '
'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'
'; +} + +$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; +$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields +$moreforfilter= ''; + +print '
'; +print ''; + +print ''; + +if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; +} + +if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) { + print ''; +} + +// Ref +if ($arrayfields['ref']['checked']) { + print ''; +} + +// Label +if ($arrayfields['label']['checked']) { + print ''; +} + +// Payment date +if ($arrayfields['datep']['checked']) { + print ''; +} + +// Value date +if ($arrayfields['datev']['checked']) { + print ''; +} + +// Payment type +if ($arrayfields['type']['checked']) { + print ''; +} + +// Project +if ($arrayfields['project']['checked']) { + print ''; +} + +// Bank account +if ($arrayfields['bank']['checked']) { + print ''; +} + +// Bank entry +if ($arrayfields['entry']['checked']) { + print ''; +} + +// Accounting account +if (!empty($arrayfields['account']['checked'])) { + print ''; +} + +// Subledger account +if (!empty($arrayfields['subledger']['checked'])) { + print ''; +} + +// Debit +if (!empty($arrayfields['debit']['checked'])) { + print ''; +} + +// Credit +if ($arrayfields['credit']['checked']) { + print ''; +} + +if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; +} + +print ''; + + +print ''; + +if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'maxwidthsearch center '); +} + +if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) { + print_liste_field_titre('#', $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder); +} + +if ($arrayfields['ref']['checked']) { + print_liste_field_titre($arrayfields['ref']['label'], $_SERVER["PHP_SELF"], 'v.rowid', '', $param, '', $sortfield, $sortorder); +} +if ($arrayfields['label']['checked']) { + print_liste_field_titre($arrayfields['label']['label'], $_SERVER["PHP_SELF"], 'v.label', '', $param, '', $sortfield, $sortorder); +} +if ($arrayfields['datep']['checked']) { + print_liste_field_titre($arrayfields['datep']['label'], $_SERVER["PHP_SELF"], 'v.datep,v.rowid', '', $param, '', $sortfield, $sortorder, 'center '); +} +if ($arrayfields['datev']['checked']) { + print_liste_field_titre($arrayfields['datev']['label'], $_SERVER["PHP_SELF"], 'v.datev,v.rowid', '', $param, '', $sortfield, $sortorder, 'center '); +} +if ($arrayfields['type']['checked']) { + print_liste_field_titre($arrayfields['type']['label'], $_SERVER["PHP_SELF"], 'type', '', $param, '', $sortfield, $sortorder, 'center '); +} +if ($arrayfields['project']['checked']) { + print_liste_field_titre($arrayfields['project']['label'], $_SERVER["PHP_SELF"], 'fk_project', '', $param, '', $sortfield, $sortorder); +} +if ($arrayfields['bank']['checked']) { + print_liste_field_titre($arrayfields['bank']['label'], $_SERVER["PHP_SELF"], 'ba.label', '', $param, '', $sortfield, $sortorder); +} +if ($arrayfields['entry']['checked']) { + print_liste_field_titre($arrayfields['entry']['label'], $_SERVER["PHP_SELF"], 'ba.label', '', $param, '', $sortfield, $sortorder); +} +if (!empty($arrayfields['account']['checked'])) { + print_liste_field_titre($arrayfields['account']['label'], $_SERVER["PHP_SELF"], 'v.accountancy_code', '', $param, '', $sortfield, $sortorder, 'left '); +} +if (!empty($arrayfields['subledger']['checked'])) { + print_liste_field_titre($arrayfields['subledger']['label'], $_SERVER["PHP_SELF"], 'v.subledger_account', '', $param, '', $sortfield, $sortorder, 'left '); +} +if ($arrayfields['debit']['checked']) { + print_liste_field_titre($arrayfields['debit']['label'], $_SERVER["PHP_SELF"], 'v.amount', '', $param, '', $sortfield, $sortorder, 'right '); +} +if ($arrayfields['credit']['checked']) { + print_liste_field_titre($arrayfields['credit']['label'], $_SERVER["PHP_SELF"], 'v.amount', '', $param, '', $sortfield, $sortorder, 'right '); +} + +// Fields from hook +$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); +$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; + +if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'maxwidthsearch center '); +} +print ''; + + +$totalarray = array(); +$totalarray['nbfield'] = 0; +$totalarray['val']['total_cred'] = 0; +$totalarray['val']['total_deb'] = 0; + +$imaxinloop = ($limit ? min($num, $limit) : $num); +while ($i < $imaxinloop) { + $obj = $db->fetch_object($resql); + + $variousstatic->id = $obj->rowid; + $variousstatic->ref = $obj->rowid; + $variousstatic->label = $obj->label; + $variousstatic->datep = $obj->datep; + $variousstatic->type_payment = $obj->payment_code; + $bankline->fetch($obj->fk_bank); + $variousstatic->fk_bank = $bankline->getNomUrl(1); + $variousstatic->amount = $obj->amount; + + $accountingaccount->fetch('', $obj->accountancy_code, 1); + $variousstatic->accountancy_code = $accountingaccount->getNomUrl(0, 0, 1, $obj->accountingaccount, 1); + + if ($mode == 'kanban') { + if ($i == 0) { + print ''; +} + +$db->free($resql); + +$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql); +$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; + +print '
'; + $searchpicto = $form->showFilterAndCheckAddButtons(0); + print $searchpicto; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print '
'; + print $form->selectDate($search_datep_start ? $search_datep_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); + print '
'; + print '
'; + print $form->selectDate($search_datep_end ? $search_datep_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); + print '
'; + print '
'; + print '
'; + print $form->selectDate($search_datev_start ? $search_datev_start : -1, 'search_date_value_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); + print '
'; + print '
'; + print $form->selectDate($search_datev_end ? $search_datev_end : -1, 'search_date_value_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); + print '
'; + print '
'; + print $form->select_types_paiements($search_type_id, 'search_type_id', '', 0, 1, 1, 16, 1, 'maxwidth100', 1); + print ''; + // TODO + print ''; + $form->select_comptes($search_bank_account, 'search_account', 0, '', 1, '', 0, 'maxwidth100'); + print ''; + print ''; + print ''; + print '
'; + print $formaccounting->select_account($search_accountancy_account, 'search_accountancy_account', 1, array(), 1, 1, 'maxwidth200'); + print '
'; + print '
'; + print '
'; + print $formaccounting->select_auxaccount($search_accountancy_subledger, 'search_accountancy_subledger', 1, 'maxwidth200'); + print '
'; + print '
'; + print ''; + print ''; + print ''; + print ''; + $searchpicto = $form->showFilterAndCheckAddButtons(0); + print $searchpicto; + print '
'; + print '
'; } - print '
'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'
'; - } - - $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; - $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields - $moreforfilter= ''; - - print '
'; - print ''; - - print ''; - - if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; - } - - if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) { - print ''; - } - - // Ref - if ($arrayfields['ref']['checked']) { - print ''; - } - - // Label - if ($arrayfields['label']['checked']) { - print ''; - } - - // Payment date - if ($arrayfields['datep']['checked']) { - print ''; - } - - // Value date - if ($arrayfields['datev']['checked']) { - print ''; - } - - // Payment type - if ($arrayfields['type']['checked']) { - print ''; - } - - // Project - if ($arrayfields['project']['checked']) { - print ''; - } - - // Bank account - if ($arrayfields['bank']['checked']) { - print ''; - } - - // Bank entry - if ($arrayfields['entry']['checked']) { - print ''; - } - - // Accounting account - if (!empty($arrayfields['account']['checked'])) { - print ''; - } - - // Subledger account - if (!empty($arrayfields['subledger']['checked'])) { - print ''; - } - - // Debit - if (!empty($arrayfields['debit']['checked'])) { - print ''; - } - - // Credit - if ($arrayfields['credit']['checked']) { - print ''; - } - - if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; - } - - print ''; - - - print ''; - - if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'maxwidthsearch center '); - } - - if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) { - print_liste_field_titre('#', $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder); - } - - if ($arrayfields['ref']['checked']) { - print_liste_field_titre($arrayfields['ref']['label'], $_SERVER["PHP_SELF"], 'v.rowid', '', $param, '', $sortfield, $sortorder); - } - if ($arrayfields['label']['checked']) { - print_liste_field_titre($arrayfields['label']['label'], $_SERVER["PHP_SELF"], 'v.label', '', $param, '', $sortfield, $sortorder); - } - if ($arrayfields['datep']['checked']) { - print_liste_field_titre($arrayfields['datep']['label'], $_SERVER["PHP_SELF"], 'v.datep,v.rowid', '', $param, '', $sortfield, $sortorder, 'center '); - } - if ($arrayfields['datev']['checked']) { - print_liste_field_titre($arrayfields['datev']['label'], $_SERVER["PHP_SELF"], 'v.datev,v.rowid', '', $param, '', $sortfield, $sortorder, 'center '); - } - if ($arrayfields['type']['checked']) { - print_liste_field_titre($arrayfields['type']['label'], $_SERVER["PHP_SELF"], 'type', '', $param, '', $sortfield, $sortorder, 'center '); - } - if ($arrayfields['project']['checked']) { - print_liste_field_titre($arrayfields['project']['label'], $_SERVER["PHP_SELF"], 'fk_project', '', $param, '', $sortfield, $sortorder); - } - if ($arrayfields['bank']['checked']) { - print_liste_field_titre($arrayfields['bank']['label'], $_SERVER["PHP_SELF"], 'ba.label', '', $param, '', $sortfield, $sortorder); - } - if ($arrayfields['entry']['checked']) { - print_liste_field_titre($arrayfields['entry']['label'], $_SERVER["PHP_SELF"], 'ba.label', '', $param, '', $sortfield, $sortorder); - } - if (!empty($arrayfields['account']['checked'])) { - print_liste_field_titre($arrayfields['account']['label'], $_SERVER["PHP_SELF"], 'v.accountancy_code', '', $param, '', $sortfield, $sortorder, 'left '); - } - if (!empty($arrayfields['subledger']['checked'])) { - print_liste_field_titre($arrayfields['subledger']['label'], $_SERVER["PHP_SELF"], 'v.subledger_account', '', $param, '', $sortfield, $sortorder, 'left '); - } - if ($arrayfields['debit']['checked']) { - print_liste_field_titre($arrayfields['debit']['label'], $_SERVER["PHP_SELF"], 'v.amount', '', $param, '', $sortfield, $sortorder, 'right '); - } - if ($arrayfields['credit']['checked']) { - print_liste_field_titre($arrayfields['credit']['label'], $_SERVER["PHP_SELF"], 'v.amount', '', $param, '', $sortfield, $sortorder, 'right '); - } - - // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); - $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - - if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'maxwidthsearch center '); - } - print ''; - - - $totalarray = array(); - $totalarray['nbfield'] = 0; - $totalarray['val']['total_cred'] = 0; - $totalarray['val']['total_deb'] = 0; - - while ($i < min($num, $limit)) { - $obj = $db->fetch_object($resql); - - $variousstatic->id = $obj->rowid; - $variousstatic->ref = $obj->rowid; - $variousstatic->label = $obj->label; - $variousstatic->datep = $obj->datep; - $variousstatic->type_payment = $obj->payment_code; - $bankline->fetch($obj->fk_bank); - $variousstatic->fk_bank = $bankline->getNomUrl(1); - $variousstatic->amount = $obj->amount; - - $accountingaccount->fetch('', $obj->accountancy_code, 1); - $variousstatic->accountancy_code = $accountingaccount->getNomUrl(0, 0, 1, $obj->accountingaccount, 1); - - if ($mode == 'kanban') { - if ($i == 0) { - print ''; + } + } else { + // Show here line of result + $j = 0; + print ''; + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + if (!$i) { + $totalarray['nbfield']++; } - // Output Kanban + } - print $variousstatic->getKanbanView(''); - if ($i == (min($num, $limit) - 1)) { - print ''; - print ''; + // No + if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) { + print ''; + } + + // Ref + if ($arrayfields['ref']['checked']) { + print '"; + if (!$i) { + $totalarray['nbfield']++; } - } else { - print ''; + } - if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; + // Label payment + if ($arrayfields['label']['checked']) { + print '"; + if (!$i) { + $totalarray['nbfield']++; } + } - // No - if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) { - print ''; + // Date payment + if ($arrayfields['datep']['checked']) { + print '"; + if (!$i) { + $totalarray['nbfield']++; } + } - // Ref - if ($arrayfields['ref']['checked']) { - print '"; - if (!$i) { - $totalarray['nbfield']++; - } + + // Date value + if ($arrayfields['datev']['checked']) { + print '"; + if (!$i) { + $totalarray['nbfield']++; } + } - // Label payment - if ($arrayfields['label']['checked']) { - print '"; - if (!$i) { - $totalarray['nbfield']++; - } + // Type + if ($arrayfields['type']['checked']) { + print '"; - if (!$i) { - $totalarray['nbfield']++; - } + print $obj->num_payment; + print ''; + if (!$i) { + $totalarray['nbfield']++; } + } - - // Date value - if ($arrayfields['datev']['checked']) { - print '"; - if (!$i) { - $totalarray['nbfield']++; - } + // Project + if ($arrayfields['project']['checked']) { + print ''; - if (!$i) { - $totalarray['nbfield']++; - } + print ''; + if (!$i) { + $totalarray['nbfield']++; } + } - // Project - if ($arrayfields['project']['checked']) { - print ''; - if (!$i) { - $totalarray['nbfield']++; + // Bank account + if ($arrayfields['bank']['checked']) { + print ''; - if (!$i) { - $totalarray['nbfield']++; - } + print ''; + if (!$i) { + $totalarray['nbfield']++; } + } - // Bank entry - if ($arrayfields['entry']['checked']) { - $bankline->fetch($obj->fk_bank); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } + // Bank entry + if ($arrayfields['entry']['checked']) { + $bankline->fetch($obj->fk_bank); + print ''; + if (!$i) { + $totalarray['nbfield']++; } + } - // Accounting account - if (!empty($arrayfields['account']['checked'])) { - $accountingaccount->fetch('', $obj->accountancy_code, 1); + // Accounting account + if (!empty($arrayfields['account']['checked'])) { + $accountingaccount->fetch('', $obj->accountancy_code, 1); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } + print ''; + if (!$i) { + $totalarray['nbfield']++; } + } - // Accounting subledger account - if (!empty($arrayfields['subledger']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } + // Accounting subledger account + if (!empty($arrayfields['subledger']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; } + } - // Debit - if ($arrayfields['debit']['checked']) { - print ''; - } - - // Credit - if ($arrayfields['credit']['checked']) { - print ''; - } - - if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; + // Debit + if ($arrayfields['debit']['checked']) { + print ''."\n"; + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'total_deb'; + } + print ''; } - $i++; - } - // Show total line - include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; + // Credit + if ($arrayfields['credit']['checked']) { + print ''; + } - // If no record found - if ($num == 0) { - $colspan = 1; - foreach ($arrayfields as $key => $val) { - if (!empty($val['checked'])) { - $colspan++; + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + if (!$i) { + $totalarray['nbfield']++; } } - print ''; + + print ''."\n"; } - - $db->free($resql); - - $parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql); - $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - - print '
'; - $searchpicto = $form->showFilterAndCheckAddButtons(0); - print $searchpicto; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print '
'; - print $form->selectDate($search_datep_start ? $search_datep_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); - print '
'; - print '
'; - print $form->selectDate($search_datep_end ? $search_datep_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); - print '
'; - print '
'; - print '
'; - print $form->selectDate($search_datev_start ? $search_datev_start : -1, 'search_date_value_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); - print '
'; - print '
'; - print $form->selectDate($search_datev_end ? $search_datev_end : -1, 'search_date_value_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); - print '
'; - print '
'; - print $form->select_types_paiements($search_type_id, 'search_type_id', '', 0, 1, 1, 16, 1, 'maxwidth100', 1); - print ''; - // TODO - print ''; - $form->select_comptes($search_bank_account, 'search_account', 0, '', 1, '', 0, 'maxwidth100'); - print ''; - print ''; - print ''; - print '
'; - print $formaccounting->select_account($search_accountancy_account, 'search_accountancy_account', 1, array(), 1, 1, 'maxwidth200'); - print '
'; - print '
'; - print '
'; - print $formaccounting->select_auxaccount($search_accountancy_subledger, 'search_accountancy_subledger', 1, 'maxwidth200'); - print '
'; - print '
'; - print ''; - print ''; - print ''; - print ''; - $searchpicto = $form->showFilterAndCheckAddButtons(0); - print $searchpicto; - print '
'; - print '
'; + // Output Kanban + print $variousstatic->getKanbanView(''); + if ($i == ($imaxinloop) - 1) { + print '
'; + print '
'.(($offset * $limit) + $i).''.$variousstatic->getNomUrl(1)."
'.$variousstatic->label."'.(($offset * $limit) + $i).''.dol_print_date($obj->datep, 'day')."'.$variousstatic->getNomUrl(1)."'.dol_print_date($obj->datev, 'day')."'.$variousstatic->label."'; + if ($obj->payment_code) { + print $langs->trans("PaymentTypeShort".$obj->payment_code); + print ' '; } - - // Date payment - if ($arrayfields['datep']['checked']) { - print ''.dol_print_date($obj->datep, 'day')."'.dol_print_date($obj->datev, 'day')."'; + if ($obj->fk_project > 0) { + $proj->fetch($obj->fk_project); + print $proj->getNomUrl(1); } - - // Type - if ($arrayfields['type']['checked']) { - print ''; - if ($obj->payment_code) { - print $langs->trans("PaymentTypeShort".$obj->payment_code); - print ' '; - } - print $obj->num_payment; - print ''; - if ($obj->fk_project > 0) { - $proj->fetch($obj->fk_project); - print $proj->getNomUrl(1); - } - print ''; + if ($obj->bid > 0) { + $accountstatic->id = $obj->bid; + $accountstatic->ref = $obj->bref; + $accountstatic->number = $obj->bnumber; + + if (isModEnabled('accounting')) { + $accountstatic->account_number = $obj->bank_account_number; + $accountingjournal->fetch($obj->accountancy_journal); + $accountstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1, '', 1); } + + $accountstatic->label = $obj->blabel; + print $accountstatic->getNomUrl(1); + } else { + print ' '; } - - // Bank account - if ($arrayfields['bank']['checked']) { - print ''; - if ($obj->bid > 0) { - $accountstatic->id = $obj->bid; - $accountstatic->ref = $obj->bref; - $accountstatic->number = $obj->bnumber; - - if (isModEnabled('accounting')) { - $accountstatic->account_number = $obj->bank_account_number; - $accountingjournal->fetch($obj->accountancy_journal); - $accountstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1, '', 1); - } - - $accountstatic->label = $obj->blabel; - print $accountstatic->getNomUrl(1); - } else { - print ' '; - } - print ''.$bankline->getNomUrl(1).''.$bankline->getNomUrl(1).''.$accountingaccount->getNomUrl(0, 1, 1, '', 1).''.$accountingaccount->getNomUrl(0, 1, 1, '', 1).''.length_accounta($obj->subledger_account).''.length_accounta($obj->subledger_account).''; - if ($obj->sens == 0) { - print ''.price($obj->amount).''; - $totalarray['val']['total_deb'] += $obj->amount; - } - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'total_deb'; - } - print ''; - if ($obj->sens == 1) { - print ''.price($obj->amount).''; - $totalarray['val']['total_cred'] += $obj->amount; - } - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'total_cred'; - } - print ''; + if ($obj->sens == 0) { + print ''.price($obj->amount).''; + $totalarray['val']['total_deb'] += $obj->amount; } if (!$i) { $totalarray['nbfield']++; } - - print '
'; + if ($obj->sens == 1) { + print ''.price($obj->amount).''; + $totalarray['val']['total_cred'] += $obj->amount; + } + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'total_cred'; + } + print '
'.$langs->trans("NoRecordFound").'
'."\n"; - print '
'."\n"; - - print ''."\n"; -} else { - dol_print_error($db); + $i++; } +// Show total line +include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; + +// If no record found +if ($num == 0) { + $colspan = 1; + foreach ($arrayfields as $key => $val) { + if (!empty($val['checked'])) { + $colspan++; + } + } + print '
'.$langs->trans("NoRecordFound").'
'."\n"; +print '
'."\n"; + +print ''."\n"; + // End of page llxFooter(); diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 23c7d87f87a..5f9d0c507d3 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -1928,7 +1928,7 @@ if ($resql) { $userstatic->fetch($obj->fk_user_author); $facturestatic->fk_user_author = $userstatic->getNomUrl(1); print $facturestatic->getKanbanView(''); - if ($i == (min($num, $limit) - 1)) { + if ($i == ($imaxinloop - 1)) { print ''; print ''; } diff --git a/htdocs/compta/localtax/list.php b/htdocs/compta/localtax/list.php index 23fd1186e0e..dbd3bdafdbf 100644 --- a/htdocs/compta/localtax/list.php +++ b/htdocs/compta/localtax/list.php @@ -28,15 +28,19 @@ require_once DOL_DOCUMENT_ROOT.'/compta/localtax/class/localtax.class.php'; // Load translation files required by the page $langs->load("compta"); +$limit = GETPOST('limit', 'int'); + // Security check $socid = GETPOST('socid', 'int'); if ($user->socid) { $socid = $user->socid; } + $result = restrictedArea($user, 'tax', '', '', 'charges'); $ltt = GETPOST("localTaxType", 'int'); $mode = GETPOST('mode', 'alpha'); + /* * View */ @@ -80,8 +84,9 @@ if ($result) { print ''.$langs->trans("DatePayment").''; print "".$langs->trans("PayedByThisPayment").""; print "\n"; - $var = 1; - while ($i < $num) { + + $imaxinloop = ($limit ? min($num, $limit) : $num); + while ($i < $imaxinloop) { $obj = $db->fetch_object($result); $localtax_static->label = $obj->label; @@ -100,7 +105,7 @@ if ($result) { } // Output Kanban print $localtax_static->getKanbanView(''); - if ($i == ($num - 1)) { + if ($i == ($imaxinloop - 1)) { print ''; print ''; } diff --git a/htdocs/compta/paiement/cheque/list.php b/htdocs/compta/paiement/cheque/list.php index 794db8df39b..3c617a2db0c 100644 --- a/htdocs/compta/paiement/cheque/list.php +++ b/htdocs/compta/paiement/cheque/list.php @@ -226,7 +226,8 @@ if ($resql) { print "\n"; if ($num > 0) { - while ($i < min($num, $limit)) { + $imaxinloop = ($limit ? min($num, $limit) : $num); + while ($i < $imaxinloop) { $objp = $db->fetch_object($resql); $checkdepositstatic->id = $objp->rowid; @@ -247,7 +248,7 @@ if ($resql) { } // Output Kanban print $checkdepositstatic->getKanbanView(''); - if ($i == (min($num, $limit) - 1)) { + if ($i == ($imaxinloop - 1)) { print ''; print ''; } diff --git a/htdocs/compta/prelevement/list.php b/htdocs/compta/prelevement/list.php index ad8570d9268..307a7239fe8 100644 --- a/htdocs/compta/prelevement/list.php +++ b/htdocs/compta/prelevement/list.php @@ -265,7 +265,8 @@ if ($result) { print "\n"; if ($num) { - while ($i < min($num, $limit)) { + $imaxinloop = ($limit ? min($num, $limit) : $num); + while ($i < $imaxinloop) { $obj = $db->fetch_object($result); $bon->id = $obj->rowid; @@ -285,9 +286,8 @@ if ($result) { print '
'; } // Output Kanban - print $bon->getKanbanView(''); - if ($i == (min($num, $limit) - 1)) { + if ($i == ($imaxinloop - 1)) { print '
'; print ''; } diff --git a/htdocs/compta/prelevement/orders_list.php b/htdocs/compta/prelevement/orders_list.php index c2e8c5e4194..8dd056ed796 100644 --- a/htdocs/compta/prelevement/orders_list.php +++ b/htdocs/compta/prelevement/orders_list.php @@ -239,7 +239,6 @@ if ($result) { print '
'; } // Output Kanban - print $directdebitorder->getKanbanView(''); if ($i == (min($num, $limit) - 1)) { print '
'; diff --git a/htdocs/compta/sociales/list.php b/htdocs/compta/sociales/list.php index 498a28a54f5..297dc3f7de5 100644 --- a/htdocs/compta/sociales/list.php +++ b/htdocs/compta/sociales/list.php @@ -594,7 +594,8 @@ $i = 0; $totalarray = $TLoadedUsers = array(); $totalarray['nbfield'] = 0; $totalarray['val']['totalttcfield'] = 0; -while ($i < min($num, $limit)) { +$imaxinloop = ($limit ? min($num, $limit) : $num); +while ($i < $imaxinloop) { $obj = $db->fetch_object($resql); $chargesociale_static->id = $obj->rowid; @@ -617,10 +618,9 @@ while ($i < min($num, $limit)) { print '
'; } // Output Kanban - $chargesociale_static->fk_project = $projectstatic->getNomUrl(); print $chargesociale_static->getKanbanView(''); - if ($i == (min($num, $limit) - 1)) { + if ($i == ($imaxinloop - 1)) { print '
'; print ''; } diff --git a/htdocs/compta/tva/list.php b/htdocs/compta/tva/list.php index 80f73c6fe44..44aa49361f9 100644 --- a/htdocs/compta/tva/list.php +++ b/htdocs/compta/tva/list.php @@ -475,7 +475,8 @@ $totalarray = array(); $totalarray['nbfield'] = 0; $total = 0; -while ($i < min($num, $limit)) { +$imaxinloop = ($limit ? min($num, $limit) : $num); +while ($i < $imaxinloop) { $obj = $db->fetch_object($resql); $tva_static->id = $obj->rowid; @@ -492,9 +493,8 @@ while ($i < min($num, $limit)) { print '
'; } // Output Kanban - print $tva_static->getKanbanView(''); - if ($i == (min($num, $limit) - 1)) { + if ($i == ($imaxinloop - 1)) { print '
'; print ''; } diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index 03e65e18988..b55e09bd252 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -990,7 +990,6 @@ while ($i < $imaxinloop) { print ''; print '
'; } - // Output Kanban $contracttmp->societe = $socstatic->getNomUrl(); $contracttmp->date_contrat = $obj->date_contrat; diff --git a/htdocs/don/list.php b/htdocs/don/list.php index a895db4f3a6..320c1616d22 100644 --- a/htdocs/don/list.php +++ b/htdocs/don/list.php @@ -289,7 +289,8 @@ if ($resql) { } print "\n"; - while ($i < min($num, $limit)) { + $imaxinloop = ($limit ? min($num, $limit) : $num); + while ($i < $imaxinloop) { $objp = $db->fetch_object($resql); $donationstatic->setVarsFromFetchObj($objp); $company = new Societe($db); @@ -314,7 +315,7 @@ if ($resql) { } print $donationstatic->getKanbanView(''); - if ($i == (min($num, $limit) - 1)) { + if ($i == ($imaxinloop - 1)) { print '
'; print ''; } diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index c093bbfd721..1edf6c0edca 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -732,6 +732,8 @@ if ($resql) { $totalarray['val']['d.total_tva'] = 0; $totalarray['val']['d.total_ttc'] = 0; $totalarray['totalizable'] = array(); + + $imaxinloop = ($limit ? min($num, $limit) : $num); while ($i < min($num, $limit)) { $obj = $db->fetch_object($resql); @@ -756,14 +758,12 @@ if ($resql) { $expensereportstatic->fk_user_author = $usertmp->getNomUrl(1); // Output Kanban - if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - if ($massactionbutton || $massaction) { - $selected = 0; + if ($massactionbutton || $massaction) { + $selected = 0; - print $expensereportstatic->getKanbanView(''); - } + print $expensereportstatic->getKanbanView(''); } - if ($i == (min($num, $limit) - 1)) { + if ($i == ($imaxinloop - 1)) { print ''; print ''; } diff --git a/htdocs/expensereport/payment/list.php b/htdocs/expensereport/payment/list.php index c236e72d514..18420e7ac20 100644 --- a/htdocs/expensereport/payment/list.php +++ b/htdocs/expensereport/payment/list.php @@ -477,7 +477,8 @@ $i = 0; $savnbfield = $totalarray['nbfield']; $totalarray = array(); $totalarray['nbfield'] = 0; -while ($i < min($num, $limit)) { +$imaxinloop = ($limit ? min($num, $limit) : $num); +while ($i < $imaxinloop) { $objp = $db->fetch_object($resql); $paymentexpensereportstatic->id = $objp->rowid; @@ -504,7 +505,7 @@ while ($i < min($num, $limit)) { } // Output Kanban print $paymentexpensereportstatic->getKanbanView(''); - if ($i == (min($num, $limit) - 1)) { + if ($i == ($imaxinloop - 1)) { print ''; print ''; } diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index f3e88404f6d..86554408a23 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -714,9 +714,8 @@ while ($i < $imaxinloop) { $objectstatic->duration = $obj->duree; $objectstatic->socid = $companystatic->getNomUrl(1, '', 44); - print $objectstatic->getKanbanView(''); - if ($i == (min($num, $limit) - 1)) { + if ($i == ($imaxinloop - 1)) { print ''; print ''; } diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index b6e94712e0b..6f326a75250 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -1686,7 +1686,7 @@ if ($resql) { $objectstatic->socid = $thirdpartytmp->getNomUrl('supplier', 0, 0, -1); // Output Kanban print $objectstatic->getKanbanView(''); - if ($i == (min($num, $limit) - 1)) { + if ($i == ($imaxinloop - 1)) { print ''; print ''; } diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 043a92b0648..a5363fd6c19 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -1359,7 +1359,8 @@ if ($num > 0) { $totalarray['val']['f.total_localtax1']=0; $totalarray['val']['f.total_ttc']=0; - while ($i < min($num, $limit)) { + $imaxinloop = ($limit ? min($num, $limit) : $num); + while ($i < $imaxinloop) { $obj = $db->fetch_object($resql); $datelimit = $db->jdate($obj->datelimite); @@ -1423,7 +1424,7 @@ if ($num > 0) { $facturestatic->total_ht = $obj->total_ht; $facturestatic->date = $obj->datef; print $facturestatic->getKanbanView(''); - if ($i == (min($num, $limit) - 1)) { + if ($i == ($imaxinloop - 1)) { print ''; print ''; } diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index 421da582e0d..3f8f9d69131 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -790,7 +790,8 @@ if ($resql) { $totalarray = array(); $totalarray['nbfield'] = 0; $totalduration = 0; - while ($i < min($num, $limit)) { + $imaxinloop = ($limit ? min($num, $limit) : $num); + while ($i < $imaxinloop) { $obj = $db->fetch_object($resql); // Leave request @@ -852,7 +853,7 @@ if ($resql) { $arraydata = array('user'=>$userstatic, 'labeltype'=>$labeltypeleavetoshow); print $holidaystatic->getKanbanView('', $arraydata); } - if ($i == (min($num, $limit) - 1)) { + if ($i == ($imaxinloop - 1)) { print ''; print ''; } diff --git a/htdocs/hrm/evaluation_list.php b/htdocs/hrm/evaluation_list.php index f39030cf3d5..b4c0ebe9f02 100644 --- a/htdocs/hrm/evaluation_list.php +++ b/htdocs/hrm/evaluation_list.php @@ -567,7 +567,8 @@ if (isset($extrafields->attributes[$object->table_element]['computed']) && is_ar $i = 0; $totalarray = array(); $totalarray['nbfield'] = 0; -while ($i < ($limit ? min($num, $limit) : $num)) { +$imaxinloop = ($limit ? min($num, $limit) : $num); +while ($i < $imaxinloop) { $obj = $db->fetch_object($resql); if (empty($obj)) { break; // Should not happen diff --git a/htdocs/hrm/skill_list.php b/htdocs/hrm/skill_list.php index e9d3564c1a4..796c1abd57d 100644 --- a/htdocs/hrm/skill_list.php +++ b/htdocs/hrm/skill_list.php @@ -544,7 +544,8 @@ if (isset($extrafields->attributes[$object->table_element]['computed']) && is_ar $i = 0; $totalarray = array(); $totalarray['nbfield'] = 0; -while ($i < ($limit ? min($num, $limit) : $num)) { +$imaxiloop = ($limit ? min($num, $limit) : $num); +while ($i < $imaxloop) { $obj = $db->fetch_object($resql); if (empty($obj)) { break; // Should not happen @@ -570,7 +571,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) { } print $object->getKanbanView(''); } - if ($i == (min($num, $limit) - 1)) { + if ($i == ($imaxinloop - 1)) { print ''; print ''; } diff --git a/htdocs/loan/list.php b/htdocs/loan/list.php index d3eace18a88..57e5ef97d97 100644 --- a/htdocs/loan/list.php +++ b/htdocs/loan/list.php @@ -270,7 +270,8 @@ if ($resql) { // -------------------------------------------------------------------- $i = 0; $totalarray = array(); - while ($i < ($limit ? min($num, $limit) : $num)) { + $imaxinloop = ($limit ? min($num, $limit) : $num); + while ($i < $imaxinloop) { $obj = $db->fetch_object($resql); if (empty($obj)) { break; // Should not happen @@ -294,7 +295,7 @@ if ($resql) { $loan_static->totalpaid = $obj->paid; print $loan_static->getKanbanView(''); - if ($i == (min($num, $limit) - 1)) { + if ($i == ($imaxinloop - 1)) { print ''; print ''; } diff --git a/htdocs/mrp/mo_list.php b/htdocs/mrp/mo_list.php index 36dbe6c120a..30b9d288562 100644 --- a/htdocs/mrp/mo_list.php +++ b/htdocs/mrp/mo_list.php @@ -596,7 +596,8 @@ $bom = new Bom($db); $i = 0; $totalarray = array(); $totalarray['nbfield'] = 0; -while ($i < ($limit ? min($num, $limit) : $num)) { +$imaxinloop = ($limit ? min($num, $limit) : $num); +while ($i < $imaxinloop) { $obj = $db->fetch_object($resql); if (empty($obj)) { break; // Should not happen @@ -619,7 +620,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) { // Output Kanban print $object->getKanbanView(''); - if ($i == (min($num, $limit) - 1)) { + if ($i == ($imaxinloop - 1)) { print ''; print ''; } diff --git a/htdocs/product/stock/list.php b/htdocs/product/stock/list.php index 56f83c26f03..b6291958144 100644 --- a/htdocs/product/stock/list.php +++ b/htdocs/product/stock/list.php @@ -619,7 +619,8 @@ $i = 0; $warehouse = new Entrepot($db); -while ($i < min($num, $limit)) { +$imaxinloop = ($limit ? min($num, $limit) : $num); +while ($i < $imaxinloop) { $obj = $db->fetch_object($resql); if (empty($obj)) { break; // Should not happen diff --git a/htdocs/recruitment/recruitmentcandidature_list.php b/htdocs/recruitment/recruitmentcandidature_list.php index 8fcd62fc078..05524716cad 100644 --- a/htdocs/recruitment/recruitmentcandidature_list.php +++ b/htdocs/recruitment/recruitmentcandidature_list.php @@ -66,7 +66,7 @@ $pagenext = $page + 1; $object = new RecruitmentCandidature($db); $extrafields = new ExtraFields($db); $diroutputmassaction = $conf->recruitment->dir_output.'/temp/massgeneration/'.$user->id; -$hookmanager->initHooks(array('recruitmentcandidaturelist')); // Note that conf->hooks_modules contains array +$hookmanager->initHooks(array($contextpage)); // Note that conf->hooks_modules contains array of activated contexes // Fetch optionals attributes and labels $extrafields->fetch_name_optionals_label($object->table_element); @@ -102,6 +102,13 @@ foreach ($object->fields as $key => $val) { $fieldstosearchall['t.'.$key] = $val['label']; } } +/*$parameters = array('fieldstosearchall'=>$fieldstosearchall); +$reshook = $hookmanager->executeHooks('completeFieldsToSearchAll', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks +if ($reshook > 0) { + $fieldstosearchall = $hookmanager->resArray['fieldstosearchall']; +} elseif ($reshook == 0) { + $fieldstosearchall = array_merge($fieldstosearchall, $hookmanager->resArray['fieldstosearchall']); +}*/ // Definition of array of fields for columns $arrayfields = array(); @@ -226,6 +233,9 @@ $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook $sql .= preg_replace('/^,/', '', $hookmanager->resPrint); $sql = preg_replace('/,\s*$/', '', $sql); + +$sqlfields = $sql; // $sql fields to remove for count total + $sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t"; if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)"; @@ -279,7 +289,7 @@ if (!empty($id)) { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; // Add where from hooks $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; /* If a group by is required @@ -304,7 +314,8 @@ $sql = preg_replace('/,\s*$/', '', $sql); $nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { /* The fast and low memory method to get and count full list converts the sql into a sql count */ - $sqlforcount = preg_replace('/^SELECT[a-zA-Z0-9\._\s\(\),=<>\:\-\']+\sFROM/Ui', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql); + $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql); + $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount); $resql = $db->query($sqlforcount); if ($resql) { $objforcount = $db->fetch_object($resql); @@ -313,7 +324,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { dol_print_error($db); } - if (($page * $limit) > $nbtotalofrecords) { // if total of record found is smaller than page * limit, goto and load page 0 + if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller than the paging size (filtering), goto and load page 0 $page = 0; $offset = 0; } @@ -500,7 +511,7 @@ if ($limit > 0 && $limit != $conf->liste_limit) { $param .= '&limit='.urlencode($limit); } foreach ($search as $key => $val) { - if (is_array($search[$key]) && count($search[$key])) { + if (is_array($search[$key])) { foreach ($search[$key] as $skey) { if ($skey != '') { $param .= '&search_'.$key.'[]='.urlencode($skey); @@ -581,7 +592,7 @@ $moreforfilter.= $langs->trans('MyFilter') . ': '; +print ''; // Action column -if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { - print ''; +if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; $searchpicto = $form->showFilterButtons('left'); print $searchpicto; print ''; @@ -621,13 +632,13 @@ foreach ($object->fields as $key => $val) { $cssforfield .= ($cssforfield ? ' ' : '').'center'; } elseif (in_array($val['type'], array('timestamp'))) { $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; - } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) { + } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'rowid' && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) { $cssforfield .= ($cssforfield ? ' ' : '').'right'; } if (!empty($arrayfields['t.'.$key]['checked'])) { - print ''; + print ''; if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) { - print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1); + print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100'.($key == 'status' ? ' search_status width100 onrightofpage' : ''), 1); } elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:') === 0)) { print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', $cssforfield.' maxwidth250', 1); } elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) { @@ -652,11 +663,11 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; // Fields from hook $parameters = array('arrayfields'=>$arrayfields); -$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column -if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { - print ''; +if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; $searchpicto = $form->showFilterButtons(); print $searchpicto; print ''; @@ -669,8 +680,9 @@ $totalarray['nbfield'] = 0; // Fields title label // -------------------------------------------------------------------- print ''; -if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { +if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; + $totalarray['nbfield']++; } foreach ($object->fields as $key => $val) { $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); @@ -680,12 +692,12 @@ foreach ($object->fields as $key => $val) { $cssforfield .= ($cssforfield ? ' ' : '').'center'; } elseif (in_array($val['type'], array('timestamp'))) { $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; - } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) { + } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'rowid' && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) { $cssforfield .= ($cssforfield ? ' ' : '').'right'; } $cssforfield = preg_replace('/small\s*/', '', $cssforfield); // the 'small' css must not be used for the title label if (!empty($arrayfields['t.'.$key]['checked'])) { - print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''))."\n"; + print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''), 0, (empty($val['helplist']) ? '' : $val['helplist']))."\n"; $totalarray['nbfield']++; } } @@ -693,13 +705,13 @@ foreach ($object->fields as $key => $val) { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder, 'totalarray'=>&$totalarray); -$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column -if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { +if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; + $totalarray['nbfield']++; } -$totalarray['nbfield']++; print ''."\n"; @@ -707,7 +719,7 @@ print ''."\n"; $needToFetchEachLine = 0; if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) { foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) { - if (preg_match('/\$object/', $val)) { + if ($val && preg_match('/\$object/', $val)) { $needToFetchEachLine++; // There is at least one compute field that use $object } } @@ -739,14 +751,11 @@ while ($i < $imaxinloop) { $recuitment->fetch($obj->fk_recruitmentjobposition); $object->fk_recruitmentjobposition = $recuitment->getNomUrl(); $object->phone = $obj->phone; - // Output Kanban - if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - if ($massactionbutton || $massaction) { - $selected = 0; - } - // Output Kanban - print $object->getKanbanView(''); + if ($massactionbutton || $massaction) { + $selected = 0; } + // Output Kanban + print $object->getKanbanView(''); if ($i == ($imaxinloop - 1)) { print ''; print ''; @@ -756,7 +765,7 @@ while ($i < $imaxinloop) { $j = 0; print ''; // Action column - if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''; if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined $selected = 0; @@ -766,6 +775,9 @@ while ($i < $imaxinloop) { print ''; } print ''; + if (!$i) { + $totalarray['nbfield']++; + } } foreach ($object->fields as $key => $val) { $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); @@ -787,7 +799,7 @@ while ($i < $imaxinloop) { //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100'; if (!empty($arrayfields['t.'.$key]['checked'])) { - print '$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); - $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column - if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''; if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined $selected = 0; @@ -834,9 +846,9 @@ while ($i < $imaxinloop) { print ''; } print ''; - } - if (!$i) { - $totalarray['nbfield']++; + if (!$i) { + $totalarray['nbfield']++; + } } print ''."\n"; diff --git a/htdocs/recruitment/recruitmentjobposition_list.php b/htdocs/recruitment/recruitmentjobposition_list.php index 8a0d3f06540..4cb2d845828 100644 --- a/htdocs/recruitment/recruitmentjobposition_list.php +++ b/htdocs/recruitment/recruitmentjobposition_list.php @@ -593,13 +593,11 @@ while ($i < $imaxinloop) { print ''; print '
'; } - if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - if ($massactionbutton || $massaction) { - $selected = 0; - } - // Output Kanban - print $object->getKanbanView(''); + if ($massactionbutton || $massaction) { + $selected = 0; } + // Output Kanban + print $object->getKanbanView(''); if ($i == ($imaxinloop - 1)) { print '
'; print ''; diff --git a/htdocs/salaries/list.php b/htdocs/salaries/list.php index 35e82e96da1..7ef8db376b7 100644 --- a/htdocs/salaries/list.php +++ b/htdocs/salaries/list.php @@ -537,7 +537,8 @@ $totalarray = array(); $totalarray['nbfield'] = 0; $totalarray['val'] = array(); $totalarray['val']['totalttcfield'] = 0; -while ($i < ($limit ? min($num, $limit) : $num)) { +$imaxinloop = ($limit ? min($num, $limit) : $num); +while ($i < $imaxinloop) { $obj = $db->fetch_object($resql); if (empty($obj)) { break; // Should not happen @@ -574,7 +575,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) { } // Output Kanban print $salstatic->getKanbanView(''); - if ($i == (min($num, $limit) - 1)) { + if ($i == ($imaxinloop - 1)) { print ''; print ''; } diff --git a/htdocs/salaries/payments.php b/htdocs/salaries/payments.php index 807ae82f9af..15b50c6dfc3 100644 --- a/htdocs/salaries/payments.php +++ b/htdocs/salaries/payments.php @@ -534,7 +534,7 @@ $i = 0; $total = 0; $totalarray = array(); $totalarray['nbfield'] = 0; -while ($i < ($limit ? min($num, $limit) : $num)) { +while ($i < $imaxinloop) { $obj = $db->fetch_object($resql); if (empty($obj)) { break; @@ -544,8 +544,6 @@ while ($i < ($limit ? min($num, $limit) : $num)) { // Store properties in $object $object->setVarsFromFetchObj($obj); - - $userstatic->id = $obj->uid; $userstatic->lastname = $obj->lastname; $userstatic->firstname = $obj->firstname; @@ -570,18 +568,14 @@ while ($i < ($limit ? min($num, $limit) : $num)) { $paymentsalstatic->fk_bank = $accountlinestatic->getNomUrl(1); $paymentsalstatic->fk_user_author = $userstatic->getNomUrl(1); - - if ($mode == 'kanban') { if ($i == 0) { print ''; print '
'; } // Output Kanban - - print $paymentsalstatic->getKanbanView(''); - if ($i == (min($num, $limit) - 1)) { + if ($i == ($imaxinloop - 1)) { print '
'; print ''; } diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index b3f1888f505..226ddb55206 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -965,7 +965,9 @@ if ($resql) { $totalarray['val']['sp.total_ht'] = 0; $totalarray['val']['sp.total_tva'] = 0; $totalarray['val']['sp.total_ttc'] = 0; - while ($i < min($num, $limit)) { + + $imaxinloop = ($limit ? min($num, $limit) : $num); + while ($i < $imaxinloop) { $obj = $db->fetch_object($resql); $objectstatic->id = $obj->rowid; @@ -992,7 +994,7 @@ if ($resql) { $objectstatic->user_author_id = $userstatic->getNomUrl(1); $objectstatic->delivery_date = $obj->dp; print $objectstatic->getKanbanView(''); - if ($i == (min($num, $limit) - 1)) { + if ($i == ($imaxinloop - 1)) { print ''; print ''; }