Bug 7910

Summary: Batch renewal of subscriptions
Product: Koha Reporter: Savitra Sirohi <savitra.sirohi>
Component: SerialsAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact:
Severity: enhancement    
Priority: P5 - low CC: amitddng135, colin.campbell, jonathan.druart, katrin.fischer, kohapatch, martin.renvoize, paul.poulain, savitra.sirohi, severine.queune
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15531
Change sponsored?: Sponsored Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on: 20614    
Bug Blocks:    
Attachments: Batch renewal of serials
Bug 7910 - Batch renewal of serials
Bug 7910 - Batch renewal of serials
Bug 7910: Add the ability to renew several subscriptions at once
Bug 7910: Give feedack when the subscriptions have been renewed - useless?
Bug 7910: Add the ability to renew several subscriptions at once
Bug 7910: Give feedack when the subscriptions have been renewed - useless?
Bug 20614: Use GET instead of POST for subscription renewing
Bug 7910: Add the ability to renew several subscriptions at once
Bug 7910: Give feedack when the subscriptions have been renewed - useless?
Bug 7910: Add the ability to renew several subscriptions at once
Bug 7910: Give feedack when the subscriptions have been renewed

Description Savitra Sirohi 2012-04-06 03:21:31 UTC
Allow of serials to be renewed in batch, also upon renewal create an order basket containing with serials that are renewed
Comment 1 Amit Gupta 2012-06-04 04:07:11 UTC Comment hidden (obsolete)
Comment 2 Jonathan Druart 2012-07-09 15:02:30 UTC Comment hidden (obsolete)
Comment 3 Jonathan Druart 2012-07-10 07:11:22 UTC
Created attachment 10737 [details] [review]
Bug 7910 - Batch renewal of serials

To Test:
1) Go to Serials click on Check expiration link.
2) Search some subscription which have to expire it will give some result.
3) Select atleast one subscription which you want to renew.
4) Check the expiration date after renew.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
modify
+    subscriptionid => @subscriptionid,
with
+    subscriptionid => \@subscriptionid,

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Comment 4 Paul Poulain 2012-07-26 16:03:16 UTC
QA comment: 
 * failed perlcritic:
Loop iterator is not lexical at line 88, column 5.  See page 108 of PBP.  (Severity: 5)
 * a question = has the "also upon renewal create an order basket containing with serials that are renewed" be implemented ? I think no, this patch just introduce the -nice & usefull- batch renewal feature

