Skip to main content

Javascript overrides and extensions

Some commonly used Javascript functions can be replaced or extended to change their behavior. To do this, simply create a function that has the same name as the function to be modified with the addition of "_override" or "_extension" and the same parameters. The behavior of the two extensions is as follows:

FUNCTION_override() If present, this function is called instead of the original one. The return value of this function is the return value.
FUNCTION_extension() If present, this function is called and if it returns false or a value equivalent to false, the original function ends by returning false, while if it returns true or an equivalent value, the execution continues in the original function.

The difference is that, in the first case the original function is completely ignored, while in the second, it is possible to decide whether to continue the standard execution or not. This is very convenient in the case of validation functions, usually very long, in which you simply want to add a control, without copying the entire function for small changes.
The functions that support these extensions are as follows:

File Functions
include/js/general.js doformValidation
startCall
getFormValidate
include/js/Inventory.js

settotalnoofrows

deleteRow

calcTotal

calcProductTotal

calcGrandTotal

validateInventory

FindDuplicate

validateNewTaxType

validateTaxes

setDiscount

callTaxCalc

calcCurrentTax

calcGroupTax

calcSHTax

validateProductDiscounts

updatePrices

updatePriceValues

resetSHandAdjValues

moveUpDown

InventorySelectAll

fnAddProductOrServiceRowNew