diff --git a/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php b/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php
index 064ac81163f..621ae8d5bb7 100644
--- a/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php
+++ b/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php
@@ -59,6 +59,8 @@ class InterfaceActionsBlockedLog extends DolibarrTriggers
*/
public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf)
{
+ global $mysoc;
+
if (!isModEnabled('blockedlog')) {
return 0; // Module not active, we do nothing
}
@@ -88,6 +90,15 @@ class InterfaceActionsBlockedLog extends DolibarrTriggers
return 0;
}
+ if ($action === 'PAYMENT_CUSTOMER_CREATE' && $object->element == 'payment') {
+ if (isALNERunningVersion() && $mysoc->country_code == 'FR') {
+ if (!in_array($object->paiementcode, array('LIQ', 'CB', 'CHQ'))) {
+ $this->errors[] = 'The payment mode '.$object->paiementcode.' is not available in this version.';
+ return -1;
+ }
+ }
+ }
+
// Event/record is qualified
$qualified = 0;
$amounts_taxexcl = null;
diff --git a/htdocs/install/mysql/migration/22.0.0-23.0.0.sql b/htdocs/install/mysql/migration/22.0.0-23.0.0.sql
index 66ca80f8782..58564b7ee92 100644
--- a/htdocs/install/mysql/migration/22.0.0-23.0.0.sql
+++ b/htdocs/install/mysql/migration/22.0.0-23.0.0.sql
@@ -393,7 +393,8 @@ CREATE TABLE llx_expensereport_det_extrafields
ALTER TABLE llx_blockedlog ADD INDEX idx_ref_object (ref_object);
-ALTER TABLE llx_blockedlog ADD CONSTRAINT fk_linktoref FOREIGN KEY (linktoref) REFERENCES llx_blockedlog(ref_object);
+--ALTER TABLE llx_blockedlog ADD CONSTRAINT fk_linktoref FOREIGN KEY (linktoref) REFERENCES llx_blockedlog(ref_object);
+ALTER TABLE llx_blockedlog DROP FOREIGN KEY fk_linktoref;
ALTER TABLE llx_fichinterdet ADD COLUMN special_code integer DEFAULT 0 AFTER fk_parent_line;
ALTER TABLE llx_fichinterdet ADD COLUMN product_type integer DEFAULT 0 AFTER special_code;
diff --git a/htdocs/install/mysql/tables/llx_blockedlog.key.sql b/htdocs/install/mysql/tables/llx_blockedlog.key.sql
index 1ab9eaa3e54..52b229702b8 100644
--- a/htdocs/install/mysql/tables/llx_blockedlog.key.sql
+++ b/htdocs/install/mysql/tables/llx_blockedlog.key.sql
@@ -28,4 +28,4 @@ ALTER TABLE llx_blockedlog ADD INDEX fk_user (fk_user);
-- We add this index for the "SELECT rowid, signature FROM llx_blockedlog FORCE INDEX entity_rowid WHERE entity = x AND rowid < z ORDER BY rowid DESC"
ALTER TABLE llx_blockedlog ADD INDEX entity_rowid (entity, rowid);
-ALTER TABLE llx_blockedlog ADD CONSTRAINT fk_linktoref FOREIGN KEY (linktoref) REFERENCES llx_blockedlog(ref_object);
+--ALTER TABLE llx_blockedlog ADD CONSTRAINT fk_linktoref FOREIGN KEY (linktoref) REFERENCES llx_blockedlog(ref_object);
diff --git a/htdocs/takepos/admin/terminal.php b/htdocs/takepos/admin/terminal.php
index 0b461268267..cc6b4f15027 100644
--- a/htdocs/takepos/admin/terminal.php
+++ b/htdocs/takepos/admin/terminal.php
@@ -28,9 +28,18 @@
// Load Dolibarr environment
require '../../main.inc.php'; // Load $user and permissions
+/**
+ * @var Conf $conf
+ * @var DoliDB $db
+ * @var HookManager $hookmanager
+ * @var Societe $mysoc
+ * @var Translate $langs
+ * @var User $user
+ */
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/blockedlog/lib/blockedlog.lib.php';
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
require_once DOL_DOCUMENT_ROOT."/core/lib/takepos.lib.php";
require_once DOL_DOCUMENT_ROOT.'/stripe/class/stripe.class.php';
@@ -43,15 +52,6 @@ if (GETPOST('CASHDESK_ID_THIRDPARTY'.$terminal.'_id', 'alpha')) {
$_REQUEST['CASHDESK_ID_THIRDPARTY'.$terminal] = GETPOST('CASHDESK_ID_THIRDPARTY'.$terminal.'_id', 'alpha');
}
-/**
- * @var Conf $conf
- * @var DoliDB $db
- * @var HookManager $hookmanager
- * @var Societe $mysoc
- * @var Translate $langs
- * @var User $user
- */
-
// Security check
if (!$user->admin) {
accessforbidden();
@@ -297,6 +297,7 @@ if (isModEnabled("bank")) {
print '';
}
+ // Payment mode other than 'LIQ', 'CB', 'CHQ' are not supported by the cash control feature so we must disallow them
foreach ($paiements as $modep) {
if (in_array($modep->code, array('LIQ', 'CB', 'CHQ'))) {
continue; // Already managed before
@@ -308,9 +309,13 @@ if (isModEnabled("bank")) {
$atleastonefound++;
}
$cour = preg_match('/^LIQ.*/', $modep->code) ? 2 : 1;
- print img_picto('', 'bank_account', 'class="pictofixedwidth"');
- print $form->select_comptes(getDolGlobalInt($name), $name, 0, "courant=".$cour, 1, '', 0, 'maxwidth500 widthcentpercentminusxx', 1);
- print ' ';
+ if (isALNERunningVersion() && $mysoc->country_code == 'FR') {
+ print ''.$form->textwithpicto($langs->trans("NotAvailable"), $langs->trans("NotAvailableForCountryWhenModuleIsOn", $mysoc->country_code, $langs->transnoentitiesnoconv('Module3200Name'))).'';
+ } else {
+ print img_picto('', 'bank_account', 'class="pictofixedwidth"');
+ print $form->select_comptes(getDolGlobalInt($name), $name, 0, "courant=".$cour, 1, '', 0, 'maxwidth500 widthcentpercentminusxx', 1);
+ print ' ';
+ }
print '';
}
}
@@ -458,7 +463,7 @@ if (isModEnabled('receiptprinter')) {
print '';
print '
';
if (!$customprinterallowed) { // @phpstan-ignore-line
- print ''.$langs->trans("NotAvailableForCountryWhenModuleIsOn", $mysoc->country_code, $langs->transnoentitiesnoconv('Module3200Name')).'';
+ print ''.$form->textwithpicto($langs->trans("NotAvailable"), $langs->trans("NotAvailableForCountryWhenModuleIsOn", $mysoc->country_code, $langs->transnoentitiesnoconv('Module3200Name'))).'';
} else {
print $form->selectarray('TAKEPOS_PRINTER_TO_USE'.$terminal, $printers, getDolGlobalInt('TAKEPOS_PRINTER_TO_USE'.$terminal), 1);
}
@@ -496,7 +501,7 @@ if (isModEnabled('receiptprinter') || getDolGlobalString('TAKEPOS_PRINT_METHOD')
}
print ' | ';
if (!$customprinttemplateallowed) {
- print ''.$langs->trans("NotAvailableForCountryWhenModuleIsOn", $mysoc->country_code, $langs->transnoentitiesnoconv('Module3200Name')).'';
+ print ''.$form->textwithpicto($langs->trans("NotAvailable"), $langs->trans("NotAvailableForCountryWhenModuleIsOn", $mysoc->country_code, $langs->transnoentitiesnoconv('Module3200Name'))).'';
} else {
print $form->selectarray('TAKEPOS_TEMPLATE_TO_USE_FOR_INVOICES'.$terminal, $templates, getDolGlobalInt('TAKEPOS_TEMPLATE_TO_USE_FOR_INVOICES'.$terminal), 1, 0, 0, '', 0, 0, 0, '', 'minwidth150');
}
diff --git a/htdocs/takepos/pay.php b/htdocs/takepos/pay.php
index 966ece3f253..30ea0492a83 100644
--- a/htdocs/takepos/pay.php
+++ b/htdocs/takepos/pay.php
@@ -41,10 +41,6 @@ if (!defined('NOREQUIREHTML')) {
// Load Dolibarr environment
require '../main.inc.php'; // Load $user and permissions
-require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
-require_once DOL_DOCUMENT_ROOT.'/stripe/class/stripe.class.php';
-
-
/**
* @var Conf $conf
* @var DoliDB $db
@@ -52,6 +48,9 @@ require_once DOL_DOCUMENT_ROOT.'/stripe/class/stripe.class.php';
* @var Translate $langs
* @var User $user
*/
+require_once DOL_DOCUMENT_ROOT.'/blockedlog/lib/blockedlog.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
+require_once DOL_DOCUMENT_ROOT.'/stripe/class/stripe.class.php';
// Load translation files required by the page
$langs->loadLangs(array("main", "bills", "cashdesk", "banks"));
@@ -236,13 +235,18 @@ if ($usestripeterminals && $invoice->type != $invoice::TYPE_CREDIT_NOTE) {
country_code == 'FR') {
+ // In certified version, we can use only 3 payments modes in POS because
+ // the cash control feature support only this 3 payment modes
+ $sql .= " AND code IN ('LIQ', 'CB', 'CHQ')";
+}
$sql .= " ORDER BY libelle";
$resql = $db->query($sql);
@@ -302,7 +306,9 @@ if (!getDolGlobalInt("TAKEPOS_NUMPAD")) {
?>
$('.change1').html(pricejs(parseFloat(received), 'MT'));
$('.change1').val(parseFloat(received));
- alreadypaydplusreceived=price2numjs(alreadypayed + parseFloat(received));
+ console.log(alreadypayed);
+ console.log(received);
+ alreadypaydplusreceived = price2numjs(alreadypayed + parseFloat(received));
//console.log("already+received = "+alreadypaydplusreceived);
//console.log("total_ttc = "+total_ttc; ?>);
if (alreadypaydplusreceived > total_ttc; ?>)
@@ -319,15 +325,12 @@ if (!getDolGlobalInt("TAKEPOS_NUMPAD")) {
{
$('.change2').html(pricejs(0, 'MT'));
$('.change2').val(0);
- if (alreadypaydplusreceived == total_ttc; ?>)
- {
+ if (alreadypaydplusreceived == total_ttc; ?>) {
$('.change1').removeClass('colorred');
$('.change1').addClass('colorgreen');
$('.change2').removeClass('colorred');
$('.change2').addClass('colorwhite');
- }
- else
- {
+ } else {
$('.change1').removeClass('colorgreen');
$('.change1').addClass('colorred');
$('.change2').removeClass('colorred');
@@ -359,17 +362,16 @@ if (!getDolGlobalInt("TAKEPOS_NUMPAD")) {
var accountid = $("#selectaccountid").val();
var amountpayed = $("#change1").val();
var excess = $("#change2").val();
- if (amountpayed > total_ttc; ?>) {
- amountpayed = total_ttc; ?>;
+ if (amountpayed > total_ttc; ?>) {
+ amountpayed = total_ttc; ?>;
}
console.log("We click on the payment mode to pay amount = "+amountpayed);
parent.$("#poslines").load("invoice.php?place=&action=valid&token=&pay="+payment+"&amount="+amountpayed+"&excess="+excess+"&invoiceid="+invoiceid+"&accountid="+accountid, function() {
- if (amountpayed > || amountpayed == || amountpayed==0 ) {
+ if (amountpayed > || amountpayed == || amountpayed == 0 ) {
console.log("Close popup");
parent.$('#invoiceid').val("");
parent.$.colorbox.close();
- }
- else {
+ } else {
console.log("Amount is not complete, so we do NOT close popup and reload it.");
location.reload();
}
@@ -432,11 +434,11 @@ if (!getDolGlobalInt("TAKEPOS_NUMPAD")) {
var accountid = $("#selectaccountid").val();
var amountpayed = $("#change1").val();
var excess = $("#change2").val();
- if (amountpayed > getRemainToPay(); ?>) {
- amountpayed = getRemainToPay(); ?>;
+ if (amountpayed > getRemainToPay(); ?>) {
+ amountpayed = getRemainToPay(); ?>;
}
if (amountpayed == 0) {
- amountpayed = getRemainToPay(); ?>;
+ amountpayed = getRemainToPay(); ?>;
}
console.log("Pay with terminal ", amountpayed);
@@ -469,7 +471,7 @@ if (!getDolGlobalInt("TAKEPOS_NUMPAD")) {
document.getElementById("card-present-alert").innerHTML = ' trans('PaymentValidated'); ?> ';
console.log("Capture paymentIntent successful "+paymentIntentId);
parent.$("#poslines").load("invoice.php?place=&action=valid&token=&pay=CB&amount="+amountpayed+"&excess="+excess+"&invoiceid="+invoiceid+"&accountid="+accountid, function() {
- if (amountpayed > || amountpayed == || amountpayed==0 ) {
+ if (amountpayed > || amountpayed == || amountpayed == 0 ) {
console.log("Close popup");
parent.$.colorbox.close();
}
@@ -491,13 +493,13 @@ if (!getDolGlobalInt("TAKEPOS_NUMPAD")) {
function ValidateSumup() {
console.log("Launch ValidateSumup");
- var invoiceid = 0 ? $invoiceid : 0); ?>;
+ var invoiceid = 0 ? $invoiceid : 0); ?>;
var amountpayed = $("#change1").val();
- if (amountpayed > total_ttc; ?>) {
- amountpayed = total_ttc; ?>;
+ if (amountpayed > total_ttc; ?>) {
+ amountpayed = total_ttc; ?>;
}
if (amountpayed == 0) {
- amountpayed = total_ttc; ?>;
+ amountpayed = total_ttc; ?>;
}
var currencycode = "multicurrency_code; ?>";
|