Bug 30751

Summary: Print autorenewal notice to console when running in verbose.
Product: Koha Reporter: Martin Renvoize <martin.renvoize>
Component: Command-line UtilitiesAssignee: Martin Renvoize <martin.renvoize>
Status: Failed QA --- QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: andrewfh, lucy.vaux-harvey, nick, robin
Version: unspecified   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30278
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30755
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on: 19966    
Bug Blocks:    
Attachments: Bug 30751: Add notice printing to automatic_renewals.pl
Bug 30751: Add notice printing to automatic_renewals.pl

Description Martin Renvoize 2022-05-13 15:07:36 UTC
It would be really helpful to be able to preview how the notices look for autorenewals.

It's fairly simple to add this to the script when running in verbose mode.
Comment 1 Martin Renvoize 2022-05-13 15:18:36 UTC
Created attachment 134980 [details] [review]
Bug 30751: Add notice printing to automatic_renewals.pl

This patch adds notice preview to the automatic_renewals.pl script.

Test plan
1) Setup automtic renewals and add some checkouts with autorenewal
   enabled
2) Run the automatic_renewals.pl script with verbose mode. (without
   confirm if your testing and don't want to actually send notice or
   perform the renewals)
3) Confirm that you no get notices printed at the end of the output
Comment 2 Lucas Gass 2022-05-13 16:53:39 UTC
Created attachment 134984 [details] [review]
Bug 30751: Add notice printing to automatic_renewals.pl

This patch adds notice preview to the automatic_renewals.pl script.

Test plan
1) Setup automtic renewals and add some checkouts with autorenewal
   enabled
2) Run the automatic_renewals.pl script with verbose mode. (without
   confirm if your testing and don't want to actually send notice or
   perform the renewals)
3) Confirm that you no get notices printed at the end of the output

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 3 Nick Clemens 2022-05-19 17:27:28 UTC
Right now, the error is not set in the issue object if not confirm:
$auto_renew->auto_renew_error($error)->store if $confirm;

I suspect we need:
$auto_renew->auto_renew_error($error)
$auto_renew->store if $confirm;

Additionally:
173         if ($confirm){
174             my $date_due = AddRenewal( $auto_renew->borrowernumber, $auto_renew->itemnumber, $auto_renew->branchco    de, undef, undef, undef, 0 );
175             $auto_renew->auto_renew_error(undef)->store;
176         }


Otherwise the messages I get don't have the correct info/status

There may be other instances like this to check as well
Comment 4 Martin Renvoize 2022-05-20 07:03:00 UTC
Hmm, I think I see what you're saying.. but I don't think the suggested change will work either.  

Notices always fetch the data from the database for themselves, so splitting out the change and store calls won't help as the notice itself will still refer back to the database on generation.

Hmm...
Comment 5 Martin Renvoize 2022-05-23 12:03:29 UTC
So we really need bug 19966 for this to ever work I think.