Bug 15376 - Edit invoices: Can not change Shipping cost.
Summary: Edit invoices: Can not change Shipping cost.
Status: CLOSED WONTFIX
Alias: None
Product: Koha
Classification: Unclassified
Component: Acquisitions (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal (vote)
Assignee: Marc Véron
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-12-15 14:13 UTC by Marc Véron
Modified: 2017-06-14 22:10 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 15376: Edit invoices: Can not change Shipping cost (1.60 KB, patch)
2015-12-15 14:19 UTC, Marc Véron
Details | Diff | Splinter Review
Bug 15376: Edit invoices: Can not change Shipping cost (3.20 KB, patch)
2015-12-15 14:43 UTC, Marc Véron
Details | Diff | Splinter Review
Bug 15376: Edit invoices: Can not change Shipping cost (3.36 KB, patch)
2015-12-15 15:50 UTC, Frédéric Demians
Details | Diff | Splinter Review
Bug 15376: (followup) Set on_editing flag (1.36 KB, patch)
2015-12-16 09:59 UTC, Marc Véron
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Marc Véron 2015-12-15 14:13:59 UTC
To verify:
- Go to Home > Acquisitions
- Edit an invoice that has no shipping date
- Change shipment cost. Leave shipping date empty
- Save
Result: Page reloads, shipment cost keeps old value. 
        Warnings in intranet-error.log
Comment 1 Marc Véron 2015-12-15 14:19:23 UTC Comment hidden (obsolete)
Comment 2 Marc Véron 2015-12-15 14:43:35 UTC Comment hidden (obsolete)
Comment 3 Frédéric Demians 2015-12-15 15:50:18 UTC
Created attachment 45709 [details] [review]
Bug 15376: Edit invoices: Can not change Shipping cost

To reproduce:
- Go to Home > Acquisitions
- Edit an invoice that has no shipping date
- Change shipment cost. Leave shipping date empty
- Save
Result: Page reloads, shipment cost keeps old value.
        Warnings in intranet-error.log

To test:
- Apply patch
- Follow steps above
Result: Shipment costs are changed as expected
        No warnings in intrante-error.log

Additionally, verify that the input field 'Shipping cost' is
properly formatted and that in invoice details 'Shipment cost'
is replaced by 'Shipping cost'

Signed-off-by: Frédéric Demians <f.demians@tamil.fr>
  Confirm bug and solution
Comment 4 Jonathan Druart 2015-12-16 09:35:56 UTC
Comment on attachment 45709 [details] [review]
Bug 15376: Edit invoices: Can not change Shipping cost

Review of attachment 45709 [details] [review]:
-----------------------------------------------------------------

::: koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt
@@ +80,4 @@
>                      <input type="text" size="10" id="billingdate" name="billingdate" value="[% billingdate | $KohaDates %]" readonly="readonly" class="datepicker" /></li>
>  
>              <li><label for="shipmentcost">Shipping cost:</label>
> +                    <input type="text" size="10" id="shipmentcost" name="shipmentcost" value="[% shipmentcost | $Price %]" /></li>

I have not tried the patch but Price should be called with the on_editing flag set when it's used for an input field.
Comment 5 Marc Véron 2015-12-16 09:59:51 UTC
Created attachment 45718 [details] [review]
Bug 15376: (followup) Set on_editing flag

See comment #4
Comment 6 Jonathan Druart 2015-12-18 11:45:45 UTC
I don't get the issue on master, please provide a more detail test plan.
Comment 7 Marcel de Rooy 2015-12-28 09:30:04 UTC
I followed the test plan. And can (also) change the shipping cost for an invoice without shipment date in current master.
Comment 8 Aleisha Amohia 2016-01-07 22:49:37 UTC
I followed test plan and can't reproduce this bug either.
Comment 9 Marc Véron 2016-01-08 09:22:47 UTC
The error no longer appears on current master.

I had a look at the database: When I filed the bug, the error occured with records where shipmentdate = NULL.

The current behaviour is that a record with shipmentdate = NULL has now shipmentdate = 0000-00-00 after saving with an empty field 'shipmentdate'.

More testing:
If I receive a shipment and save with an empty shipmentdate, the shipmentdate gets a NULL in the database (and billingdate / closedate as well).

Additionally: If I edit this record and save it without changing any values (leaving shipmentdate and billingdate empty), shipmentdate turns to 0000-00-00 but billingdate is still NULL. I would expect that both dates behave the same.

(BTW: While saving I get a log entry 'invoice.pl: Use of uninitialized value in concatenation (.) or string at .../invoice.tt line 79)

So we have two different values for "empty date" in the table aqinvoices: NULL and 0000-00-00.

@Jonathan: What dou you think about 0000-00-00 vs NULL? If I look at Bugzilla I see a couple of Bugs regarding 0000-00-00.
Comment 10 Marc Véron 2016-02-19 15:34:47 UTC
Re-tested on current master, I can no longer reproduce the issue.