Bug 14131

Summary: Patroncard: Add possibility to print from patron lists
Product: Koha Reporter: Marc Véron <veron>
Component: Label/patron card printingAssignee: Marc Véron <veron>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: brendan, cnighswonger, gwilliams, jonathan.druart, koha, liz
Version: master   
Hardware: All   
OS: All   
See Also: http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=12471
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14138
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14739
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on: 14676    
Bug Blocks: 16022    
Attachments: Bug 14131 - Patroncard: Add possibility to print from patron lists
Error when attempting to build a patron list
Error when attempting to build a patron list
Bug 14131 - Patroncard: Add possibility to print from patron lists
[Follow-up]Bug 14131 - Fix typo in print.tt
Bug 14131 - Patroncard: Add possibility to print from patron lists
Bug 14131 - Adding print patron cards to patron lists home page
Bug 14131 - Adding print patron cards to patron lists home page
Bug 14131 - Adding print patron cards to patron lists home page
Bug 14131: Reduce the greybox height to 400px
Bug 14131 - Patroncard: Add possibility to print from patron lists
Bug 14131 - Adding print patron cards to patron lists home page
Bug 14131: Reduce the greybox height to 400px

Description Marc Véron 2015-05-03 21:23:52 UTC
The patron card creator allows to print batches from it's own batch functionality. It would be very useful if it could export patron cards from patron lists as well.
Comment 1 Marc Véron 2015-05-03 21:40:06 UTC Comment hidden (obsolete)
Comment 2 Chris Nighswonger 2015-05-05 19:27:29 UTC
When attempting to create a patron list (running master), I receive an error which states:

"An error occurred."

See the attached screenshot.
Comment 3 Chris Nighswonger 2015-05-05 19:29:22 UTC Comment hidden (obsolete)
Comment 4 Chris Nighswonger 2015-05-05 19:30:56 UTC
Created attachment 38876 [details]
Error when attempting to build a patron list

