Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Credit Invoice: impossible to not credit shipping
05-02-2019, 11:43 PM
Post: #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
Find all posts by this user
Quote this message in a reply
05-03-2019, 01:15 AM
Post: #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
Visit this user's website Find all posts by this user
Quote this message in a reply
05-04-2019, 05:50 PM
Post: #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
Visit this user's website Find all posts by this user
Quote this message in a reply
05-05-2019, 12:15 AM (This post was last modified: 05-05-2019 01:01 AM by HDeriauFF.)
Post: #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']));
Find all posts by this user
Quote this message in a reply
05-05-2019, 02:14 AM
Post: #5
RE: Credit Invoice: impossible to not credit shipping
Thanks!

I have added that to the pull request

Tim
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 2 Guest(s)