webERP Forum

Full Version: Credit Invoice: impossible to not credit shipping
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi Folks

could you please confirm:
in a sales invoice that contains a shipping charge, the credit shipping cannot be set zero by entering "0", a click on "update" is ignored and goes back to the previous value.
A trick works however: if we enter 0.001, the update goes to zero
This seems to be on line 204 of Credit_Invoice.php where the following check takes place:

if (isset($_POST['ChargeFreightCost']) and abs($_POST['ChargeFreightCost']) > 0) {

I am unsure why it is necessary here to check that $_POST['ChargeFreightCost'] is non-zero. Changing that line to:

if (isset($_POST['ChargeFreightCost'])) {

solves the problem. Unless somebody knows a reason why this check is done I will apply the change.

As nobody has come up with any objections I have committed this fix and created a pull request.

Thank you Tim!

I also changed the line immediately after, to make sure that a negative credit would not be applied.

so the global change is


if(isset($_POST['ChargeFreightCost']) AND abs($_POST['ChargeFreightCost'])>0) {
$_SESSION['CreditItems' . $identifier]->FreightCost = filter_number_format($_POST['ChargeFreightCost']);

changed to:

if(isset($_POST['ChargeFreightCost'])) {
$_SESSION['CreditItems' . $identifier]->FreightCost = abs(filter_number_format($_POST['ChargeFreightCost']));

I have added that to the pull request

Reference URL's