Bug 27949

Summary: Batch printing of article request slips
Product: Koha Reporter: Nick Clemens (kidclamp) <nick>
Component: CirculationAssignee: Agustín Moyano <agustinmoyano>
Status: CLOSED FIXED QA Contact: Nick Clemens (kidclamp) <nick>
Severity: enhancement    
Priority: P5 - low CC: gmcharlt, jonathan.druart, kyle.m.hall, kyle, m.de.rooy, nick, tomascohen
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22590
Change sponsored?: Sponsored Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
This developments adds a way to select several article requests and print slips for them in batch.
Version(s) released in:
21.11.00
Circulation function:
Bug Depends on: 29086    
Bug Blocks: 29262, 29110    
Attachments: Bug 27949: Allow multiple article requests print slip
Bug 27949: Allow multiple article requests print slip
Bug 27949: Allow multiple article requests print slip
Bug 27949: Allow multiple article requests print slip
Bug 27949: (QA follow-up) Remove TODO
Bug 27949: Allow multiple article requests print slip
Bug 27949: Allow multiple article requests print slip
Bug 27949: (QA follow-up) Remove TODO

Description Nick Clemens (kidclamp) 2021-03-12 14:51:49 UTC
We propose allowing for staff to select multiple article requests on the screen and have Koha generate them and print in one transaction
through the browser.
Comment 1 Agustín Moyano 2021-06-03 21:01:39 UTC
Created attachment 121608 [details] [review]
Bug 27949: Allow multiple article requests print slip

This bug allows for batch printing of multiple article requests slips

To test:
1. apply this patch
2. restart_all
3. enable ArticleRequests preference
4. create multiple article requests
5. go to circ/article-requests.pl in staff interface
6. print a single slip from a row
CHECK => it works as expected
7. select all rows and print slip from general actions menu (above the table)
SUCCESS => all article requests slips are printed
8. select multiple rows (not all) and print slip from general actions menu (above the table)
SUCCESS => only selected article requests slips are printed
Comment 2 Marcel de Rooy 2021-06-18 07:28:11 UTC Comment hidden (obsolete)
Comment 3 Marcel de Rooy 2021-06-18 09:07:55 UTC
What if I would like to have these notices on a separate page?

I would be inclined to look for a solution with NoticeCSS and a page-break-after. Should this development respect NoticeCSS ?

Please have a look at:
Koha/Patron/Discharge.pm, sub generate_as_pdf
misc/cronjobs/gather_print_notices.pl, sub generate_html
Both are using: koha-tmpl/intranet-tmpl/prog/en/modules/batch/print-notices.tt
Comment 4 Agustín Moyano 2021-08-30 14:49:50 UTC
Hi Marcel, sorry for the delay. For what I've seen, printslip.tt uses SlipCSS stylesheet (if defined) where you may say, for example

