New: Can choose third party to use in point of sale module during logon.

This commit is contained in:
Laurent Destailleur 2010-10-22 02:00:50 +00:00
parent bdf3bbfb36
commit 19dae2da95
12 changed files with 75 additions and 54 deletions

View File

@ -3,6 +3,7 @@ English Dolibarr ChangeLog
***** ChangeLog for 3.0 compared to 2.9 *****
For users:
- New: Can choose third party to use in point of sale module during logon.
- New: A lot of enhancements into ECM module:
Directories can contains special characters,
Speed enhancements,

View File

@ -40,7 +40,7 @@ if (!$user->admin)
accessforbidden();
$langs->load("admin");
$langs->load("@cashdesk");
$langs->load("cashdesk");
/*
@ -91,7 +91,7 @@ print "</tr>\n";
$var=!$var;
print '<tr '.$bc[$var].'><td width=\"50%\">'.$langs->trans("CashDeskThirdPartyForSell").'</td>';
print '<td colspan="2">';
print $form->select_societes($conf->global->CASHDESK_ID_THIRDPARTY,'socid','',1,1);
print $form->select_societes($conf->global->CASHDESK_ID_THIRDPARTY,'socid','s.client=1',1,1);
print '</td></tr>';
if ($conf->banque->enabled)
{

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) 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

View File

@ -98,7 +98,7 @@ if ( dol_strlen ($_GET["code"]) >= 0 ) // If search criteria is on char length a
}
else
{
$langs->load("cashdesk@cashdesk");
$langs->load("cashdesk");
print '<ul class="dhtml_bloc">';
print '<li class="dhtml_defaut">'.$langs->trans("NoResults").'</li>';

View File

@ -29,29 +29,19 @@ $conf_db_pass = $dolibarr_main_db_pass;
$conf_db_base = $dolibarr_main_db_name;
// Identifiant unique correspondant au tiers generique pour la vente
$conf_fksoc = $conf->global->CASHDESK_ID_THIRDPARTY;
$conf_fksoc = (! empty($_SESSION["CASHDESK_ID_THIRDPARTY"]))?$_SESSION["CASHDESK_ID_THIRDPARTY"]:($conf->global->CASHDESK_ID_THIRDPARTY>0?$conf->global->CASHDESK_ID_THIRDPARTY:0);
// Identifiant unique correspondant a l'entrepot a utiliser
$conf_fkentrepot = (! empty($_SESSION["CASHDESK_ID_WAREHOUSE"]))?$_SESSION["CASHDESK_ID_WAREHOUSE"]:($conf->global->CASHDESK_ID_WAREHOUSE>0?$conf->global->CASHDESK_ID_WAREHOUSE:0);
// Identifiant unique correspondant au compte caisse / liquide
$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 = (! 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 = (! 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 = (! 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 = '';
if (empty($conf_fksoc))
{
$error.= '<div class="error">Setup of CashDesk module not complete. Third party not defined</div>';
}
if ($conf->banque->enabled && (empty($conf_fkaccount_cash) || empty($conf_fkaccount_cheque) || empty($conf_fkaccount_cb)))
{
$error.= '<div class="error">Setup of CashDesk module not complete. Bank account not defined</div>';
}
// Parametres d'affichage
$conf_taille_listes = 200; // Nombre max de lignes a afficher dans les listes
$conf_nbr_car_listes = 60; // Nombre max de caracteres par ligne dans les listes

View File

@ -26,6 +26,10 @@
// Set and init common variables
// This include will set: config file variable $dolibarr_xxx, $conf, $langs and $mysoc objects
require_once("../main.inc.php");
require_once(DOL_DOCUMENT_ROOT."/product/class/html.formproduct.class.php");
$langs->load("admin");
$langs->load("cashdesk");
// Test if user logged
if ( $_SESSION['uid'] > 0 )
@ -35,24 +39,16 @@ if ( $_SESSION['uid'] > 0 )
}
require_once(DOL_DOCUMENT_ROOT."/product/class/html.formproduct.class.php");
/*
* View
*/
$form=new Form($db);
$formproduct=new FormProduct($db);
$arrayofcss=array(DOL_URL_ROOT.'/cashdesk/css/style.css');
top_htmlhead('','',0,0,'',$arrayofcss);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Point of Sale login</title>
<meta name="robots" content="none" />
<meta name="author" content="Jeremie Ollivier - jeremie.o@laposte.net" />
<meta name="Generator" content="Kwrite, Gimp, Inkscape" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<link href="<?php echo DOL_URL_ROOT.'/cashdesk/css/style.css'; ?>" rel="stylesheet" type="text/css" media="screen" />
</head>
<body>
<div class="conteneur">
@ -68,7 +64,7 @@ $formproduct=new FormProduct($db);
<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">
<form id="frmLogin" method="post" action="index_verif.php">
<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>" />
<table>
@ -82,6 +78,16 @@ $formproduct=new FormProduct($db);
<td><input name="pwdPassword" class="texte_login" type="password" value="" /></td>
</tr>
<?php
print "<tr>";
print '<td class="label1">'.$langs->trans("CashDeskThirdPartyForSell").'</td>';
print '<td>';
$disabled=0;
if (! empty($conf->global->CASHDESK_ID_THIRDPARTY)) $disabled=1; // If a particular third party is defined, we disable choice
$form->select_societes($conf->global->CASHDESK_ID_THIRDPARTY,'socid','s.client=1',!$disabled,$disabled,1);
//print '<input name="warehouse_id" class="texte_login" type="warehouse_id" value="" />';
print '</td>';
print "</tr>\n";
if ($conf->stock->enabled)
{
$langs->load("stocks");
@ -93,12 +99,12 @@ if ($conf->stock->enabled)
$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>";
print "</tr>\n";
}
?>
</table>
<span class="bouton_login"><input name="sbmtConnexion" type="submit" value="Connexion" /></span>
<center><span class="bouton_login"><input name="sbmtConnexion" type="submit" value="Connexion" /></span></center>
</form>
</fieldset>

