task #11278: Option into point of sale module to add services in list

This commit is contained in:
Juanjo Menent 2011-08-26 14:52:00 +00:00
parent 44eebeca76
commit db012b467d
7 changed files with 50 additions and 22 deletions

View File

@ -1,5 +1,6 @@
<?php <?php
/* Copyright (C) 2008-2010 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2008-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -19,7 +20,7 @@
* \file htdocs/cashdesk/admin/cashdesk.php * \file htdocs/cashdesk/admin/cashdesk.php
* \ingroup cashdesk * \ingroup cashdesk
* \brief Setup page for cashdesk module * \brief Setup page for cashdesk module
* \version $Id: cashdesk.php,v 1.7 2011/08/03 00:46:38 eldy Exp $ * \version $Id: cashdesk.php,v 1.8 2011/08/26 14:52:00 simnandez Exp $
*/ */
require("../../main.inc.php"); require("../../main.inc.php");
@ -45,22 +46,36 @@ $langs->load("cashdesk");
/* /*
* Actions * Actions
*/ */
if ($_POST["action"] == 'set') if (GETPOST("action") == 'set')
{ {
if ($_POST["socid"] < 0) $_POST["socid"]=''; $db->begin();
if ($_POST["CASHDESK_ID_BANKACCOUNT"] < 0) $_POST["CASHDESK_ID_BANKACCOUNT"]='';
if ($_POST["CASHDESK_ID_WAREHOUSE"] < 0) $_POST["CASHDESK_ID_WAREHOUSE"]='';
dolibarr_set_const($db,"CASHDESK_ID_THIRDPARTY",$_POST["socid"],'chaine',0,'',$conf->entity); if (GETPOST("socid") < 0) $_POST["socid"]='';
dolibarr_set_const($db,"CASHDESK_ID_BANKACCOUNT_CASH",$_POST["CASHDESK_ID_BANKACCOUNT_CASH"],'chaine',0,'',$conf->entity); /*if (GETPOST("CASHDESK_ID_BANKACCOUNT") < 0) $_POST["CASHDESK_ID_BANKACCOUNT"]='';
dolibarr_set_const($db,"CASHDESK_ID_BANKACCOUNT_CHEQUE",$_POST["CASHDESK_ID_BANKACCOUNT_CHEQUE"],'chaine',0,'',$conf->entity); if (GETPOST("CASHDESK_ID_WAREHOUSE") < 0) $_POST["CASHDESK_ID_WAREHOUSE"]='';*/
dolibarr_set_const($db,"CASHDESK_ID_BANKACCOUNT_CB",$_POST["CASHDESK_ID_BANKACCOUNT_CB"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db,"CASHDESK_ID_WAREHOUSE",$_POST["CASHDESK_ID_WAREHOUSE"],'chaine',0,'',$conf->entity);
dol_syslog("admin/cashdesk: level ".$_POST["level"]); $res = dolibarr_set_const($db,"CASHDESK_ID_THIRDPARTY",GETPOST("socid"),'chaine',0,'',$conf->entity);
$res = dolibarr_set_const($db,"CASHDESK_ID_BANKACCOUNT_CASH",GETPOST("CASHDESK_ID_BANKACCOUNT_CASH"),'chaine',0,'',$conf->entity);
$res = dolibarr_set_const($db,"CASHDESK_ID_BANKACCOUNT_CHEQUE",GETPOST("CASHDESK_ID_BANKACCOUNT_CHEQUE"),'chaine',0,'',$conf->entity);
$res = dolibarr_set_const($db,"CASHDESK_ID_BANKACCOUNT_CB",GETPOST("CASHDESK_ID_BANKACCOUNT_CB"),'chaine',0,'',$conf->entity);
$res = dolibarr_set_const($db,"CASHDESK_ID_WAREHOUSE",GETPOST("CASHDESK_ID_WAREHOUSE"),'chaine',0,'',$conf->entity);
$res = dolibarr_set_const($db,"CASHDESK_SERVICES", GETPOST("CASHDESK_SERVICES"),'chaine',0,'',$conf->entity);
dol_syslog("admin/cashdesk: level ".GETPOST("level"));
if (! $res > 0) $error++;
if (! $error)
{
$db->commit();
$mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>";
}
else
{
$db->rollback();
$mesg = "<font class=\"error\">".$langs->trans("Error")."</font>";
}
} }
/* /*
* View * View
@ -121,6 +136,13 @@ if ($conf->stock->enabled)
print '</td></tr>'; print '</td></tr>';
} }
$var=! $var;
print '<tr '.$bc[$var].'><td>';
print $langs->trans("CashdeskShowServices");
print '<td colspan="2">';;
print $form->selectyesno("CASHDESK_SERVICES",$conf->global->CASHDESK_SERVICES,1);
print "</td></tr>\n";
print '</table>'; print '</table>';
print '<br>'; print '<br>';
@ -128,5 +150,7 @@ print '<center><input type="submit" class="button" value="'.$langs->trans("Save"
print "</form>\n"; print "</form>\n";
llxFooter('$Date: 2011/08/03 00:46:38 $ - $Revision: 1.7 $'); dol_htmloutput_mesg($mesg);
llxFooter('$Date: 2011/08/26 14:52:00 $ - $Revision: 1.8 $');
?> ?>

View File

@ -21,7 +21,7 @@
* \file htdocs/cashdesk/facturation.php * \file htdocs/cashdesk/facturation.php
* \ingroup cashdesk * \ingroup cashdesk
* \brief Include to show main page for cashdesk module * \brief Include to show main page for cashdesk module
* \version $Id: facturation.php,v 1.19 2011/07/31 22:23:27 eldy Exp $ * \version $Id: facturation.php,v 1.20 2011/08/26 14:52:00 simnandez Exp $
*/ */
// 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)
@ -30,12 +30,12 @@ if ( $_GET['filtre'] ) {
// Avec filtre // Avec filtre
$ret=array(); $i=0; $ret=array(); $i=0;
$sql = "SELECT p.rowid, p.ref, p.label, p.tva_tx"; $sql = "SELECT p.rowid, p.ref, p.label, p.tva_tx, p.fk_product_type";
if ($conf->stock->enabled && !empty($conf_fkentrepot)) $sql.= ", ps.reel"; if ($conf->stock->enabled && !empty($conf_fkentrepot)) $sql.= ", ps.reel";
$sql.= " FROM ".MAIN_DB_PREFIX."product as p"; $sql.= " FROM ".MAIN_DB_PREFIX."product as p";
if ($conf->stock->enabled && !empty($conf_fkentrepot)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON p.rowid = ps.fk_product AND ps.fk_entrepot = '".$conf_fkentrepot."'"; if ($conf->stock->enabled && !empty($conf_fkentrepot)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON p.rowid = ps.fk_product AND ps.fk_entrepot = '".$conf_fkentrepot."'";
$sql.= " WHERE p.tosell = 1"; $sql.= " WHERE p.tosell = 1";
$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 '%".$_GET['filtre']."%' OR p.label LIKE '%".$_GET['filtre']."%' ";
if ($conf->barcode->enabled) $sql.= " OR p.barcode='".$_GET['filtre']."')"; if ($conf->barcode->enabled) $sql.= " OR p.barcode='".$_GET['filtre']."')";
else $sql.= ")"; else $sql.= ")";
@ -66,12 +66,12 @@ if ( $_GET['filtre'] ) {
$ret=array(); $ret=array();
$i=0; $i=0;
$sql = "SELECT p.rowid, ref, label, tva_tx"; $sql = "SELECT p.rowid, ref, label, tva_tx, p.fk_product_type";
if ($conf->stock->enabled && !empty($conf_fkentrepot)) $sql.= ", ps.reel"; if ($conf->stock->enabled && !empty($conf_fkentrepot)) $sql.= ", ps.reel";
$sql.= " FROM ".MAIN_DB_PREFIX."product as p"; $sql.= " FROM ".MAIN_DB_PREFIX."product as p";
if ($conf->stock->enabled && !empty($conf_fkentrepot)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON p.rowid = ps.fk_product AND ps.fk_entrepot = '".$conf_fkentrepot."'"; if ($conf->stock->enabled && !empty($conf_fkentrepot)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON p.rowid = ps.fk_product AND ps.fk_entrepot = '".$conf_fkentrepot."'";
$sql.= " WHERE p.tosell = 1"; $sql.= " WHERE p.tosell = 1";
$sql.= " AND p.fk_product_type = 0"; if(!$conf->global->CASHDESK_SERVICES) $sql.= " AND p.fk_product_type = 0";
$sql.= " ORDER BY p.label"; $sql.= " ORDER BY p.label";
dol_syslog($sql); dol_syslog($sql);

View File

@ -21,7 +21,7 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
$Id: facturation1.tpl.php,v 1.15 2011/08/03 01:13:30 eldy Exp $ $Id: facturation1.tpl.php,v 1.16 2011/08/26 14:52:00 simnandez Exp $
--> -->
<script type="text/javascript" src="javascript/facturation1.js"></script> <script type="text/javascript" src="javascript/facturation1.js"></script>
<script type="text/javascript" src="javascript/dhtml.js"></script> <script type="text/javascript" src="javascript/dhtml.js"></script>
@ -73,7 +73,7 @@ $Id: facturation1.tpl.php,v 1.15 2011/08/03 01:13:30 eldy Exp $
$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 ($conf->stock->enabled && !empty($conf_fkentrepot)) print ' ('.$langs->trans("CashDeskStock").': '.$tab_designations[$i]['reel'].')'; if ($conf->stock->enabled && !empty($conf_fkentrepot) && $tab_designations[$i]['fk_product_type']==0) print ' ('.$langs->trans("CashDeskStock").': '.$tab_designations[$i]['reel'].')';
print '</option>'."\n "; print '</option>'."\n ";
} }
@ -91,7 +91,7 @@ $Id: facturation1.tpl.php,v 1.15 2011/08/03 01:13:30 eldy Exp $
$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 ($conf->stock->enabled && !empty($conf_fkentrepot)) print ' ('.$langs->trans("CashDeskStock").': '.(empty($tab_designations[$i]['reel'])?0:$tab_designations[$i]['reel']).')'; if ($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 ";
} }

View File

@ -8,6 +8,7 @@ CashDeskBankCash=Compte bancari (efectiu)
CashDeskBankCB=Compte bancari (targetes) CashDeskBankCB=Compte bancari (targetes)
CashDeskBankCheque=Compte bancari (xecs) CashDeskBankCheque=Compte bancari (xecs)
CashDeskWarehouse=Magatzem CashDeskWarehouse=Magatzem
CashdeskShowServices=Vendre serveis
CashDeskProducts=Productes CashDeskProducts=Productes
CashDeskStock=Estoc CashDeskStock=Estoc
CashDeskOn=de CashDeskOn=de

View File

@ -8,6 +8,7 @@ CashDeskBankCash=Bank account (cash)
CashDeskBankCB=Bank account (card) CashDeskBankCB=Bank account (card)
CashDeskBankCheque=Bank account (cheque) CashDeskBankCheque=Bank account (cheque)
CashDeskWarehouse=Warehouse CashDeskWarehouse=Warehouse
CashdeskShowServices=Selling services
CashDeskProducts=Products CashDeskProducts=Products
CashDeskStock=Stock CashDeskStock=Stock
CashDeskOn=on CashDeskOn=on

View File

@ -8,6 +8,7 @@ CashDeskBankCash=Cuenta bancaria (efectivo)
CashDeskBankCB=Cuenta bancaria (tarjetas) CashDeskBankCB=Cuenta bancaria (tarjetas)
CashDeskBankCheque=Cuenta bancaria (cheques) CashDeskBankCheque=Cuenta bancaria (cheques)
CashDeskWarehouse=Almacén CashDeskWarehouse=Almacén
CashdeskShowServices=Vender servicios
CashDeskProducts=Productos CashDeskProducts=Productos
CashDeskStock=Stock CashDeskStock=Stock
CashDeskOn=de CashDeskOn=de

View File

@ -8,6 +8,7 @@ CashDeskBankCash=Compte bancaire (liquide)
CashDeskBankCB=Compte bancaire (cartes) CashDeskBankCB=Compte bancaire (cartes)
CashDeskBankCheque=Compte bancaire (chèques) CashDeskBankCheque=Compte bancaire (chèques)
CashDeskWarehouse=Entrepôt CashDeskWarehouse=Entrepôt
CashdeskShowServices=Vendre des services
CashDeskProducts=Produits CashDeskProducts=Produits
CashDeskStock=Stock CashDeskStock=Stock
CashDeskOn=de CashDeskOn=de