dolibarr/htdocs/loan/list.php

448 lines
16 KiB
PHP
Raw Normal View History

2014-09-21 17:42:38 +02:00
<?php
2023-10-09 06:09:44 +02:00
/* Copyright (C) 2014-2023 Alexandre Spangaro <aspangaro@open-dsi.fr>
2015-03-27 18:09:00 +01:00
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
2018-05-19 08:06:52 +02:00
* Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
2014-09-21 17:42:38 +02:00
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
2019-09-23 21:55:30 +02:00
* along with this program. If not, see <https://www.gnu.org/licenses/>.
2014-09-21 17:42:38 +02:00
*/
/**
2018-11-08 10:04:25 +01:00
* \file htdocs/loan/list.php
2018-05-20 07:46:02 +02:00
* \ingroup loan
* \brief Page to list all loans
2014-09-21 17:42:38 +02:00
*/
2022-09-07 20:08:59 +02:00
// Load Dolibarr environment
2015-03-22 20:19:22 +01:00
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/loan/class/loan.class.php';
2014-09-21 17:42:38 +02:00
2018-05-26 21:11:25 +02:00
// Load translation files required by the page
2023-10-09 06:09:44 +02:00
$langs->loadLangs(array("banks", "bills", "compta", "loan"));
2014-09-21 17:42:38 +02:00
2023-10-17 15:27:07 +02:00
$massaction = GETPOST('massaction', 'alpha');
2020-04-20 18:38:25 +02:00
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
2020-09-18 17:13:01 +02:00
$sortfield = GETPOST('sortfield', 'aZ09comma');
2020-09-17 14:31:25 +02:00
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
2023-10-17 15:27:07 +02:00
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;
2023-10-17 15:27:07 +02:00
}
$offset = $limit * $page;
2014-09-21 17:42:38 +02:00
$pageprev = $page - 1;
$pagenext = $page + 1;
2020-01-13 13:35:29 +01:00
// Initialize technical objects
2023-10-09 06:09:44 +02:00
$hookmanager->initHooks(array('loanlist'));
$object = new Loan($db);
2020-01-13 13:35:29 +01:00
$extrafields = new ExtraFields($db);
if (!$sortfield) {
$sortfield = "l.rowid";
}
if (!$sortorder) {
$sortorder = "DESC";
}
2014-09-21 17:42:38 +02:00
$search_ref = GETPOST('search_ref', 'int');
$search_label = GETPOST('search_label', 'alpha');
$search_amount = GETPOST('search_amount', 'alpha');
2019-12-25 23:15:56 +01:00
2020-09-25 10:27:30 +02:00
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'loanlist'; // To manage different context of search
$optioncss = GETPOST('optioncss', 'alpha');
2023-01-16 17:10:26 +01:00
$mode = GETPOST('mode', 'alpha'); // mode view result
2014-11-04 20:53:07 +01:00
2023-10-09 06:09:44 +02:00
$permissiontoadd = $user->hasRight('loan', 'write');
// Security check
$socid = GETPOST('socid', 'int');
if ($user->socid) {
$socid = $user->socid;
}
$result = restrictedArea($user, 'loan', '', '', '');
2020-01-13 13:35:29 +01:00
2023-10-17 15:27:07 +02:00
2020-01-13 13:35:29 +01:00
/*
* Actions
*/
if (GETPOST('cancel', 'alpha')) {
2023-10-17 15:27:07 +02:00
$action = 'list';
$massaction = '';
}
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
$massaction = '';
}
2020-01-13 13:35:29 +01:00
$parameters = array();
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
2020-01-13 13:35:29 +01:00
if (empty($reshook)) {
2020-01-13 13:35:29 +01:00
// 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
2020-01-13 13:35:29 +01:00
$search_ref = "";
$search_label = "";
$search_amount = "";
}
2014-11-04 20:53:07 +01:00
}
2014-09-21 17:42:38 +02:00
2014-09-21 17:42:38 +02:00
/*
* View
*/
2023-10-09 06:09:44 +02:00
$form = new Form($db);
2020-01-13 13:35:29 +01:00
$now = dol_now();
2014-09-21 17:42:38 +02:00
2023-10-09 06:09:44 +02:00
$help_url="EN:Module_Loan|FR:Module_Emprunt";
2020-01-13 13:35:29 +01:00
$help_url = '';
$title = $langs->trans('Loans');
2014-09-21 17:42:38 +02:00
2023-10-09 06:09:44 +02:00
llxHeader('', $title, $help_url);
$arrayofselected = is_array($toselect) ? $toselect : array();
2023-10-17 15:27:07 +02:00
// Build and execute select
// --------------------------------------------------------------------
2018-05-20 07:46:02 +02:00
$sql = "SELECT l.rowid, l.label, l.capital, l.datestart, l.dateend, l.paid,";
2021-02-03 19:36:02 +01:00
$sql .= " SUM(pl.amount_capital) as alreadypaid";
2022-11-26 01:53:18 +01:00
$sqlfields = $sql; // $sql fields to remove for count total
$sql .= " FROM ".MAIN_DB_PREFIX."loan as l";
$linktopl = " LEFT JOIN ".MAIN_DB_PREFIX."payment_loan AS pl ON l.rowid = pl.fk_loan";
$sql .= $linktopl;
$sql .= " WHERE l.entity = ".$conf->entity;
if ($search_amount) {
$sql .= natural_search("l.capital", $search_amount, 1);
}
if ($search_ref) {
2021-04-24 20:18:11 +02:00
$sql .= " AND l.rowid = ".((int) $search_ref);
}
if ($search_label) {
$sql .= natural_search("l.label", $search_label);
}
$sql .= " GROUP BY l.rowid, l.label, l.capital, l.paid, l.datestart, l.dateend";
2020-01-13 13:35:29 +01:00
// Count total nb of records
$nbtotalofrecords = '';
2023-04-28 16:05:25 +02:00
if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
2022-11-26 01:53:18 +01:00
/* The fast and low memory method to get and count full list converts the sql into a sql count */
$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);
$nbtotalofrecords = $objforcount->nbtotalofrecords;
} else {
dol_print_error($db);
}
2023-10-17 15:27:07 +02:00
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller than the paging size (filtering), goto and load page 0
2018-05-20 07:46:02 +02:00
$page = 0;
$offset = 0;
}
2022-11-26 01:53:18 +01:00
$db->free($resql);
2015-11-28 19:08:52 +01:00
}
2023-01-24 14:32:20 +01:00
$arrayfields = array();
2022-11-26 01:53:18 +01:00
// Complete request and execute it with limit
$sql .= $db->order($sortfield, $sortorder);
if ($limit) {
$sql .= $db->plimit($limit + 1, $offset);
}
2020-01-13 21:19:32 +01:00
2022-11-26 01:53:18 +01:00
$resql = $db->query($sql);
if (!$resql) {
dol_print_error($db);
exit;
2020-01-13 13:35:29 +01:00
}
2022-11-26 01:53:18 +01:00
$num = $db->num_rows($resql);
2023-10-17 15:27:07 +02:00
// Direct jump if only one record found
if ($num == 1 && getDolGlobalInt('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
$obj = $db->fetch_object($resql);
$id = $obj->rowid;
header("Location: ".dol_buildpath('/mymodule/myobject_card.php', 1).'?id='.((int) $id));
exit;
}
2020-01-13 13:35:29 +01:00
// Output page
// --------------------------------------------------------------------
if ($resql) {
2014-11-10 06:08:50 +01:00
$i = 0;
2014-09-21 17:42:38 +02:00
$param = '';
2023-01-11 18:22:46 +01:00
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) {
2023-04-08 01:43:21 +02:00
$param .= '&limit='.((int) $limit);
}
if ($search_ref) {
$param .= "&search_ref=".urlencode($search_ref);
}
if ($search_label) {
$param .= "&search_label=".urlencode($search_label);
}
if ($search_amount) {
$param .= "&search_amount=".urlencode($search_amount);
}
if ($optioncss != '') {
$param .= '&optioncss='.urlencode($optioncss);
}
2018-05-20 07:46:02 +02:00
$url = DOL_URL_ROOT.'/loan/card.php?action=create';
if (!empty($socid)) {
$url .= '&socid='.$socid;
}
2023-01-11 18:22:46 +01:00
$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'));
2023-10-09 06:09:44 +02:00
$newcardbutton .= dolGetButtonTitleSeparator();
$newcardbutton .= dolGetButtonTitle($langs->trans('NewLoan'), '', 'fa fa-plus-circle', $url, '', $permissiontoadd);
2023-10-17 15:27:07 +02:00
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
2020-01-13 13:35:29 +01:00
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
if ($optioncss != '') {
print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
}
2019-12-01 10:20:11 +01:00
print '<input type="hidden" name="token" value="'.newToken().'">';
2020-01-13 13:35:29 +01:00
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="action" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
2023-10-17 15:27:07 +02:00
print '<input type="hidden" name="page" value="'.$page.'">';
2020-01-13 13:35:29 +01:00
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
2023-10-17 15:27:07 +02:00
print '<input type="hidden" name="page_y" value="">';
2023-01-11 18:22:46 +01:00
print '<input type="hidden" name="mode" value="'.$mode.'">';
2023-10-17 15:27:07 +02:00
$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 .= dolGetButtonTitleSeparator();
$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/loan/card.php', 1).'?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permissiontoadd);
2023-10-17 15:27:07 +02:00
print_barre_liste($langs->trans("Loans"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'money-bill-alt', 0, $newcardbutton, '', $limit, 0, 0, 1);
2015-11-28 19:08:52 +01:00
2023-10-17 15:27:07 +02:00
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if (empty($reshook)) {
$moreforfilter .= $hookmanager->resPrint;
} else {
$moreforfilter = $hookmanager->resPrint;
}
if (!empty($moreforfilter)) {
print '<div class="liste_titre liste_titre_bydiv centpercent">';
print $moreforfilter;
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '</div>';
}
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
$selectedfields = ($mode != 'kanban' ? $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')) : ''); // This also change content of $arrayfields
$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
2019-12-25 23:15:56 +01:00
2018-05-20 07:46:02 +02:00
print '<div class="div-table-responsive">';
2023-10-17 15:27:07 +02:00
print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
2023-10-17 15:27:07 +02:00
// Fields title search
// --------------------------------------------------------------------
2017-04-01 12:46:47 +02:00
print '<tr class="liste_titre_filter">';
2023-10-17 15:27:07 +02:00
// Action column
2023-01-31 13:28:05 +01:00
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
2023-10-17 15:27:07 +02:00
print '<td class="liste_titre center maxwidthsearch">';
$searchpicto = $form->showFilterButtons('left');
2023-01-31 13:28:05 +01:00
print $searchpicto;
print '</td>';
}
2023-10-09 06:09:44 +02:00
// Filter: Ref
2014-11-10 06:08:50 +01:00
print '<td class="liste_titre"><input class="flat" size="4" type="text" name="search_ref" value="'.$search_ref.'"></td>';
2023-10-09 06:09:44 +02:00
// Filter: Label
2014-11-10 06:08:50 +01:00
print '<td class="liste_titre"><input class="flat" size="12" type="text" name="search_label" value="'.$search_label.'"></td>';
2023-10-09 06:09:44 +02:00
// Filter: Amount
2019-03-03 08:55:27 +01:00
print '<td class="liste_titre right" ><input class="flat" size="8" type="text" name="search_amount" value="'.$search_amount.'"></td>';
2023-10-09 06:09:44 +02:00
// No filter: Date start
2014-09-24 04:10:29 +02:00
print '<td class="liste_titre">&nbsp;</td>';
2023-10-09 06:09:44 +02:00
// No filter: Date end
2018-05-20 07:46:02 +02:00
print '<td class="liste_titre">&nbsp;</td>';
2023-10-09 06:09:44 +02:00
// No filter: Status
2017-01-07 17:32:45 +01:00
print '<td class="liste_titre"></td>';
2023-10-09 06:09:44 +02:00
2023-10-17 15:27:07 +02:00
// Action column
2023-01-31 13:28:05 +01:00
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
2023-10-17 15:27:07 +02:00
print '<td class="liste_titre center maxwidthsearch">';
$searchpicto = $form->showFilterButtons();
2023-01-31 13:28:05 +01:00
print $searchpicto;
print '</td>';
}
2023-10-17 15:27:07 +02:00
print '</tr>'."\n";
2015-03-22 20:57:41 +01:00
2023-06-28 11:50:28 +02:00
$totalarray = array();
$totalarray['nbfield'] = 0;
2020-01-13 13:35:29 +01:00
// Fields title label
// --------------------------------------------------------------------
2017-04-01 12:46:47 +02:00
print '<tr class="liste_titre">';
2023-10-17 15:27:07 +02:00
// Action column
2023-01-31 13:28:05 +01:00
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch ');
2023-06-28 11:50:28 +02:00
$totalarray['nbfield']++;
2023-01-31 13:28:05 +01:00
}
print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "l.rowid", "", $param, "", $sortfield, $sortorder);
2023-06-28 11:50:28 +02:00
$totalarray['nbfield']++;
2019-03-03 08:55:27 +01:00
print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "l.label", "", $param, '', $sortfield, $sortorder, 'left ');
2023-06-28 11:50:28 +02:00
$totalarray['nbfield']++;
2019-03-03 08:55:27 +01:00
print_liste_field_titre("LoanCapital", $_SERVER["PHP_SELF"], "l.capital", "", $param, '', $sortfield, $sortorder, 'right ');
2023-06-28 11:50:28 +02:00
$totalarray['nbfield']++;
2019-03-03 08:55:27 +01:00
print_liste_field_titre("DateStart", $_SERVER["PHP_SELF"], "l.datestart", "", $param, '', $sortfield, $sortorder, 'center ');
2023-06-28 11:50:28 +02:00
$totalarray['nbfield']++;
2019-03-03 08:55:27 +01:00
print_liste_field_titre("DateEnd", $_SERVER["PHP_SELF"], "l.dateend", "", $param, '', $sortfield, $sortorder, 'center ');
2023-06-28 11:50:28 +02:00
$totalarray['nbfield']++;
2019-03-03 08:55:27 +01:00
print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "l.paid", "", $param, '', $sortfield, $sortorder, 'right ');
2023-06-28 11:50:28 +02:00
$totalarray['nbfield']++;
2023-01-31 13:28:05 +01:00
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch ');
2023-06-28 11:50:28 +02:00
$totalarray['nbfield']++;
2023-01-31 13:28:05 +01:00
}
2020-01-13 21:19:32 +01:00
print "</tr>\n";
2020-01-13 13:35:29 +01:00
// Loop on record
// --------------------------------------------------------------------
$i = 0;
2023-06-28 11:50:28 +02:00
$savnbfield = $totalarray['nbfield'];
2020-01-13 13:35:29 +01:00
$totalarray = array();
2023-10-17 15:27:07 +02:00
$totalarray['nbfield'] = 0;
2023-03-02 19:40:28 +01:00
$imaxinloop = ($limit ? min($num, $limit) : $num);
while ($i < $imaxinloop) {
2014-09-24 04:10:29 +02:00
$obj = $db->fetch_object($resql);
if (empty($obj)) {
break; // Should not happen
}
2020-01-13 21:19:32 +01:00
2023-10-09 06:09:44 +02:00
$object->id = $obj->rowid;
$object->ref = $obj->rowid;
$object->label = $obj->label;
$object->paid = $obj->paid;
2015-03-22 20:57:41 +01:00
2014-09-21 17:42:38 +02:00
2023-01-11 18:22:46 +01:00
if ($mode == 'kanban') {
if ($i == 0) {
2023-06-28 11:50:28 +02:00
print '<tr class="trkanban"><td colspan="'.$savnbfield.'">';
2023-02-19 02:39:39 +01:00
print '<div class="box-flex-container kanban">';
2023-01-11 18:22:46 +01:00
}
// Output Kanban
2023-10-09 06:09:44 +02:00
$object->datestart= $obj->datestart;
$object->dateend = $obj->dateend;
$object->capital = $obj->capital;
$object->totalpaid = $obj->paid;
2014-09-21 17:42:38 +02:00
2023-10-17 15:27:07 +02:00
// Output Kanban
$selected = -1;
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;
if (in_array($object->id, $arrayofselected)) {
$selected = 1;
}
}
print $object->getKanbanView('', array('selected' => $selected));
2023-03-02 19:40:28 +01:00
if ($i == ($imaxinloop - 1)) {
2023-01-11 18:22:46 +01:00
print '</div>';
print '</td></tr>';
}
} else {
2023-10-17 15:27:07 +02:00
print '<tr data-rowid="'.$object->id.'" class="oddeven">';
2014-09-21 17:42:38 +02:00
2023-01-31 13:28:05 +01:00
// Action column
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td></td>';
}
2023-01-11 18:22:46 +01:00
// Ref
2023-10-09 06:09:44 +02:00
print '<td>'.$object->getNomUrl(1).'</td>';
2014-09-21 17:42:38 +02:00
2023-01-11 18:22:46 +01:00
// Label
print '<td>'.dol_trunc($obj->label, 42).'</td>';
2014-09-21 17:42:38 +02:00
2023-01-11 18:22:46 +01:00
// Capital
print '<td class="right maxwidth100"><span class="amount">'.price($obj->capital).'</span></td>';
2018-05-20 07:46:02 +02:00
2023-01-11 18:22:46 +01:00
// Date start
print '<td class="center width100">'.dol_print_date($db->jdate($obj->datestart), 'day').'</td>';
2014-09-21 17:42:38 +02:00
2023-01-11 18:22:46 +01:00
// Date end
print '<td class="center width100">'.dol_print_date($db->jdate($obj->dateend), 'day').'</td>';
2023-01-11 18:22:46 +01:00
print '<td class="right nowrap">';
2023-10-09 06:09:44 +02:00
print $object->LibStatut($obj->paid, 5, $obj->alreadypaid);
2023-01-11 18:22:46 +01:00
print '</td>';
2015-03-22 20:57:41 +01:00
2023-01-31 13:28:05 +01:00
// Action column
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td></td>';
}
2023-01-11 18:22:46 +01:00
2023-10-17 15:27:07 +02:00
print '</tr>'."\n";
2023-01-11 18:22:46 +01:00
}
2014-09-24 04:10:29 +02:00
$i++;
2014-09-21 17:42:38 +02:00
}
2014-09-24 04:10:29 +02:00
2019-12-25 23:15:56 +01:00
// If no record found
if ($num == 0) {
2019-12-25 23:15:56 +01:00
$colspan = 7;
//foreach ($arrayfields as $key => $val) { if (!empty($val['checked'])) $colspan++; }
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
}
2020-01-13 13:35:29 +01:00
$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
2023-10-17 15:27:07 +02:00
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
2020-01-13 13:35:29 +01:00
print $hookmanager->resPrint;
2020-01-13 21:19:32 +01:00
2020-01-13 13:35:29 +01:00
print '</table>'."\n";
print '</div>'."\n";
2020-01-13 21:19:32 +01:00
2020-01-13 13:35:29 +01:00
print '</form>'."\n";
2020-01-13 21:19:32 +01:00
2018-05-20 07:46:02 +02:00
$db->free($resql);
2020-05-21 15:05:19 +02:00
} else {
2018-05-20 07:46:02 +02:00
dol_print_error($db);
2014-09-21 17:42:38 +02:00
}
2018-08-13 11:25:48 +02:00
// End of page
2014-09-21 17:42:38 +02:00
llxFooter();
2015-03-27 18:09:00 +01:00
$db->close();