Simplify terminal variables
This commit is contained in:
parent
9f8f45d5bc
commit
114ddea54f
@ -227,7 +227,6 @@ if ($action=="change")
|
||||
{
|
||||
$idcustomer = GETPOST('idcustomer', 'int');
|
||||
$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant
|
||||
$posnb = (GETPOST('posnb', 'int') > 0 ? GETPOST('posnb', 'int') : 0); // $posnb is id of POS
|
||||
|
||||
$sql="UPDATE ".MAIN_DB_PREFIX."facture set fk_soc=".$idcustomer." where ref='(PROV-POS-".$place.")'";
|
||||
$resql = $db->query($sql);
|
||||
|
||||
@ -58,7 +58,6 @@ if($resql){
|
||||
}
|
||||
|
||||
$terminaltouse = $terminal;
|
||||
if ($terminaltouse == '1') $terminaltouse = '';
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@ -43,7 +43,6 @@ $left = GETPOST('left', 'alpha');
|
||||
$top = GETPOST('top', 'alpha');
|
||||
|
||||
$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant
|
||||
$posnb = (GETPOST('posnb', 'int') > 0 ? GETPOST('posnb', 'int') : 0); // $posnb is id of POS
|
||||
|
||||
$newname = GETPOST('newname', 'alpha');
|
||||
$mode = GETPOST('mode', 'alpha');
|
||||
|
||||
@ -36,7 +36,6 @@ require '../main.inc.php'; // Load $user and permissions
|
||||
$langs->loadLangs(array("bills", "cashdesk"));
|
||||
|
||||
$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant
|
||||
$posnb = (GETPOST('posnb', 'int') > 0 ? GETPOST('posnb', 'int') : 0); // $posnb is id of POS
|
||||
|
||||
$idline = GETPOST('idline', 'int');
|
||||
$action = GETPOST('action', 'alpha');
|
||||
|
||||
@ -43,7 +43,6 @@ $id = GETPOST('id', 'int');
|
||||
$action = GETPOST('action', 'alpha');
|
||||
$idproduct = GETPOST('idproduct', 'int');
|
||||
$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant
|
||||
$posnb = (GETPOST('posnb', 'int') > 0 ? GETPOST('posnb', 'int') : 0); // $posnb is id of POS
|
||||
|
||||
/**
|
||||
* Abort invoice creationg with a given error message
|
||||
@ -90,7 +89,7 @@ if ($invoiceid > 0)
|
||||
}
|
||||
else
|
||||
{
|
||||
$ret = $invoice->fetch('', '(PROV-POS'.$_SESSION["takepostermvar"].'-'.$place.')');
|
||||
$ret = $invoice->fetch('', '(PROV-POS'.$_SESSION["takeposterminal"].'-'.$place.')');
|
||||
}
|
||||
if ($ret > 0)
|
||||
{
|
||||
@ -104,12 +103,12 @@ if ($ret > 0)
|
||||
|
||||
if ($action == 'valid' && $user->rights->facture->creer)
|
||||
{
|
||||
if ($pay == "cash") $bankaccount = $conf->global->{'CASHDESK_ID_BANKACCOUNT_CASH'.$_SESSION["takepostermvar"]}; // For backward compatibility
|
||||
elseif ($pay == "card") $bankaccount = $conf->global->{'CASHDESK_ID_BANKACCOUNT_CB'.$_SESSION["takepostermvar"]}; // For backward compatibility
|
||||
elseif ($pay == "cheque") $bankaccount = $conf->global->{'CASHDESK_ID_BANKACCOUNT_CHEQUE'.$_SESSION["takepostermvar"]}; // For backward compatibility
|
||||
if ($pay == "cash") $bankaccount = $conf->global->{'CASHDESK_ID_BANKACCOUNT_CASH'.$_SESSION["takeposterminal"]}; // For backward compatibility
|
||||
elseif ($pay == "card") $bankaccount = $conf->global->{'CASHDESK_ID_BANKACCOUNT_CB'.$_SESSION["takeposterminal"]}; // For backward compatibility
|
||||
elseif ($pay == "cheque") $bankaccount = $conf->global->{'CASHDESK_ID_BANKACCOUNT_CHEQUE'.$_SESSION["takeposterminal"]}; // For backward compatibility
|
||||
else
|
||||
{
|
||||
$accountname="CASHDESK_ID_BANKACCOUNT_".$pay.$_SESSION["takepostermvar"];
|
||||
$accountname="CASHDESK_ID_BANKACCOUNT_".$pay.$_SESSION["takeposterminal"];
|
||||
$bankaccount=$conf->global->$accountname;
|
||||
}
|
||||
$now=dol_now();
|
||||
@ -137,9 +136,9 @@ if ($action == 'valid' && $user->rights->facture->creer)
|
||||
$invoice->update($user);
|
||||
}
|
||||
|
||||
if (! empty($conf->stock->enabled) && $conf->global->{'CASHDESK_NO_DECREASE_STOCK'.$_SESSION["takepostermvar"]} != "1")
|
||||
if (! empty($conf->stock->enabled) && $conf->global->{'CASHDESK_NO_DECREASE_STOCK'.$_SESSION["takeposterminal"]} != "1")
|
||||
{
|
||||
$invoice->validate($user, '', $conf->global->{'CASHDESK_ID_WAREHOUSE'.$_SESSION["takepostermvar"]});
|
||||
$invoice->validate($user, '', $conf->global->{'CASHDESK_ID_WAREHOUSE'.$_SESSION["takeposterminal"]});
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -180,13 +179,13 @@ if ($action == 'history')
|
||||
|
||||
if (($action=="addline" || $action=="freezone") && $placeid == 0)
|
||||
{
|
||||
$invoice->socid = $conf->global->{'CASHDESK_ID_THIRDPARTY'.$_SESSION["takepostermvar"]};
|
||||
$invoice->socid = $conf->global->{'CASHDESK_ID_THIRDPARTY'.$_SESSION["takeposterminal"]};
|
||||
$invoice->date = dol_now();
|
||||
$invoice->module_source = 'takepos';
|
||||
$invoice->pos_source = (string) $posnb;
|
||||
$invoice->pos_source = $_SESSION["takeposterminal"];
|
||||
|
||||
$placeid = $invoice->create($user);
|
||||
$sql="UPDATE ".MAIN_DB_PREFIX."facture set ref='(PROV-POS".$_SESSION["takepostermvar"]."-".$place.")' where rowid=".$placeid;
|
||||
$sql="UPDATE ".MAIN_DB_PREFIX."facture set ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")' where rowid=".$placeid;
|
||||
$db->query($sql);
|
||||
}
|
||||
|
||||
@ -559,11 +558,11 @@ else { // No invoice generated yet
|
||||
|
||||
print '</table>';
|
||||
|
||||
if ($invoice->socid != $conf->global->{'CASHDESK_ID_THIRDPARTY'.$_SESSION["takepostermvar"]})
|
||||
if ($invoice->socid != $conf->global->{'CASHDESK_ID_THIRDPARTY'.$_SESSION["takeposterminal"]})
|
||||
{
|
||||
$soc = new Societe($db);
|
||||
if ($invoice->socid > 0) $soc->fetch($invoice->socid);
|
||||
else $soc->fetch($conf->global->{'CASHDESK_ID_THIRDPARTY'.$_SESSION["takepostermvar"]});
|
||||
else $soc->fetch($conf->global->{'CASHDESK_ID_THIRDPARTY'.$_SESSION["takeposterminal"]});
|
||||
print '<p style="font-size:120%;" class="right">';
|
||||
print $langs->trans("Customer").': '.$soc->name;
|
||||
print '</p>';
|
||||
|
||||
@ -35,7 +35,6 @@ require '../main.inc.php'; // Load $user and permissions
|
||||
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
|
||||
|
||||
$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant
|
||||
$posnb = (GETPOST('posnb', 'int') > 0 ? GETPOST('posnb', 'int') : 0); // $posnb is id of POS
|
||||
|
||||
$invoiceid = GETPOST('invoiceid', 'int');
|
||||
|
||||
@ -51,7 +50,7 @@ if ($invoiceid > 0)
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql="SELECT rowid FROM ".MAIN_DB_PREFIX."facture where ref='(PROV-POS".$_SESSION["takepostermvar"]."-".$place.")'";
|
||||
$sql="SELECT rowid FROM ".MAIN_DB_PREFIX."facture where ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")'";
|
||||
$resql = $db->query($sql);
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($obj)
|
||||
|
||||
@ -31,7 +31,6 @@ include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
$langs->loadLangs(array("main", "cashdesk"));
|
||||
|
||||
$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant
|
||||
$posnb = (GETPOST('posnb', 'int') > 0 ? GETPOST('posnb', 'int') : 0); // $posnb is id of POS
|
||||
|
||||
$facid=GETPOST('facid', 'int');
|
||||
|
||||
@ -44,7 +43,7 @@ top_httphead('text/html');
|
||||
|
||||
if ($place > 0)
|
||||
{
|
||||
$sql="SELECT rowid FROM ".MAIN_DB_PREFIX."facture where ref='(PROV-POS".$_SESSION["takepostermvar"]."-".$place.")'";
|
||||
$sql="SELECT rowid FROM ".MAIN_DB_PREFIX."facture where ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")'";
|
||||
$resql = $db->query($sql);
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($obj)
|
||||
|
||||
@ -39,15 +39,12 @@ require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
|
||||
$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant
|
||||
$posnb = (GETPOST('posnb', 'int') > 0 ? GETPOST('posnb', 'int') : 0); // $posnb is id of POS
|
||||
$action = GETPOST('action', 'alpha');
|
||||
$setterminal = GETPOST('setterminal', 'int');
|
||||
|
||||
if ($setterminal>0)
|
||||
{
|
||||
$_SESSION["takeposterminal"]=$setterminal;
|
||||
if ($setterminal==1) $_SESSION["takepostermvar"]="";
|
||||
else $_SESSION["takepostermvar"]=$setterminal;
|
||||
}
|
||||
|
||||
$langs->loadLangs(array("bills","orders","commercial","cashdesk","receiptprinter"));
|
||||
|
||||
Loading…
Reference in New Issue
Block a user