Cashdesk module works with same driver than dolibarr
This commit is contained in:
parent
fb0e668fc0
commit
cfe31513f2
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
|
||||
* Copyright (C) 2008 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
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
@ -96,62 +96,69 @@
|
||||
protected function verif_utilisateurs () {
|
||||
|
||||
global $conf, $db;
|
||||
|
||||
|
||||
//var_dump($conf->db);
|
||||
//$sql = new Sql ($conf->db->host, $conf->db->user, $conf->db->pass, $conf->db->name);
|
||||
$sql = $db;
|
||||
|
||||
|
||||
// Verification des informations dans la base
|
||||
$res = $sql->query ($this->sql);
|
||||
$num = $sql->num_rows ($res);
|
||||
$resql = $sql->query ($this->sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $sql->num_rows ($resql);
|
||||
|
||||
if ( $num ) {
|
||||
if ( $num ) {
|
||||
|
||||
// fetchFirst
|
||||
$ret=array();
|
||||
$tab = mysql_fetch_array($res);
|
||||
foreach ( $tab as $cle => $valeur )
|
||||
{
|
||||
$ret[$cle] = $valeur;
|
||||
}
|
||||
$tab=$ret;
|
||||
// fetchFirst
|
||||
$ret=array();
|
||||
$tab = $sql->fetch_array($resql);
|
||||
foreach ( $tab as $cle => $valeur )
|
||||
{
|
||||
$ret[$cle] = $valeur;
|
||||
}
|
||||
$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
|
||||
if ( $tab['statut'] ) {
|
||||
// On verifie que le compte soit bien actif
|
||||
if ( $tab['statut'] ) {
|
||||
|
||||
$this->reponse(0);
|
||||
$this->reponse(0);
|
||||
|
||||
} else {
|
||||
|
||||
$this->reponse(-2);
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
$this->reponse(-2);
|
||||
$this->reponse(-1);
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
$this->reponse(-1);
|
||||
$this->reponse(-10);
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
$this->reponse(-10);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function verif ($aLogin, $aPasswd) {
|
||||
global $conf;
|
||||
|
||||
$this->login ($aLogin);
|
||||
$this->passwd ($aPasswd);
|
||||
|
||||
$this->sql = "SELECT rowid, pass_crypted, statut
|
||||
FROM ".MAIN_DB_PREFIX."user
|
||||
WHERE login = '".$this->login."'";
|
||||
WHERE login = '".$this->login."' and entity IN (0,".$conf->entity.")";
|
||||
|
||||
|
||||
$this->verif_utilisateurs();
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
|
||||
* Copyright (C) 2008 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
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
@ -79,10 +79,10 @@ class Facturation {
|
||||
// global $conf_db_host, $conf_db_user, $conf_db_pass, $conf_db_base;
|
||||
// $sql = new Sql ($conf_db_host, $conf_db_user, $conf_db_pass, $conf_db_base);
|
||||
|
||||
global $sql;
|
||||
global $sql;
|
||||
$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();
|
||||
foreach ( $tab_tva as $cle => $valeur )
|
||||
{
|
||||
@ -90,7 +90,7 @@ class Facturation {
|
||||
}
|
||||
$tab_tva=$ret;
|
||||
// var_dump($tab_tva);exit;
|
||||
|
||||
|
||||
// TODO Mettre methode de calcul arrondi TVA de Dolibarr
|
||||
|
||||
// Calcul du total ht sans remise
|
||||
@ -110,7 +110,7 @@ class Facturation {
|
||||
// Calcul du total ttc
|
||||
$total_ttc = ($total_ht - $montant_remise) * (($tab_tva['taux'] / 100) + 1);
|
||||
|
||||
|
||||
|
||||
$sql->query('INSERT INTO '.MAIN_DB_PREFIX.'tmp_caisse (
|
||||
fk_article,
|
||||
qte,
|
||||
@ -151,18 +151,18 @@ class Facturation {
|
||||
// global $conf_db_host, $conf_db_user, $conf_db_pass, $conf_db_base;
|
||||
// $sql = new Sql ($conf_db_host, $conf_db_user, $conf_db_pass, $conf_db_base);
|
||||
|
||||
global $sql;
|
||||
global $sql;
|
||||
$res = $sql->query ('SELECT remise, total_ht, total_ttc, taux FROM '.MAIN_DB_PREFIX.'tmp_caisse as c
|
||||
LEFT JOIN '.MAIN_DB_PREFIX.'c_tva as t ON c.fk_tva = t.rowid
|
||||
ORDER BY id');
|
||||
|
||||
$total_ht=0;
|
||||
$total_ttc=0;
|
||||
|
||||
|
||||
if ( $sql->num_rows($res) ) {
|
||||
|
||||
$ret=array(); $i=0;
|
||||
while ( $tab = mysql_fetch_array($res) )
|
||||
while ( $tab = $sql->fetch_array($res) )
|
||||
{
|
||||
foreach ( $tab as $cle => $valeur )
|
||||
{
|
||||
@ -171,7 +171,7 @@ class Facturation {
|
||||
$i++;
|
||||
}
|
||||
$tab=$ret;
|
||||
|
||||
|
||||
for ( $i = 0; $i < count($tab); $i++ ) {
|
||||
|
||||
// Total HT
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
|
||||
* Copyright (C) 2008 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
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
@ -32,7 +32,7 @@ if ( $_GET['filtre'] ) {
|
||||
AND ref LIKE \'%'.$_GET['filtre'].'%\'
|
||||
OR label LIKE \'%'.$_GET['filtre'].'%\'
|
||||
ORDER BY label');
|
||||
while ( $tab = mysql_fetch_array($resql) )
|
||||
while ( $tab = $sql->fetch_array($resql) )
|
||||
{
|
||||
foreach ( $tab as $cle => $valeur )
|
||||
{
|
||||
@ -52,7 +52,7 @@ if ( $_GET['filtre'] ) {
|
||||
AND fk_product_type = 0
|
||||
AND fk_entrepot = '.$conf_fkentrepot.'
|
||||
ORDER BY label');
|
||||
while ( $tab = mysql_fetch_array($resql) )
|
||||
while ( $tab = $sql->fetch_array($resql) )
|
||||
{
|
||||
foreach ( $tab as $cle => $valeur )
|
||||
{
|
||||
@ -92,7 +92,7 @@ if ( $nbr_enreg > 1 ) {
|
||||
global $mysoc;
|
||||
$request="SELECT t.rowid, t.taux
|
||||
FROM ".MAIN_DB_PREFIX."c_tva as t, llx_c_pays as p
|
||||
WHERE t.fk_pays = p.rowid AND t.active = 1 AND p.code = '".$mysoc->pays_code."'";
|
||||
WHERE t.fk_pays = p.rowid AND t.active = 1 AND p.code = '".$mysoc->pays_code."'";
|
||||
//print $request;
|
||||
|
||||
$ret=array(); $i=0;
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
|
||||
* Copyright (C) 2008 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
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
@ -38,7 +38,7 @@
|
||||
$resultat = '<ul class="dhtml_bloc">';
|
||||
|
||||
$ret=array(); $i=0;
|
||||
while ( $tab = mysql_fetch_array($res) )
|
||||
while ( $tab = $sql->fetch_array($res) )
|
||||
{
|
||||
foreach ( $tab as $cle => $valeur )
|
||||
{
|
||||
@ -47,7 +47,7 @@
|
||||
$i++;
|
||||
}
|
||||
$tab=$ret;
|
||||
|
||||
|
||||
for ( $i = 0; $i < count ($tab); $i++ ) {
|
||||
|
||||
$resultat .= '
|
||||
|
||||
@ -55,7 +55,7 @@ switch ( $_GET['action'] ) {
|
||||
if ( $sql->num_rows ($res) ) {
|
||||
|
||||
$ret=array();
|
||||
$tab = mysql_fetch_array($res);
|
||||
$tab = $sql->fetch_array($res);
|
||||
foreach ( $tab as $cle => $valeur )
|
||||
{
|
||||
$ret[$cle] = $valeur;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?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
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \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.
|
||||
$sessionname='DOLSESSID_'.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="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 http-equiv="Content-Type" content="text/html; charset=iso-8859-15" />
|
||||
|
||||
@ -24,7 +24,6 @@ require ('classes/Auth.class.php');
|
||||
$username = $_POST['txtUsername'];
|
||||
$password = $_POST['pwdPassword'];
|
||||
|
||||
|
||||
$auth = new Auth ($conf_db_host,$conf_db_user, $conf_db_pass, $conf_db_base );
|
||||
|
||||
$retour = $auth->verif ($username, $password);
|
||||
@ -37,10 +36,10 @@ if ( $retour >= 0 ) {
|
||||
$res=$sql->query (
|
||||
"SELECT rowid, name, firstname
|
||||
FROM ".MAIN_DB_PREFIX."user
|
||||
WHERE login = '".$username."'");
|
||||
WHERE login = '".$username."' and entity IN (0,".$conf->entity.")");
|
||||
|
||||
$ret=array();
|
||||
$tab = mysql_fetch_array($res);
|
||||
$tab = $sql->fetch_array($res);
|
||||
foreach ( $tab as $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) ) {
|
||||
|
||||
$ret=array(); $i=0;
|
||||
while ( $tab = mysql_fetch_array($res) )
|
||||
while ( $tab = $sql->fetch_array($res) )
|
||||
{
|
||||
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) ) {
|
||||
|
||||
$ret=array(); $i=0;
|
||||
while ( $tab = mysql_fetch_array($res) )
|
||||
while ( $tab = $sql->fetch_array($res) )
|
||||
{
|
||||
foreach ( $tab as $cle => $valeur )
|
||||
{
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
|
||||
* Copyright (C) 2008 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
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
@ -43,12 +43,12 @@ switch ( $_GET['action'] ) {
|
||||
if ( $sql->num_rows ($res) ) {
|
||||
|
||||
$ret=array();
|
||||
$tab = mysql_fetch_array($res);
|
||||
$tab = $sql->fetch_array($res);
|
||||
foreach ( $tab as $cle => $valeur )
|
||||
{
|
||||
$ret[$cle] = $valeur;
|
||||
}
|
||||
|
||||
|
||||
$tab_num_facture = $ret;
|
||||
|
||||
$tab = explode ('-', $tab_num_facture['facnumber']);
|
||||
@ -212,9 +212,9 @@ switch ( $_GET['action'] ) {
|
||||
FROM ".MAIN_DB_PREFIX."facture
|
||||
WHERE 1
|
||||
ORDER BY rowid DESC");
|
||||
|
||||
|
||||
$ret=array();
|
||||
$tab = mysql_fetch_array($resql);
|
||||
$tab = $sql->fetch_array($resql);
|
||||
foreach ( $tab as $cle => $valeur )
|
||||
{
|
||||
$ret[$cle] = $valeur;
|
||||
@ -296,9 +296,9 @@ switch ( $_GET['action'] ) {
|
||||
FROM ".MAIN_DB_PREFIX."facture
|
||||
WHERE 1
|
||||
ORDER BY rowid DESC");
|
||||
|
||||
|
||||
$ret=array();
|
||||
$tab = mysql_fetch_array($resql);
|
||||
$tab = $sql->fetch_array($resql);
|
||||
foreach ( $tab as $cle => $valeur )
|
||||
{
|
||||
$ret[$cle] = $valeur;
|
||||
@ -351,7 +351,7 @@ switch ( $_GET['action'] ) {
|
||||
ORDER BY rowid DESC");
|
||||
|
||||
$ret=array();
|
||||
$tab = mysql_fetch_array($resql);
|
||||
$tab = $sql->fetch_array($resql);
|
||||
foreach ( $tab as $cle => $valeur )
|
||||
{
|
||||
$ret[$cle] = $valeur;
|
||||
@ -401,9 +401,9 @@ switch ( $_GET['action'] ) {
|
||||
FROM ".MAIN_DB_PREFIX."paiement
|
||||
WHERE 1
|
||||
ORDER BY rowid DESC");
|
||||
|
||||
|
||||
$ret=array();
|
||||
$tab = mysql_fetch_array($resql);
|
||||
$tab = $sql->fetch_array($resql);
|
||||
foreach ( $tab as $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
|
||||
WHERE 1');
|
||||
$ret=array(); $i=0;
|
||||
while ( $tab = mysql_fetch_array($res) )
|
||||
while ( $tab = $sql->fetch_array($res) )
|
||||
{
|
||||
foreach ( $tab as $cle => $valeur )
|
||||
{
|
||||
@ -472,7 +472,7 @@ switch ( $_GET['action'] ) {
|
||||
FROM '.MAIN_DB_PREFIX.'product
|
||||
WHERE rowid = '.$tab_liste[$i]['fk_article']);
|
||||
$ret=array();
|
||||
$tab = mysql_fetch_array($res);
|
||||
$tab = $sql->fetch_array($res);
|
||||
foreach ( $tab as $cle => $valeur )
|
||||
{
|
||||
$ret[$cle] = $valeur;
|
||||
@ -484,14 +484,14 @@ switch ( $_GET['action'] ) {
|
||||
FROM '.MAIN_DB_PREFIX.'c_tva
|
||||
WHERE rowid = '.$tab_liste[$i]['fk_tva']);
|
||||
$ret=array();
|
||||
$tab = mysql_fetch_array($res);
|
||||
$tab = $sql->fetch_array($res);
|
||||
foreach ( $tab as $cle => $valeur )
|
||||
{
|
||||
$ret[$cle] = $valeur;
|
||||
}
|
||||
$tab_tva = $ret;
|
||||
|
||||
|
||||
|
||||
|
||||
// Calcul du montant de la TVA
|
||||
$montant_tva = $tab_liste[$i]['total_ttc'] - $tab_liste[$i]['total_ht'];
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user