New: Some change to allow to use different warehouse in pos module

This commit is contained in:
Laurent Destailleur 2010-06-16 22:16:11 +00:00
parent f505c21a67
commit 8fd69cadb3
6 changed files with 59 additions and 28 deletions

View File

@ -3,6 +3,7 @@ English Dolibarr ChangeLog
***** ChangeLog for 2.9 compared to 2.8 *****
For users:
- New: POS module allow to choose which warehouse use.
- New: Support "Department/State" field on contact and members card.
- New: Can reopen a refused/canceled supplier order.
- New: Add Gant diagramm on project module.

View File

@ -31,6 +31,7 @@ if ( $_SESSION['uid'] <= 0 ) {
exit;
}
print '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">';
print '<html>'."\n";
@ -58,7 +59,7 @@ print '</head>'."\n";
print '<body>'."\n";
if (!empty($error))
if (!empty($error))
{
print $error;
print '</body></html>';

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
* Copyright (C) 2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2009-2010 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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
@ -41,13 +41,15 @@ $conf_db_base = $dolibarr_main_db_name;
// Identifiant unique correspondant au tiers generique pour la vente
$conf_fksoc = $conf->global->CASHDESK_ID_THIRDPARTY;
// Identifiant unique correspondant au compte caisse / liquide
$conf_fkaccount_cash = $conf->global->CASHDESK_ID_BANKACCOUNT_CASH > 0?$conf->global->CASHDESK_ID_BANKACCOUNT_CASH:$_SESSION["CASHDESK_ID_BANKACCOUNT_CASH"];
$conf_fkaccount_cash = (! empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CASH"]))?$_SESSION["CASHDESK_ID_BANKACCOUNT_CASH"]:($conf->global->CASHDESK_ID_BANKACCOUNT_CASH>0?$conf->global->CASHDESK_ID_BANKACCOUNT_CASH:0);
// Identifiant unique correspondant au compte cheque
$conf_fkaccount_cheque = $conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE > 0?$conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE:$_SESSION["CASHDESK_ID_BANKACCOUNT_CHEQUE"];
$conf_fkaccount_cheque = (! empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CHEQUE"]))?$_SESSION["CASHDESK_ID_BANKACCOUNT_CHEQUE"]:($conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE>0?$conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE:0);
// Identifiant unique correspondant au compte cb
$conf_fkaccount_cb = $conf->global->CASHDESK_ID_BANKACCOUNT_CB > 0?$conf->global->CASHDESK_ID_BANKACCOUNT_CB:$_SESSION["CASHDESK_ID_BANKACCOUNT_CB"];
$conf_fkaccount_cb = (! empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CB"]))?$_SESSION["CASHDESK_ID_BANKACCOUNT_CB"]:($conf->global->CASHDESK_ID_BANKACCOUNT_CB>0?$conf->global->CASHDESK_ID_BANKACCOUNT_CB:0);
// Identifiant unique correspondant a l'entrepot a utiliser
$conf_fkentrepot = $conf->global->CASHDESK_ID_WAREHOUSE > 0?$conf->global->CASHDESK_ID_WAREHOUSE:$_SESSION["CASHDESK_ID_WAREHOUSE"];
$conf_fkentrepot = (! empty($_SESSION["CASHDESK_ID_WAREHOUSE"]))?$_SESSION["CASHDESK_ID_WAREHOUSE"]:($conf->global->CASHDESK_ID_WAREHOUSE>0?$conf->global->CASHDESK_ID_WAREHOUSE:0);
//var_dump($_SESSION);
// Check if setup ok
$error = '';
@ -59,11 +61,6 @@ if ($conf->banque->enabled && (empty($conf_fkaccount_cash) || empty($conf_fkacco
{
$error.= '<div class="error">Setup of CashDesk module not complete. Bank account not defined</div>';
}
// If we setup stock module to ask movement on invoices, with must not work if required setup not finished.
if ($conf->stock->enabled && $conf->global->STOCK_CALCULATE_ON_BILL && empty($conf_fkentrepot))
{
$error.= '<div class="error">Setup of CashDesk module not complete. You ask to decrease stock on invoice creation but warehouse for this is not defined (Change stock module setup, or complete point of sale module setup).</div>';
}
// Parametres d'affichage
$conf_taille_listes = 200; // Nombre max de lignes a afficher dans les listes

View File

@ -78,12 +78,14 @@ $formproduct=new FormProduct($db);
<div class="conteneur_img_gauche">
<div class="conteneur_img_droite">
<h1 class="entete"><span>CAISSE : identification</span></h1>
<h1 class="entete"></h1>
<div class="menu_principal"></div>
<div class="menu_principal">
</div>
<div class="contenu">
<div class="principal_login">
<?php if (! empty($_GET["err"])) print $_GET["err"]."<br><br>\n"; ?>
<fieldset class="cadre_facturation"><legend class="titre1">Identification</legend>
<form class="formulaire_login" id="frmLogin" method="post" action="index_verif.php">
<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>" />
@ -98,7 +100,8 @@ $formproduct=new FormProduct($db);
<td class="label1"><?php echo $langs->trans("Password"); ?></td>
<td><input name="pwdPassword" class="texte_login" type="password" value="" /></td>
</tr>
<?php if ($conf->stock->enabled)
<?php
if ($conf->stock->enabled)
{
$langs->load("stocks");
print "<tr>";
@ -106,7 +109,7 @@ $formproduct=new FormProduct($db);
print '<td>';
$disabled=0;
if (! empty($conf->global->CASHDESK_ID_WAREHOUSE)) $disabled=1; // If a particular stock is defined, we disable choice
print $formproduct->selectWarehouses($conf->global->CASHDESK_ID_WAREHOUSE,'idwarehouse','',!$disabled,$disabled);
print $formproduct->selectWarehouses($conf->global->CASHDESK_ID_WAREHOUSE,'warehouseid','',!$disabled,$disabled);
//print '<input name="warehouse_id" class="texte_login" type="warehouse_id" value="" />';
print '</td>';
print "</tr>";

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
* Copyright (C) 2008 Laurent Destailleur <eldy@uers.sourceforge.net>
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
* Copyright (C) 2008-2010 Laurent Destailleur <eldy@uers.sourceforge.net>
*
* 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
@ -15,45 +15,71 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* This page is called after submission of login page.
* We set here login choices into session.
*/
include('../master.inc.php');
require('include/environnement.php');
require('class/Auth.class.php');
$langs->load("main");
$username = $_POST['txtUsername'];
$password = $_POST['pwdPassword'];
$warehouseid = isset($_POST['warehouseid'])?$_POST['warehouseid']:0;
// Check username
if (empty($username))
{
$retour=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Login"));
header ('Location: '.DOL_URL_ROOT.'/cashdesk/index.php?err='.urlencode($retour).'&user='.$username);
exit;
}
// If we setup stock module to ask movement on invoices, we must not allow access if required setup not finished.
if ($conf->stock->enabled && $conf->global->STOCK_CALCULATE_ON_BILL && ! ($warehouseid > 0))
{
$retour=$langs->trans("You ask to decrease stock on invoice creation but warehouse for this is was not defined (Change stock module setup, or choose a warehouse).");
header ('Location: '.DOL_URL_ROOT.'/cashdesk/index.php?err='.urlencode($retour).'&user='.$username);
exit;
}
// Check password
$auth = new Auth($db);
$retour = $auth->verif ($username, $password);
if ( $retour >= 0 )
{
$return=array();
$sql = "SELECT rowid, name, firstname";
$sql.= " FROM ".MAIN_DB_PREFIX."user";
$sql.= " WHERE login = '".$username."'";
$sql.= " AND entity IN (0,".$conf->entity.")";
$result = $db->query($sql);
if ($result)
{
$tab = $db->fetch_array($res);
foreach ( $tab as $key => $value )
{
$return[$key] = $value;
}
$_SESSION['uid'] = $tab['rowid'];
$_SESSION['uname'] = $username;
$_SESSION['nom'] = $tab['name'];
$_SESSION['prenom'] = $tab['firstname'];
$_SESSION['CASHDESK_ID_WAREHOUSE'] = $warehouseid;
//var_dump($_SESSION);
header ('Location: '.DOL_URL_ROOT.'/cashdesk/affIndex.php?menu=facturation&id=NOUV');
exit;
}
else
{
@ -63,7 +89,9 @@ if ( $retour >= 0 )
}
else
{
header ('Location: '.DOL_URL_ROOT.'/cashdesk/index.php?err='.$retour.'&user='.$username);
$retour=$langs->trans("ErrorWrongPassword");
header ('Location: '.DOL_URL_ROOT.'/cashdesk/index.php?err='.urlencode($retour).'&user='.$username);
exit;
}
?>

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
* Copyright (C) 2008-2009 Laurent Destailleur <eldy@uers.sourceforge.net>
* Copyright (C) 2008-2010 Laurent Destailleur <eldy@uers.sourceforge.net>
* Copyright (C) 2009 Regis Houssin <regis@dolibarr.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -32,6 +32,7 @@ if (!empty($conf->global->CASHDESK_ID_BANKACCOUNT_CASH))
{
$bankcash=new Account($db);
$bankcash->fetch($conf->global->CASHDESK_ID_BANKACCOUNT_CASH);
$bankcash->label=$bankcash->ref;
$bankcashLink = $bankcash->getNomUrl(1);
}
if (!empty($conf->global->CASHDESK_ID_BANKACCOUNT_CB))
@ -46,10 +47,10 @@ if (!empty($conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE))
$bankcheque->fetch($conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE);
$bankchequeLink = $bankcheque->getNomUrl(1);
}
if (!empty($conf->global->CASHDESK_ID_WAREHOUSE) && $conf->stock->enabled)
if (!empty($_SESSION["CASHDESK_ID_WAREHOUSE"]) && $conf->stock->enabled)
{
$warehouse=new Entrepot($db);
$warehouse->fetch($conf->global->CASHDESK_ID_WAREHOUSE);
$warehouse->fetch($_SESSION["CASHDESK_ID_WAREHOUSE"]);
$warehouseLink = $warehouse->getNomUrl(1);
}
@ -70,7 +71,7 @@ print $langs->trans("CashDeskThirdParty").': '.$companyLink.'<br>';
print $langs->trans("CashDeskBankCash").': '.$bankcashLink.'<br>';
print $langs->trans("CashDeskBankCB").': '.$bankcbLink.'<br>';
print $langs->trans("CashDeskBankCheque").': '.$bankchequeLink.'<br>';
if (!empty($conf->global->CASHDESK_ID_WAREHOUSE) && $conf->stock->enabled)
if (!empty($_SESSION["CASHDESK_ID_WAREHOUSE"]) && $conf->stock->enabled)
{
print $langs->trans("CashDeskWarehouse").': '.$warehouseLink;
}