webERP Forum
Credit Invoice: impossible to not credit shipping - Printable Version

+- webERP Forum (http://www.weberp.org/forum)
+-- Forum: webERP Discussion (/forumdisplay.php?fid=1)
+--- Forum: Problems / Bugs? (/forumdisplay.php?fid=8)
+--- Thread: Credit Invoice: impossible to not credit shipping (/showthread.php?tid=8339)



Credit Invoice: impossible to not credit shipping - HDeriauFF - 05-02-2019 11:43 PM

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


RE: Credit Invoice: impossible to not credit shipping - falkoner - 05-03-2019 01:15 AM

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.

Tim


RE: Credit Invoice: impossible to not credit shipping - falkoner - 05-04-2019 05:50 PM

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

Tim


RE: Credit Invoice: impossible to not credit shipping - HDeriauFF - 05-05-2019 12:15 AM

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

from:

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']));


RE: Credit Invoice: impossible to not credit shipping - falkoner - 05-05-2019 02:14 AM

Thanks!

I have added that to the pull request

Tim