Topic: INVOICE NUMBER - PREVENT CHANGE BY USER
I have posted this under another post but there is no reply so I transferred the topic to here....
There is a need to implement a control of the invoice number and we have to make the invoice number non-editable by the user when they enter a Direct Invoice or Invoice against a delivery. We used the Form Setup to assign the first number and let the Invoice number incremental run automatically.
Currently, the Invoice screen will show the Invoice Number assigned by the Form Setup and the field allows user to edit. This is because of the lines below in sales\customer_invoice.php:
if ($_SESSION['Items']->trans_no == 0) {
ref_cells(_("Reference"), 'ref', '', null, "class='tableheader2'"); //Invoice Number assigned but editable
} else {
label_cells(_("Reference"), $_SESSION['Items']->reference, "class='tableheader2'");
}
To make it non-editable, I have replaced the line ref_cells to label_cells as follows:
if ($_SESSION['Items']->trans_no == 0) {
label_cells(_("Reference"), $_SESSION['Items']->reference, "class='tableheader2'"); //Invoice Number assigned and now not editable
} else {
label_cells(_("Reference"), $_SESSION['Items']->reference, "class='tableheader2'");
}
With this change, now the Invoice number is assigned (by Form Setups) and not editable. However, when I process the Invoice, the error "You must enter a reference." shows. I know I missed out something but I don't know what else to change. The Invoice Number showed is not assigned to the variable which in turn update the reference in the database tables. This variable is empty.
Would you please advise what other codes I have to change so that the assigned Invoice number is picked up and update the reference in the Tables?
Thank you.
Mark