Fix: Miscellaneous fixes into cachdesk module:

- Missing footer in cashdesk module
- Wrong field label
- Do not use limit list (Freeze when too many product)
This commit is contained in:
Laurent Destailleur 2013-06-07 15:58:15 +02:00
parent c78d5aa4a7
commit a27d71f083
5 changed files with 30 additions and 42 deletions

View File

@ -23,5 +23,7 @@
?> ?>
<div class="pied"> <div class="pied">
<?php
printCommonFooter('private');
?>
</div> </div>

View File

@ -24,7 +24,7 @@
*/ */
// Get list of articles (in warehouse '$conf_fkentrepot' if defined and stock module enabled) // Get list of articles (in warehouse '$conf_fkentrepot' if defined and stock module enabled)
if ( $_GET['filtre'] ) { if ( GETPOST('filtre') ) {
// Avec filtre // Avec filtre
$ret=array(); $i=0; $ret=array(); $i=0;
@ -36,17 +36,18 @@ if ( $_GET['filtre'] ) {
$sql.= " WHERE p.entity IN (".getEntity('product', 1).")"; $sql.= " WHERE p.entity IN (".getEntity('product', 1).")";
$sql.= " AND p.tosell = 1"; $sql.= " AND p.tosell = 1";
if(!$conf->global->CASHDESK_SERVICES) $sql.= " AND p.fk_product_type = 0"; 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']."%' "; $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 '%".$_GET['filtre']."%')"; if (! empty($conf->barcode->enabled)) $sql.= " OR p.barcode LIKE '%".$db->escape(GETPOST('filtre'))."%')";
else $sql.= ")"; else $sql.= ")";
$sql.= " ORDER BY label"; $sql.= " ORDER BY label";
dol_syslog("facturation.php sql=".$sql); dol_syslog("facturation.php sql=".$sql);
$resql=$db->query($sql); $resql=$db->query($sql);
if ($resql) 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 ) foreach ( $tab as $cle => $valeur )
{ {
@ -79,7 +80,9 @@ if ( $_GET['filtre'] ) {
$resql=$db->query($sql); $resql=$db->query($sql);
if ($resql) 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 ) foreach ( $tab as $cle => $valeur )
{ {
@ -95,7 +98,7 @@ if ( $_GET['filtre'] ) {
$tab_designations=$ret; $tab_designations=$ret;
} }
$nbr_enreg = count($tab_designations); //$nbr_enreg = count($tab_designations);
if ( $nbr_enreg > 1 ) if ( $nbr_enreg > 1 )
{ {

View File

@ -35,7 +35,7 @@ $langs->load("cashdesk");
<input type="hidden" name="hdnSource" value="NULL" /> <input type="hidden" name="hdnSource" value="NULL" />
<table> <table>
<tr><th class="label1"><?php echo $langs->trans("Code"); ?></th><th class="label1"><?php echo $langs->trans("Designation"); ?></th></tr> <tr><th class="label1"><?php echo $langs->trans("FilterRefOrLabelOrBC"); ?></th><th class="label1"><?php echo $langs->trans("Designation"); ?></th></tr>
<tr> <tr>
<!-- Affichage de la reference et de la designation --> <!-- Affichage de la reference et de la designation -->
<td><input class="texte_ref" type="text" id ="txtRef" name="txtRef" value="<?php echo $obj_facturation->ref() ?>" <td><input class="texte_ref" type="text" id ="txtRef" name="txtRef" value="<?php echo $obj_facturation->ref() ?>"
@ -62,43 +62,24 @@ $langs->load("cashdesk");
$id = $obj_facturation->id(); $id = $obj_facturation->id();
// Si trop d'articles ont ete trouves, on n'affiche que les X premiers (defini dans le fichier de configuration) ... // 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'] ) for ($i = 0; $i < $nbtoshow; $i++)
$selected = 'selected="selected"'; {
else if ( $id == $tab_designations[$i]['rowid'] )
$selected = ''; $selected = 'selected="selected"';
else
$selected = '';
$label = $tab_designations[$i]['label']; $label = $tab_designations[$i]['label'];
print '<option '.$selected.' value="'.$tab_designations[$i]['rowid'].'">'.dol_trunc($tab_designations[$i]['ref'],7).' - '.dol_trunc($label,35,'middle'); print '<option '.$selected.' value="'.$tab_designations[$i]['rowid'].'">'.dol_trunc($tab_designations[$i]['ref'],7).' - '.dol_trunc($label,35,'middle');
if (! empty($conf->stock->enabled) && !empty($conf_fkentrepot) && $tab_designations[$i]['fk_product_type']==0) print ' ('.$langs->trans("CashDeskStock").': '.$tab_designations[$i]['reel'].')'; if (! empty($conf->stock->enabled) && !empty($conf_fkentrepot) && $tab_designations[$i]['fk_product_type']==0) print ' ('.$langs->trans("CashDeskStock").': '.(empty($tab_designations[$i]['reel'])?0:$tab_designations[$i]['reel']).')';
print '</option>'."\n "; print '</option>'."\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 '<option '.$selected.' value="'.$tab_designations[$i]['rowid'].'">'.dol_trunc($tab_designations[$i]['ref'],7).' - '.dol_trunc($label,35,'middle');
if (! empty($conf->stock->enabled) && !empty($conf_fkentrepot) && $tab_designations[$i]['fk_product_type']==0) print ' ('.$langs->trans("CashDeskStock").': '.(empty($tab_designations[$i]['reel'])?0:$tab_designations[$i]['reel']).')';
print '</option>'."\n ";
}
} }
?> ?>
</select> </select>
</td> </td>

View File

@ -36,4 +36,5 @@ CashDeskSetupStock=You ask to decrease stock on invoice creation but warehouse f
BankToPay=Charge Account BankToPay=Charge Account
ShowCompany=Show company ShowCompany=Show company
ShowStock=Show warehouse ShowStock=Show warehouse
DeleteArticle=Click to remove this article DeleteArticle=Click to remove this article
FilterRefOrLabelOrBC=Search (Ref/Label)

View File

@ -36,4 +36,5 @@ CashDeskSetupStock=La configuration du module stock demande une réduction du st
BankToPay=Compte à créditer BankToPay=Compte à créditer
ShowCompany=Voir société ShowCompany=Voir société
ShowStock=Voir entrepôt ShowStock=Voir entrepôt
DeleteArticle=Cliquez pour enlever cet article DeleteArticle=Cliquez pour enlever cet article
FilterRefOrLabelOrBC=Recherche (Ref/Lib.)