And now the shot with the error showing...
Comment 5 Marc Véron 2015-05-05 21:01:44 UTC
(In reply to Chris Nighswonger from comment #3)
> Created attachment 38875 [details]
> Error when attempting to build a patron list
> 
> This may be a tangential bug not directly related to this enhancement, but
> I'll wait for confirmation before opening a separate bug report.

I just re-tested on current master, I could create patron lists from patron search with and without patch.
Additonally, this pach does not touch creating of patron lists but uses existing patron lists.
Comment 6 Marc Véron 2015-08-31 12:08:48 UTC
Still applies.
Comment 7 Marc Véron 2015-09-10 12:00:28 UTC
*** Bug 12471 has been marked as a duplicate of this bug. ***
Comment 8 Nick Clemens 2015-09-11 20:53:10 UTC Comment hidden (obsolete)
Comment 9 Pete Edwards 2015-09-14 14:35:30 UTC
This is a really useful improvement - thanks. I have 2 comments:

There is a small typo in the patch. See line 54 in print.tt.
  [% IF ( borrower_count == 1 ) %]Exporting [% borrower_count %] patroncard[% ELSE %]Exporting [% borrower_count %] patroncards[% END %]a
The "a" at the end is incorrect.

The feature has been added to the Patron Card Creator tool which is where cards are normally created but the functionality is very oriented towards batches and in this case there is no batch. This may be a little quirky for the user. They have to go to "Manage batches" in order to export a list. Can I suggest a few options? 
  - Describe this feature in the home page of the module
  - Add a link on the left, e.g."Export list"
  - In the Patron Lists module, add an "Export cards" button in the table of Patron Lists and then, in the list itself allow the user to select some borrowers and "Export cards" for those selected.

The Export button on the patron list table could be done with the following changes to patron_lists/lists.tt:
Add: [% INCLUDE 'greybox.inc' %]
Modify the table sorting: { "aTargets": [ -1, -2, -3, -4 ], "bSortable": false, "bSearchable": false },
Add export column:
  <td>
    <a class="btn btn-mini" href="#" onclick='GB_showCenter(_("Export patron cards from list"), "/cgi-bin/koha/patroncards/print.pl?patronlist_id=[% l.patron_list_id %]", 700, 800);return false;'>
      <i class="icon-print"></i> Export cards
    </a>
  </td>
I know this is not the complete solution as the grey box does not have a Done button.

I will investigate how to become a contributor to Koha but wanted to make this suggestion while I work on that.
Comment 10 Jonathan Druart 2015-09-23 14:53:04 UTC
(In reply to Pete Edwards from comment #9)
> I will investigate how to become a contributor to Koha but wanted to make
> this suggestion while I work on that.

Hi Pete,
Did you plan to provide a patch?
See the wiki pages http://wiki.koha-community.org/wiki/SubmitingAPatch and http://wiki.koha-community.org/wiki/Version_Control_Using_Git
Comment 11 Marc Véron 2015-09-23 15:45:35 UTC Comment hidden (obsolete)
Comment 12 Marc Véron 2015-09-23 15:56:32 UTC
Hi Pete,

Thanks for pointing out the typo and thanks for your suggestions as well.

I propose to use my patch(es) 'as is' and to open a new bug to enhance / embellish this feature.

Marc
Comment 13 Jonathan Druart 2015-09-28 13:57:52 UTC
I join the opinion of Pete, there is an ergonomic issue, I don't think the new "export from patron list" enhancement is correctly placed.
I let another QAer have a look at your patch and give his/her feedback.
Comment 14 Liz Rea 2015-10-15 02:05:01 UTC Comment hidden (obsolete)
Comment 15 Liz Rea 2015-10-15 02:09:20 UTC
Hm, I could possibly look after the ergonomic things once both this and 14676 are upstream, because the suggestions would only apply on the current UI.
Comment 16 Liz Rea 2015-10-15 04:15:37 UTC Comment hidden (obsolete)
Comment 17 Jonathan Druart 2015-10-15 11:41:19 UTC
What is the state of this one?
Does the ergonomic issue fixed?
Comment 18 Liz Rea 2015-10-15 20:03:01 UTC
The ergonomic change I added will probably want testing on top of this patch.

The modified patch I did for compatibility with 14676 is likely ok, but if you're gonna test the one, you'll have to have the other(s) anyway.

Note that the two I've uploaded will need to be applied on top of 14676.
Comment 19 Marc Véron 2015-10-16 20:04:50 UTC Comment hidden (obsolete)
Comment 20 Jonathan Druart 2015-10-23 08:21:55 UTC Comment hidden (obsolete)
Comment 21 Jonathan Druart 2015-10-23 08:21:59 UTC Comment hidden (obsolete)
Comment 22 Jonathan Druart 2015-10-23 08:23:07 UTC
The display looks better on my screens (15" and 26"), 800 is definitely too much.
Comment 23 Jonathan Druart 2015-10-23 08:23:32 UTC
... with the last patch!
Comment 24 Liz Rea 2015-10-27 20:43:25 UTC
Jonathan, do you think we should change the height on that greybox across the board for the label and patron card creators?

It kinda feels like the right thing to do.

Liz
Comment 25 Jonathan Druart 2015-10-28 08:21:58 UTC
(In reply to Liz Rea from comment #24)
> Jonathan, do you think we should change the height on that greybox across
> the board for the label and patron card creators?
> 
> It kinda feels like the right thing to do.
> 
> Liz

Indeed, to be consistent it would be good to reduce them too.
Comment 26 Liz Rea 2015-10-28 08:23:25 UTC
cool I'll probably have a poke at that one unless you've already started on it.
Comment 27 Jonathan Druart 2015-10-28 09:29:09 UTC
(In reply to Liz Rea from comment #26)
> cool I'll probably have a poke at that one unless you've already started on
> it.

I don't :)
Comment 28 Marc Véron 2015-12-14 10:22:45 UTC
Created attachment 45634 [details] [review]
Bug 14131 - Patroncard: Add possibility to print from patron lists

This patch adds the possibility to print patron cards from patron lists.

To test:

- Go to Home > Tools > Patron card creator
- Prepare a patron card and create some cards using the batch functionality
- Apply patch
- Prepare a patron list e.g. from patron search
- Go to Home > Tools > Patron card creator > Manage batches
- Below the list of batches you have a dropdown to select a patron list
- Select your list and hit "Export from patron list"
- Select template and layout as you would do with batches
- Hit "Export"
- Download PDF

Modified patch to work with Bug 14676 changes. Functionality unchanged.

Signed-off-by: Nick Clemens <nick@quecheelibrary.org>
Signed-off-by: Liz <wizzyrea@gmail.com>

(Amended to make it apply on current master)
Comment 29 Marc Véron 2015-12-14 10:24:22 UTC
Created attachment 45635 [details] [review]
Bug 14131 - Adding print patron cards to patron lists home page

To test:

Go to /cgi-bin/koha/patron-lists/lists.pl
Make a patron list
Click "Print patron cards"
Success: you get a pdf of cards to print.
Failure: you can't get a pdf of cards to print.

Note that you'll need to have a card layout, template, and printer profile defined. The defaults should work.

Signed-off-by: Marc Véron <veron@veron.ch>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 30 Marc Véron 2015-12-14 10:25:07 UTC
Created attachment 45636 [details] [review]
Bug 14131: Reduce the greybox height to 400px

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 31 Marc Véron 2015-12-14 10:26:30 UTC
I amended the first patch to make it apply and then re-uploaded the following patches (unchanged) to keep them in the right order, I hope that is OK.
Comment 32 Brendan Gallagher 2015-12-31 20:25:50 UTC
Pushed to Master - thanks