|
@@ -144,7 +144,7 @@ $soc = new Societe($db);
|
|
|
if ($invoice->socid > 0) {
|
|
|
$soc->fetch($invoice->socid);
|
|
|
} else {
|
|
|
- $soc->fetch(getDolGlobalString("$constforcompanyid"));
|
|
|
+ $soc->fetch(getDolGlobalString($constforcompanyid));
|
|
|
}
|
|
|
|
|
|
// Change the currency of invoice if it was modified
|
|
@@ -216,7 +216,7 @@ if (empty($reshook)) {
|
|
|
$invoice->update($user);
|
|
|
}
|
|
|
|
|
|
- $constantforkey = 'CASHDESK_NO_DECREASE_STOCK'.$_SESSION["takeposterminal"];
|
|
|
+ $constantforkey = 'CASHDESK_NO_DECREASE_STOCK'.(isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : '');
|
|
|
if ($error) {
|
|
|
dol_htmloutput_errors($errormsg, null, 1);
|
|
|
} elseif ($invoice->statut != Facture::STATUS_DRAFT) {
|
|
@@ -231,18 +231,18 @@ if (empty($reshook)) {
|
|
|
$error++;
|
|
|
dol_syslog('Sale without lines');
|
|
|
dol_htmloutput_errors($langs->trans("NoLinesToBill", "TakePos"), null, 1);
|
|
|
- } elseif (isModEnabled('stock') && $conf->global->$constantforkey != "1") {
|
|
|
+ } elseif (isModEnabled('stock') && getDolGlobalString($constantforkey) != "1") {
|
|
|
$savconst = $conf->global->STOCK_CALCULATE_ON_BILL;
|
|
|
$conf->global->STOCK_CALCULATE_ON_BILL = 1;
|
|
|
|
|
|
$constantforkey = 'CASHDESK_ID_WAREHOUSE'.$_SESSION["takeposterminal"];
|
|
|
- dol_syslog("Validate invoice with stock change into warehouse defined into constant ".$constantforkey." = ".$conf->global->$constantforkey);
|
|
|
+ dol_syslog("Validate invoice with stock change into warehouse defined into constant ".$constantforkey." = ".getDolGlobalString($constantforkey));
|
|
|
$batch_rule = 0;
|
|
|
if (isModEnabled('productbatch') && !empty($conf->global->CASHDESK_FORCE_DECREASE_STOCK)) {
|
|
|
require_once DOL_DOCUMENT_ROOT.'/product/class/productbatch.class.php';
|
|
|
$batch_rule = Productbatch::BATCH_RULE_SELLBY_EATBY_DATES_FIRST;
|
|
|
}
|
|
|
- $res = $invoice->validate($user, '', $conf->global->$constantforkey, 0, $batch_rule);
|
|
|
+ $res = $invoice->validate($user, '', getDolGlobalString($constantforkey), 0, $batch_rule);
|
|
|
|
|
|
$conf->global->STOCK_CALCULATE_ON_BILL = $savconst;
|
|
|
} else {
|
|
@@ -431,18 +431,18 @@ if (empty($reshook)) {
|
|
|
}
|
|
|
$creditnote->update_price(1);
|
|
|
|
|
|
- $constantforkey = 'CASHDESK_NO_DECREASE_STOCK'.$_SESSION["takeposterminal"];
|
|
|
- if (isModEnabled('stock') && $conf->global->$constantforkey != "1") {
|
|
|
+ $constantforkey = 'CASHDESK_NO_DECREASE_STOCK'.(isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : '');
|
|
|
+ if (isModEnabled('stock') && getDolGlobalString($constantforkey) != "1") {
|
|
|
$savconst = $conf->global->STOCK_CALCULATE_ON_BILL;
|
|
|
$conf->global->STOCK_CALCULATE_ON_BILL = 1;
|
|
|
- $constantforkey = 'CASHDESK_ID_WAREHOUSE'.$_SESSION["takeposterminal"];
|
|
|
- dol_syslog("Validate invoice with stock change into warehouse defined into constant ".$constantforkey." = ".$conf->global->$constantforkey);
|
|
|
+ $constantforkey = 'CASHDESK_ID_WAREHOUSE'.(isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : '');
|
|
|
+ dol_syslog("Validate invoice with stock change into warehouse defined into constant ".$constantforkey." = ".getDolGlobalString($constantforkey));
|
|
|
$batch_rule = 0;
|
|
|
- if (isModEnabled('productbatch') && !empty($conf->global->CASHDESK_FORCE_DECREASE_STOCK)) {
|
|
|
+ if (isModEnabled('productbatch') && getDolGlobalString('CASHDESK_FORCE_DECREASE_STOCK')) {
|
|
|
require_once DOL_DOCUMENT_ROOT.'/product/class/productbatch.class.php';
|
|
|
$batch_rule = Productbatch::BATCH_RULE_SELLBY_EATBY_DATES_FIRST;
|
|
|
}
|
|
|
- $res = $creditnote->validate($user, '', $conf->global->$constantforkey, 0, $batch_rule);
|
|
|
+ $res = $creditnote->validate($user, '', getDolGlobalString($constantforkey), 0, $batch_rule);
|
|
|
$conf->global->STOCK_CALCULATE_ON_BILL = $savconst;
|
|
|
} else {
|
|
|
$res = $creditnote->validate($user);
|
|
@@ -658,7 +658,7 @@ if (empty($reshook)) {
|
|
|
|
|
|
$sql = "UPDATE ".MAIN_DB_PREFIX."facture";
|
|
|
$varforconst = 'CASHDESK_ID_THIRDPARTY'.$_SESSION["takeposterminal"];
|
|
|
- $sql .= " SET fk_soc = ".((int) $conf->global->$varforconst).", ";
|
|
|
+ $sql .= " SET fk_soc = ".((int) getDolGlobalString($varforconst)).", ";
|
|
|
$sql .= " datec = '".$db->idate(dol_now())."'";
|
|
|
$sql .= " WHERE ref = '(PROV-POS".$db->escape($_SESSION["takeposterminal"]."-".$place).")'";
|
|
|
$resql1 = $db->query($sql);
|
|
@@ -1205,7 +1205,7 @@ $( document ).ready(function() {
|
|
|
$idwarehouse = 0;
|
|
|
$constantforkey = 'CASHDESK_NO_DECREASE_STOCK'. (isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : '');
|
|
|
if (isModEnabled('stock')) {
|
|
|
- if (getDolGlobalString("$constantforkey") != "1") {
|
|
|
+ if (getDolGlobalString($constantforkey) != "1") {
|
|
|
$constantforkey = 'CASHDESK_ID_WAREHOUSE'. (isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : '');
|
|
|
$idwarehouse = getDolGlobalString($constantforkey);
|
|
|
if ($idwarehouse > 0) {
|
|
@@ -1240,7 +1240,7 @@ $( document ).ready(function() {
|
|
|
|
|
|
// Module Adherent
|
|
|
$s = '';
|
|
|
- if (isModEnabled('adherent') && $invoice->socid > 0 && $invoice->socid != $conf->global->$constforcompanyid) {
|
|
|
+ if (isModEnabled('adherent') && $invoice->socid > 0 && $invoice->socid != getDolGlobalInt($constforcompanyid)) {
|
|
|
$s = '<span class="small">';
|
|
|
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
|
|
$langs->load("members");
|
|
@@ -1616,13 +1616,13 @@ if ($placeid > 0) {
|
|
|
$htmlforlines .= '<td class="right">';
|
|
|
if (isModEnabled('stock') && !empty($user->rights->stock->mouvement->lire)) {
|
|
|
$constantforkey = 'CASHDESK_ID_WAREHOUSE'.$_SESSION["takeposterminal"];
|
|
|
- if (!empty($conf->global->$constantforkey) && $line->fk_product > 0 && empty($conf->global->TAKEPOS_HIDE_STOCK_ON_LINE)) {
|
|
|
+ if (getDolGlobalString($constantforkey) && $line->fk_product > 0 && empty($conf->global->TAKEPOS_HIDE_STOCK_ON_LINE)) {
|
|
|
$sql = "SELECT e.rowid, e.ref, e.lieu, e.fk_parent, e.statut, ps.reel, ps.rowid as product_stock_id, p.pmp";
|
|
|
$sql .= " FROM ".MAIN_DB_PREFIX."entrepot as e,";
|
|
|
$sql .= " ".MAIN_DB_PREFIX."product_stock as ps";
|
|
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = ps.fk_product";
|
|
|
$sql .= " WHERE ps.reel != 0";
|
|
|
- $sql .= " AND ps.fk_entrepot = ".((int) $conf->global->$constantforkey);
|
|
|
+ $sql .= " AND ps.fk_entrepot = ".((int) getDolGlobalString($constantforkey));
|
|
|
$sql .= " AND e.entity IN (".getEntity('stock').")";
|
|
|
$sql .= " AND ps.fk_product = ".((int) $line->fk_product);
|
|
|
$resql = $db->query($sql);
|