by COBS Tech Support » Fri Apr 28, 2006 7:32 am
You can make certain fields on transactions mandatory by using the appropriate hook scripts in conjunction with the IsEmpty() and ReadTranValue() functions.
The fields you can check the values for are listed inside the topic relating to ReadTranValue().
For invoicing, create a text file called R-ITOTAL.MAC and place this text inside the file:
If IsEmpty(ReadTranValue("REFERENCE"))
Echo("Sorry, please fill in the reference field")
Return FALSE
Endif
Return TRUE
Change the field "REFERENCE" to the field that you don't want to be blank. You can add multiple statements after the first If...Endif block of text, before the Return TRUE statement, if required. E.g.,
If IsEmpty(ReadTranValue("OURREF"))
Echo("Sorry, please fill in the auxiliary reference field")
Return FALSE
Endif
If IsEmpty(ReadTranValue("OURREF2"))
Echo("Sorry, please fill in the second auxiliary reference field")
Return FALSE
Endif
Return TRUE
And so on.
To have this script affect all companies, place it in the \CAPITAL folder. To have the script affect the operations of a specific company only, place it in the \CAPITAL\XXX folder where XXX is the name of the company you want to affect.
For the names of other script hook files consult the help topic: "Other Transaction Pre-Saving Hooks".