Fix stock-out boot, transfer 500, Clear buttons and uncaught engine errors
Return JSON from any uncaught engine exception, stop the empty stock-out warehouse list aborting page boot, reject non-transfer rows in the transfer lookup, define the missing reset_input helper, and remove a stale unreferenced copy of confirm_order.php.
This commit is contained in:
@@ -1074,6 +1074,36 @@ function to_iso_date(dateStr) {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Clear every field inside a form or form-like container — the "Clear" buttons
|
||||
* on the master-data pages. It was called by five pages but never defined, so
|
||||
* each click threw a ReferenceError, and where the container is a <div> rather
|
||||
* than a <form> (Chart of Accounts, Departments) the button did nothing at all.
|
||||
* Disabled and hidden inputs are left alone: those carry the record id and
|
||||
* locked values, not user input.
|
||||
*/
|
||||
function reset_input(selector) {
|
||||
var $scope = $(selector);
|
||||
if (!$scope.length) return;
|
||||
|
||||
$scope.find('input, textarea, select').each(function () {
|
||||
if (this.disabled || this.type === 'hidden' || this.type === 'button' || this.type === 'submit') return;
|
||||
|
||||
if (this._flatpickr) {
|
||||
this._flatpickr.clear();
|
||||
} else if (this.type === 'checkbox' || this.type === 'radio') {
|
||||
this.checked = this.defaultChecked;
|
||||
} else if (this.tagName === 'SELECT') {
|
||||
this.selectedIndex = 0;
|
||||
} else {
|
||||
this.value = '';
|
||||
}
|
||||
|
||||
$(this).removeAttr('secondary').removeClass('is-invalid is-valid');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function round_dp(value, places) {
|
||||
var factor = Math.pow(10, places);
|
||||
return Math.round((Number(value) + Number.EPSILON) * factor) / factor;
|
||||
|
||||
Reference in New Issue
Block a user