Bug 13707

Summary: Adding a new column datereceived for items and biblioitems
Product: Koha Reporter: Olli-Antti Kivilahti <olli-antti.kivilahti>
Component: DatabaseAssignee: Olli-Antti Kivilahti <olli-antti.kivilahti>
Status: Patch doesn't apply --- QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: aleisha, dpavlin, josef.moravec
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Medium patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: Bug 13707 - Adding a new column datereceived for items and biblioitems. Value accessors.
Bug 13707 - Adding a new column datereceived for items and biblioitems. New sortable Zebra index.
Bug 13707 - Adding a new column datereceived for items and biblioitems
Bug 13707 - Adding a new column datereceived for items and biblioitems. New sortable Zebra index.
Bug 13707 - Adding a new column datereceived for items and biblioitems. New sortable Zebra index.
Bug 13707 - 1. Adding a new column datereceived for items and biblioitems
Bug 13707 - 2. Adding a new column datereceived for items and biblioitems. Value accessors.
Bug 13707 - 3. Adding a new column datereceived for items and biblioitems. New sortable Zebra index.
Bug 13707 - 2. Adding a new column datereceived for items and biblioitems. Value accessors.
Bug 13707 - 3. Adding a new column datereceived for items and biblioitems. New sortable Zebra index.
Bug 13707 - 4. Adding a new column datereceived for items and biblioitems. Unit tests.
KD-245 - Bug 13707 - 5. Prepared searches. NOT FOR MASTER
Bug 13707 - 3. Adding a new column datereceived for items and biblioitems. New sortable Zebra index.
Bug 13707 - 1. Adding a new column datereceived for items and biblioitems
Bug 13707: (squashable) Column 'datereceived' in where clause is ambiguous
Bug 13707: (follow-up) Fix failing unit test t/db_dependent/Datereceived.t

Description Olli-Antti Kivilahti 2015-02-13 09:53:42 UTC
This column tells when the Item or Biblio has been received for the first time into a library.
Date-of-acquisition (dateaccessioned) answers, when the Item has been ordered.
Date-of-receival (datereceived) answers, when the Item has arrived to the library or when the first Item for the Biblio has for the first time arrived to the library.
This is very useful regarding statistics of acquisitions if they are based on the date received instead of the date acquired.
Also other cool stuff can be built on top of it, like better searches for new material.

This patch adds new DB columns items.datereceived, biblioitems.datereceived, deleteditems.datereceived, deletedbiblioitems.datereceived
and populates those columns from the acorders.datereceived if the Item has been acquired using the acquisitions module, or from the items.dateaccessioned-column if no acquisitions module has been used.
Biblioitems.datereceived is always the oldest timestamp from all the Items the Biblio has.
Comment 1 Olli-Antti Kivilahti 2015-02-13 15:58:04 UTC Comment hidden (obsolete)
Comment 2 Olli-Antti Kivilahti 2015-02-13 16:07:32 UTC Comment hidden (obsolete)
Comment 3 Olli-Antti Kivilahti 2015-02-13 16:09:29 UTC Comment hidden (obsolete)
Comment 4 Olli-Antti Kivilahti 2015-02-13 17:34:14 UTC Comment hidden (obsolete)
Comment 5 Olli-Antti Kivilahti 2015-02-16 14:10:15 UTC Comment hidden (obsolete)
Comment 6 Olli-Antti Kivilahti 2015-02-16 15:30:10 UTC Comment hidden (obsolete)
Comment 7 Olli-Antti Kivilahti 2015-02-16 15:30:58 UTC Comment hidden (obsolete)
Comment 8 Olli-Antti Kivilahti 2015-02-16 15:31:28 UTC Comment hidden (obsolete)
Comment 9 Olli-Antti Kivilahti 2015-02-17 12:47:50 UTC
Created attachment 35966 [details] [review]
Bug 13707 - 2. Adding a new column datereceived for items and biblioitems. Value accessors.

This makes sure that the datereceived-columns are populated, eg the Item and
biblio get the date of receival.
This happens when an Item is added using the cataloguin/additem.pl or the
acqui/finishreceive.pl

TEST PLAN: (cataloguing)

1. Add a new Biblio, either via Z39.50 or cataloguing/addbiblio.pl
2. Add an Item for the new Biblio using the cataloguing/additem.pl. This is
   the default view you get after saving the Biblio.
3. Observe that the new Item has a datereceived-field with current time as the
   timestamp.
4. Observe that the new Biblio has datereceived populated in the field where
   you have it mapped to. This defaults to 942$1.

TEST PLAN: (acquisitions)

1. Add a new Biblio, either via Z39.50 or cataloguing/addbiblio.pl
2. Add an Item for the new Biblio using the acquisitions workflow. Close the
   basketgroup.
3. Receive the Item using the acqui/finishreceive.pl.
4. Observe that the new Item has a datereceived-field with current time as the
   timestamp.
5. Observe that the new Biblio has datereceived populated in the field where
   you have it mapped to. This defaults to 942$1.

TEST PLAN: (break it, after any test path)

10. Receive new Items using both the acquisitions module and the cataloguin
    module.
11. Observe that Biblio's datereceived-field (942$1) doesn't change, but
    remains as the value set when receiving the first Item.
12. Observe that each Item gets the original timestamp when it has been received.
Comment 10 Olli-Antti Kivilahti 2015-02-17 12:52:46 UTC Comment hidden (obsolete)
Comment 11 Olli-Antti Kivilahti 2015-02-17 12:53:25 UTC
Created attachment 35968 [details] [review]
Bug 13707 - 4. Adding a new column datereceived for items and biblioitems. Unit tests.
Comment 12 Olli-Antti Kivilahti 2015-02-17 12:55:37 UTC
Pushed this to production here.
Waiting for trouble!

Have fun!
Comment 13 Olli-Antti Kivilahti 2015-02-17 14:43:23 UTC
Created attachment 35970 [details] [review]
KD-245 - Bug 13707 - 5. Prepared searches. NOT FOR MASTER

An example on how to utilize this new search index.
Comment 14 Olli-Antti Kivilahti 2015-09-04 12:00:39 UTC
Created attachment 42391 [details] [review]
Bug 13707 - 3. Adding a new column datereceived for items and biblioitems. New sortable Zebra index.
Comment 15 Olli-Antti Kivilahti 2015-09-04 12:47:47 UTC
Created attachment 42394 [details] [review]
Bug 13707 - 1. Adding a new column datereceived for items and biblioitems
Comment 16 Aleisha Amohia 2016-02-03 19:37:53 UTC
Applying: Bug 13707 - 2. Adding a new column datereceived for items and biblioitems. Value accessors.
fatal: sha1 information is lacking or useless (C4/Biblio.pm).
Repository lacks necessary blobs to fall back on 3-way merge.
Cannot fall back to three-way merge.
Patch failed at 0001 Bug 13707 - 2. Adding a new column datereceived for items and biblioitems. Value accessors.
Comment 17 Lari Taskula 2017-06-15 17:31:27 UTC
Created attachment 64343 [details] [review]
Bug 13707: (squashable) Column 'datereceived' in where clause is ambiguous

To test:
1. prove t/db_dependent/Acquisition.t
Comment 18 Lari Taskula 2017-06-15 17:32:08 UTC
Created attachment 64344 [details] [review]
Bug 13707: (follow-up) Fix failing unit test t/db_dependent/Datereceived.t

To replicate:
1. Before applying patch, prove t/db_dependent/Datereceived.t

To test:
1. Apply patch
2. prove t/db_dependent/Datereceived.t