From 2d3915b88c1dd0ecd05eafac93d753c30417f039 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 23 Dec 2015 14:31:42 +0100 Subject: [PATCH 01/13] Fix hook implementation on some thirdparty pages --- htdocs/margin/tabs/thirdpartyMargins.php | 15 +++ htdocs/societe/notify/card.php | 103 ++++++++++-------- htdocs/societe/price.php | 127 +++++++++++++---------- 3 files changed, 143 insertions(+), 102 deletions(-) diff --git a/htdocs/margin/tabs/thirdpartyMargins.php b/htdocs/margin/tabs/thirdpartyMargins.php index bd2730edda0..0a0239f0bf2 100644 --- a/htdocs/margin/tabs/thirdpartyMargins.php +++ b/htdocs/margin/tabs/thirdpartyMargins.php @@ -49,6 +49,21 @@ $pagenext = $page + 1; if (! $sortorder) $sortorder="DESC"; if (! $sortfield) $sortfield="f.datef"; +$object = new Societe($db); + +// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +$hookmanager->initHooks(array('thirdpartymargins','globalcard')); + + +/* + * Actions + */ + +$parameters=array('id'=>$socid); +$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'); + + /* * View diff --git a/htdocs/societe/notify/card.php b/htdocs/societe/notify/card.php index 2855e82b076..ea0baec1a02 100644 --- a/htdocs/societe/notify/card.php +++ b/htdocs/societe/notify/card.php @@ -56,65 +56,78 @@ if (! $sortfield) $sortfield="c.lastname"; $now=dol_now(); +$object = new Societe($db); + +// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +$hookmanager->initHooks(array('thirdpartynotification','globalcard')); + + /* * Actions */ -// Add a notification -if ($action == 'add') +$parameters=array('id'=>$socid); +$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'); + +if (empty($reshook)) { - $error=0; - - if (empty($contactid)) + // Add a notification + if ($action == 'add') { - setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Contact")), 'errors'); - $error++; - } - if ($actionid <= 0) - { - setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Action")), 'errors'); - $error++; - } - - if (! $error) - { - $db->begin(); - - $sql = "DELETE FROM ".MAIN_DB_PREFIX."notify_def"; - $sql .= " WHERE fk_soc=".$socid." AND fk_contact=".$contactid." AND fk_action=".$actionid; - if ($db->query($sql)) + $error=0; + + if (empty($contactid)) { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."notify_def (datec,fk_soc, fk_contact, fk_action)"; - $sql .= " VALUES ('".$db->idate($now)."',".$socid.",".$contactid.",".$actionid.")"; - - if (! $db->query($sql)) - { - $error++; - dol_print_error($db); - } + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Contact")), 'errors'); + $error++; } - else + if ($actionid <= 0) { - dol_print_error($db); + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Action")), 'errors'); + $error++; } - + if (! $error) { - $db->commit(); - } - else - { - $db->rollback(); + $db->begin(); + + $sql = "DELETE FROM ".MAIN_DB_PREFIX."notify_def"; + $sql .= " WHERE fk_soc=".$socid." AND fk_contact=".$contactid." AND fk_action=".$actionid; + if ($db->query($sql)) + { + $sql = "INSERT INTO ".MAIN_DB_PREFIX."notify_def (datec,fk_soc, fk_contact, fk_action)"; + $sql .= " VALUES ('".$db->idate($now)."',".$socid.",".$contactid.",".$actionid.")"; + + if (! $db->query($sql)) + { + $error++; + dol_print_error($db); + } + } + else + { + dol_print_error($db); + } + + if (! $error) + { + $db->commit(); + } + else + { + $db->rollback(); + } } } -} - -// Remove a notification -if ($action == 'delete') -{ - $sql = "DELETE FROM ".MAIN_DB_PREFIX."notify_def where rowid=".$_GET["actid"]; - $db->query($sql); + + // Remove a notification + if ($action == 'delete') + { + $sql = "DELETE FROM ".MAIN_DB_PREFIX."notify_def where rowid=".$_GET["actid"]; + $db->query($sql); + } } @@ -150,7 +163,7 @@ if ($result > 0) print ''; // Alias names (commercial, trademark or alias names) - print ''.$langs->trans('AliasNames').''; + print ''.$langs->trans('AliasNames').''; print $object->name_alias; print ""; diff --git a/htdocs/societe/price.php b/htdocs/societe/price.php index 7898f543507..82adbd96607 100644 --- a/htdocs/societe/price.php +++ b/htdocs/societe/price.php @@ -49,69 +49,82 @@ if ($user->societe_id) $socid = $user->societe_id; $result = restrictedArea($user, 'societe', $socid, '&societe'); +$object = new Societe($db); + +// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +$hookmanager->initHooks(array('thirdpartycustomerprice','globalcard')); + + /* * Actions */ -if ($action == 'add_customer_price_confirm' && ! $_POST ["cancel"] && ($user->rights->produit->creer || $user->rights->service->creer)) { +$parameters=array('id'=>$socid); +$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'); - $update_child_soc = GETPOST('updatechildprice'); - - // add price by customer - $prodcustprice->fk_soc = $socid; - $prodcustprice->fk_product = GETPOST('prodid', 'int'); - $prodcustprice->price = price2num(GETPOST("price"), 'MU'); - $prodcustprice->price_min = price2num(GETPOST("price_min"), 'MU'); - $prodcustprice->price_base_type = GETPOST("price_base_type", 'alpha'); - $prodcustprice->tva_tx = str_replace('*', '', GETPOST("tva_tx")); - $prodcustprice->recuperableonly = (preg_match('/\*/', GETPOST("tva_tx")) ? 1 : 0); - - $result = $prodcustprice->create($user, 0, $update_child_soc); - - if ($result < 0) { - setEventMessage($prodcustprice->error, 'errors'); - } else { - setEventMessage($langs->trans('Save'), 'mesgs'); - } - - $action = ''; -} - -if ($action == 'delete_customer_price' && ($user->rights->produit->creer || $user->rights->service->creer)) { - // Delete price by customer - $prodcustprice->id = GETPOST('lineid'); - $result = $prodcustprice->delete($user); - - if ($result < 0) { - setEventMessage($prodcustprice->error, 'mesgs'); - } else { - setEventMessage($langs->trans('Delete'), 'errors'); - } - $action = ''; -} - -if ($action == 'update_customer_price_confirm' && ! $_POST ["cancel"] && ($user->rights->produit->creer || $user->rights->service->creer)) { - - $prodcustprice->fetch(GETPOST('lineid', 'int')); - - $update_child_soc = GETPOST('updatechildprice'); - - // update price by customer - $prodcustprice->price = price2num(GETPOST("price"), 'MU'); - $prodcustprice->price_min = price2num(GETPOST("price_min"), 'MU'); - $prodcustprice->price_base_type = GETPOST("price_base_type", 'alpha'); - $prodcustprice->tva_tx = str_replace('*', '', GETPOST("tva_tx")); - $prodcustprice->recuperableonly = (preg_match('/\*/', GETPOST("tva_tx")) ? 1 : 0); - - $result = $prodcustprice->update($user, 0, $update_child_soc); - if ($result < 0) { - setEventMessage($prodcustprice->error, 'errors'); - } else { - setEventMessage($langs->trans('Save'), 'mesgs'); - } - - $action = ''; +if (empty($reshook)) +{ + if ($action == 'add_customer_price_confirm' && ! $_POST ["cancel"] && ($user->rights->produit->creer || $user->rights->service->creer)) { + + $update_child_soc = GETPOST('updatechildprice'); + + // add price by customer + $prodcustprice->fk_soc = $socid; + $prodcustprice->fk_product = GETPOST('prodid', 'int'); + $prodcustprice->price = price2num(GETPOST("price"), 'MU'); + $prodcustprice->price_min = price2num(GETPOST("price_min"), 'MU'); + $prodcustprice->price_base_type = GETPOST("price_base_type", 'alpha'); + $prodcustprice->tva_tx = str_replace('*', '', GETPOST("tva_tx")); + $prodcustprice->recuperableonly = (preg_match('/\*/', GETPOST("tva_tx")) ? 1 : 0); + + $result = $prodcustprice->create($user, 0, $update_child_soc); + + if ($result < 0) { + setEventMessage($prodcustprice->error, 'errors'); + } else { + setEventMessage($langs->trans('Save'), 'mesgs'); + } + + $action = ''; + } + + if ($action == 'delete_customer_price' && ($user->rights->produit->creer || $user->rights->service->creer)) { + // Delete price by customer + $prodcustprice->id = GETPOST('lineid'); + $result = $prodcustprice->delete($user); + + if ($result < 0) { + setEventMessage($prodcustprice->error, 'mesgs'); + } else { + setEventMessage($langs->trans('Delete'), 'errors'); + } + $action = ''; + } + + if ($action == 'update_customer_price_confirm' && ! $_POST ["cancel"] && ($user->rights->produit->creer || $user->rights->service->creer)) { + + $prodcustprice->fetch(GETPOST('lineid', 'int')); + + $update_child_soc = GETPOST('updatechildprice'); + + // update price by customer + $prodcustprice->price = price2num(GETPOST("price"), 'MU'); + $prodcustprice->price_min = price2num(GETPOST("price_min"), 'MU'); + $prodcustprice->price_base_type = GETPOST("price_base_type", 'alpha'); + $prodcustprice->tva_tx = str_replace('*', '', GETPOST("tva_tx")); + $prodcustprice->recuperableonly = (preg_match('/\*/', GETPOST("tva_tx")) ? 1 : 0); + + $result = $prodcustprice->update($user, 0, $update_child_soc); + if ($result < 0) { + setEventMessage($prodcustprice->error, 'errors'); + } else { + setEventMessage($langs->trans('Save'), 'mesgs'); + } + + $action = ''; + } } From d30c64413db0d610bb7974bc1d8c35995785b7c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Thu, 24 Dec 2015 14:27:12 +0100 Subject: [PATCH 02/13] FIX #4055 SQL error when trying to access a non-existing expedition --- htdocs/comm/action/class/actioncomm.class.php | 2 +- htdocs/expedition/class/expedition.class.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 7c53a885043..27cdedc4e1e 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -841,7 +841,7 @@ class ActionComm extends CommonObject if (! empty($elementtype)) { if ($elementtype == 'project') $sql.= ' AND a.fk_project = '.$fk_element; - else $sql.= " AND a.fk_element = ".$fk_element." AND a.elementtype = '".$elementtype."'"; + else $sql.= " AND a.fk_element = ".(int) $fk_element." AND a.elementtype = '".$elementtype."'"; } if (! empty($filter)) $sql.= $filter; if ($sortorder && $sortfield) $sql.=$db->order($sortfield, $sortorder); diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index b685a2c8ec4..cb77607261b 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -536,7 +536,7 @@ class Expedition extends CommonObject else { dol_syslog(get_class($this).'::Fetch no expedition found', LOG_ERR); - $this->error='Delivery with id '.$id.' not found sql='.$sql; + $this->error='Delivery with id '.$id.' not found'; return 0; } } From 8b633aee66978bd4333bc3ed909c2bda2ec4a97a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Thu, 24 Dec 2015 14:39:28 +0100 Subject: [PATCH 03/13] FIX #4182 SQL error when deleting an unexisting bank entry --- htdocs/compta/bank/class/account.class.php | 6 +++--- htdocs/compta/bank/rappro.php | 13 ++++++++----- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index a7e55afb3cb..774c284f730 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -1277,12 +1277,12 @@ class AccountLine extends CommonObject $nbko++; } - $sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_class WHERE lineid=".$this->rowid; + $sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_class WHERE lineid=".(int) $this->rowid; dol_syslog(get_class($this)."::delete", LOG_DEBUG); $result = $this->db->query($sql); if (! $result) $nbko++; - $sql = "DELETE FROM ".MAIN_DB_PREFIX."bank WHERE rowid=".$this->rowid; + $sql = "DELETE FROM ".MAIN_DB_PREFIX."bank WHERE rowid=".(int) $this->rowid; dol_syslog(get_class($this)."::delete", LOG_DEBUG); $result = $this->db->query($sql); if (! $result) $nbko++; @@ -1319,7 +1319,7 @@ class AccountLine extends CommonObject $this->db->begin(); - $sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_url WHERE fk_bank=".$this->rowid; + $sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_url WHERE fk_bank=".(int) $this->rowid; dol_syslog(get_class($this)."::delete_urls", LOG_DEBUG); $result = $this->db->query($sql); if (! $result) $nbko++; diff --git a/htdocs/compta/bank/rappro.php b/htdocs/compta/bank/rappro.php index 8468bfbd5fb..3884891fb21 100644 --- a/htdocs/compta/bank/rappro.php +++ b/htdocs/compta/bank/rappro.php @@ -99,11 +99,14 @@ if ($action == 'rappro' && $user->rights->banque->consolidate) if ($action == 'del') { $bankline=new AccountLine($db); - $bankline->fetch($_GET["rowid"]); - $result=$bankline->delete($user); - if ($result < 0) - { - dol_print_error($db,$bankline->error); + + if ($bankline->fetch($_GET["rowid"]) > 1) { + $result = $bankline->delete($user); + if ($result < 0) { + dol_print_error($db, $bankline->error); + } + } else { + setEventMessage($langs->trans('ErrorRecordNotFound'), 'errors'); } } From de1625b9de47796f47283a6503faa89d01efe6ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Thu, 24 Dec 2015 14:46:01 +0100 Subject: [PATCH 04/13] FIX #4285 SQL query shown when accessing an unexisting invoice --- htdocs/compta/facture/class/facture.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 7eb3144cc42..628fd45f1ed 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1074,7 +1074,7 @@ class Facture extends CommonInvoice } else { - $this->error='Bill with id '.$rowid.' or ref '.$ref.' not found sql='.$sql; + $this->error='Bill with id '.$rowid.' or ref '.$ref.' not found'; dol_syslog(get_class($this)."::fetch Error ".$this->error, LOG_ERR); return 0; } From da959c5cf0eb02428e7dc46df6656cef84d59f9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garc=C3=ADa?= Date: Fri, 25 Dec 2015 11:32:13 +0100 Subject: [PATCH 05/13] Little typo in commit 8b633ae --- htdocs/compta/bank/rappro.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/bank/rappro.php b/htdocs/compta/bank/rappro.php index 3884891fb21..a2db7be0a93 100644 --- a/htdocs/compta/bank/rappro.php +++ b/htdocs/compta/bank/rappro.php @@ -100,7 +100,7 @@ if ($action == 'del') { $bankline=new AccountLine($db); - if ($bankline->fetch($_GET["rowid"]) > 1) { + if ($bankline->fetch($_GET["rowid"]) > 0) { $result = $bankline->delete($user); if ($result < 0) { dol_print_error($db, $bankline->error); From 686348a0d6b9a7ca62bea8ea9c4f670a01974703 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Fri, 25 Dec 2015 11:47:48 +0100 Subject: [PATCH 06/13] FIX #4287 SQL error when accessing an unexisting proposal --- htdocs/core/class/html.form.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index d11bf26d7c4..7db437150ca 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1026,7 +1026,7 @@ class Form $sql = "SELECT re.rowid, re.amount_ht, re.amount_tva, re.amount_ttc,"; $sql.= " re.description, re.fk_facture_source"; $sql.= " FROM ".MAIN_DB_PREFIX ."societe_remise_except as re"; - $sql.= " WHERE fk_soc = ".$socid; + $sql.= " WHERE fk_soc = ".(int) $socid; if ($filter) $sql.= " AND ".$filter; $sql.= " ORDER BY re.description ASC"; From 67bdfa26173ecf8c1a938531c6451de39c2ecd67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Sun, 27 Dec 2015 13:10:33 +0100 Subject: [PATCH 07/13] FIX #4282 Defined shipping time were not shown in Customer order's PDF documents --- htdocs/commande/class/commande.class.php | 32 +++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 3afe428b9f8..5d7736b5e4e 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -89,10 +89,39 @@ class Commande extends CommonOrder var $cond_reglement_id; var $cond_reglement_code; var $fk_account; + /** + * It holds the label of the payment mode. Use it in case translation cannot be found. + * @var string + */ + var $mode_reglement; + + /** + * Payment mode id + * @var int + */ var $mode_reglement_id; + + /** + * Payment mode code + * @var string + */ var $mode_reglement_code; + /** + * Availability delivery time id + * @var int + */ var $availability_id; + /** + * Availability delivery time code + * @var string + */ var $availability_code; + /** + * Label of availability delivery time. Use it in case translation cannot be found. + * @var string + */ + var $availability; + var $demand_reason_id; var $demand_reason_code; var $fk_delivery_address; @@ -1470,7 +1499,7 @@ class Commande extends CommonOrder $sql.= ", i.libelle as libelle_incoterms"; $sql.= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle'; $sql.= ', cr.code as cond_reglement_code, cr.libelle as cond_reglement_libelle, cr.libelle_facture as cond_reglement_libelle_doc'; - $sql.= ', ca.code as availability_code'; + $sql.= ', ca.code as availability_code, ca.label as availability_label'; $sql.= ', dr.code as demand_reason_code'; $sql.= ' FROM '.MAIN_DB_PREFIX.'commande as c'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as cr ON (c.fk_cond_reglement = cr.rowid)'; @@ -1527,6 +1556,7 @@ class Commande extends CommonOrder $this->fk_account = $obj->fk_account; $this->availability_id = $obj->fk_availability; $this->availability_code = $obj->availability_code; + $this->availability = $obj->availability_label; $this->demand_reason_id = $obj->fk_input_reason; $this->demand_reason_code = $obj->demand_reason_code; $this->date_livraison = $this->db->jdate($obj->date_livraison); From 98351d6fec2a8caef0ed20c6253ec198c5bb2a45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Sun, 27 Dec 2015 13:15:05 +0100 Subject: [PATCH 08/13] FIX #4302 Undefined variable $conf in Commande::LibStatut --- htdocs/commande/class/commande.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 3afe428b9f8..27ccb14da3d 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -2917,7 +2917,7 @@ class Commande extends CommonOrder */ function LibStatut($statut,$billed,$mode) { - global $langs; + global $langs, $conf; //print 'x'.$statut.'-'.$billed; if ($mode == 0) { From c40c695d20596a215a5ba1f44deef5f352bafaad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Sun, 27 Dec 2015 14:58:07 +0100 Subject: [PATCH 09/13] FIX #4036 Direct printing module without any driver configured, shows an unformatted error message --- htdocs/core/class/dolprintipp.class.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/dolprintipp.class.php b/htdocs/core/class/dolprintipp.class.php index fdd0fc2732c..869b26e2f75 100644 --- a/htdocs/core/class/dolprintipp.class.php +++ b/htdocs/core/class/dolprintipp.class.php @@ -66,7 +66,7 @@ class dolprintIPP */ function list_jobs($module) { - global $conf, $db, $bc; + global $conf, $db, $bc, $langs; include_once DOL_DOCUMENT_ROOT.'/includes/printipp/CupsPrintIPP.php'; $ipp = new CupsPrintIPP(); $ipp->setLog(DOL_DATA_ROOT.'/printipp.log','file',3); // logging very verbose @@ -96,7 +96,8 @@ class dolprintIPP } catch(Exception $e) { - print $e->getMessage(); + setEventMessage('[printipp] '.$langs->trans('CoreErrorMessage'), 'errors'); + dol_syslog($e->getMessage(), LOG_ERR); } print ''; From ebdaf7dfa6314fe59db3ab6fe91bd7a39f71334f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Sun, 27 Dec 2015 15:12:02 +0100 Subject: [PATCH 10/13] FIX #3980 Search field in "product by supplier" list sends empty result 3.8 and 3.7 --- htdocs/fourn/product/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/product/list.php b/htdocs/fourn/product/list.php index afaf4c8e796..4aba26ec413 100644 --- a/htdocs/fourn/product/list.php +++ b/htdocs/fourn/product/list.php @@ -108,7 +108,7 @@ if ($sref) } if ($snom) { - $sql .= natural_search('s.nom', $snom); + $sql .= natural_search('p.label', $snom); } if($catid) { From 97030b05ce11537d848267e04bc84bdc6ad604ba Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 27 Dec 2015 18:20:39 +0100 Subject: [PATCH 11/13] FIX #4281 --- htdocs/product/list.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/product/list.php b/htdocs/product/list.php index c7789761cd3..a91c177e164 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -67,6 +67,7 @@ if (! $sortorder) $sortorder="ASC"; $limit = $conf->liste_limit; +if (empty($action)) $action='list'; // Get object canvas (By default, this is not defined, so standard usage of dolibarr) $canvas=GETPOST("canvas"); @@ -108,8 +109,8 @@ $form=new Form($db); if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { - $objcanvas->assign_values('list'); // This must contains code to load data (must call LoadListDatas($limit, $offset, $sortfield, $sortorder)) - $objcanvas->display_canvas('list'); // This is code to show template + $objcanvas->assign_values($action); // This must contains code to load data (must call LoadListDatas($limit, $offset, $sortfield, $sortorder)) + $objcanvas->display_canvas($action); // This is code to show template } else { From 96bc2023f32db2299f02dcd8c42ea5b5a8585f91 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 27 Dec 2015 18:56:15 +0100 Subject: [PATCH 12/13] Prepare package 3.6.6 --- build/debian/changelog | 2 +- build/makepack-dolibarr.pl | 46 +++++++++++++++++++++++++++++--------- build/makepack-howto.txt | 25 ++++++++++++--------- htdocs/filefunc.inc.php | 2 +- 4 files changed, 51 insertions(+), 24 deletions(-) diff --git a/build/debian/changelog b/build/debian/changelog index 5d34808d3a6..326405a6d2b 100644 --- a/build/debian/changelog +++ b/build/debian/changelog @@ -1,4 +1,4 @@ -dolibarr (3.6.5-3) UNRELEASED; urgency=low +dolibarr (__VERSION__) UNRELEASED; urgency=low [ Laurent Destailleur (eldy) ] * New upstream release. diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index 603fd0f2e7a..fbae52f9726 100755 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -65,6 +65,13 @@ $DIR||='.'; $DIR =~ s/([^\/\\])[\\\/]+$/$1/; $SOURCE="$DIR/.."; $DESTI="$SOURCE/build"; +if ($SOURCE !~ /^\//) +{ + print "Error: Launch the script $PROG.$Extension with its full path from /.\n"; + print "$PROG.$Extension aborted.\n"; + sleep 2; + exit 1; +} if (! $ENV{"DESTIBETARC"} || ! $ENV{"DESTISTABLE"}) { print "Error: Missing environment variables.\n"; @@ -338,8 +345,8 @@ foreach my $target (sort keys %CHOOSEDPUBLISH) { if ($nboftargetok) { - # Update CVS if required - #----------------------- + # Update GIT tag if required + #--------------------------- if ($nbofpublishneedtag) { print "Go to directory $SOURCE\n"; @@ -353,7 +360,7 @@ if ($nboftargetok) { print "Error: The ChangeLogFile was not updated. Run the following command first:\n"; if (! $BUILD) { - print 'cd ~/git/dolibarr_'.$MAJOR.'.'.$MINOR.'; git log `git rev-list --boundary '.$MAJOR.'.'.$MINOR.'..origin/develop`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e \'^FIX\|NEW\' | sort -u | sed \'s/FIXED:/FIX:/g\' | sed \'s/FIXED :/FIX:/g\' | sed \'s/FIX :/FIX:/g\' | sed \'s/FIX /FIX: /g\' | sed \'s/NEW :/NEW:/g\' | sed \'s/NEW /NEW: /g\' > /tmp/aaa'; + print 'cd ~/git/dolibarr_'.$MAJOR.'.'.$MINOR.'; git log `git rev-list --boundary '.$MAJOR.'.'.$MINOR.'..origin/develop | grep ^- | cut -c2- | head -n`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e \'^FIX\|NEW\' | sort -u | sed \'s/FIXED:/FIX:/g\' | sed \'s/FIXED :/FIX:/g\' | sed \'s/FIX :/FIX:/g\' | sed \'s/FIX /FIX: /g\' | sed \'s/NEW :/NEW:/g\' | sed \'s/NEW /NEW: /g\' > /tmp/aaa'; } else { @@ -443,6 +450,7 @@ if ($nboftargetok) { $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/install/mssql`; + $ret=`rm -fr $BUILDROOT/$PROJECT/dev/ansible`; $ret=`rm -fr $BUILDROOT/$PROJECT/dev/codesniffer`; $ret=`rm -fr $BUILDROOT/$PROJECT/dev/codetemplates`; $ret=`rm -fr $BUILDROOT/$PROJECT/dev/dbmodel`; @@ -451,6 +459,7 @@ if ($nboftargetok) { $ret=`rm -fr $BUILDROOT/$PROJECT/dev/ldap`; $ret=`rm -fr $BUILDROOT/$PROJECT/dev/licence`; $ret=`rm -fr $BUILDROOT/$PROJECT/dev/mail`; + $ret=`rm -fr $BUILDROOT/$PROJECT/dev/multitail`; $ret=`rm -fr $BUILDROOT/$PROJECT/dev/phpcheckstyle`; $ret=`rm -fr $BUILDROOT/$PROJECT/dev/phpunit`; $ret=`rm -fr $BUILDROOT/$PROJECT/dev/security`; @@ -478,23 +487,28 @@ if ($nboftargetok) { $ret=`rm -fr $BUILDROOT/$PROJECT/documents`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/document`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/documents`; - # Removed known external modules to avoir any error when packaging on test env + + # Removed known external modules to avoid any error when packaging from env where external modules are tested + $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/custom/*`; # For custom we want to keep dir + $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/allscreens*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/ancotec*`; + $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/cabinetmed*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/calling*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/bootstrap*`; - $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/custom*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/factory*`; + $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/lead*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/management*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/multicompany*`; + $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/ndf*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/nltechno*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/oscim*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/pos*`; - $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/public/test`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/teclib*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/timesheet*`; - # Removed other test files $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/themes/oblyon*`; + # Removed other test files $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/themes/eldy/*.new`; + $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/public/api/explorer`; # This is a dev tool $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/public/test`; $ret=`rm -fr $BUILDROOT/$PROJECT/test`; $ret=`rm -fr $BUILDROOT/$PROJECT/Thumbs.db $BUILDROOT/$PROJECT/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/*/*/Thumbs.db`; @@ -511,6 +525,7 @@ if ($nboftargetok) { $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/jquery/plugins/multiselect/MIT-LICENSE.txt`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nusoap/lib/Mail`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nusoap/samples`; + $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/php-iban/docs`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpexcel/license.txt`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpexcel/PHPExcel/Shared/PDF`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpexcel/PHPExcel/Shared/PCLZip`; @@ -702,7 +717,7 @@ if ($nboftargetok) { use Date::Language; $lang=Date::Language->new('English'); $datestring = $lang->time2str("%a %b %e %Y", time); - $changelogstring="* ".$datestring." Laurent Destailleur $MAJOR.$MINOR.$REL1-$RPMSUBVERSION\n- Upstream release\n"; + $changelogstring="* ".$datestring." Laurent Destailleur (eldy) $MAJOR.$MINOR.$REL1-$RPMSUBVERSION\n- Upstream release\n"; print "Generate file $BUILDROOT/$BUILDFIC from $SOURCE/build/rpm/${BUILDFICSRC}\n"; open (SPECFROM,"<$SOURCE/build/rpm/${BUILDFICSRC}") || die "Error"; @@ -734,7 +749,7 @@ if ($nboftargetok) { $ret=`$cmd`; print "Move $RPMDIR/SOURCES/".$FILENAMETGZ2.".tgz into $NEWDESTI/".$FILENAMETGZ2.".tgz\n"; $cmd="mv \"$RPMDIR/SOURCES/".$FILENAMETGZ2.".tgz\" \"$NEWDESTI/".$FILENAMETGZ2.".tgz\""; - $ret=`$cmd`; + #$ret=`$cmd`; next; } @@ -824,8 +839,17 @@ if ($nboftargetok) { print "Create directory $BUILDROOT/$PROJECT.tmp/debian\n"; $ret=`mkdir "$BUILDROOT/$PROJECT.tmp/debian"`; print "Copy $SOURCE/build/debian/xxx to $BUILDROOT/$PROJECT.tmp/debian\n"; + # Add files for dpkg-source (changelog) + #$ret=`cp -f "$SOURCE/build/debian/changelog" "$BUILDROOT/$PROJECT.tmp/debian"`; + open (SPECFROM,"<$SOURCE/build/debian/changelog") || die "Error"; + open (SPECTO,">$BUILDROOT/$PROJECT.tmp/debian/changelog") || die "Error"; + while () { + $_ =~ s/__VERSION__/$MAJOR.$MINOR.$newbuild/; + print SPECTO $_; + } + close SPECFROM; + close SPECTO; # Add files for dpkg-source - $ret=`cp -f "$SOURCE/build/debian/changelog" "$BUILDROOT/$PROJECT.tmp/debian"`; $ret=`cp -f "$SOURCE/build/debian/compat" "$BUILDROOT/$PROJECT.tmp/debian"`; $ret=`cp -f "$SOURCE/build/debian/control" "$BUILDROOT/$PROJECT.tmp/debian"`; $ret=`cp -f "$SOURCE/build/debian/copyright" "$BUILDROOT/$PROJECT.tmp/debian"`; @@ -1004,7 +1028,7 @@ if ($nboftargetok) { mkdir($DESTI.'/package_windows'); if (-d $DESTI.'/package_windows') { $NEWDESTI=$DESTI.'/package_windows'; } - print "Remove target $FILENAMEEXEDOLIWAMP.exe...\n"; + print "Remove target $NEWDESTI/$FILENAMEEXEDOLIWAMP.exe...\n"; unlink "$NEWDESTI/$FILENAMEEXEDOLIWAMP.exe"; print "Check that in your Wine setup, you create a Z: drive that point to your / directory.\n"; diff --git a/build/makepack-howto.txt b/build/makepack-howto.txt index 83836757ba7..2bf516dfe88 100644 --- a/build/makepack-howto.txt +++ b/build/makepack-howto.txt @@ -8,19 +8,20 @@ This files describe steps made by Dolibarr packaging team to make a beta version of Dolibarr, step by step. - Check all files are commited. -- Update version/info in /ChangeLog +- Update version/info in ChangeLog. +To generate a changelog of a major new version x.y.0, you can do "cd ~/git/dolibarr_x.y; git log `git rev-list --boundary x.y..origin/develop | grep ^- | cut -c2- | head -n`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/aaa" +To generate a changelog of a maintenance version x.y.z, you can do "cd ~/git/dolibarr_x.y; git log x.y.z-1.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/aaa" - Update version number with x.y.z-w in htdocs/filefunc.inc.php -- Update version number with x.y.z-w in build/debian/changelog -- Update version number with x.y.z-w in build/exe/doliwamp/doliwamp.iss - Commit all changes. -- Add a Tag (x.y.betaz_YYYYMMDD) and push it: git push --tags -- Create a branch (x.y). - Run makepack-dolibarr.pl to generate all packages. + +- Create a branch (x.y), if version seems stable enough. + - Move build files into www.dolibarr.org web site (/home/dolibarr/wwwroot/files/lastbuild). -- Post a news on dolibarr.org/dolibarr.fr +- Post a news on dolibarr.org/dolibarr.fr + social networks - Send mail on mailings-list @@ -29,20 +30,22 @@ This files describe steps made by Dolibarr packaging team to make a complete release of Dolibarr, step by step. - Check all files are commited. -- Update version/info in ChangeLog +- Update version/info in ChangeLog. +To generate a changelog of a major new version x.y.0, you can do "cd ~/git/dolibarr_x.y; git log `git rev-list --boundary x.y..origin/develop | grep ^- | cut -c2- | head -n`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/aaa" +To generate a changelog of a maintenance version x.y.z, you can do "cd ~/git/dolibarr_x.y; git log x.y.z-1.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/aaa" - Update version number with x.y.z in htdocs/filefunc.inc.php -- Update version number with x.y.z in build/debian/changelog -- Update version number with x.y.z in build/exe/doliwamp/doliwamp.iss - Commit all changes. -- Build Dolibarr and DoliWamp packages with makepack-dolibarr.pl +- Run makepack-dolibarr.pl to generate all packages. + - Check content of built packages. - Move build files into www.dolibarr.org web site (/home/dolibarr/wwwroot/files/stable). + - Run makepack-dolibarr.pl again with option to publish files on sourceforge. This will also add official tag. - Edit symbolic links in directory "/home/dolibarr/wwwroot/files/stable/xxx" on server to point to new files (used by some web sites). +- Post a news on dolibarr.org/dolibarr.fr + social networks - Send mail on mailings-list -- Send news on OpenSource web sites (if major beta or release) diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index 75ca19a35fe..d1784fb4863 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -29,7 +29,7 @@ * \brief File that include conf.php file and commons lib like functions.lib.php */ -if (! defined('DOL_VERSION')) define('DOL_VERSION','3.6.5'); +if (! defined('DOL_VERSION')) define('DOL_VERSION','3.6.6'); if (! defined('EURO')) define('EURO',chr(128)); // Define syslog constants From ed3f0ce86bfb764f46d0ba9f579da07ffdf24f2c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 28 Dec 2015 00:20:48 +0100 Subject: [PATCH 13/13] Fix totalnboflines not correctly managed --- htdocs/compta/salaries/index.php | 6 ++++++ htdocs/compta/sociales/index.php | 6 ++++++ htdocs/compta/tva/reglement.php | 6 ++++++ htdocs/contrat/list.php | 8 ++++++-- htdocs/contrat/services.php | 6 ++++++ htdocs/fichinter/list.php | 6 ++++++ htdocs/product/stock/list.php | 35 ++++++++++++++++++++------------ 7 files changed, 58 insertions(+), 15 deletions(-) diff --git a/htdocs/compta/salaries/index.php b/htdocs/compta/salaries/index.php index f3312761141..52f1938a857 100644 --- a/htdocs/compta/salaries/index.php +++ b/htdocs/compta/salaries/index.php @@ -108,6 +108,12 @@ if ($typeid) { $sql .= " AND s.fk_typepayment=".$typeid; } //$sql.= " GROUP BY u.rowid, u.lastname, u.firstname, s.rowid, s.fk_user, s.amount, s.label, s.datev, s.fk_typepayment, s.num_payment, pst.code"; +$totalnboflines=0; +$result=$db->query($sql); +if ($result) +{ + $totalnboflines = $db->num_rows($result); +} $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($limit+1,$offset); diff --git a/htdocs/compta/sociales/index.php b/htdocs/compta/sociales/index.php index dec724c95d5..63c156609c8 100644 --- a/htdocs/compta/sociales/index.php +++ b/htdocs/compta/sociales/index.php @@ -119,6 +119,12 @@ if ($typeid) { $sql .= " AND cs.fk_type=".$typeid; } $sql.= " GROUP BY cs.rowid, cs.fk_type, cs.amount, cs.date_ech, cs.libelle, cs.paye, cs.periode, c.libelle"; +$totalnboflines=0; +$result=$db->query($sql); +if ($result) +{ + $totalnboflines = $db->num_rows($result); +} $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($limit+1,$offset); diff --git a/htdocs/compta/tva/reglement.php b/htdocs/compta/tva/reglement.php index b603101ad29..91140bb97ca 100644 --- a/htdocs/compta/tva/reglement.php +++ b/htdocs/compta/tva/reglement.php @@ -115,6 +115,12 @@ if ($filtre) { if ($typeid) { $sql .= " AND t.fk_typepayment=".$typeid; } +$totalnboflines=0; +$result=$db->query($sql); +if ($result) +{ + $totalnboflines = $db->num_rows($result); +} $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($limit+1,$offset); diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index 22b619c599c..e8c722dcab3 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -136,17 +136,21 @@ if ($search_contract) { if (!empty($search_ref_supplier)) { $sql .= natural_search(array('c.ref_supplier'), $search_ref_supplier); } - if ($search_sale > 0) { $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$search_sale; } - if ($sall) { $sql .= natural_search(array_keys($fieldstosearchall), $sall); } if ($search_user > 0) $sql.= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='contrat' AND tc.source='internal' AND ec.element_id = c.rowid AND ec.fk_socpeople = ".$search_user; $sql.= " GROUP BY c.rowid, c.ref, c.datec, c.date_contrat, c.statut, c.ref_supplier, s.nom, s.rowid"; +$totalnboflines=0; +$result=$db->query($sql); +if ($result) +{ + $totalnboflines = $db->num_rows($result); +} $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($conf->liste_limit + 1, $offset); diff --git a/htdocs/contrat/services.php b/htdocs/contrat/services.php index c59c67fe91c..b7b257ca07a 100644 --- a/htdocs/contrat/services.php +++ b/htdocs/contrat/services.php @@ -147,6 +147,12 @@ $filter_date1=dol_mktime(0,0,0,$op1month,$op1day,$op1year); $filter_date2=dol_mktime(0,0,0,$op2month,$op2day,$op2year); if (! empty($filter_op1) && $filter_op1 != -1 && $filter_date1 != '') $sql.= " AND date_ouverture_prevue ".$filter_op1." '".$db->idate($filter_date1)."'"; if (! empty($filter_op2) && $filter_op2 != -1 && $filter_date2 != '') $sql.= " AND date_fin_validite ".$filter_op2." '".$db->idate($filter_date2)."'"; +$totalnboflines=0; +$result=$db->query($sql); +if ($result) +{ + $totalnboflines = $db->num_rows($result); +} $sql .= $db->order($sortfield,$sortorder); $sql .= $db->plimit($limit + 1, $offset); diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index 241b8f522b0..74edaf72099 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -123,6 +123,12 @@ if ($socid) if ($sall) { $sql .= natural_search(array_keys($fieldstosearchall), $sall); } +$totalnboflines=0; +$result=$db->query($sql); +if ($result) +{ + $totalnboflines = $db->num_rows($result); +} $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($limit+1, $offset); //print $sql; diff --git a/htdocs/product/stock/list.php b/htdocs/product/stock/list.php index a7dde67013a..833e285f608 100644 --- a/htdocs/product/stock/list.php +++ b/htdocs/product/stock/list.php @@ -68,6 +68,12 @@ if ($search_label) $sql.= natural_search("e.lieu", $search_label); // label if ($search_status != '' && $search_status >= 0) $sql.= " AND e.statut = ".$search_status; if ($sall) $sql.= natural_search(array('e.label','e.description','e.lieu','e.address','e.town'), $sall); $sql.= " GROUP BY e.rowid, e.label, e.statut, e.lieu, e.address, e.zip, e.town, e.fk_pays"; +$totalnboflines=0; +$result=$db->query($sql); +if ($result) +{ + $totalnboflines = $db->num_rows($result); +} $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($limit+1, $offset); @@ -81,7 +87,7 @@ if ($result) $help_url='EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks'; llxHeader("",$langs->trans("ListOfWarehouses"),$help_url); - print_barre_liste($langs->trans("ListOfWarehouses"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder,'',$num); + print_barre_liste($langs->trans("ListOfWarehouses"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, '', $num, $totalnboflines); print '
'; print ''; @@ -168,20 +174,23 @@ if ($result) $i++; } - print '
'; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print "\n"; } - print ''; - print ''; - print ''; - print "\n"; } $db->free($result);
'.$langs->trans("Total").''.price(price2num($total,'MT'),1,$langs,0,0,-1,$conf->currency).''; - if (empty($conf->global->PRODUIT_MULTIPRICES)) print price(price2num($totalsell,'MT'),1,$langs,0,0,-1,$conf->currency); - else + if ($totalnboflines <= $limit) { - $htmltext=$langs->trans("OptionMULTIPRICESIsOn"); - print $form->textwithtooltip($langs->trans("Variable"),$htmltext); + print '
'.$langs->trans("Total").''.price(price2num($total,'MT'),1,$langs,0,0,-1,$conf->currency).''; + if (empty($conf->global->PRODUIT_MULTIPRICES)) print price(price2num($totalsell,'MT'),1,$langs,0,0,-1,$conf->currency); + else + { + $htmltext=$langs->trans("OptionMULTIPRICESIsOn"); + print $form->textwithtooltip($langs->trans("Variable"),$htmltext); + } + print '