mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-02-08 09:01:40 +01:00
Debug v23
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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 '</td></tr>';
|
||||
}
|
||||
|
||||
// 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 ' <a href="'.DOL_URL_ROOT.'/compta/bank/card.php?action=create&type=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?terminal='.$terminal).'"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans("NewBankAccount").'"></span></a>';
|
||||
if (isALNERunningVersion() && $mysoc->country_code == 'FR') {
|
||||
print '<span class="opacitymedium">'.$form->textwithpicto($langs->trans("NotAvailable"), $langs->trans("NotAvailableForCountryWhenModuleIsOn", $mysoc->country_code, $langs->transnoentitiesnoconv('Module3200Name'))).'</span>';
|
||||
} else {
|
||||
print img_picto('', 'bank_account', 'class="pictofixedwidth"');
|
||||
print $form->select_comptes(getDolGlobalInt($name), $name, 0, "courant=".$cour, 1, '', 0, 'maxwidth500 widthcentpercentminusxx', 1);
|
||||
print ' <a href="'.DOL_URL_ROOT.'/compta/bank/card.php?action=create&type=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?terminal='.$terminal).'"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans("NewBankAccount").'"></span></a>';
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
}
|
||||
@@ -458,7 +463,7 @@ if (isModEnabled('receiptprinter')) {
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
if (!$customprinterallowed) { // @phpstan-ignore-line
|
||||
print '<span class="opacitymedium">'.$langs->trans("NotAvailableForCountryWhenModuleIsOn", $mysoc->country_code, $langs->transnoentitiesnoconv('Module3200Name')).'</span>';
|
||||
print '<span class="opacitymedium">'.$form->textwithpicto($langs->trans("NotAvailable"), $langs->trans("NotAvailableForCountryWhenModuleIsOn", $mysoc->country_code, $langs->transnoentitiesnoconv('Module3200Name'))).'</span>';
|
||||
} 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 '<td>';
|
||||
if (!$customprinttemplateallowed) {
|
||||
print '<span class="opacitymedium">'.$langs->trans("NotAvailableForCountryWhenModuleIsOn", $mysoc->country_code, $langs->transnoentitiesnoconv('Module3200Name')).'</span>';
|
||||
print '<span class="opacitymedium">'.$form->textwithpicto($langs->trans("NotAvailable"), $langs->trans("NotAvailableForCountryWhenModuleIsOn", $mysoc->country_code, $langs->transnoentitiesnoconv('Module3200Name'))).'</span>';
|
||||
} 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');
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
</script>
|
||||
<?php
|
||||
|
||||
// Define list of possible payments
|
||||
$arrayOfValidPaymentModes = array();
|
||||
// Define list of possible payments
|
||||
$arrayOfValidPaymentModes = array();
|
||||
$arrayOfValidBankAccount = array();
|
||||
|
||||
$sql = "SELECT code, libelle as label FROM ".MAIN_DB_PREFIX."c_paiement";
|
||||
$sql .= " WHERE entity IN (".getEntity('c_paiement').")";
|
||||
$sql .= " AND active = 1";
|
||||
if (isALNERunningVersion() && $mysoc->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 = "+<?php echo (float) $invoice->total_ttc; ?>);
|
||||
if (alreadypaydplusreceived > <?php echo (float) $invoice->total_ttc; ?>)
|
||||
@@ -319,15 +325,12 @@ if (!getDolGlobalInt("TAKEPOS_NUMPAD")) {
|
||||
{
|
||||
$('.change2').html(pricejs(0, 'MT'));
|
||||
$('.change2').val(0);
|
||||
if (alreadypaydplusreceived == <?php echo $invoice->total_ttc; ?>)
|
||||
{
|
||||
if (alreadypaydplusreceived == <?php echo (float) $invoice->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 > <?php echo $invoice->total_ttc; ?>) {
|
||||
amountpayed = <?php echo $invoice->total_ttc; ?>;
|
||||
if (amountpayed > <?php echo (float) $invoice->total_ttc; ?>) {
|
||||
amountpayed = <?php echo (float) $invoice->total_ttc; ?>;
|
||||
}
|
||||
console.log("We click on the payment mode to pay amount = "+amountpayed);
|
||||
parent.$("#poslines").load("invoice.php?place=<?php echo $place; ?>&action=valid&token=<?php echo newToken(); ?>&pay="+payment+"&amount="+amountpayed+"&excess="+excess+"&invoiceid="+invoiceid+"&accountid="+accountid, function() {
|
||||
if (amountpayed > <?php echo $remaintopay; ?> || amountpayed == <?php echo $remaintopay; ?> || amountpayed==0 ) {
|
||||
if (amountpayed > <?php echo (float) $remaintopay; ?> || amountpayed == <?php echo (float) $remaintopay; ?> || 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 > <?php echo $invoice->getRemainToPay(); ?>) {
|
||||
amountpayed = <?php echo $invoice->getRemainToPay(); ?>;
|
||||
if (amountpayed > <?php echo (float) $invoice->getRemainToPay(); ?>) {
|
||||
amountpayed = <?php echo (float) $invoice->getRemainToPay(); ?>;
|
||||
}
|
||||
if (amountpayed == 0) {
|
||||
amountpayed = <?php echo $invoice->getRemainToPay(); ?>;
|
||||
amountpayed = <?php echo (float) $invoice->getRemainToPay(); ?>;
|
||||
}
|
||||
|
||||
console.log("Pay with terminal ", amountpayed);
|
||||
@@ -469,7 +471,7 @@ if (!getDolGlobalInt("TAKEPOS_NUMPAD")) {
|
||||
document.getElementById("card-present-alert").innerHTML = '<div class="warning clearboth"><?php echo $langs->trans('PaymentValidated'); ?></div>';
|
||||
console.log("Capture paymentIntent successful "+paymentIntentId);
|
||||
parent.$("#poslines").load("invoice.php?place=<?php echo $place; ?>&action=valid&token=<?php echo newToken(); ?>&pay=CB&amount="+amountpayed+"&excess="+excess+"&invoiceid="+invoiceid+"&accountid="+accountid, function() {
|
||||
if (amountpayed > <?php echo $remaintopay; ?> || amountpayed == <?php echo $remaintopay; ?> || amountpayed==0 ) {
|
||||
if (amountpayed > <?php echo (float) $remaintopay; ?> || amountpayed == <?php echo (float) $remaintopay; ?> || amountpayed == 0 ) {
|
||||
console.log("Close popup");
|
||||
parent.$.colorbox.close();
|
||||
}
|
||||
@@ -491,13 +493,13 @@ if (!getDolGlobalInt("TAKEPOS_NUMPAD")) {
|
||||
function ValidateSumup() {
|
||||
console.log("Launch ValidateSumup");
|
||||
<?php $_SESSION['SMP_CURRENT_PAYMENT'] = "NEW" ?>
|
||||
var invoiceid = <?php echo($invoiceid > 0 ? $invoiceid : 0); ?>;
|
||||
var invoiceid = <?php echo ($invoiceid > 0 ? $invoiceid : 0); ?>;
|
||||
var amountpayed = $("#change1").val();
|
||||
if (amountpayed > <?php echo $invoice->total_ttc; ?>) {
|
||||
amountpayed = <?php echo $invoice->total_ttc; ?>;
|
||||
if (amountpayed > <?php echo (float) $invoice->total_ttc; ?>) {
|
||||
amountpayed = <?php echo (float) $invoice->total_ttc; ?>;
|
||||
}
|
||||
if (amountpayed == 0) {
|
||||
amountpayed = <?php echo $invoice->total_ttc; ?>;
|
||||
amountpayed = <?php echo (float) $invoice->total_ttc; ?>;
|
||||
}
|
||||
var currencycode = "<?php echo $invoice->multicurrency_code; ?>";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user