diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php
index ebbd01ffffd..64ddc447053 100644
--- a/htdocs/core/lib/product.lib.php
+++ b/htdocs/core/lib/product.lib.php
@@ -425,7 +425,7 @@ function product_lot_admin_prepare_head()
*/
function show_stats_for_company($product, $socid)
{
- global $conf, $langs, $user, $db, $hookmanager;
+ global $langs, $user, $db, $hookmanager;
$form = new Form($db);
diff --git a/htdocs/product/stats/bom.php b/htdocs/product/stats/bom.php
index 4e9cc30d12a..d680bfd524a 100644
--- a/htdocs/product/stats/bom.php
+++ b/htdocs/product/stats/bom.php
@@ -47,7 +47,6 @@ if ($user->socid) {
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('productstatsbom'));
-$mesg = '';
$option = '';
// Load variable for pagination
@@ -68,6 +67,8 @@ if (!$sortfield) {
$sortfield = "b.date_valid";
}
+$socid = 0;
+
$result = restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype);
@@ -115,7 +116,7 @@ if ($id > 0 || !empty($ref)) {
print '
';
print '
';
- print '
';
+ print '';
$nboflines = show_stats_for_company($product, $socid);
@@ -182,6 +183,9 @@ if ($id > 0 || !empty($ref)) {
$bomtmp->fk_product = $objp->fk_product;
$bom_data_result[$objp->rowid]['link'] = $bomtmp->getNomUrl(1, 'production');
$bom_data_result[$objp->rowid]['product'] = (array_key_exists($objp->fk_product, $product_cache) ? $product_cache[$objp->fk_product]->getNomUrl(1) : '');
+ if (empty($bom_data_result[$objp->rowid]['qty_toproduce'])) {
+ $bom_data_result[$objp->rowid]['qty_toproduce'] = 0;
+ }
$bom_data_result[$objp->rowid]['qty_toproduce'] += ($objp->qty_toproduce > 0 ? $objp->qty_toproduce : 0);
$bom_data_result[$objp->rowid]['qty_toconsume'] = 0;
$bom_data_result[$objp->rowid]['date_valid'] = dol_print_date($db->jdate($objp->date_valid), 'dayhour');
@@ -246,6 +250,9 @@ if ($id > 0 || !empty($ref)) {
$bom_data_result[$objp->rowid]['link'] = $bomtmp->getNomUrl(1, 'production');
$bom_data_result[$objp->rowid]['product'] = (array_key_exists($objp->fk_product, $product_cache) ? $product_cache[$objp->fk_product]->getNomUrl(1) : '');
$bom_data_result[$objp->rowid]['qty_toproduce'] = 0;
+ if (empty($bom_data_result[$objp->rowid]['qty_toconsume'])) {
+ $bom_data_result[$objp->rowid]['qty_toconsume'] = 0;
+ }
$bom_data_result[$objp->rowid]['qty_toconsume'] += ($objp->qty_toconsume > 0 ? $objp->qty_toconsume : 0);
$bom_data_result[$objp->rowid]['date_valid'] = dol_print_date($db->jdate($objp->date_valid), 'dayhour');
$bom_data_result[$objp->rowid]['status'] = $bomtmp->LibStatut($objp->status, 5);
diff --git a/htdocs/product/stats/commande.php b/htdocs/product/stats/commande.php
index 8c9dbd7830b..4bca950f4e7 100644
--- a/htdocs/product/stats/commande.php
+++ b/htdocs/product/stats/commande.php
@@ -233,7 +233,7 @@ if ($id > 0 || !empty($ref)) {
print '';
print '
';
print $langs->trans('Period').' ('.$langs->trans("OrderDate").') - ';
- print $langs->trans('Month').':
';
+ print $langs->trans('Month').':
';
print $langs->trans('Year').':'.$formother->selectyear($search_year ? $search_year : - 1, 'search_year', 1, 20, 5);
print $langs->trans('Status');
$formorder->selectOrderStatus($search_status, 1, 'search_status');
@@ -290,10 +290,10 @@ if ($id > 0 || !empty($ref)) {
}
}
print '
';
- if ($num < $limit) {
- print ''.$langs->trans("Total").' ';
+ if ($num < $limit && empty($offset)) {
+ print ''.$langs->trans("Total").' ';
} else {
- print ''.$langs->trans("Totalforthispage").' ';
+ print ''.$form->textwithpicto($langs->trans("Total"), $langs->trans("Totalforthispage")).' ';
}
print ' ';
// delivery planned date
diff --git a/htdocs/product/stats/commande_fournisseur.php b/htdocs/product/stats/commande_fournisseur.php
index e91555cea67..830533f695b 100644
--- a/htdocs/product/stats/commande_fournisseur.php
+++ b/htdocs/product/stats/commande_fournisseur.php
@@ -233,7 +233,7 @@ if ($id > 0 || !empty($ref)) {
print '';
print '
';
print $langs->trans('Period').' ('.$langs->trans("OrderDate").') - ';
- print $langs->trans('Month').': ';
+ print $langs->trans('Month').': ';
print $langs->trans('Year').':'.$formother->selectyear($search_year ? $search_year : - 1, 'search_year', 1, 20, 5);
print $langs->trans('Status');
$formorder->selectSupplierOrderStatus($search_status, 1, 'search_status');
@@ -290,10 +290,10 @@ if ($id > 0 || !empty($ref)) {
}
}
print '
';
- if ($num < $limit) {
- print ''.$langs->trans("Total").' ';
+ if ($num < $limit && empty($offset)) {
+ print ''.$langs->trans("Total").' ';
} else {
- print ''.$langs->trans("Totalforthispage").' ';
+ print ''.$form->textwithpicto($langs->trans("Total"), $langs->trans("Totalforthispage")).' ';
}
print ' ';
// delivery planned date
diff --git a/htdocs/product/stats/contrat.php b/htdocs/product/stats/contrat.php
index 6712ac33185..2a7e54e9fec 100644
--- a/htdocs/product/stats/contrat.php
+++ b/htdocs/product/stats/contrat.php
@@ -63,6 +63,8 @@ if (!$sortfield) {
$sortfield = "c.date_contrat";
}
+$socid = 0;
+
$result = restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype);
@@ -175,12 +177,14 @@ if ($id > 0 || !empty($ref)) {
if ($limit > 0 && $limit != $conf->liste_limit) {
$option .= '&limit='.((int) $limit);
}
+ /*
if (!empty($search_month)) {
$option .= '&search_month='.urlencode($search_month);
}
if (!empty($search_year)) {
$option .= '&search_year='.urlencode((string) ($search_year));
}
+ */
print ' \n";
$i++;
}
+ } else {
+ print ''.$langs->trans("None").' ';
}
print '
';
diff --git a/htdocs/product/stats/expedition.php b/htdocs/product/stats/expedition.php
index a03e104f7d4..2b11d2255b5 100644
--- a/htdocs/product/stats/expedition.php
+++ b/htdocs/product/stats/expedition.php
@@ -213,7 +213,7 @@ if ($id > 0 || !empty($ref)) {
print '';
print '
';
print $langs->trans('Period').' ('.$langs->trans("DateCreation").') - ';
- print $langs->trans('Month').':
';
+ print $langs->trans('Month').':
';
print $langs->trans('Year').':'.$formother->selectyear($search_year ? $search_year : - 1, 'search_year', 1, 20, 5);
print '
';
print '
';
@@ -269,10 +269,10 @@ if ($id > 0 || !empty($ref)) {
}
}
print '
';
- if ($num < $limit) {
- print ''.$langs->trans("Total").' ';
+ if ($num < $limit && empty($offset)) {
+ print ''.$langs->trans("Total").' ';
} else {
- print ''.$langs->trans("Totalforthispage").' ';
+ print ''.$form->textwithpicto($langs->trans("Total"), $langs->trans("Totalforthispage")).' ';
}
print ' ';
print ' ';
diff --git a/htdocs/product/stats/facture.php b/htdocs/product/stats/facture.php
index 3dcc2ad3d98..76a0b873b95 100644
--- a/htdocs/product/stats/facture.php
+++ b/htdocs/product/stats/facture.php
@@ -75,6 +75,8 @@ if (!$sortfield) {
$sortfield = "f.datef";
}
+$option = '';
+
$search_date_startday = GETPOSTINT('search_date_startday');
if (!empty($search_date_startday)) {
$option .= '&search_date_startday='.$search_date_startday;
@@ -239,6 +241,7 @@ if ($id > 0 || !empty($ref)) {
$sql .= " AND f.fk_soc = ".((int) $socid);
}
// Add where from extra fields
+ $extrafieldsobjectkey = 'facture';
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
// Add where from hooks
$parameters = array();
@@ -274,12 +277,6 @@ if ($id > 0 || !empty($ref)) {
if ($limit > 0 && $limit != $conf->liste_limit) {
$option .= '&limit='.((int) $limit);
}
- if (!empty($search_month)) {
- $option .= '&search_month='.urlencode($search_month);
- }
- if (!empty($search_year)) {
- $option .= '&search_year='.urlencode((string) ($search_year));
- }
// Add $param from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
@@ -373,10 +370,10 @@ if ($id > 0 || !empty($ref)) {
}
}
print ' ';
- if ($num < $limit) {
- print ''.$langs->trans("Total").' ';
+ if ($num < $limit && empty($offset)) {
+ print ''.$langs->trans("Total").' ';
} else {
- print ''.$langs->trans("Totalforthispage").' ';
+ print ''.$form->textwithpicto($langs->trans("Total"), $langs->trans("Totalforthispage")).' ';
}
print ' ';
print ''.$total_qty.' ';
diff --git a/htdocs/product/stats/facture_fournisseur.php b/htdocs/product/stats/facture_fournisseur.php
index 2ee2e18b793..33e57bbc939 100644
--- a/htdocs/product/stats/facture_fournisseur.php
+++ b/htdocs/product/stats/facture_fournisseur.php
@@ -49,6 +49,8 @@ if (!empty($user->socid)) {
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('productstatssupplierinvoice'));
+$option = '';
+
// Load variable for pagination
$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
@@ -215,7 +217,7 @@ if ($id > 0 || !empty($ref)) {
print '';
print '
';
print $langs->trans('Period').' ('.$langs->trans("DateInvoice").') - ';
- print $langs->trans('Month').':
';
+ print $langs->trans('Month').':
';
print $langs->trans('Year').':'.$formother->selectyear($search_year ? $search_year : - 1, 'search_year', 1, 20, 5);
print '
';
print '
';
@@ -271,10 +273,10 @@ if ($id > 0 || !empty($ref)) {
}
}
print '
';
- if ($num < $limit) {
- print ''.$langs->trans("Total").' ';
+ if ($num < $limit && empty($offset)) {
+ print ''.$langs->trans("Total").' ';
} else {
- print ''.$langs->trans("Totalforthispage").' ';
+ print ''.$form->textwithpicto($langs->trans("Total"), $langs->trans("Totalforthispage")).' ';
}
print ' ';
print ''.$total_qty.' ';
diff --git a/htdocs/product/stats/facturerec.php b/htdocs/product/stats/facturerec.php
index 83d66963e51..63426a4667a 100644
--- a/htdocs/product/stats/facturerec.php
+++ b/htdocs/product/stats/facturerec.php
@@ -156,7 +156,7 @@ if ($id > 0 || !empty($ref)) {
print ''.$langs->trans("ClinkOnALinkOfColumn", $langs->transnoentitiesnoconv("Referers")).' ';
} elseif ($user->hasRight('facture', 'lire')) {
$sql = "SELECT DISTINCT s.nom as name, s.rowid as socid, s.code_client,";
- $sql .= "f.titre as title, f.datec, f.rowid as facid, f.suspended as suspended,";
+ $sql .= "f.rowid as facid, 0 as type, f.titre as title, f.datec, f.suspended as suspended,";
$sql .= " d.rowid, d.total_ht as total_ht, d.qty"; // We must keep the d.rowid here to not loose record because of the distinct used to ignore duplicate line when link on societe_commerciaux is used
if (!$user->hasRight('societe', 'client', 'voir')) {
$sql .= ", sc.fk_soc, sc.fk_user ";
@@ -233,7 +233,7 @@ if ($id > 0 || !empty($ref)) {
print '';
print '
';
print $langs->trans('Period').' ('.$langs->trans("DateInvoice").') - ';
- print $langs->trans('Month').':
';
+ print $langs->trans('Month').':
';
print $langs->trans('Year').':'.$formother->selectyear($search_year ? $search_year : - 1, 'search_year', 1, 20, 5);
print '
';
print '
';
@@ -287,10 +287,10 @@ if ($id > 0 || !empty($ref)) {
}
}
print '
';
- if ($num < $limit) {
- print ''.$langs->trans("Total").' ';
+ if ($num < $limit && empty($offset)) {
+ print ''.$langs->trans("Total").' ';
} else {
- print ''.$langs->trans("Totalforthispage").' ';
+ print ''.$form->textwithpicto($langs->trans("Total"), $langs->trans("Totalforthispage")).' ';
}
print ' ';
print ''.$total_qty.' ';
diff --git a/htdocs/product/stats/mo.php b/htdocs/product/stats/mo.php
index d98a73fbc79..763afe6f07b 100644
--- a/htdocs/product/stats/mo.php
+++ b/htdocs/product/stats/mo.php
@@ -73,6 +73,8 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter',
$search_year = '';
}
+$socid = 0;
+
$result = restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype);
@@ -124,7 +126,7 @@ if ($id > 0 || !empty($ref)) {
print '';
print '
';
- print '
';
+ print '';
$nboflines = show_stats_for_company($product, $socid);
@@ -211,7 +213,7 @@ if ($id > 0 || !empty($ref)) {
print '