mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-10 11:31:26 +01:00
Fix: No error when no product has been selected on point of sale module.
This commit is contained in:
@@ -32,10 +32,10 @@
|
|||||||
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
|
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
|
||||||
//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1');
|
//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1');
|
||||||
//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1');
|
//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1');
|
||||||
//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1');
|
//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no menu to show
|
||||||
//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1');
|
//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); // If we don't need to load the html.form.class.php
|
||||||
//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
|
//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
|
||||||
//if (! defined("NOLOGIN")) define("NOLOGIN",'1');
|
//if (! defined("NOLOGIN")) define("NOLOGIN",'1'); // If this page is public (can be called outside logged session)
|
||||||
|
|
||||||
// Change this following line to use the correct relative path (../, ../../, etc)
|
// Change this following line to use the correct relative path (../, ../../, etc)
|
||||||
require("../main.inc.php");
|
require("../main.inc.php");
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
|
/* 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) 2010 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@@ -28,18 +28,18 @@ include_once(DOL_DOCUMENT_ROOT.'/lib/price.lib.php');
|
|||||||
class Facturation {
|
class Facturation {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Attributs "volatiles" : r<EFBFBD>initialis<EFBFBD>s apr<EFBFBD>s chaque traitement d'un article
|
* Attributs "volatiles" : reinitialises apres chaque traitement d'un article
|
||||||
* <p>Attributs "volatiles" : r<EFBFBD>initialis<EFBFBD>s apr<EFBFBD>s chaque traitement d'un article</p>
|
* <p>Attributs "volatiles" : reinitialises apres chaque traitement d'un article</p>
|
||||||
* @var int $id => 'rowid' du produit dans llx_product
|
* @var int $id => 'rowid' du produit dans llx_product
|
||||||
* @var string $ref => 'ref' du produit dans llx_product
|
* @var string $ref => 'ref' du produit dans llx_product
|
||||||
* @var int $qte => Quantit<EFBFBD> pour le produit en cours de traitement
|
* @var int $qte => Quantite pour le produit en cours de traitement
|
||||||
* @var int $stock => Stock th<EFBFBD>orique pour le produit en cours de traitement
|
* @var int $stock => Stock theorique pour le produit en cours de traitement
|
||||||
* @var int $remise_percent => Remise en pourcent sur le produit en cours
|
* @var int $remise_percent => Remise en pourcent sur le produit en cours
|
||||||
* @var int $montant_remise => Remise en pourcent sur le produit en cours
|
* @var int $montant_remise => Remise en pourcent sur le produit en cours
|
||||||
* @var int $prix => Prix HT du produit en cours
|
* @var int $prix => Prix HT du produit en cours
|
||||||
* @var int $tva => 'rowid' du taux de tva dans llx_c_tva
|
* @var int $tva => 'rowid' du taux de tva dans llx_c_tva
|
||||||
*/
|
*/
|
||||||
protected $id;
|
var $id;
|
||||||
protected $ref;
|
protected $ref;
|
||||||
protected $qte;
|
protected $qte;
|
||||||
protected $stock;
|
protected $stock;
|
||||||
|
|||||||
@@ -19,15 +19,30 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* This page is called each time we press a key in the code or description
|
* This page is called each time we press a key in the code or description
|
||||||
* search form to show product combo list
|
* search form to show product combo list.
|
||||||
*/
|
*/
|
||||||
include('../master.inc.php');
|
|
||||||
require ('include/environnement.php');
|
|
||||||
|
|
||||||
$langs->load("@cashdesk");
|
|
||||||
|
|
||||||
// Verification
|
//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1');
|
||||||
if ( strlen ($_GET["code"]) >= 0 ) // If at least one key
|
//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1');
|
||||||
|
if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
|
||||||
|
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
|
||||||
|
if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1');
|
||||||
|
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1');
|
||||||
|
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1');
|
||||||
|
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1');
|
||||||
|
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
|
||||||
|
//if (! defined("NOLOGIN")) define("NOLOGIN",'1');
|
||||||
|
|
||||||
|
// Change this following line to use the correct relative path (../, ../../, etc)
|
||||||
|
require("../main.inc.php");
|
||||||
|
require(DOL_DOCUMENT_ROOT.'/cashdesk/include/environnement.php');
|
||||||
|
|
||||||
|
//header("Content-type: text/html; charset=UTF-8");
|
||||||
|
header("Content-type: text/html; charset=".$conf->file->character_set_client);
|
||||||
|
|
||||||
|
// Search from criteria
|
||||||
|
if ( strlen ($_GET["code"]) >= 0 ) // If search criteria is on char length at least
|
||||||
{
|
{
|
||||||
$sql = "SELECT p.rowid, p.ref, p.label, p.tva_tx";
|
$sql = "SELECT p.rowid, p.ref, p.label, p.tva_tx";
|
||||||
if ($conf->stock->enabled && !empty($conf_fkentrepot)) $sql.= ", ps.reel";
|
if ($conf->stock->enabled && !empty($conf_fkentrepot)) $sql.= ", ps.reel";
|
||||||
@@ -64,7 +79,7 @@ if ( strlen ($_GET["code"]) >= 0 ) // If at least one key
|
|||||||
<li class="dhtml_defaut" title="'.$tab[$i]['ref'].'"
|
<li class="dhtml_defaut" title="'.$tab[$i]['ref'].'"
|
||||||
onMouseOver="javascript: this.className = \'dhtml_selection\';"
|
onMouseOver="javascript: this.className = \'dhtml_selection\';"
|
||||||
onMouseOut="javascript: this.className = \'dhtml_defaut\';"
|
onMouseOut="javascript: this.className = \'dhtml_defaut\';"
|
||||||
">'.htmlentities($tab[$i]['ref'].' - '.$tab[$i]['label']).'</li>
|
>'.$tab[$i]['ref'].' - '.$tab[$i]['label'].'</li>
|
||||||
';
|
';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -74,6 +89,8 @@ if ( strlen ($_GET["code"]) >= 0 ) // If at least one key
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
$langs->load("cashdesk@cashdesk");
|
||||||
|
|
||||||
print '<ul class="dhtml_bloc">';
|
print '<ul class="dhtml_bloc">';
|
||||||
print '<li class="dhtml_defaut">'.$langs->trans("NoResults").'</li>';
|
print '<li class="dhtml_defaut">'.$langs->trans("NoResults").'</li>';
|
||||||
print '</ul>';
|
print '</ul>';
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
|
/* 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>
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@@ -18,8 +18,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
require ('../master.inc.php');
|
require ('../master.inc.php');
|
||||||
require ('include/environnement.php');
|
require (DOL_DOCUMENT_ROOT.'/cashdesk/include/environnement.php');
|
||||||
require ('class/Facturation.class.php');
|
require (DOL_DOCUMENT_ROOT.'/cashdesk/class/Facturation.class.php');
|
||||||
|
|
||||||
$obj_facturation = unserialize ($_SESSION['serObjFacturation']);
|
$obj_facturation = unserialize ($_SESSION['serObjFacturation']);
|
||||||
unset ($_SESSION['serObjFacturation']);
|
unset ($_SESSION['serObjFacturation']);
|
||||||
@@ -103,12 +103,20 @@ switch ( $_GET['action'] )
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'ajout_article':
|
case 'ajout_article': // We have clicked on button "Add product"
|
||||||
|
|
||||||
|
//var_dump($obj_facturation);
|
||||||
|
//exit;
|
||||||
|
|
||||||
|
if (! empty($obj_facturation->id)) // A product has been selected and stored in session
|
||||||
|
{
|
||||||
$obj_facturation->qte($_POST['txtQte']);
|
$obj_facturation->qte($_POST['txtQte']);
|
||||||
$obj_facturation->tva($_POST['selTva']);
|
$obj_facturation->tva($_POST['selTva']);
|
||||||
$obj_facturation->remise_percent($_POST['txtRemise']);
|
$obj_facturation->remise_percent($_POST['txtRemise']);
|
||||||
$obj_facturation->ajoutArticle();
|
$obj_facturation->ajoutArticle();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
$redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menu=facturation';
|
$redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menu=facturation';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
/* 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
|
||||||
@@ -51,7 +51,7 @@ function file (fichier) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Affichage des donn<EFBFBD>es aTexte dans le bloc identifi<EFBFBD> par aId
|
// Affichage des donnees aTexte dans le bloc identifie par aId
|
||||||
function afficheDonnees (aId, aTexte) {
|
function afficheDonnees (aId, aTexte) {
|
||||||
|
|
||||||
document.getElementById(aId).innerHTML = aTexte;
|
document.getElementById(aId).innerHTML = aTexte;
|
||||||
@@ -59,7 +59,7 @@ function afficheDonnees (aId, aTexte) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// aCible : id du bloc de destination; aCode : argument <EFBFBD> passer <EFBFBD> la page php charg<EFBFBD>e du traitement et de l'affichage
|
// aCible : id du bloc de destination; aCode : argument a passer a la page php chargee du traitement et de l'affichage
|
||||||
function verifResultat (aCible, aCode) {
|
function verifResultat (aCible, aCode) {
|
||||||
if (aCode != '') {
|
if (aCode != '') {
|
||||||
|
|
||||||
@@ -76,7 +76,7 @@ function verifResultat (aCible, aCode) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Change dynamiquement la classe de l'<EFBFBD>l<EFBFBD>ment ayant l'id aIdElement pour aClasse
|
// Change dynamiquement la classe de l'element ayant l'id aIdElement pour aClasse
|
||||||
function setStyle (aIdElement, aClasse) {
|
function setStyle (aIdElement, aClasse) {
|
||||||
|
|
||||||
aIdElement.className = aClasse;
|
aIdElement.className = aClasse;
|
||||||
|
|||||||
Reference in New Issue
Block a user