From a27d71f083caf6598196b73a11704de88b00ccce Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 7 Jun 2013 15:58:15 +0200 Subject: [PATCH] Fix: Miscellaneous fixes into cachdesk module: - Missing footer in cashdesk module - Wrong field label - Do not use limit list (Freeze when too many product) --- htdocs/cashdesk/affPied.php | 4 ++- htdocs/cashdesk/facturation.php | 17 +++++---- htdocs/cashdesk/tpl/facturation1.tpl.php | 45 +++++++----------------- htdocs/langs/en_US/cashdesk.lang | 3 +- htdocs/langs/fr_FR/cashdesk.lang | 3 +- 5 files changed, 30 insertions(+), 42 deletions(-) diff --git a/htdocs/cashdesk/affPied.php b/htdocs/cashdesk/affPied.php index 9c77c9ee03e..b97b9108de1 100644 --- a/htdocs/cashdesk/affPied.php +++ b/htdocs/cashdesk/affPied.php @@ -23,5 +23,7 @@ ?>
- +
diff --git a/htdocs/cashdesk/facturation.php b/htdocs/cashdesk/facturation.php index b64ad065c64..e70b4ed3483 100644 --- a/htdocs/cashdesk/facturation.php +++ b/htdocs/cashdesk/facturation.php @@ -24,7 +24,7 @@ */ // Get list of articles (in warehouse '$conf_fkentrepot' if defined and stock module enabled) -if ( $_GET['filtre'] ) { +if ( GETPOST('filtre') ) { // Avec filtre $ret=array(); $i=0; @@ -36,17 +36,18 @@ if ( $_GET['filtre'] ) { $sql.= " WHERE p.entity IN (".getEntity('product', 1).")"; $sql.= " AND p.tosell = 1"; if(!$conf->global->CASHDESK_SERVICES) $sql.= " AND p.fk_product_type = 0"; - $sql.= " AND (p.ref LIKE '%".$_GET['filtre']."%' OR p.label LIKE '%".$_GET['filtre']."%' "; - if (! empty($conf->barcode->enabled)) $sql.= " OR p.barcode LIKE '%".$_GET['filtre']."%')"; + $sql.= " AND (p.ref LIKE '%".$db->escape(GETPOST('filtre'))."%' OR p.label LIKE '%".$db->escape(GETPOST('filtre'))."%'"; + if (! empty($conf->barcode->enabled)) $sql.= " OR p.barcode LIKE '%".$db->escape(GETPOST('filtre'))."%')"; else $sql.= ")"; - $sql.= " ORDER BY label"; dol_syslog("facturation.php sql=".$sql); $resql=$db->query($sql); if ($resql) { - while ( $tab = $db->fetch_array($resql) ) + $nbr_enreg = $db->num_rows($resql); + + while ($i < $conf_taille_listes && $tab = $db->fetch_array($resql) ) { foreach ( $tab as $cle => $valeur ) { @@ -79,7 +80,9 @@ if ( $_GET['filtre'] ) { $resql=$db->query($sql); if ($resql) { - while ( $tab = $db->fetch_array($resql) ) + $nbr_enreg = $db->num_rows($resql); + + while ($i < $conf_taille_listes && $tab = $db->fetch_array($resql)) { foreach ( $tab as $cle => $valeur ) { @@ -95,7 +98,7 @@ if ( $_GET['filtre'] ) { $tab_designations=$ret; } -$nbr_enreg = count($tab_designations); +//$nbr_enreg = count($tab_designations); if ( $nbr_enreg > 1 ) { diff --git a/htdocs/cashdesk/tpl/facturation1.tpl.php b/htdocs/cashdesk/tpl/facturation1.tpl.php index 482b1474d99..eb35a9e05d5 100644 --- a/htdocs/cashdesk/tpl/facturation1.tpl.php +++ b/htdocs/cashdesk/tpl/facturation1.tpl.php @@ -35,7 +35,7 @@ $langs->load("cashdesk"); - + diff --git a/htdocs/langs/en_US/cashdesk.lang b/htdocs/langs/en_US/cashdesk.lang index f8e1d1fa780..f11853b7b89 100644 --- a/htdocs/langs/en_US/cashdesk.lang +++ b/htdocs/langs/en_US/cashdesk.lang @@ -36,4 +36,5 @@ CashDeskSetupStock=You ask to decrease stock on invoice creation but warehouse f BankToPay=Charge Account ShowCompany=Show company ShowStock=Show warehouse -DeleteArticle=Click to remove this article \ No newline at end of file +DeleteArticle=Click to remove this article +FilterRefOrLabelOrBC=Search (Ref/Label) diff --git a/htdocs/langs/fr_FR/cashdesk.lang b/htdocs/langs/fr_FR/cashdesk.lang index 6eab6e5b3d0..6fd0f1bb137 100644 --- a/htdocs/langs/fr_FR/cashdesk.lang +++ b/htdocs/langs/fr_FR/cashdesk.lang @@ -36,4 +36,5 @@ CashDeskSetupStock=La configuration du module stock demande une réduction du st BankToPay=Compte à créditer ShowCompany=Voir société ShowStock=Voir entrepôt -DeleteArticle=Cliquez pour enlever cet article \ No newline at end of file +DeleteArticle=Cliquez pour enlever cet article +FilterRefOrLabelOrBC=Recherche (Ref/Lib.) \ No newline at end of file
trans("Code"); ?>trans("Designation"); ?>
trans("FilterRefOrLabelOrBC"); ?>trans("Designation"); ?>
load("cashdesk"); $id = $obj_facturation->id(); // Si trop d'articles ont ete trouves, on n'affiche que les X premiers (defini dans le fichier de configuration) ... - if ( $nbr_enreg > $conf_taille_listes ) { - for ($i = 0; $i < $conf_taille_listes; $i++) { + $nbtoshow = $nbr_enreg; + if (! empty($conf_taille_listes) && $nbtoshow > $conf_taille_listes) $nbtoshow = $conf_taille_listes; - if ( $id == $tab_designations[$i]['rowid'] ) - $selected = 'selected="selected"'; - else - $selected = ''; + for ($i = 0; $i < $nbtoshow; $i++) + { + if ( $id == $tab_designations[$i]['rowid'] ) + $selected = 'selected="selected"'; + else + $selected = ''; - $label = $tab_designations[$i]['label']; + $label = $tab_designations[$i]['label']; - print ''."\n "; - - } - - // ... sinon on affiche tout - } else { - - for ($i = 0; $i < $nbr_enreg; $i++) { - - if ( $id == $tab_designations[$i]['rowid'] ) - $selected = 'selected="selected"'; - else - $selected = ''; - - $label = $tab_designations[$i]['label']; - - print ''."\n "; - - } + print ''."\n"; } - ?>