View File

@ -25,11 +25,15 @@ require_once(DOL_DOCUMENT_ROOT.'/cashdesk/include/environnement.php');
require_once(DOL_DOCUMENT_ROOT.'/cashdesk/class/Auth.class.php');
$langs->load("main");
$langs->load("admin");
$langs->load("cashdesk");
$username = $_POST['txtUsername'];
$password = $_POST['pwdPassword'];
$warehouseid = isset($_POST['warehouseid'])?$_POST['warehouseid']:0;
$thirdpartyid = isset($_POST['socid'])?$_POST['socid']:$conf->global->CASHDESK_ID_THIRDPARTY;
$warehouseid = isset($_POST['warehouseid'])?$_POST['warehouseid']:$conf->global->CASHDESK_ID_WAREHOUSE;
$error = '';
// Check username
if (empty($username))
@ -38,6 +42,13 @@ if (empty($username))
header ('Location: '.DOL_URL_ROOT.'/cashdesk/index.php?err='.urlencode($retour).'&user='.$username);
exit;
}
// Check third party id
if (! ($thirdpartyid > 0))
{
$retour=$langs->trans("ErrorFieldRequired",$langs->transnoentities("CashDeskThirdPartyForSell"));
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))
@ -47,6 +58,14 @@ if ($conf->stock->enabled && $conf->global->STOCK_CALCULATE_ON_BILL && ! ($wareh
exit;
}
if (! empty($_POST['txtUsername']) && $conf->banque->enabled && (empty($conf_fkaccount_cash) || empty($conf_fkaccount_cheque) || empty($conf_fkaccount_cb)))
{
// $error.= '<div class="error"></div>';
header("Location: index.php?err=".urlencode('Setup of Point of Sale module not complete. Bank account not defined').'&user='.$username);
exit;
}
// Check password
$auth = new Auth($db);
@ -75,8 +94,9 @@ if ( $retour >= 0 )
$_SESSION['uname'] = $username;
$_SESSION['nom'] = $tab['name'];
$_SESSION['prenom'] = $tab['firstname'];
$_SESSION['CASHDESK_ID_WAREHOUSE'] = $warehouseid;
//var_dump($_SESSION);
$_SESSION['CASHDESK_ID_THIRDPARTY'] = $thirdpartyid;
$_SESSION['CASHDESK_ID_WAREHOUSE'] = $warehouseid;
//var_dump($_SESSION);exit;
header ('Location: '.DOL_URL_ROOT.'/cashdesk/affIndex.php?menu=facturation&id=NOUV');
exit;

View File

@ -1,7 +1,7 @@
<?php
$langs->load("main");
$langs->load("bills");
$langs->load("@cashdesk");
$langs->load("cashdesk");
?>
<!--
Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>

View File

@ -1,7 +1,7 @@
<?php
$langs->load("main");
$langs->load("bills");
$langs->load("@cashdesk");
$langs->load("cashdesk");
?>
<!--Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>

View File

@ -22,10 +22,10 @@ include_once(DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php');
include_once(DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php');
include_once(DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php');
if (!empty($conf->global->CASHDESK_ID_THIRDPARTY))
if (!empty($_SESSION["CASHDESK_ID_THIRDPARTY"]))
{
$company=new Societe($db);
$company->fetch($conf->global->CASHDESK_ID_THIRDPARTY);
$company->fetch($_SESSION["CASHDESK_ID_THIRDPARTY"]);
$companyLink = $company->getNomUrl(1);
}
if (!empty($conf->global->CASHDESK_ID_BANKACCOUNT_CASH))
@ -55,7 +55,7 @@ if (!empty($_SESSION["CASHDESK_ID_WAREHOUSE"]) && $conf->stock->enabled)
}
$langs->load("@cashdesk");
$langs->load("cashdesk");
$langs->load("main");
$logout='<img class="login" border="0" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/logout.png">';

View File

@ -773,13 +773,13 @@ function top_httphead()
/**
* \brief Show HTML header
* \param head Optionnal head lines
* \param title Web page title
* \param disablejs Do not output links to js (Ex: qd fonction utilisee par sous formulaire Ajax)
* \param disablehead Do not output head section
* \param arrayofjs Array of js files to add in header
* \param arrayofcss Array of css files to add in header
* Show HTML header
* @param head Optionnal head lines
* @param title Web page title
* @param disablejs Do not output links to js (Ex: qd fonction utilisee par sous formulaire Ajax)
* @param disablehead Do not output head section
* @param arrayofjs Array of js files to add in header
* @param arrayofcss Array of css files to add in header
*/
function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='')
{
@ -960,7 +960,7 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a
$menutop = new MenuTop($db);
$menutop->atarget=$target;
$menutop->showmenu();
// Select entity
if (! empty($conf->global->MAIN_MODULE_MULTICOMPANY))
{
@ -1030,7 +1030,7 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a
$logouttext.=' alt="'.dol_escape_htmltag($langs->trans("Logout")).'" title=""';
$logouttext.='>';
}
print $html->textwithtooltip('',$loginhtmltext,2,1,$logintext);
print $html->textwithtooltip('',$logouthtmltext,2,1,$logouttext);

View File

@ -52,7 +52,7 @@ dol_syslog(join(',',$_GET));
// Generation liste des societes
if (! empty($_GET['newcompany']) || ! empty($_GET['socid']) || ! empty($_GET['id_fourn']))
if (GETPOST('newcompany') || GETPOST('socid') || GETPOST('id_fourn'))
{
$return_arr = array();
@ -103,10 +103,14 @@ if (! empty($_GET['newcompany']) || ! empty($_GET['socid']) || ! empty($_GET['id
echo json_encode($return_arr);
}
else
{
echo json_encode(array('nom'=>'Error','label'=>'Error','key'=>'Error','value'=>'Error'));
}
}
else
{
echo json_encode(array('nom'=>'ErrorBadParameter','label'=>'ErrorBadParameter','key'=>'ErrorBadParameter','value'=>'ErrorBadParameter'));
}
?>