You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Feature]: Debit/Credit transaction number field #4093
I would like to have a field added to all receipts and transactions named transaction auth #. This field would appear when the checkout option of credit/debit card is selected.
This field should also be mandatory and not allow the transaction to be completed unless this field is populated
Currently in my testing, I can track this auth code using the comments fieldhowever, it does not appear on the customer invoice when printed.
What files can I modify so that we can include the auth code to be printed on the receipt and, I would like a field in the database to store this information.
Additional Information
No response
Verify you searched open requests in OpensourcePOS
To implement what you're aiming for, some work is required on both the backend and the frontend.
In the backend, an additional table needs to be created in sales_payments to store transaction references. On the frontend, you can use JavaScript to set a condition: if payment is made by card, the "Add Payment" button should remain disabled until a value is entered in the reference input field. This ensures that the process cannot be completed without a valid reference.
$(document).ready(function() {
// Lista de métodos de pago que deben bloquear el botón si no hay valor en el input
var restrictedPayments = [
'Tarjeta Bac NIO',
'Tarjeta Bac USD',
'Tarjeta Banpro NIO',
'Tarjeta Banpro USD',
'Tarjeta Lafise NIO',
'Tarjeta Lafise USD'
];
// Lista de métodos de pago que permiten que el botón esté siempre activo
var allowedPayments = [
'Efectivo',
'Transferencias',
'USD',
'NIO'
];
// Función para validar el estado del botón
function validateButtonState() {
var selectedPayment = $('#payment_types').val();
var inputValue = $('#payment_ref').val();
var creditValue = $('#exinput6').val();
// Si el método de pago es A Credito, verificar el valor de exinput6
if (selectedPayment === 'A Credito') {
if (creditValue !== '') {
$('#add_payment_button').prop('disabled', false); // Activar el botón si hay un valor en el input de crédito
} else {
$('#add_payment_button').prop('disabled', true); // Bloquear el botón si no hay valor en el input de crédito
}
}
// Si el método seleccionado está en la lista permitida, habilitar siempre el botón
else if (allowedPayments.includes(selectedPayment)) {
$('#add_payment_button').prop('disabled', false);
}
// Si el método seleccionado está en la lista restringida y no hay valor en el input
else if (restrictedPayments.includes(selectedPayment) && inputValue === '') {
$('#add_payment_button').prop('disabled', true); // Bloquear el botón
} else if (inputValue !== '') {
$('#add_payment_button').prop('disabled', false); // Activar el botón si hay un valor en el input
} else {
$('#add_payment_button').prop('disabled', true); // Bloquear si no cumple las condiciones
}
}
// Llamar la función de validación al cargar la página
validateButtonState();
// Escuchar cambios en el dropdown
$('#payment_types').on('change', function() {
validateButtonState(); // Validar el botón al cambiar el dropdown
});
// Escuchar cambios en el input de pago
$('#payment_ref').on('input', function() {
validateButtonState(); // Validar el botón al escribir en el input
});
// Escuchar cambios en el input de crédito
$('#exinput6').on('input', function() {
validateButtonState(); // Validar el botón al escribir en el input de crédito
});
// Si recargas contenido por AJAX, asegúrate de llamar a validateButtonState después de que se actualice el DOM.
$(document).ajaxComplete(function() {
validateButtonState(); // Validar el botón después de una recarga AJAX
});
});
$(document).ready(function() {
// Lista de métodos de pago que deben bloquear el botón si no hay valor en el input
var restrictedPayments = [
'Tarjeta Bac NIO',
'Tarjeta Bac USD',
'Tarjeta Banpro NIO',
'Tarjeta Banpro USD',
'Tarjeta Lafise NIO',
'Tarjeta Lafise USD'
];
// Lista de métodos de pago que permiten que el botón esté siempre activo
var allowedPayments = [
'Efectivo',
'Transferencias',
'USD',
'NIO'
];
// Función para validar el estado del botón
function validateButtonState() {
var selectedPayment = $('#payment_types').val();
var inputValue = $('#payment_ref').val();
var creditValue = $('#exinput6').val();
// Si el método de pago es A Credito, verificar el valor de exinput6
if (selectedPayment === 'A Credito') {
if (creditValue !== '') {
$('#add_payment_button').prop('disabled', false); // Activar el botón si hay un valor en el input de crédito
} else {
$('#add_payment_button').prop('disabled', true); // Bloquear el botón si no hay valor en el input de crédito
}
}
// Si el método seleccionado está en la lista permitida, habilitar siempre el botón
else if (allowedPayments.includes(selectedPayment)) {
$('#add_payment_button').prop('disabled', false);
}
// Si el método seleccionado está en la lista restringida y no hay valor en el input
else if (restrictedPayments.includes(selectedPayment) && inputValue === '') {
$('#add_payment_button').prop('disabled', true); // Bloquear el botón
} else if (inputValue !== '') {
$('#add_payment_button').prop('disabled', false); // Activar el botón si hay un valor en el input
} else {
$('#add_payment_button').prop('disabled', true); // Bloquear si no cumple las condiciones
}
}
// Llamar la función de validación al cargar la página
validateButtonState();
// Escuchar cambios en el dropdown
$('#payment_types').on('change', function() {
validateButtonState(); // Validar el botón al cambiar el dropdown
});
// Escuchar cambios en el input de pago
$('#payment_ref').on('input', function() {
validateButtonState(); // Validar el botón al escribir en el input
});
// Escuchar cambios en el input de crédito
$('#exinput6').on('input', function() {
validateButtonState(); // Validar el botón al escribir en el input de crédito
});
// Si recargas contenido por AJAX, asegúrate de llamar a validateButtonState después de que se actualice el DOM.
$(document).ajaxComplete(function() {
validateButtonState(); // Validar el botón después de una recarga AJAX
});
});
Status: Appears resolved by a later, more general feature.
This 2024 request asked for a transaction-reference-number field tied to debit/credit payments. master now has a generalized Payment Reference Code feature: app/Controllers/Config.php::postSaveLocale() validates payment_reference_code_min/payment_reference_code_max, app/Views/configs/locale_config.php exposes a configurable length-limit slider, and (per the related work noted in issue #4548's thread) the register view/JS gates a reference-code input field for the payment types that need it (originally Credit/Debit, later extended to Bank Transfer/Wallet/UPI) via a get_reference_code_payment_types() helper, validated server-side in Sales::postAddPayment(). This covers the underlying need from this issue (configurable, validated reference code captured alongside non-cash payments), implemented more generally than the ad-hoc JS/SQL patch suggested in the original comments.
Activity
andriux1990 commentedon Oct 25, 2024
To implement what you're aiming for, some work is required on both the backend and the frontend.
In the backend, an additional table needs to be created in sales_payments to store transaction references. On the frontend, you can use JavaScript to set a condition: if payment is made by card, the "Add Payment" button should remain disabled until a value is entered in the reference input field. This ensures that the process cannot be completed without a valid reference.

andriux1990 commentedon Oct 25, 2024
Javascript code:
andriux1990 commentedon Oct 25, 2024
SQL:
ALTER TABLE
ospos_sales_paymentsADD COLUMN IF NOT EXISTS
payment_refvarchar(40) NOT NULL;retechp commentedon Oct 25, 2024
Thanks for this. What file do edit with this
Thanks for this. What file do edit with this
objecttothis commentedon Nov 4, 2026
Claude Issue Checker Agent (cc @objecttothis)
Investigated against current
master.Status: Appears resolved by a later, more general feature.
This 2024 request asked for a transaction-reference-number field tied to debit/credit payments.
masternow has a generalized Payment Reference Code feature:app/Controllers/Config.php::postSaveLocale()validatespayment_reference_code_min/payment_reference_code_max,app/Views/configs/locale_config.phpexposes a configurable length-limit slider, and (per the related work noted in issue #4548's thread) the register view/JS gates a reference-code input field for the payment types that need it (originally Credit/Debit, later extended to Bank Transfer/Wallet/UPI) via aget_reference_code_payment_types()helper, validated server-side inSales::postAddPayment(). This covers the underlying need from this issue (configurable, validated reference code captured alongside non-cash payments), implemented more generally than the ad-hoc JS/SQL patch suggested in the original comments.