';
$tmp = getCustomerProposalPieChart($socid);
if ($tmp) {
print $tmp;
- print '
';
}
$tmp = getCustomerOrderPieChart($socid);
if ($tmp) {
print $tmp;
- print '
';
}
/*
diff --git a/htdocs/expensereport/payment/list.php b/htdocs/expensereport/payment/list.php
index 60221163175..5efef914f43 100644
--- a/htdocs/expensereport/payment/list.php
+++ b/htdocs/expensereport/payment/list.php
@@ -76,10 +76,10 @@ $search_amount = GETPOST('search_amount', 'alpha'); // alpha because we must b
$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
-$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOSTINT('page');
-
-if (empty($page) || $page == -1) {
- $page = 0; // If $page is not defined, or '' or -1
+$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT('page');
+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;
}
$offset = $limit * $page;
$pageprev = $page - 1;
@@ -147,8 +147,10 @@ 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
$search_ref = '';
$search_date_startday = '';
@@ -171,19 +173,28 @@ if (empty($reshook)) {
* View
*/
-llxHeader('', $langs->trans('ListPayment'));
-
$form = new Form($db);
$formother = new FormOther($db);
$accountstatic = new Account($db);
$userstatic = new User($db);
$paymentexpensereportstatic = new PaymentExpenseReport($db);
+
+// Build and execute select
+// --------------------------------------------------------------------
$sql = 'SELECT pndf.rowid, pndf.rowid as ref, pndf.datep, pndf.amount as pamount, pndf.num_payment';
-$sql .= ', u.rowid as userid, u.login, u.lastname, u.firstname';
+$sql .= ', u.rowid as userid, u.login, u.email, u.lastname, u.firstname, u.photo';
$sql .= ', c.code as paiement_type, c.libelle as paiement_libelle';
$sql .= ', ba.rowid as bid, ba.ref as bref, ba.label as blabel, ba.number, ba.account_number as account_number, ba.iban_prefix, ba.bic, ba.currency_code, ba.fk_accountancy_journal as accountancy_journal';
$sql .= ', SUM(pndf.amount)';
+// Add fields from hooks
+$parameters = array();
+$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
+$sql .= $hookmanager->resPrint;
+$sql = preg_replace('/,\s*$/', '', $sql);
+
+$sqlfields = $sql; // $sql fields to remove for count total
+
$sql .= ' FROM '.MAIN_DB_PREFIX.'payment_expensereport AS pndf';
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'expensereport AS ndf ON ndf.rowid=pndf.fk_expensereport';
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement AS c ON pndf.fk_typepayment = c.id';
@@ -212,7 +223,7 @@ if ($search_user) {
$sql .= natural_search(array('u.login', 'u.lastname', 'u.firstname'), $search_user);
}
if ($search_payment_type != '') {
- $sql .= " AND c.code='".$db->escape($search_payment_type)."'";
+ $sql .= " AND c.code = '".$db->escape($search_payment_type)."'";
}
if ($search_cheque_num != '') {
$sql .= natural_search('pndf.num_payment', $search_cheque_num);
@@ -229,40 +240,65 @@ if ($search_all) {
// Add where from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
+// Add where from hooks
+$parameters = array();
+$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
+$sql .= $hookmanager->resPrint;
-$sql .= ' GROUP BY pndf.rowid, pndf.datep, pndf.amount, pndf.num_payment, u.rowid, u.login, u.lastname, u.firstname, c.code, c.libelle,';
+$sql .= ' GROUP BY pndf.rowid, pndf.datep, pndf.amount, pndf.num_payment, u.rowid, u.login, u.email, u.lastname, u.firstname, u.photo, c.code, c.libelle,';
$sql .= ' ba.rowid, ba.ref, ba.label, ba.number, ba.account_number, ba.iban_prefix, ba.bic, ba.currency_code, ba.fk_accountancy_journal';
-$sql .= $db->order($sortfield, $sortorder);
-
+// Count total nb of records
$nbtotalofrecords = '';
if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
- $result = $db->query($sql);
- $nbtotalofrecords = $db->num_rows($result);
- if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
+ /* 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);
+ }
+
+ if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller than the paging size (filtering), goto and load page 0
$page = 0;
$offset = 0;
}
+ $db->free($resql);
}
-$sql .= $db->plimit($limit + 1, $offset);
+// Complete request and execute it with limit
+$sql .= $db->order($sortfield, $sortorder);
+if ($limit) {
+ $sql .= $db->plimit($limit + 1, $offset);
+}
$resql = $db->query($sql);
if (!$resql) {
dol_print_error($db);
- llxFooter();
- $db->close();
exit;
}
$num = $db->num_rows($resql);
$i = 0;
+
+
+// Output page
+// --------------------------------------------------------------------
+
+llxHeader('', $langs->trans('ListPayment'));
+
+$arrayofselected = is_array($toselect) ? $toselect : array();
+
$param = '';
if (!empty($mode)) {
$param .= '&mode='.urlencode($mode);
}
-if (!empty($contextpage) && $contextpage != $_SERVER['PHP_SELF']) {
+if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
@@ -305,24 +341,42 @@ if ($search_cheque_num) {
if ($search_amount) {
$param .= '&search_amount='.urlencode($search_amount);
}
-
if ($search_bank_account) {
$param .= '&search_bank_account='.urlencode((string) ($search_bank_account));
}
// Add $param from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
+// Add $param from hooks
+$parameters = array('param' => &$param);
+$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
+$param .= $hookmanager->resPrint;
-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);
+$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
+print $hookmanager->resPrint;
+
+print ''."\n";
+print '
'."\n";
+
+print ''."\n";
// End of page
llxFooter();
diff --git a/htdocs/product/list.php b/htdocs/product/list.php
index cc2d1a26ed4..6a4eb772ef7 100644
--- a/htdocs/product/list.php
+++ b/htdocs/product/list.php
@@ -1011,7 +1011,7 @@ if (!empty($arrayfields['thumbnail']['checked'])) {
}
if (!empty($arrayfields['p.label']['checked'])) {
print '
';
}
// Type
diff --git a/htdocs/product/stock/movement_list.php b/htdocs/product/stock/movement_list.php
index c6a2463fe2f..4e4c4500dc7 100644
--- a/htdocs/product/stock/movement_list.php
+++ b/htdocs/product/stock/movement_list.php
@@ -1156,7 +1156,7 @@ print '