Bug 14535 - Late orders does not show orders with price = 0
Summary: Late orders does not show orders with price = 0
Status: Pushed to Stable
Alias: None
Product: Koha
Classification: Unclassified
Component: Acquisitions (show other bugs)
Version: master
Hardware: All All
: P5 - low normal (vote)
Assignee: Marcel de Rooy
QA Contact: Testopia
URL:
Whiteboard:
Keywords: Academy
Depends on: 7291
Blocks:
  Show dependency treegraph
 
Reported: 2015-07-16 09:31 UTC by Katrin Fischer
Modified: 2017-05-03 03:56 UTC (History)
9 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Bot Control: ---
When did the bot last check this:
Who signed the patch off:
Text to go in the release notes:


Attachments
Bug 14535: Late orders does not show orders with price = 0 (1.33 KB, patch)
2017-02-06 09:11 UTC, Marcel de Rooy
Details | Diff | Splinter Review
Bug 14535: Update the supplier filter too (1.16 KB, patch)
2017-02-06 09:37 UTC, Marcel de Rooy
Details | Diff | Splinter Review
Bug 14535: Update the supplier filter too (1.81 KB, patch)
2017-02-06 13:34 UTC, Marcel de Rooy
Details | Diff | Splinter Review
[SIGNED-OFF] Bug 14535: Late orders does not show orders with price = 0 (1.35 KB, patch)
2017-03-21 01:40 UTC, Srdjan Jankovic
Details | Diff | Splinter Review
[SIGNED-OFF] Bug 14535: Update the supplier filter too (1.83 KB, patch)
2017-03-21 01:41 UTC, Srdjan Jankovic
Details | Diff | Splinter Review
Bug 14535: Late orders does not show orders with price = 0 (1.41 KB, patch)
2017-03-21 11:40 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 14535: Update the supplier filter too (1.89 KB, patch)
2017-03-21 11:40 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Katrin Fischer 2015-07-16 09:31:44 UTC
If the price is unknown or the book is free, part of another deal or whatever, the orders are entered with 0.00 as a price sometimes.

The problem is, that those orders won't ever show up in the late orders page, although you might want to ask for them to be delivered. This is because of a condition in the routine:

