Bug 11438 - Add creation date and closing date to basketgroups
Summary: Add creation date and closing date to basketgroups
Status: RESOLVED MOVED
Alias: None
Product: Koha
Classification: Unclassified
Component: Acquisitions (show other bugs)
Version: master
Hardware: All All
: P3 enhancement (vote)
Assignee: mathieu saby
QA Contact: Testopia
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-12-23 23:18 UTC by mathieu saby
Modified: 2014-12-02 15:08 UTC (History)
3 users (show)

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


Attachments
[PATCH] Bug 11438 - Add creation date and closing date to basketgroups (32.24 KB, patch)
2013-12-23 23:19 UTC, mathieu saby
Details | Diff | Splinter Review
[PATCH] Bug 11438 - Add creation date and closing date to basketgroups (32.60 KB, patch)
2014-04-03 17:42 UTC, mathieu saby
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description mathieu saby 2013-12-23 23:18:31 UTC
This bug will add creation date and closing date management to basketgroups, in order to provide further enh, specially but 10919 (not yet written).

M. Saby
Comment 1 mathieu saby 2013-12-23 23:19:55 UTC Comment hidden (obsolete)
Comment 2 jmbroust 2014-01-10 14:10:06 UTC
Tested on sandbox 16 biblibre
We had no existing basketgroups in database. So we only tested on basketgroup creation :
closing date and creation date seem to work fine but we couldn't test with different dates. It would be better to test this patch on several days and with existing basket groups in database.
Comment 3 mathieu saby 2014-01-10 16:03:29 UTC
(In reply to jmbroust from comment #2)
> Tested on sandbox 16 biblibre
> We had no existing basketgroups in database. So we only tested on
> basketgroup creation :
> closing date and creation date seem to work fine but we couldn't test with
> different dates. It would be better to test this patch on several days and
> with existing basket groups in database.

Thank you for testing.
The other solution could be to alter by hand the database before applying the patch, but is less secure.

To sum up what is still to test :
A. The creation and editing of bg with the patch
=> seems ok for you

B. The transformation of existing data (when a bg is closed, the application of the patch should copy into the bg the date of the most recent basket closing date)
=> not yet tested

Mathieu
Comment 4 mathieu saby 2014-04-03 17:42:56 UTC
Created attachment 26800 [details] [review]
[PATCH] Bug 11438 - Add creation date and closing date to basketgroups

REBASED



This patch change the way Koha is dealing with closing basketgroups, taking as a model the way it deals with closing baskets.
This improvement will serve as a base for further enh:
- displaying the closing date in PDF instead of current date (this can be syspref-dependant)
- usign the closing date for calculation of late orders, instead of closing date of the basket (this can be syspref-dependant)

The patch provides 3 changes in in aqbasketgroups table structure:
- The closing date is stored in bg_closedate column
- The creation date is stored in bg_creationdate column
- The closed column is removed
When a basketgroup is open, or reopened, the closing date is set to NULL.
I add a "bg_" prefix in column names to avoid all possible confusion between them and closedate/creationdate column in aqbaskets.

Some changes are made to subs dealing with basketgroups in C4/Acquisition.pm.

The 2 dates are displayed in basketgroup template
- in lists of opened/closed basketgroups
- in an individual basketgroup.

updatedatabase.pl creates the 2 columns and removes closed column, but also populates the 2 new columns:
- bg_creationdate with the most recent closing date of the baskets included in each basketgroup
- bg_closingdate with NULL is the bg is open, or with the most recent closing date of the baskets included in each basketgroup

You have 2 elements to test: 
- the behavior of Koha after the patch is applied
- the changes made by updatedatabase.pl

Plan test: (bg = basketgroup)
1. Before applying the patch, prepare some bgs :
at least 1 open with 1 basket, 1 open with 2 baskets closed on different dates, 1 closed with 1 basket, 1 closed with 2 baskets closed on different dates
2. Apply the patch and run installer/data/mysql/updatedatabase.pl
3. Show the list of open and closed bg and check the creation dates are correct (it should be the most recent closing date of the baskets included in each basketgroup)
4. Check the open bg have no closing date
5. Check the closed bg have a closing date, which must be the same as the creation date
6. Click on "View" to display an individual closed bg : check you the same dates as in the list of bgs
7. Reopen the closed bg. Check it is actually reopened and displayed in "open" tab, with no value in "closing date" column
8. Click on "Edit" to edit an individual open bg : check you the same creation date as in the list of bgs, and no closing date
9. Make some changes to this bg, and Save it without closing it
10. Check the changes were actually saved, and that the bg is still in "Open" tab, with no value in "closing date column"
11. Edit again the bg
12. Make some changes, but this time, check "Close basket group" box at the bottom of the form before Saving it
13. Check the changes were actually saved, and that the bg is now in "Closed" tab, with the today date in "closing date" column
14. Click on "New basketgroup" to create a new bg
15. Check no date at all is displayed in the creation form.
16. Give it a name, and Save it without closing it
17. Check the bg has been created, and is displayed in "Open" tab, with today date in "creation date" column, and no value in "closing date"
18. Click on "New basketgroup" to create an other new bg
19. Give it a name, but this time, check "Close basket group" box at the bottom of the form before Saving it
20. Check the bg has been created, and is displayed in "Open" tab, with today date in "creation date" column, and no value in "closing date"
23. In basket pages, Close an open basket, and ask to create a new bg with the same name
24. Check in bg page that a new closed bg with the same name as the closed basket has been created
25. In basket pages, Close basket without creating a bg, then put this basket in an open bg, using the "change group" dropdown menu
26. Check in bg page that the basket is now included in the bg
Comment 5 mathieu saby 2014-04-17 10:27:15 UTC
Will probably need a rewrite if bug 11708 is pushed first
Comment 6 Paola Rossi 2014-05-23 13:11:44 UTC
(In reply to mathieu saby from comment #4)

> [....]
> Plan test: (bg = basketgroup)
> 1. Before applying the patch, prepare some bgs :
> at least 1 open with 1 basket, 1 open with 2 baskets closed on different
> dates, 1 closed with 1 basket, 1 closed with 2 baskets closed on different
> dates
> 2. Apply the patch and run installer/data/mysql/updatedatabase.pl
> 3. Show the list of open and closed bg and check the creation dates are
> correct (it should be the most recent closing date of the baskets included
> in each basketgroup)
> 4. Check the open bg have no closing date
> 5. Check the closed bg have a closing date, which must be the same as the
> creation date
> 6. Click on "View" to display an individual closed bg : check you the same
> dates as in the list of bgs
> 7. Reopen the closed bg. Check it is actually reopened and displayed in
> "open" tab, with no value in "closing date" column
> 8. Click on "Edit" to edit an individual open bg : check you the same
> creation date as in the list of bgs, and no closing date
> 9. Make some changes to this bg, and Save it without closing it
> 10. Check the changes were actually saved, and that the bg is still in
> "Open" tab, with no value in "closing date column"
> 11. Edit again the bg
> 12. Make some changes, but this time, check "Close basket group" box at the
> bottom of the form before Saving it
> 13. Check the changes were actually saved, and that the bg is now in
> "Closed" tab, with the today date in "closing date" column
> 14. Click on "New basketgroup" to create a new bg
> 15. Check no date at all is displayed in the creation form.
> 16. Give it a name, and Save it without closing it
> 17. Check the bg has been created, and is displayed in "Open" tab, with
> today date in "creation date" column, and no value in "closing date"
> 18. Click on "New basketgroup" to create an other new bg
> 19. Give it a name, but this time, check "Close basket group" box at the
> bottom of the form before Saving it
> 20. Check the bg has been created, and is displayed in "Open" tab, with
> today date in "creation date" column, and no value in "closing date"
> 23. In basket pages, Close an open basket, and ask to create a new bg with
> the same name
> 24. Check in bg page that a new closed bg with the same name as the closed
> basket has been created
> 25. In basket pages, Close basket without creating a bg, then put this
> basket in an open bg, using the "change group" dropdown menu
> 26. Check in bg page that the basket is now included in the bg

Trying to sign off this bug, I'm in doubt. 
Please I'd be glad for these 2 checkes:

1) Perhaps is the 20-th step wrong? And should the following one be better?
20. Check the bg has been created, and is displayed in "Closed" tab, with
today date in "creation date" column, and in "closing date" too

2)Perhaps does any step miss after the 20-th one ?