failing QA for #1 (no other comments, will pass QA and push once you've submitted a follow-up that fixes this error)
Comment 5 Katrin Fischer 2014-03-27 06:31:43 UTC
*** Bug 5340 has been marked as a duplicate of this bug. ***
Comment 6 Katrin Fischer 2015-03-25 16:49:46 UTC
It would be nice to see this moving again. A better integration of serials and acquisition would be great.
Comment 7 Katrin Fischer 2016-06-19 22:28:22 UTC
*** Bug 4457 has been marked as a duplicate of this bug. ***
Comment 8 Séverine Queune 2018-03-09 13:43:29 UTC
The BULAC (http://www.bulac.fr/) would like to sponsor this development !

As long as “Change sponsored?” is set on “Seeking developer”, anyone wanting to quote us for the development of such a feature or just ask for more information is welcome to write to us: <sigb@bulac.fr>.
Comment 9 Jonathan Druart 2018-04-18 18:46:35 UTC
Created attachment 74501 [details] [review]
Bug 7910: Add the ability to renew several subscriptions at once

This patch adds a "Renew all selected subscriptions" action link on top
of the table of the "Check expiration" page.

It will allow to auto-renew several subscriptions.

Test plan:
Make sure this new link renew the selected subscriptions as expected.
Comment 10 Jonathan Druart 2018-04-18 18:46:38 UTC
Created attachment 74502 [details] [review]
Bug 7910: Give feedack when the subscriptions have been renewed - useless?

This patch adds a message to the user to let them know the subscription
have been renewed successfully.
Comment 11 Jonathan Druart 2018-04-18 18:47:35 UTC
The original patch did not work at all, I had to rewrite from scratch.
Comment 12 Jonathan Druart 2018-04-18 19:09:31 UTC
Updating the bug report title, the "order creation" bit is not part of these patches.
Comment 13 Katrin Fischer 2018-04-18 23:09:06 UTC
I am sorry, but this doesn't work for me.

The GUI works nicely, select/unselect all and link logic. 

But:
When I click on the link, I get a pop up with a sucess message that the subscriptions have been renewed. But when I repeat my search, the expiration date hasn't changed.

When I try to renew the subscription nanually using the 'renew button' the pop-up asks about the duration for the renewal and the expiration date is correctly updated.
Comment 14 Katrin Fischer 2018-04-18 23:10:20 UTC
Was this intentional? 
+    use Data::Printer colored => 1; warn p $subscription;

If possible I think the success message for batch renewal would be better without the pop-up and just on the page above the table with the usual markup.
Comment 15 Jonathan Druart 2018-04-19 10:45:52 UTC
Created attachment 74540 [details] [review]
Bug 7910: Add the ability to renew several subscriptions at once

This patch adds a "Renew all selected subscriptions" action link on top
of the table of the "Check expiration" page.

It will allow to auto-renew several subscriptions.

Test plan:
Make sure this new link renew the selected subscriptions as expected.
Comment 16 Jonathan Druart 2018-04-19 10:45:56 UTC
Created attachment 74541 [details] [review]
Bug 7910: Give feedack when the subscriptions have been renewed - useless?

This patch adds a message to the user to let them know the subscription
have been renewed successfully.
Comment 17 Jonathan Druart 2018-04-19 10:48:26 UTC
(In reply to Katrin Fischer from comment #13)
> I am sorry, but this doesn't work for me.

Heh, UI changes distracted me a bit apparently :)
Fixed now.

(In reply to Katrin Fischer from comment #14)
> Was this intentional? 
> +    use Data::Printer colored => 1; warn p $subscription;

Of course not, removed.

> If possible I think the success message for batch renewal would be better
> without the pop-up and just on the page above the table with the usual
> markup.

I would consider that out of the scope, I think it has been improved with bug 20614 and the confirmation popup. It would require a complete rewrite of this script to make it work better.
Comment 18 Séverine Queune 2018-04-19 11:09:07 UTC
koha@kohamonodev:/var/repositories/koha$ git bz apply 7910

Bug 7910 Depends on bug 20614
Follow? [(y)es, (n)o] y
Bug 20614 - Firefox prevents parent page reload when renewing subscriptions

74509 - Bug 20614: Use GET instead of POST for subscription renewing

Apply? [(y)es, (n)o, (i)nteractive] y
Applying: Bug 20614: Use GET instead of POST for subscription renewing
Bug 7910 - Batch renewal of serials

74540 - Bug 7910: Add the ability to renew several subscriptions at once
74541 - Bug 7910: Give feedack when the subscriptions have been renewed - useless?

Apply? [(y)es, (n)o, (i)nteractive] y
Applying: Bug 7910: Add the ability to renew several subscriptions at once
fatal: sha1 information is lacking or useless (koha-tmpl/intranet-tmpl/prog/en/modules/serials/checkexpiration.tt).
Repository lacks necessary blobs to fall back on 3-way merge.
Cannot fall back to three-way merge.
Patch failed at 0001 Bug 7910: Add the ability to renew several subscriptions at once
The copy of the patch that failed is found in:
   /var/repositories/koha/.git/rebase-apply/patch
When you have resolved this problem run "git bz apply --continue".
If you would prefer to skip this patch, instead run "git bz apply --skip".
To restore the original branch and stop patching run "git bz apply --abort".
Patch left in /tmp/Bug-7910-Add-the-ability-to-renew-several-subscrip-gRgY9c.patch
Comment 19 Jonathan Druart 2018-04-19 12:08:05 UTC
Applies ok for me, please try again.
Comment 20 Séverine Queune 2018-04-19 12:38:17 UTC
Created attachment 74545 [details] [review]
Bug 20614: Use GET instead of POST for subscription renewing

It will prevent Firefox (and certainly other browsers) to block the form
resubmit:

"To display this page, Firefox must send information that will repeat
any action (such as a search or order confirmation) that was performed
earlier."

Test plan:
Renew a subscription and save

=> You should not longer see the browser warning

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 21 Séverine Queune 2018-04-19 12:38:20 UTC
Created attachment 74546 [details] [review]
Bug 7910: Add the ability to renew several subscriptions at once

This patch adds a "Renew all selected subscriptions" action link on top
of the table of the "Check expiration" page.

It will allow to auto-renew several subscriptions.

Test plan:
Make sure this new link renew the selected subscriptions as expected.

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Comment 22 Séverine Queune 2018-04-19 12:38:23 UTC
Created attachment 74547 [details] [review]
Bug 7910: Give feedack when the subscriptions have been renewed - useless?

This patch adds a message to the user to let them know the subscription
have been renewed successfully.

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Comment 23 Séverine Queune 2018-04-19 12:41:29 UTC
Works as expected.
Maybe the popup could be smaller, but that's a detail.
Page is reloaded after the renewal of the subscriptions so it make the operation clear for me. 
Thanks Jonathan !
Comment 24 Katrin Fischer 2018-04-21 11:06:43 UTC
Created attachment 74687 [details] [review]
Bug 7910: Add the ability to renew several subscriptions at once

This patch adds a "Renew all selected subscriptions" action link on top
of the table of the "Check expiration" page.

It will allow to auto-renew several subscriptions.

Test plan:
Make sure this new link renew the selected subscriptions as expected.

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 25 Katrin Fischer 2018-04-21 11:08:05 UTC
The GUI could be improved a little, for example, we could show for how many issues each selected subscription will be renewed. But this works well as is now and will be a big help to a lot of libraries.
Comment 26 Jonathan Druart 2018-04-24 15:37:05 UTC
Pushed to master for 18.05, thanks to everybody involved!
Comment 27 Jonathan Druart 2018-05-11 14:05:10 UTC
Created attachment 75269 [details] [review]
Bug 7910: Give feedack when the subscriptions have been renewed

This patch adds a message to the user to let them know the subscription
have been renewed successfully.

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Comment 28 Jonathan Druart 2018-05-11 14:13:32 UTC
(In reply to Jonathan Druart from comment #27)
> Created attachment 75269 [details] [review] [review]
> Bug 7910: Give feedack when the subscriptions have been renewed
> 
> This patch adds a message to the user to let them know the subscription
> have been renewed successfully.
> 
> Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>

This patch has been forgotten (obsoleted), and was marked as " - useless?" in the commit message. It is not.

GUI could be improved indeed, as Katrin said.
Comment 29 Jonathan Druart 2018-05-11 14:13:43 UTC
Last patch pushed to master.