FIX php8.2

This commit is contained in:
Laurent Destailleur 2023-10-09 15:44:57 +02:00
parent 0ecf2b3327
commit df454003da
15 changed files with 66 additions and 55 deletions

View File

@ -274,7 +274,6 @@ while ($i <= $MAXAGENDA) {
print '<td><input type="text" class="flat hideifnotset" name="AGENDA_EXT_OFFSETTZ' . $key . '" value="' . (GETPOST('AGENDA_EXT_OFFSETTZ' . $key) ? GETPOST('AGENDA_EXT_OFFSETTZ' . $key) : getDolGlobalString($offsettz)) . '" size="2"></td>';
// Color (Possible colors are limited by Google)
print '<td class="nowrap right">';
//print $formadmin->selectColor($conf->global->$color, "google_agenda_color".$key, $colorlist);
print $formother->selectColor((GETPOST("AGENDA_EXT_COLOR" . $key) ? GETPOST("AGENDA_EXT_COLOR" . $key) : getDolGlobalString($color)), "AGENDA_EXT_COLOR" . $key, 'extsitesconfig', 1, '', 'hideifnotset');
print '</td>';
// Calendar active by default

View File

@ -144,7 +144,7 @@ $arrayfields = array(
'e.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
'l.ref'=>array('label'=>$langs->trans("DeliveryRef"), 'checked'=>1, 'enabled'=>(getDolGlobalInt('MAIN_SUBMODULE_DELIVERY') ? 1 : 0)),
'l.date_delivery'=>array('label'=>$langs->trans("DateReceived"), 'checked'=>1, 'enabled'=>(getDolGlobalInt('MAIN_SUBMODULE_DELIVERY') ? 1 : 0)),
'e.billed'=>array('label'=>$langs->trans("Billed"), 'checked'=>1, 'position'=>1000, 'enabled'=>'getDolGlobalConst("WORKFLOW_BILL_ON_SHIPMENT") !== "0"')
'e.billed'=>array('label'=>$langs->trans("Billed"), 'checked'=>1, 'position'=>1000, 'enabled'=>'getDolGlobalString("WORKFLOW_BILL_ON_SHIPMENT") !== "0"')
);
// Extra fields

View File

@ -65,12 +65,12 @@ if (!empty($keyforcontent)) {
&& !preg_match('/EXTERNAL_SITE_URL_/', $keyforcontent)) {
$langs->load("errors");
print $langs->trans("ErrorBadSyntaxForParamKeyForContent", 'EXTERNAL_SITE_CONTENT_', 'EXTERNAL_SITE_URL_');
} elseif (empty($conf->global->$keyforcontent)) {
} elseif (!getDolGlobalString($keyforcontent)) {
$langs->load("errors");
print $langs->trans("ErrorVariableKeyForContentMustBeSet", 'EXTERNAL_SITE_CONTENT_'.$keyforcontent, 'EXTERNAL_SITE_URL_'.$keyforcontent);
} else {
if (preg_match('/EXTERNAL_SITE_CONTENT_/', $keyforcontent)) {
print $conf->global->$keyforcontent;
print getDolGlobalString($keyforcontent);
} elseif (preg_match('/EXTERNAL_SITE_URL_/', $keyforcontent)) {
/*print "
<html>
@ -82,7 +82,7 @@ if (!empty($keyforcontent)) {
<frame name=\"barre\" src=\"frametop.php?mainmenu=".$mainmenu."&leftmenu=".$leftmenu."&idmenu=".$idmenu.($theme?'&theme='.$theme:'').($codelang?'&lang='.$codelang:'')."&nobackground=1\" noresize scrolling=\"NO\" noborder>
";
print '<frame name="main" src="';
print $conf->global->$keyforcontent;
print getDolGlobalString($keyforcontent);
print '">';
print "
<noframes>
@ -103,7 +103,7 @@ if (!empty($keyforcontent)) {
</html>
";*/
print '<iframe src="'.$conf->global->$keyforcontent.'"></iframe>';
print '<iframe src="'.getDolGlobalString($keyforcontent).'"></iframe>';
}
}

View File

@ -1785,7 +1785,7 @@ class FactureFournisseur extends CommonInvoice
// Check for mandatory prof id (but only if country is other than ours)
if ($mysoc->country_id > 0 && $this->thirdparty->country_id == $mysoc->country_id) {
$idprof_mandatory = 'SOCIETE_'.$key.'_INVOICE_MANDATORY';
if (!$vallabel && !empty($conf->global->$idprof_mandatory)) {
if (!$vallabel && getDolGlobalString($idprof_mandatory)) {
$langs->load("errors");
$this->error = $langs->trans('ErrorProdIdIsMandatory', $langs->transcountry('ProfId'.$i, $this->thirdparty->country_code)).' ('.$langs->trans("ForbiddenBySetupRules").') ['.$langs->trans('Company').' : '.$this->thirdparty->name.']';
dol_syslog(__METHOD__.' '.$this->error, LOG_ERR);

View File

@ -658,7 +658,7 @@ if (!function_exists('ftp_connect')) {
while ($i <= $MAXFTP) {
$paramkey = 'FTP_NAME_'.$i;
//print $paramkey;
if (!empty($conf->global->$paramkey)) {
if (getDolGlobalString($paramkey)) {
$foundsetup = true;
break;
}

View File

@ -4122,7 +4122,7 @@ if ($module == 'initmodule') {
print '<a class="reposition editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.urlencode($tab).'&tabobj='.$tabobj.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=confirm_removefile&token='.newToken().'&file='.urlencode($pathtoapi).'">'.img_picto($langs->trans("Delete"), 'delete').'</a>';
print $form->textwithpicto('', $langs->trans("InfoForApiFile"), 1, 'warning');
print ' &nbsp; ';
if (empty($conf->global->$const_name)) { // If module is not activated
if (!isModEnabled(strtolower($const_name))) { // If module is not activated
print '<a href="#" class="classfortooltip" target="apiexplorer" title="'.$langs->trans("ModuleMustBeEnabled", $module).'"><strike>'.$langs->trans("ApiExplorer").'</strike></a>';
} else {
print '<a href="'.DOL_URL_ROOT.'/api/index.php/explorer/" target="apiexplorer">'.$langs->trans("ApiExplorer").'</a>';
@ -4262,7 +4262,7 @@ if ($module == 'initmodule') {
$obj = strtolower($tabobj);
$newproperty = dolGetButtonTitle($langs->trans('NewProperty'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/modulebuilder/index.php?tab=objects&module='.urlencode($module).'&tabobj=createproperty&obj='.urlencode($tabobj));
print_barre_liste($langs->trans("ObjectProperties"), $page, $_SERVER["PHP_SELF"], '', '', '', '', '', 0, '', 0, $newproperty, '', '', 0, 0, 1);
print_barre_liste($langs->trans("ObjectProperties"), 0, $_SERVER["PHP_SELF"], '', '', '', '', '', 0, '', 0, $newproperty, '', '', 0, 0, 1);
//var_dump($reflectorpropdefault);exit;
print '<!-- Table with properties of object -->'."\n";

View File

@ -129,7 +129,7 @@ $arrayfields = array(
'e.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
'e.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
'e.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
'e.billed'=>array('label'=>$langs->trans("Billed"), 'checked'=>1, 'position'=>1000, 'enabled'=>'getDolGlobalConst("WORKFLOW_BILL_ON_RECEPTION") !== "0"')
'e.billed'=>array('label'=>$langs->trans("Billed"), 'checked'=>1, 'position'=>1000, 'enabled'=>'getDolGlobalString("WORKFLOW_BILL_ON_RECEPTION") !== "0"')
);
// Extra fields

View File

@ -1206,7 +1206,7 @@ class Societe extends CommonObject
// Check for mandatory prof id (but only if country is same than ours)
if ($mysoc->country_id > 0 && $this->country_id == $mysoc->country_id) {
$idprof_mandatory = 'SOCIETE_'.$key.'_MANDATORY';
if (!$vallabel && !empty($conf->global->$idprof_mandatory)) {
if (!$vallabel && getDolGlobalString($idprof_mandatory)) {
$langs->load("errors");
$error++;
$this->errors[] = $langs->trans("ErrorProdIdIsMandatory", $langs->transcountry('ProfId'.$i, $this->country_code)).' ('.$langs->trans("ForbiddenBySetupRules").')';

View File

@ -294,7 +294,7 @@ if ($action == "change") { // Change customer for TakePOS
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
$invoice = new Facture($db);
$constforthirdpartyid = 'CASHDESK_ID_THIRDPARTY'.$_SESSION["takeposterminal"];
$invoice->socid = $conf->global->$constforthirdpartyid;
$invoice->socid = getDolGlobalInt($constforthirdpartyid);
$invoice->date = dol_now();
$invoice->module_source = 'takepos';
$invoice->pos_source = $_SESSION["takeposterminal"];

View File

@ -72,7 +72,7 @@ $soc = new Societe($db);
if ($invoice->socid > 0) {
$soc->fetch($invoice->socid);
} else {
$soc->fetch($conf->global->$constforcompanyid);
$soc->fetch(getDolGlobalInt($constforcompanyid));
}
$vatRateDefault = get_default_tva($mysoc, $soc);

View File

@ -98,7 +98,7 @@ $MAXPRODUCT = (empty($conf->global->TAKEPOS_NB_MAXPRODUCT) ? $maxproductbydefaul
$constforcompanyid = 'CASHDESK_ID_THIRDPARTY'.$_SESSION["takeposterminal"];
$soc = new Societe($db);
if ($invoice->socid > 0) $soc->fetch($invoice->socid);
else $soc->fetch($conf->global->$constforcompanyid);
else $soc->fetch(getDolGlobalInt($constforcompanyid));
*/
// Security check
@ -1218,8 +1218,8 @@ if (isset($_SESSION["takeposterminal"]) && $_SESSION["takeposterminal"]) {
}
$constantforkey = "CASHDESK_ID_BANKACCOUNT_" . $paycode . $_SESSION["takeposterminal"];
//var_dump($constantforkey.' '.$conf->global->$constantforkey);
if ( !empty($conf->global->$constantforkey) && $conf->global->$constantforkey > 0) {
//var_dump($constantforkey.' '.getDolGlobalInt($constantforkey));
if ( !empty($conf->global->$constantforkey) && getDolGlobalInt($constantforkey) > 0) {
array_push($paiementsModes, $obj);
}
}

View File

@ -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);

View File

@ -94,8 +94,12 @@ if (isModEnabled('stripe')) {
$stripe = new Stripe($db);
$stripeacc = $stripe->getStripeAccount($service); // Get Stripe OAuth connect account (no remote access to Stripe here)
$stripecu = $stripe->getStripeCustomerAccount($object->id, $servicestatus, $site_account); // Get remote Stripe customer 'cus_...' (no remote access to Stripe here)
$keyforstripeterminalbank = "CASHDESK_ID_BANKACCOUNT_STRIPETERMINAL".$_SESSION["takeposterminal"];
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
$invoicetmp = new Facture($db);
$invoicetmp->fetch($invoiceid);
$stripecu = $stripe->getStripeCustomerAccount($invoicetmp->socid, $servicestatus, $site_account); // Get remote Stripe customer 'cus_...' (no remote access to Stripe here)
$keyforstripeterminalbank = "CASHDESK_ID_BANKACCOUNT_STRIPETERMINAL".(empty($_SESSION['takeposterminal']) ? '' : $_SESSION['takeposterminal']);
$usestripeterminals = getDolGlobalString('STRIPE_LOCATION');
@ -164,7 +168,7 @@ if ($invoiceid > 0) {
<script>
<?php
if ($invoice->type != $invoice::TYPE_CREDIT_NOTE) {
if (empty($conf->global->$keyforstripeterminalbank)) { ?>
if (!getDolGlobalString($keyforstripeterminalbank)) { ?>
const config = {simulated: <?php if (empty($servicestatus) && !empty($conf->global->STRIPE_TERMINAL_SIMULATED)) { ?> true <?php } else { ?> false <?php } ?>
<?php if (!empty($conf->global->STRIPE_LOCATION)) { ?>, location: '<?php echo $conf->global->STRIPE_LOCATION; ?>'<?php } ?>}
terminal.discoverReaders(config).then(function(discoverResult) {
@ -194,7 +198,7 @@ if ($invoiceid > 0) {
}
});
<?php } else { ?>
terminal.connectReader(<?php echo json_encode($stripe->getSelectedReader($conf->global->$keyforstripeterminalbank, $stripeacc, $servicestatus)); ?>).then(function(connectResult) {
terminal.connectReader(<?php echo json_encode($stripe->getSelectedReader(getDolGlobalString($keyforstripeterminalbank), $stripeacc, $servicestatus)); ?>).then(function(connectResult) {
if (connectResult.error) {
document.getElementById("card-present-alert").innerHTML = '<div class="error clearboth">'+connectResult.error.message+'</div>';
console.log('Failed to connect: ', connectResult.error);
@ -235,8 +239,8 @@ if ($resql) {
}
$accountname = "CASHDESK_ID_BANKACCOUNT_".$paycode.$_SESSION["takeposterminal"];
if (!empty($conf->global->$accountname) && $conf->global->$accountname > 0) {
$arrayOfValidBankAccount[$conf->global->$accountname] = $conf->global->$accountname;
if (getDolGlobalInt($accountname) > 0) {
$arrayOfValidBankAccount[getDolGlobalInt($accountname)] = getDolGlobalInt($accountname);
$arrayOfValidPaymentModes[] = $obj;
}
if (!isModEnabled('banque')) {
@ -465,7 +469,7 @@ if (getDolGlobalInt('TAKEPOS_NUMPAD') == 0) {
}
// Starting sumup app
window.open('sumupmerchant://pay/1.0?affiliate-key=<?php echo $conf->global->TAKEPOS_SUMUP_AFFILIATE ?>&app-id=<?php echo $conf->global->TAKEPOS_SUMUP_APPID ?>&total=' + amountpayed + '&currency=EUR&title=' + invoiceid + '&callback=<?php echo DOL_MAIN_URL_ROOT ?>/takepos/smpcb.php');
window.open('sumupmerchant://pay/1.0?affiliate-key=<?php echo urlencode(getDolGlobalString('TAKEPOS_SUMUP_AFFILIATE')) ?>&app-id=<?php echo urlencode(getDolGlobalString('TAKEPOS_SUMUP_APPID')) ?>&total=' + amountpayed + '&currency=EUR&title=' + invoiceid + '&callback=<?php echo DOL_MAIN_URL_ROOT ?>/takepos/smpcb.php');
var loop = window.setInterval(function () {
$.ajax({
@ -474,7 +478,7 @@ if (getDolGlobalInt('TAKEPOS_NUMPAD') == 0) {
url: '<?php echo DOL_URL_ROOT ?>/takepos/smpcb.php?status' }).done(function (data) {
console.log(data);
if (data === "SUCCESS") {
parent.$("#poslines").load("invoice.php?place=<?php echo $place; ?>&action=valid&token=<?php echo newToken(); ?>&pay=CB&amount=" + amountpayed + "&invoiceid=" + invoiceid, function () {
parent.$("#poslines").load("invoice.php?place=<?php echo urlencode($place); ?>&action=valid&token=<?php echo newToken(); ?>&pay=CB&amount=" + amountpayed + "&invoiceid=" + invoiceid, function () {
//parent.$("#poslines").scrollTop(parent.$("#poslines")[0].scrollHeight);
parent.$.colorbox.close();
//parent.setFocusOnSearchField(); // This does not have effect
@ -662,7 +666,8 @@ while ($i < count($arrayOfValidPaymentModes)) {
if (isModEnabled('stripe') && isset($keyforstripeterminalbank) && !empty($conf->global->STRIPE_CARD_PRESENT)) {
$keyforstripeterminalbank = "CASHDESK_ID_BANKACCOUNT_STRIPETERMINAL".$_SESSION["takeposterminal"];
print '<span id="StripeTerminal"></span>';
if (!empty($conf->global->$keyforstripeterminalbank)) {
if (getDolGlobalString($keyforstripeterminalbank)) {
// Nothing
} else {
$langs->loadLangs(array("errors", "admin"));
//print '<button type="button" class="calcbutton2 disabled" title="'.$langs->trans("SetupNotComplete").'">TerminalOff</button>';
@ -671,7 +676,7 @@ if (isModEnabled('stripe') && isset($keyforstripeterminalbank) && !empty($conf->
$keyforsumupbank = "CASHDESK_ID_BANKACCOUNT_SUMUP".$_SESSION["takeposterminal"];
if (getDolGlobalInt('TAKEPOS_ENABLE_SUMUP')) {
if (!empty($conf->global->$keyforsumupbank)) {
if (getDolGlobalString($keyforsumupbank)) {
print '<button type="button" class="calcbutton2" onclick="ValidateSumup();">Sumup</button>';
} else {
$langs->loadLangs(array("errors", "admin"));

View File

@ -26,7 +26,7 @@
* \brief Page to show a receipt.
*/
// Includes
// Include main (when fie in included into send.php, $action is set and main was already loaded)
if (!isset($action)) {
//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); // Not disabled cause need to load personalized language
//if (! defined('NOREQUIREDB')) define('NOREQUIREDB', '1'); // Not disabled cause need to load personalized language
@ -304,11 +304,13 @@ if (getDolGlobalString('TAKEPOS_PRINT_PAYMENT_METHOD')) {
echo '</td>';
echo '</tr>';
} else {
$sql = "SELECT p.pos_change as pos_change, p.datep as date, p.fk_paiement, p.num_paiement as num, pf.amount as amount, pf.multicurrency_amount,";
$sql = "SELECT p.pos_change as pos_change, p.datep as date, p.fk_paiement, p.num_paiement as num,";
$sql .= " f.multicurrency_code,";
$sql .= " pf.amount as amount, pf.multicurrency_amount,";
$sql .= " cp.code";
$sql .= " FROM ".MAIN_DB_PREFIX."paiement_facture as pf, ".MAIN_DB_PREFIX."paiement as p";
$sql .= " FROM ".MAIN_DB_PREFIX."paiement_facture as pf, ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."paiement as p";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as cp ON p.fk_paiement = cp.id";
$sql .= " WHERE pf.fk_paiement = p.rowid AND pf.fk_facture = ".((int) $facid);
$sql .= " WHERE pf.fk_facture = f.rowid AND pf.fk_paiement = p.rowid AND pf.fk_facture = ".((int) $facid);
$sql .= " ORDER BY p.datep";
$resql = $db->query($sql);
@ -325,19 +327,24 @@ if (getDolGlobalString('TAKEPOS_PRINT_PAYMENT_METHOD')) {
echo '</td>';
echo '<td class="right">';
$amount_payment = (isModEnabled('multicurrency') && $object->multicurrency_tx != 1) ? $row->multicurrency_amount : $row->amount;
if ($row->code == "LIQ") {
$amount_payment = $amount_payment + $row->pos_change; // Show amount with excess received if is cash payment
//print "xx ".$row->multicurrency_amount." - ".$row->amount." - ".$amount_payment." - ".$object->multicurrency_tx;
if ((!isModEnabled('multicurrency') || $object->multicurrency_tx == 1) && $row->code == "LIQ" && $row->pos_change > 0) {
$amount_payment = $amount_payment + $row->pos_change; // Show amount with excess received if it's cash payment
$currency = $conf->currency;
} else {
// We do not show change if payment into a different currency because not yet supported
$currency = $row->multicurrency_code;
}
echo price($amount_payment, 1, '', 1, - 1, - 1, $conf->currency);
echo price($amount_payment, 1, '', 1, - 1, - 1, $currency);
echo '</td>';
echo '</tr>';
if ($row->code == "LIQ" && $row->pos_change > 0) { // Print change only in cash payments
if ((!isModEnabled('multicurrency') || $object->multicurrency_tx == 1) && $row->code == "LIQ" && $row->pos_change > 0) {
echo '<tr>';
echo '<td class="right">';
echo $langs->trans("Change");
echo $langs->trans("Change"); // ChangeBack ?
echo '</td>';
echo '<td class="right">';
echo price($row->pos_change, 1, '', 1, - 1, - 1, $conf->currency);
echo price($row->pos_change, 1, '', 1, - 1, - 1, $currency);
echo '</td>';
echo '</tr>';
}

View File

@ -66,7 +66,7 @@ if ($action=="split") {
$placeid = $invoice->id;
} else {
$constforcompanyid = 'CASHDESK_ID_THIRDPARTY'.$_SESSION["takeposterminal"];
$invoice->socid = $conf->global->$constforcompanyid;
$invoice->socid =getDolGlobalInt($constforcompanyid);
$invoice->date = dol_now();
$invoice->module_source = 'takepos';
$invoice->pos_source = $_SESSION["takeposterminal"];
@ -93,7 +93,7 @@ if ($action=="split") {
$placeid = $invoice->id;
} else {
$constforcompanyid = 'CASHDESK_ID_THIRDPARTY'.$_SESSION["takeposterminal"];
$invoice->socid = $conf->global->$constforcompanyid;
$invoice->socid = getDolGlobalInt($constforcompanyid);
$invoice->date = dol_now();
$invoice->module_source = 'takepos';
$invoice->pos_source = $_SESSION["takeposterminal"];