Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Credit Invoice: impossible to not credit shipping
05-02-2019, 11:43 PM,
#1
Credit Invoice: impossible to not credit shipping
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
Reply
05-03-2019, 01:15 AM,
#2
RE: Credit Invoice: impossible to not credit shipping
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
Reply
05-04-2019, 05:50 PM,
#3
RE: Credit Invoice: impossible to not credit shipping
As nobody has come up with any objections I have committed this fix and created a pull request.

Tim
Reply
05-05-2019, 12:15 AM, (This post was last modified: 05-05-2019, 01:01 AM by HDeriauFF.)
#4
RE: Credit Invoice: impossible to not credit shipping
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']));

Reply
05-05-2019, 02:14 AM,
#5
RE: Credit Invoice: impossible to not credit shipping
Thanks!

I have added that to the pull request

Tim
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)