From db012b467d2f1871c7ae891ab631a09cbcb18b6e Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Fri, 26 Aug 2011 14:52:00 +0000 Subject: [PATCH] task #11278: Option into point of sale module to add services in list --- htdocs/cashdesk/admin/cashdesk.php | 52 +++++++++++++++++------- htdocs/cashdesk/facturation.php | 10 ++--- htdocs/cashdesk/tpl/facturation1.tpl.php | 6 +-- htdocs/langs/ca_ES/cashdesk.lang | 1 + htdocs/langs/en_US/cashdesk.lang | 1 + htdocs/langs/es_ES/cashdesk.lang | 1 + htdocs/langs/fr_FR/cashdesk.lang | 1 + 7 files changed, 50 insertions(+), 22 deletions(-) diff --git a/htdocs/cashdesk/admin/cashdesk.php b/htdocs/cashdesk/admin/cashdesk.php index 720b7d3d00f..5162033dc01 100644 --- a/htdocs/cashdesk/admin/cashdesk.php +++ b/htdocs/cashdesk/admin/cashdesk.php @@ -1,5 +1,6 @@ + * Copyright (C) 2011 Juanjo Menent * * 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 @@ -19,7 +20,7 @@ * \file htdocs/cashdesk/admin/cashdesk.php * \ingroup cashdesk * \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"); @@ -45,23 +46,37 @@ $langs->load("cashdesk"); /* * Actions */ -if ($_POST["action"] == 'set') +if (GETPOST("action") == 'set') { - if ($_POST["socid"] < 0) $_POST["socid"]=''; - if ($_POST["CASHDESK_ID_BANKACCOUNT"] < 0) $_POST["CASHDESK_ID_BANKACCOUNT"]=''; - if ($_POST["CASHDESK_ID_WAREHOUSE"] < 0) $_POST["CASHDESK_ID_WAREHOUSE"]=''; + $db->begin(); + + if (GETPOST("socid") < 0) $_POST["socid"]=''; + /*if (GETPOST("CASHDESK_ID_BANKACCOUNT") < 0) $_POST["CASHDESK_ID_BANKACCOUNT"]=''; + if (GETPOST("CASHDESK_ID_WAREHOUSE") < 0) $_POST["CASHDESK_ID_WAREHOUSE"]='';*/ - dolibarr_set_const($db,"CASHDESK_ID_THIRDPARTY",$_POST["socid"],'chaine',0,'',$conf->entity); - dolibarr_set_const($db,"CASHDESK_ID_BANKACCOUNT_CASH",$_POST["CASHDESK_ID_BANKACCOUNT_CASH"],'chaine',0,'',$conf->entity); - dolibarr_set_const($db,"CASHDESK_ID_BANKACCOUNT_CHEQUE",$_POST["CASHDESK_ID_BANKACCOUNT_CHEQUE"],'chaine',0,'',$conf->entity); - 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); + $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 ".$_POST["level"]); + dol_syslog("admin/cashdesk: level ".GETPOST("level")); + + if (! $res > 0) $error++; + + if (! $error) + { + $db->commit(); + $mesg = "".$langs->trans("SetupSaved").""; + } + else + { + $db->rollback(); + $mesg = "".$langs->trans("Error").""; + } } - - /* * View */ @@ -121,6 +136,13 @@ if ($conf->stock->enabled) print ''; } +$var=! $var; +print ''; +print $langs->trans("CashdeskShowServices"); +print '';; +print $form->selectyesno("CASHDESK_SERVICES",$conf->global->CASHDESK_SERVICES,1); +print "\n"; + print ''; print '
'; @@ -128,5 +150,7 @@ print '
\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 $'); ?> diff --git a/htdocs/cashdesk/facturation.php b/htdocs/cashdesk/facturation.php index 11e5f18b5ed..b99d91bf497 100644 --- a/htdocs/cashdesk/facturation.php +++ b/htdocs/cashdesk/facturation.php @@ -21,7 +21,7 @@ * \file htdocs/cashdesk/facturation.php * \ingroup cashdesk * \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) @@ -30,12 +30,12 @@ if ( $_GET['filtre'] ) { // Avec filtre $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"; $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."'"; $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']."%' "; if ($conf->barcode->enabled) $sql.= " OR p.barcode='".$_GET['filtre']."')"; else $sql.= ")"; @@ -66,12 +66,12 @@ if ( $_GET['filtre'] ) { $ret=array(); $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"; $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."'"; $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"; dol_syslog($sql); diff --git a/htdocs/cashdesk/tpl/facturation1.tpl.php b/htdocs/cashdesk/tpl/facturation1.tpl.php index c34a9718bd3..72b41e72a80 100644 --- a/htdocs/cashdesk/tpl/facturation1.tpl.php +++ b/htdocs/cashdesk/tpl/facturation1.tpl.php @@ -21,7 +21,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . -$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 $ --> @@ -73,7 +73,7 @@ $Id: facturation1.tpl.php,v 1.15 2011/08/03 01:13:30 eldy Exp $ $label = $tab_designations[$i]['label']; print ''."\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']; print ''."\n "; } diff --git a/htdocs/langs/ca_ES/cashdesk.lang b/htdocs/langs/ca_ES/cashdesk.lang index 7eb2fe9ab72..d6159645479 100755 --- a/htdocs/langs/ca_ES/cashdesk.lang +++ b/htdocs/langs/ca_ES/cashdesk.lang @@ -8,6 +8,7 @@ CashDeskBankCash=Compte bancari (efectiu) CashDeskBankCB=Compte bancari (targetes) CashDeskBankCheque=Compte bancari (xecs) CashDeskWarehouse=Magatzem +CashdeskShowServices=Vendre serveis CashDeskProducts=Productes CashDeskStock=Estoc CashDeskOn=de diff --git a/htdocs/langs/en_US/cashdesk.lang b/htdocs/langs/en_US/cashdesk.lang index 2b95be11a08..78a9efcc083 100755 --- a/htdocs/langs/en_US/cashdesk.lang +++ b/htdocs/langs/en_US/cashdesk.lang @@ -8,6 +8,7 @@ CashDeskBankCash=Bank account (cash) CashDeskBankCB=Bank account (card) CashDeskBankCheque=Bank account (cheque) CashDeskWarehouse=Warehouse +CashdeskShowServices=Selling services CashDeskProducts=Products CashDeskStock=Stock CashDeskOn=on diff --git a/htdocs/langs/es_ES/cashdesk.lang b/htdocs/langs/es_ES/cashdesk.lang index 590d56a368b..0a24dd1290b 100755 --- a/htdocs/langs/es_ES/cashdesk.lang +++ b/htdocs/langs/es_ES/cashdesk.lang @@ -8,6 +8,7 @@ CashDeskBankCash=Cuenta bancaria (efectivo) CashDeskBankCB=Cuenta bancaria (tarjetas) CashDeskBankCheque=Cuenta bancaria (cheques) CashDeskWarehouse=Almacén +CashdeskShowServices=Vender servicios CashDeskProducts=Productos CashDeskStock=Stock CashDeskOn=de diff --git a/htdocs/langs/fr_FR/cashdesk.lang b/htdocs/langs/fr_FR/cashdesk.lang index dc8043c90a8..cb7e7f25251 100755 --- a/htdocs/langs/fr_FR/cashdesk.lang +++ b/htdocs/langs/fr_FR/cashdesk.lang @@ -8,6 +8,7 @@ CashDeskBankCash=Compte bancaire (liquide) CashDeskBankCB=Compte bancaire (cartes) CashDeskBankCheque=Compte bancaire (chèques) CashDeskWarehouse=Entrepôt +CashdeskShowServices=Vendre des services CashDeskProducts=Produits CashDeskStock=Stock CashDeskOn=de