Cashdesk module works with same driver than dolibarr
This commit is contained in:
parent
fb0e668fc0
commit
cfe31513f2
@ -102,56 +102,63 @@
|
|||||||
$sql = $db;
|
$sql = $db;
|
||||||
|
|
||||||
// Verification des informations dans la base
|
// Verification des informations dans la base
|
||||||
$res = $sql->query ($this->sql);
|
$resql = $sql->query ($this->sql);
|
||||||
$num = $sql->num_rows ($res);
|
if ($resql)
|
||||||
|
{
|
||||||
|
$num = $sql->num_rows ($resql);
|
||||||
|
|
||||||
if ( $num ) {
|
if ( $num ) {
|
||||||
|
|
||||||
// fetchFirst
|
// fetchFirst
|
||||||
$ret=array();
|
$ret=array();
|
||||||
$tab = mysql_fetch_array($res);
|
$tab = $sql->fetch_array($resql);
|
||||||
foreach ( $tab as $cle => $valeur )
|
foreach ( $tab as $cle => $valeur )
|
||||||
{
|
{
|
||||||
$ret[$cle] = $valeur;
|
$ret[$cle] = $valeur;
|
||||||
}
|
}
|
||||||
$tab=$ret;
|
$tab=$ret;
|
||||||
|
|
||||||
if ( ($tab['pass_crypted'] == md5 ($this->passwd)) || (($tab['pass'] == $this->passwd) && ($tab['pass'] != ''))) {
|
if ( ($tab['pass_crypted'] == md5 ($this->passwd)) || (($tab['pass'] == $this->passwd) && ($tab['pass'] != ''))) {
|
||||||
|
|
||||||
// On verifie que le compte soit bien actif
|
// On verifie que le compte soit bien actif
|
||||||
if ( $tab['statut'] ) {
|
if ( $tab['statut'] ) {
|
||||||
|
|
||||||
$this->reponse(0);
|
$this->reponse(0);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
$this->reponse(-2);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$this->reponse(-2);
|
$this->reponse(-1);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$this->reponse(-1);
|
$this->reponse(-10);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
else
|
||||||
|
{
|
||||||
$this->reponse(-10);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function verif ($aLogin, $aPasswd) {
|
public function verif ($aLogin, $aPasswd) {
|
||||||
|
global $conf;
|
||||||
|
|
||||||
$this->login ($aLogin);
|
$this->login ($aLogin);
|
||||||
$this->passwd ($aPasswd);
|
$this->passwd ($aPasswd);
|
||||||
|
|
||||||
$this->sql = "SELECT rowid, pass_crypted, statut
|
$this->sql = "SELECT rowid, pass_crypted, statut
|
||||||
FROM ".MAIN_DB_PREFIX."user
|
FROM ".MAIN_DB_PREFIX."user
|
||||||
WHERE login = '".$this->login."'";
|
WHERE login = '".$this->login."' and entity IN (0,".$conf->entity.")";
|
||||||
|
|
||||||
|
|
||||||
$this->verif_utilisateurs();
|
$this->verif_utilisateurs();
|
||||||
|
|||||||
@ -82,7 +82,7 @@ class Facturation {
|
|||||||
global $sql;
|
global $sql;
|
||||||
$resql=$sql->query ('SELECT taux FROM '.MAIN_DB_PREFIX.'c_tva WHERE rowid = '.$this->tva());
|
$resql=$sql->query ('SELECT taux FROM '.MAIN_DB_PREFIX.'c_tva WHERE rowid = '.$this->tva());
|
||||||
|
|
||||||
$tab_tva = mysql_fetch_array($resql);
|
$tab_tva = $sql->fetch_array($resql);
|
||||||
$ret=array();
|
$ret=array();
|
||||||
foreach ( $tab_tva as $cle => $valeur )
|
foreach ( $tab_tva as $cle => $valeur )
|
||||||
{
|
{
|
||||||
@ -162,7 +162,7 @@ class Facturation {
|
|||||||
if ( $sql->num_rows($res) ) {
|
if ( $sql->num_rows($res) ) {
|
||||||
|
|
||||||
$ret=array(); $i=0;
|
$ret=array(); $i=0;
|
||||||
while ( $tab = mysql_fetch_array($res) )
|
while ( $tab = $sql->fetch_array($res) )
|
||||||
{
|
{
|
||||||
foreach ( $tab as $cle => $valeur )
|
foreach ( $tab as $cle => $valeur )
|
||||||
{
|
{
|
||||||
|
|||||||
@ -32,7 +32,7 @@ if ( $_GET['filtre'] ) {
|
|||||||
AND ref LIKE \'%'.$_GET['filtre'].'%\'
|
AND ref LIKE \'%'.$_GET['filtre'].'%\'
|
||||||
OR label LIKE \'%'.$_GET['filtre'].'%\'
|
OR label LIKE \'%'.$_GET['filtre'].'%\'
|
||||||
ORDER BY label');
|
ORDER BY label');
|
||||||
while ( $tab = mysql_fetch_array($resql) )
|
while ( $tab = $sql->fetch_array($resql) )
|
||||||
{
|
{
|
||||||
foreach ( $tab as $cle => $valeur )
|
foreach ( $tab as $cle => $valeur )
|
||||||
{
|
{
|
||||||
@ -52,7 +52,7 @@ if ( $_GET['filtre'] ) {
|
|||||||
AND fk_product_type = 0
|
AND fk_product_type = 0
|
||||||
AND fk_entrepot = '.$conf_fkentrepot.'
|
AND fk_entrepot = '.$conf_fkentrepot.'
|
||||||
ORDER BY label');
|
ORDER BY label');
|
||||||
while ( $tab = mysql_fetch_array($resql) )
|
while ( $tab = $sql->fetch_array($resql) )
|
||||||
{
|
{
|
||||||
foreach ( $tab as $cle => $valeur )
|
foreach ( $tab as $cle => $valeur )
|
||||||
{
|
{
|
||||||
|
|||||||
@ -38,7 +38,7 @@
|
|||||||
$resultat = '<ul class="dhtml_bloc">';
|
$resultat = '<ul class="dhtml_bloc">';
|
||||||
|
|
||||||
$ret=array(); $i=0;
|
$ret=array(); $i=0;
|
||||||
while ( $tab = mysql_fetch_array($res) )
|
while ( $tab = $sql->fetch_array($res) )
|
||||||
{
|
{
|
||||||
foreach ( $tab as $cle => $valeur )
|
foreach ( $tab as $cle => $valeur )
|
||||||
{
|
{
|
||||||
|
|||||||
@ -55,7 +55,7 @@ switch ( $_GET['action'] ) {
|
|||||||
if ( $sql->num_rows ($res) ) {
|
if ( $sql->num_rows ($res) ) {
|
||||||
|
|
||||||
$ret=array();
|
$ret=array();
|
||||||
$tab = mysql_fetch_array($res);
|
$tab = $sql->fetch_array($res);
|
||||||
foreach ( $tab as $cle => $valeur )
|
foreach ( $tab as $cle => $valeur )
|
||||||
{
|
{
|
||||||
$ret[$cle] = $valeur;
|
$ret[$cle] = $valeur;
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2007-2008 J<EFBFBD>r<EFBFBD>mie Ollivier <jeremie.o@laposte.net>
|
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@ -16,6 +16,13 @@
|
|||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file htdocs/cashdesk/index.php
|
||||||
|
* \ingroup cashdesk
|
||||||
|
* \brief File to login to point of sales
|
||||||
|
* \version $Id$
|
||||||
|
*/
|
||||||
|
|
||||||
// Init session. Name of session is specific to Dolibarr instance.
|
// Init session. Name of session is specific to Dolibarr instance.
|
||||||
$sessionname='DOLSESSID_'.md5($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"]);
|
$sessionname='DOLSESSID_'.md5($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"]);
|
||||||
$sessiontimeout='DOLSESSTIMEOUT_'.md5($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"]);
|
$sessiontimeout='DOLSESSTIMEOUT_'.md5($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"]);
|
||||||
@ -41,7 +48,7 @@ if ( $_SESSION['uid'] > 0 )
|
|||||||
|
|
||||||
<meta name="robots" content="none" />
|
<meta name="robots" content="none" />
|
||||||
|
|
||||||
<meta name="author" content="J<EFBFBD>r<EFBFBD>mie Ollivier - jeremie.o@laposte.net" />
|
<meta name="author" content="Jeremie Ollivier - jeremie.o@laposte.net" />
|
||||||
<meta name="Generator" content="Kwrite, Gimp, Inkscape" />
|
<meta name="Generator" content="Kwrite, Gimp, Inkscape" />
|
||||||
|
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15" />
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15" />
|
||||||
|
|||||||
@ -24,7 +24,6 @@ require ('classes/Auth.class.php');
|
|||||||
$username = $_POST['txtUsername'];
|
$username = $_POST['txtUsername'];
|
||||||
$password = $_POST['pwdPassword'];
|
$password = $_POST['pwdPassword'];
|
||||||
|
|
||||||
|
|
||||||
$auth = new Auth ($conf_db_host,$conf_db_user, $conf_db_pass, $conf_db_base );
|
$auth = new Auth ($conf_db_host,$conf_db_user, $conf_db_pass, $conf_db_base );
|
||||||
|
|
||||||
$retour = $auth->verif ($username, $password);
|
$retour = $auth->verif ($username, $password);
|
||||||
@ -37,10 +36,10 @@ if ( $retour >= 0 ) {
|
|||||||
$res=$sql->query (
|
$res=$sql->query (
|
||||||
"SELECT rowid, name, firstname
|
"SELECT rowid, name, firstname
|
||||||
FROM ".MAIN_DB_PREFIX."user
|
FROM ".MAIN_DB_PREFIX."user
|
||||||
WHERE login = '".$username."'");
|
WHERE login = '".$username."' and entity IN (0,".$conf->entity.")");
|
||||||
|
|
||||||
$ret=array();
|
$ret=array();
|
||||||
$tab = mysql_fetch_array($res);
|
$tab = $sql->fetch_array($res);
|
||||||
foreach ( $tab as $cle => $valeur )
|
foreach ( $tab as $cle => $valeur )
|
||||||
{
|
{
|
||||||
$ret[$cle] = $valeur;
|
$ret[$cle] = $valeur;
|
||||||
|
|||||||
@ -28,7 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||||||
if ( $sql->num_rows($res) ) {
|
if ( $sql->num_rows($res) ) {
|
||||||
|
|
||||||
$ret=array(); $i=0;
|
$ret=array(); $i=0;
|
||||||
while ( $tab = mysql_fetch_array($res) )
|
while ( $tab = $sql->fetch_array($res) )
|
||||||
{
|
{
|
||||||
foreach ( $tab as $cle => $valeur )
|
foreach ( $tab as $cle => $valeur )
|
||||||
{
|
{
|
||||||
|
|||||||
@ -125,7 +125,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||||||
if ( $sql->num_rows($res) ) {
|
if ( $sql->num_rows($res) ) {
|
||||||
|
|
||||||
$ret=array(); $i=0;
|
$ret=array(); $i=0;
|
||||||
while ( $tab = mysql_fetch_array($res) )
|
while ( $tab = $sql->fetch_array($res) )
|
||||||
{
|
{
|
||||||
foreach ( $tab as $cle => $valeur )
|
foreach ( $tab as $cle => $valeur )
|
||||||
{
|
{
|
||||||
|
|||||||
@ -43,7 +43,7 @@ switch ( $_GET['action'] ) {
|
|||||||
if ( $sql->num_rows ($res) ) {
|
if ( $sql->num_rows ($res) ) {
|
||||||
|
|
||||||
$ret=array();
|
$ret=array();
|
||||||
$tab = mysql_fetch_array($res);
|
$tab = $sql->fetch_array($res);
|
||||||
foreach ( $tab as $cle => $valeur )
|
foreach ( $tab as $cle => $valeur )
|
||||||
{
|
{
|
||||||
$ret[$cle] = $valeur;
|
$ret[$cle] = $valeur;
|
||||||
@ -214,7 +214,7 @@ switch ( $_GET['action'] ) {
|
|||||||
ORDER BY rowid DESC");
|
ORDER BY rowid DESC");
|
||||||
|
|
||||||
$ret=array();
|
$ret=array();
|
||||||
$tab = mysql_fetch_array($resql);
|
$tab = $sql->fetch_array($resql);
|
||||||
foreach ( $tab as $cle => $valeur )
|
foreach ( $tab as $cle => $valeur )
|
||||||
{
|
{
|
||||||
$ret[$cle] = $valeur;
|
$ret[$cle] = $valeur;
|
||||||
@ -298,7 +298,7 @@ switch ( $_GET['action'] ) {
|
|||||||
ORDER BY rowid DESC");
|
ORDER BY rowid DESC");
|
||||||
|
|
||||||
$ret=array();
|
$ret=array();
|
||||||
$tab = mysql_fetch_array($resql);
|
$tab = $sql->fetch_array($resql);
|
||||||
foreach ( $tab as $cle => $valeur )
|
foreach ( $tab as $cle => $valeur )
|
||||||
{
|
{
|
||||||
$ret[$cle] = $valeur;
|
$ret[$cle] = $valeur;
|
||||||
@ -351,7 +351,7 @@ switch ( $_GET['action'] ) {
|
|||||||
ORDER BY rowid DESC");
|
ORDER BY rowid DESC");
|
||||||
|
|
||||||
$ret=array();
|
$ret=array();
|
||||||
$tab = mysql_fetch_array($resql);
|
$tab = $sql->fetch_array($resql);
|
||||||
foreach ( $tab as $cle => $valeur )
|
foreach ( $tab as $cle => $valeur )
|
||||||
{
|
{
|
||||||
$ret[$cle] = $valeur;
|
$ret[$cle] = $valeur;
|
||||||
@ -403,7 +403,7 @@ switch ( $_GET['action'] ) {
|
|||||||
ORDER BY rowid DESC");
|
ORDER BY rowid DESC");
|
||||||
|
|
||||||
$ret=array();
|
$ret=array();
|
||||||
$tab = mysql_fetch_array($resql);
|
$tab = $sql->fetch_array($resql);
|
||||||
foreach ( $tab as $cle => $valeur )
|
foreach ( $tab as $cle => $valeur )
|
||||||
{
|
{
|
||||||
$ret[$cle] = $valeur;
|
$ret[$cle] = $valeur;
|
||||||
@ -453,7 +453,7 @@ switch ( $_GET['action'] ) {
|
|||||||
LEFT JOIN '.MAIN_DB_PREFIX.'product_stock ON '.MAIN_DB_PREFIX.'tmp_caisse.fk_article = '.MAIN_DB_PREFIX.'product_stock.fk_product
|
LEFT JOIN '.MAIN_DB_PREFIX.'product_stock ON '.MAIN_DB_PREFIX.'tmp_caisse.fk_article = '.MAIN_DB_PREFIX.'product_stock.fk_product
|
||||||
WHERE 1');
|
WHERE 1');
|
||||||
$ret=array(); $i=0;
|
$ret=array(); $i=0;
|
||||||
while ( $tab = mysql_fetch_array($res) )
|
while ( $tab = $sql->fetch_array($res) )
|
||||||
{
|
{
|
||||||
foreach ( $tab as $cle => $valeur )
|
foreach ( $tab as $cle => $valeur )
|
||||||
{
|
{
|
||||||
@ -472,7 +472,7 @@ switch ( $_GET['action'] ) {
|
|||||||
FROM '.MAIN_DB_PREFIX.'product
|
FROM '.MAIN_DB_PREFIX.'product
|
||||||
WHERE rowid = '.$tab_liste[$i]['fk_article']);
|
WHERE rowid = '.$tab_liste[$i]['fk_article']);
|
||||||
$ret=array();
|
$ret=array();
|
||||||
$tab = mysql_fetch_array($res);
|
$tab = $sql->fetch_array($res);
|
||||||
foreach ( $tab as $cle => $valeur )
|
foreach ( $tab as $cle => $valeur )
|
||||||
{
|
{
|
||||||
$ret[$cle] = $valeur;
|
$ret[$cle] = $valeur;
|
||||||
@ -484,7 +484,7 @@ switch ( $_GET['action'] ) {
|
|||||||
FROM '.MAIN_DB_PREFIX.'c_tva
|
FROM '.MAIN_DB_PREFIX.'c_tva
|
||||||
WHERE rowid = '.$tab_liste[$i]['fk_tva']);
|
WHERE rowid = '.$tab_liste[$i]['fk_tva']);
|
||||||
$ret=array();
|
$ret=array();
|
||||||
$tab = mysql_fetch_array($res);
|
$tab = $sql->fetch_array($res);
|
||||||
foreach ( $tab as $cle => $valeur )
|
foreach ( $tab as $cle => $valeur )
|
||||||
{
|
{
|
||||||
$ret[$cle] = $valeur;
|
$ret[$cle] = $valeur;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user