110 sub GetBooksellersWithLateOrders {
111     my ( $delay, $estimateddeliverydatefrom, $estimateddeliverydateto ) = @_;
112     my $dbh = C4::Context->dbh;
117     my $query;
118     my @query_params = ();
119     my $dbdriver = C4::Context->config("db_scheme") || "mysql";
120     $query = "
121         SELECT DISTINCT aqbasket.booksellerid, aqbooksellers.name
122         FROM aqorders LEFT JOIN aqbasket ON aqorders.basketno=aqbasket.basketno
123         LEFT JOIN aqbooksellers ON aqbasket.booksellerid = aqbooksellers.id
124         WHERE
125             ( datereceived = ''
126             OR datereceived IS NULL
127             OR aqorders.quantityreceived < aqorders.quantity
128             )
129             AND aqorders.rrp <> 0
130             AND aqorders.ecost <> 0
131             AND aqorders.quantity - COALESCE(aqorders.quantityreceived,0) <> 0
132             AND aqbasket.closedate IS NOT NULL
133     "
Comment 1 Katrin Fischer 2016-01-18 00:02:12 UTC
129             AND aqorders.rrp <> 0
130             AND aqorders.ecost <> 0

Appear to be the reason for the orders not showing up.
Comment 2 Katrin Fischer 2016-08-17 16:03:57 UTC
Just had another library reporting this as a bug.
Comment 3 Sandre Cunha 2016-08-22 18:43:52 UTC
This is not an issue for us, as the only items we have with a price of zero are pre-orders which will be published in the next fiscal year. We want them to show in the OPAC to avoid patrons suggesting them, but use a zero price to keep them from affecting the current budget. Just wanted the community to be aware of this aspect when working on this bug.
Comment 4 Katrin Fischer 2016-08-22 19:54:52 UTC
Hi Sandre, what is your suggestion to resolve this? Would it be a problem if those showed up as late orders after the normal period?

How are you treating gifts? I think one of the libraries explained that they use 0 for tracking gifts that they expect to receive or have asked for or when they don't know how much an item will cost.
Comment 5 Sandre Cunha 2016-08-22 20:17:01 UTC
I don't think it would be a problem if the 0-priced items showed up on the late list. I don't have a suggestion as I don
t quite understand the intended purpose of including

129             AND aqorders.rrp <> 0
130             AND aqorders.ecost <> 0

in the selection, and what the ramifications of removing one or both would be.

We do not "track" gifts in the manner you described, as ours are either gifts of physical items or monetary donations (from which items are ordered in the usual way, but from a trust fund account.)

A larger problem is that we do so much ordering of pre-publication items, and there is no way to adjust the "lateness" according to the scheduled publication date. For example, right now we have a purchase suggestion for an item that will not be published until April 2017. We want to make the order to get the item (by a popular author) into the OPAC so patrons can see it is on order and place holds, but if I do that now, the item would be "late" in 30 days, even though it will not be published for 6 months.
Comment 6 Marcel de Rooy 2017-02-06 08:59:03 UTC
I would also opt for the possibility to claim late orders without price.
Comment 7 Marcel de Rooy 2017-02-06 09:11:20 UTC
Created attachment 59921 [details] [review]
Bug 14535: Late orders does not show orders with price = 0

This patch removes the filter of unitpricesupplier <> 0 and
unitpricelib <> 0 from GetLateOrders as used in lateorders.pl.
This allows you to claim late orders without a price entered.

Test plan:
[1] Run t/db_dependent/Acquisition.t
[2] Check if you see an order with no price in lateorders.pl. (If needed,
    remove prices from a few orders.)

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 8 Marcel de Rooy 2017-02-06 09:29:33 UTC
Still need another change
Comment 9 Marcel de Rooy 2017-02-06 09:37:48 UTC Comment hidden (obsolete)
Comment 10 Marcel de Rooy 2017-02-06 13:34:24 UTC
Created attachment 59928 [details] [review]
Bug 14535: Update the supplier filter too

The combobox on the left side of late orders is filled by sub
GetBooksellersWithLateOrders. The same change as in the first patch
must be made here to include suppliers with late orders without a
price.

Bonus: Sort the list.

Test plan:
[1] Run t/db_dependent/Bookseller.t.
[2] Go to late orders. Use the filter on suppliers.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 11 Marcel de Rooy 2017-02-23 13:57:02 UTC
Katrin: Could you test this one please?
Comment 12 Katrin Fischer 2017-02-23 13:59:51 UTC
It's on the list, but I don't have much time the next 2 weeks, someone else might be faster.
Comment 13 Srdjan Jankovic 2017-03-21 01:40:53 UTC
Created attachment 61348 [details] [review]
[SIGNED-OFF] Bug 14535: Late orders does not show orders with price = 0

This patch removes the filter of unitpricesupplier <> 0 and
unitpricelib <> 0 from GetLateOrders as used in lateorders.pl.
This allows you to claim late orders without a price entered.

Test plan:
[1] Run t/db_dependent/Acquisition.t
[2] Check if you see an order with no price in lateorders.pl. (If needed,
    remove prices from a few orders.)

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Srdjan <srdjan@catalyst.net.nz>
Comment 14 Srdjan Jankovic 2017-03-21 01:41:54 UTC
Created attachment 61349 [details] [review]
[SIGNED-OFF] Bug 14535: Update the supplier filter too

The combobox on the left side of late orders is filled by sub
GetBooksellersWithLateOrders. The same change as in the first patch
must be made here to include suppliers with late orders without a
price.

Bonus: Sort the list.

Test plan:
[1] Run t/db_dependent/Bookseller.t.
[2] Go to late orders. Use the filter on suppliers.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Srdjan <srdjan@catalyst.net.nz>
Comment 15 Katrin Fischer 2017-03-21 06:41:45 UTC
Thx, Srdjan!
Comment 16 Marcel de Rooy 2017-03-21 07:40:03 UTC
(In reply to Katrin Fischer from comment #15)
> Thx, Srdjan!

Yes. indeed. srdjan++
Comment 17 Jonathan Druart 2017-03-21 10:59:37 UTC
I wrote that long time ago and I am pretty sure that was a feature.
Comment 18 Marcel de Rooy 2017-03-21 11:02:40 UTC
(In reply to Jonathan Druart from comment #17)
> I wrote that long time ago and I am pretty sure that was a feature.

I passed QA on that long time ago and I am not sure it was :)
Comment 19 Katrin Fischer 2017-03-21 11:03:28 UTC
We got complaints - so it's at least not a feature for everyone :)
Comment 20 Jonathan Druart 2017-03-21 11:18:23 UTC
(In reply to Marcel de Rooy from comment #18)
> (In reply to Jonathan Druart from comment #17)
> > I wrote that long time ago and I am pretty sure that was a feature.
> 
> I passed QA on that long time ago and I am not sure it was :)

You did not write/read the initial specs ;)
I have asked BibLibre's guys to dig into their own bug tracker.
Comment 21 Jonathan Druart 2017-03-21 11:40:47 UTC
Created attachment 61370 [details] [review]
Bug 14535: Late orders does not show orders with price = 0

This patch removes the filter of unitpricesupplier <> 0 and
unitpricelib <> 0 from GetLateOrders as used in lateorders.pl.
This allows you to claim late orders without a price entered.

Test plan:
[1] Run t/db_dependent/Acquisition.t
[2] Check if you see an order with no price in lateorders.pl. (If needed,
    remove prices from a few orders.)

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Srdjan <srdjan@catalyst.net.nz>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 22 Jonathan Druart 2017-03-21 11:40:52 UTC
Created attachment 61371 [details] [review]
Bug 14535: Update the supplier filter too

The combobox on the left side of late orders is filled by sub
GetBooksellersWithLateOrders. The same change as in the first patch
must be made here to include suppliers with late orders without a
price.

Bonus: Sort the list.

Test plan:
[1] Run t/db_dependent/Bookseller.t.
[2] Go to late orders. Use the filter on suppliers.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Srdjan <srdjan@catalyst.net.nz>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 23 Jonathan Druart 2017-03-21 11:41:43 UTC
(In reply to Jonathan Druart from comment #20)
> (In reply to Marcel de Rooy from comment #18)
> > (In reply to Jonathan Druart from comment #17)
> > > I wrote that long time ago and I am pretty sure that was a feature.
> > 
> > I passed QA on that long time ago and I am not sure it was :)
> 
> You did not write/read the initial specs ;)
> I have asked BibLibre's guys to dig into their own bug tracker.

Gaetan agreed!
Comment 24 Marcel de Rooy 2017-03-21 11:46:05 UTC
(In reply to Jonathan Druart from comment #23)
> (In reply to Jonathan Druart from comment #20)
> > (In reply to Marcel de Rooy from comment #18)
> > > (In reply to Jonathan Druart from comment #17)
> > > > I wrote that long time ago and I am pretty sure that was a feature.
> > > 
> > > I passed QA on that long time ago and I am not sure it was :)
> > 
> > You did not write/read the initial specs ;)
> > I have asked BibLibre's guys to dig into their own bug tracker.
> 
> Gaetan agreed!

What if we did not have him :)
Thanks
Comment 25 Kyle M Hall 2017-03-31 13:19:23 UTC
Pushed to master for 17.05, thanks Marcel!
Comment 26 Katrin Fischer 2017-04-02 17:09:27 UTC
These patches have been pushed to 16.11.x and will be in 16.11.07.
.
Comment 27 Julian Maurice 2017-04-21 10:07:16 UTC
Pushed to 3.22.x for 3.22.20
Comment 28 Mason James 2017-05-03 03:56:24 UTC
Pushed to 16.05.x, for 16.05.12 release