hr {
    display: none;
    page-break-after: always;
}
Comment 5 Marcel de Rooy 2021-08-31 11:32:10 UTC
(In reply to Agustín Moyano from comment #4)
> Hi Marcel, sorry for the delay. For what I've seen, printslip.tt uses
> SlipCSS stylesheet (if defined) where you may say, for example
> 
> hr {
>     display: none;
>     page-break-after: always;
> }

Did you test this yourself?

I already did some testing with page-break-after but couldnt get it to work. I now inserted the exact lines above in a stylesheet for SlipCSS but it does not work either.
Comment 6 Marcel de Rooy 2021-09-17 09:30:54 UTC
The issue raised on comment3 (tomorrow exactly three months ago) is imo legitimate, but has not been answered sufficiently.
Changing status to emphasize the need for feedback in all appreciation.
Comment 7 Agustín Moyano 2021-09-17 13:53:30 UTC
(In reply to Marcel de Rooy from comment #5)
> (In reply to Agustín Moyano from comment #4)
> > Hi Marcel, sorry for the delay. For what I've seen, printslip.tt uses
> > SlipCSS stylesheet (if defined) where you may say, for example
> > 
> > hr {
> >     display: none;
> >     page-break-after: always;
> > }
> 
> Did you test this yourself?
> 
> I already did some testing with page-break-after but couldnt get it to work.
> I now inserted the exact lines above in a stylesheet for SlipCSS but it does
> not work either.

Hi Marcel, I did not test it, but my point was that printslip.tt includes a css, just as print-notices.tt where you can define page breaking conditions.

Let me play around a bit, and I'll post a working example
Comment 8 Agustín Moyano 2021-09-17 15:13:06 UTC
Hi Marcel, the following code worked for me

hr {
    page-break-after: always;
    border: 0px solid black !important;
}

First times did not work, but I believe it was browser's cache or memcached

Could you try again, please?
Comment 9 Marcel de Rooy 2021-09-23 09:33:14 UTC
(In reply to Agustín Moyano from comment #8)
> Hi Marcel, the following code worked for me
> 
> hr {
>     page-break-after: always;
>     border: 0px solid black !important;
> }
> 
> First times did not work, but I believe it was browser's cache or memcached
> 
> Could you try again, please?

It works for me now. Not sure what changed. Anyway, thanks!
Comment 10 Marcel de Rooy 2021-09-23 09:39:12 UTC
Created attachment 125183 [details] [review]
Bug 27949: Allow multiple article requests print slip

This bug allows for batch printing of multiple article requests slips

To test:
1. apply this patch
2. restart_all
3. enable ArticleRequests preference
4. create multiple article requests
5. go to circ/article-requests.pl in staff interface
6. print a single slip from a row
CHECK => it works as expected
7. select all rows and print slip from general actions menu (above the table)
SUCCESS => all article requests slips are printed
8. select multiple rows (not all) and print slip from general actions menu (above the table)
SUCCESS => only selected article requests slips are printed

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 11 Tomás Cohen Arazi (tcohen) 2021-09-24 13:30:11 UTC
Adding a dependency to organize things. It doesn't apply.
Comment 12 Tomás Cohen Arazi (tcohen) 2021-09-24 13:35:23 UTC
Created attachment 125248 [details] [review]
Bug 27949: Allow multiple article requests print slip

This bug allows for batch printing of multiple article requests slips

To test:
1. apply this patch
2. restart_all
3. enable ArticleRequests preference
4. create multiple article requests
5. go to circ/article-requests.pl in staff interface
6. print a single slip from a row
CHECK => it works as expected
7. select all rows and print slip from general actions menu (above the table)
SUCCESS => all article requests slips are printed
8. select multiple rows (not all) and print slip from general actions menu (above the table)
SUCCESS => only selected article requests slips are printed

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 13 Nick Clemens (kidclamp) 2021-10-07 13:50:06 UTC
Created attachment 125882 [details] [review]
Bug 27949: Allow multiple article requests print slip

This bug allows for batch printing of multiple article requests slips

To test:
1. apply this patch
2. restart_all
3. enable ArticleRequests preference
4. create multiple article requests
5. go to circ/article-requests.pl in staff interface
6. print a single slip from a row
CHECK => it works as expected
7. select all rows and print slip from general actions menu (above the table)
SUCCESS => all article requests slips are printed
8. select multiple rows (not all) and print slip from general actions menu (above the table)
SUCCESS => only selected article requests slips are printed

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 14 Nick Clemens (kidclamp) 2021-10-07 13:50:10 UTC
Created attachment 125883 [details] [review]
Bug 27949: (QA follow-up) Remove TODO

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 15 Jonathan Druart 2021-10-14 10:09:29 UTC
+        $slipContent .= "<hr/>";

+    $slipContent .= $slip->{is_html}?$slip->{content}:'<pre>'.$slip->{content}.'</pre>';

This is arbitrary, not configurable, and add html code in controller. That smells.

I don't have a good suggestion right now however.
Comment 16 Jonathan Druart 2021-10-14 10:10:02 UTC
Created attachment 126263 [details] [review]
Bug 27949: Allow multiple article requests print slip

This bug allows for batch printing of multiple article requests slips

To test:
1. apply this patch
2. restart_all
3. enable ArticleRequests preference
4. create multiple article requests
5. go to circ/article-requests.pl in staff interface
6. print a single slip from a row
CHECK => it works as expected
7. select all rows and print slip from general actions menu (above the table)
SUCCESS => all article requests slips are printed
8. select multiple rows (not all) and print slip from general actions menu (above the table)
SUCCESS => only selected article requests slips are printed

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

JD amended patch: Perltidy!
Comment 17 Jonathan Druart 2021-10-14 10:11:08 UTC
Created attachment 126264 [details] [review]
Bug 27949: Allow multiple article requests print slip

This bug allows for batch printing of multiple article requests slips

To test:
1. apply this patch
2. restart_all
3. enable ArticleRequests preference
4. create multiple article requests
5. go to circ/article-requests.pl in staff interface
6. print a single slip from a row
CHECK => it works as expected
7. select all rows and print slip from general actions menu (above the table)
SUCCESS => all article requests slips are printed
8. select multiple rows (not all) and print slip from general actions menu (above the table)
SUCCESS => only selected article requests slips are printed

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

JD amended patch: Perltidy!
Comment 18 Jonathan Druart 2021-10-14 10:12:06 UTC
Created attachment 126265 [details] [review]
Bug 27949: (QA follow-up) Remove TODO

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 19 Jonathan Druart 2021-10-18 09:33:44 UTC
Pushed to master for 21.11, thanks to everybody involved!
Comment 20 Jonathan Druart 2021-10-18 09:40:14 UTC
(In reply to Jonathan Druart from comment #15)
> +        $slipContent .= "<hr/>";
> 
> +    $slipContent .=
> $slip->{is_html}?$slip->{content}:'<pre>'.$slip->{content}.'</pre>';
> 
> This is arbitrary, not configurable, and add html code in controller. That
> smells.
> 
> I don't have a good suggestion right now however.

Do we open a follow-up bug report for that?
Comment 21 Marcel de Rooy 2021-10-18 09:47:29 UTC
(In reply to Jonathan Druart from comment #20)
> (In reply to Jonathan Druart from comment #15)
> > +        $slipContent .= "<hr/>";
> > 
> > +    $slipContent .=
> > $slip->{is_html}?$slip->{content}:'<pre>'.$slip->{content}.'</pre>';
> > 
> > This is arbitrary, not configurable, and add html code in controller. That
> > smells.
> > 
> > I don't have a good suggestion right now however.
> 
> Do we open a follow-up bug report for that?

How about the title of bug 29262 ?