Thanks in advance.
Comment 7 Paola Rossi 2014-05-23 15:47:04 UTC
Against master 3.17.00.001 the patch needs to be rebased:

Applying: Bug 11438 - Add creation date and closing date to basketgroups
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
Auto-merging koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroup.tt
Auto-merging installer/data/mysql/updatedatabase.pl
CONFLICT (content): Merge conflict in installer/data/mysql/updatedatabase.pl
Auto-merging installer/data/mysql/kohastructure.sql
Auto-merging acqui/basketgroup.pl
Auto-merging C4/Acquisition.pm
Failed to merge in the changes.
Patch failed at 0001 Bug 11438 - Add creation date and closing date to basketgroups

So I pass the patch to "Patch doesn't apply" status.
Comment 8 mathieu saby 2014-05-25 16:51:16 UTC
Hello Paola
Thank you for testing
As bug 11708 has been signed (but in failed QA), I prefer not to rewrite this one for the moment, as they are doing mostly the same thing.
For the moment, I will comment bug 11708 to stress the common points and differences between the 2 patches, and let this one in "does not apply".

Mathieu
Comment 9 Paola Rossi 2014-12-02 15:07:46 UTC
(In reply to mathieu saby from comment #8)
> Hello Paola
> Thank you for testing
> As bug 11708 has been signed (but in failed QA), I prefer not to rewrite
> this one for the moment, as they are doing mostly the same thing.
> For the moment, I will comment bug 11708 to stress the common points and
> differences between the 2 patches, and let this one in "does not apply".
> 
> Mathieu

Kind Mathieu, we'd agree with you and pass this bug from "Patch doesn't apply" status to the "Resoved - Moved" one towards bug 11708, which is in the "Signed Off" status today.
Comment 10 Paola Rossi 2014-12-02 15:08:57 UTC
We pass this bug to "Resolved- Moved" status.
See bug 11708.