Bugzilla – Attachment 45634 Details for
Bug 14131
Patroncard: Add possibility to print from patron lists
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14131 - Patroncard: Add possibility to print from patron lists
Bug-14131---Patroncard-Add-possibility-to-print-fr.patch (text/plain), 10.37 KB, created by
Marc Véron
on 2015-12-14 10:22:45 UTC
(
hide
)
Description:
Bug 14131 - Patroncard: Add possibility to print from patron lists
Filename:
MIME Type:
Creator:
Marc Véron
Created:
2015-12-14 10:22:45 UTC
Size:
10.37 KB
patch
obsolete
>From 9cb8f6e43e7ade001a7ecc1bfe95b616e3062a2f Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Marc=20V=C3=A9ron?= <veron@veron.ch> >Date: Sun, 3 May 2015 23:26:11 +0200 >Subject: [PATCH] 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) >--- > .../prog/en/modules/patroncards/manage.tt | 36 +++++++++++++++++++- > .../prog/en/modules/patroncards/print.tt | 7 ++++ > patroncards/create-pdf.pl | 10 ++++++ > patroncards/manage.pl | 3 ++ > patroncards/print.pl | 11 ++++++ > 5 files changed, 66 insertions(+), 1 deletion(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/manage.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/manage.tt >index 0812da4..c62b813 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/manage.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/manage.tt >@@ -88,7 +88,17 @@ > } > return GB_showCenter(_("Export patron cards"), "/cgi-bin/koha/patroncards/print.pl?" + getstr, 400, 800); > }; >- function selected_layouts(op) { >+ >+ function XportPatronlist() { >+ if ( patron_list_id.value.length < 1 ) { >+ alert(_("Please select a patron list.")); >+ return; // no patron list selected >+ } >+ getstr = 'patronlist_id='+patron_list_id.value; >+ return GB_showCenter(_("Export patron cards from list"), "/cgi-bin/koha/patroncards/print.pl?" + getstr, 700, 800); >+ }; >+ >+ function selected_layout(op) { > if (document.layouts.action.length) { > var selected = new Array(); > for (i=0;i<document.layouts.action.length;i++){ >@@ -143,6 +153,10 @@ > Xport(); > return false; > }); >+ $("#printlist").click(function(){ >+ XportPatronlist(); >+ return false; >+ }); > }); > //]]> > </script> >@@ -204,7 +218,27 @@ > <fieldset class="action"> > [% IF ( print ) %]<input class="btn btn-sm" type="button" id="print" value="Export selected batches" />[% END %] > </fieldset> >+ [% IF patron_lists %] >+ <fieldset class="rows"> >+ <legend>Or use a patron list</legend> >+ <ol> >+ <li> >+ <label for="patron_list_id">Patron list: </label> >+ <select id="patron_list_id" name="patron_list_id"> >+ <option value=""></option> >+ [% FOREACH pl IN patron_lists %] >+ <option value="[% pl.patron_list_id %]">[% pl.name %]</option> >+ [% END %] >+ </select> >+ </li> >+ </ol> >+ </fieldset> >+ <fieldset class="action"> >+ <input type="button" id="printlist" value="Export from patron list" /> >+ </fieldset> >+ [% END %] > </form> >+ > [% ELSE %] > <div class="dialog message"> > <h4>There are no [% PROCESS translate_card_element element=card_element_title %] currently available.</h4> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/print.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/print.tt >index c5a2857..3753b20 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/print.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/print.tt >@@ -41,12 +41,18 @@ > <input type="button" class="btn btn-default submit" id="done" onclick="parent.parent.GB_hide();" value="Done" /> > </fieldset> > </form> >+ [% ELSIF ( patronlist_id && template_id && layout_id ) %] >+ <h3>Click on the link to download the patron cards from the patron list.</h3> >+ <p> >+ <a class="document pdf" href="/cgi-bin/koha/patroncards/create-pdf.pl?patronlist_id=[% patronlist_id %]&template_id=[% template_id %]&layout_id=[% layout_id %]&start_card=[% start_card %]">label_patronlist_[% patronlist_id %].pdf</a> >+ </p> > [% ELSE %] > <h3> > [% IF ( label_ids ) %] > [% IF ( card_count == 1 ) %]Exporting [% card_count %] patron card[% ELSE %]Exporting [% card_count %] patron cards[% END %] > [% ELSIF ( borrower_numbers ) %] > [% IF ( borrower_count == 1 ) %]Exporting [% borrower_count %] patron card[% ELSE %]Exporting [% borrower_count %] patron cards[% END %] >+ [% ELSIF ( patronlist_id ) %] Exporting from patron list > [% ELSE %] > [% IF ( multi_batch_count == 1 ) %][% multi_batch_count %] batch to export[% ELSE %][% multi_batch_count %] batches to export[% END %] > [% END %] >@@ -63,6 +69,7 @@ > [% FOREACH borrower_number IN borrower_numbers %] > <input type="hidden" name="borrower_number" value="[% borrower_number.borrower_number %]" /> > [% END %] >+ [% IF (patronlist_id) %] <input type="hidden" name="patronlist_id" value="[% patronlist_id %]" /> [% END %] > <fieldset class="rows"> > <ol> > <li> >diff --git a/patroncards/create-pdf.pl b/patroncards/create-pdf.pl >index 30440a4..d52c037 100755 >--- a/patroncards/create-pdf.pl >+++ b/patroncards/create-pdf.pl >@@ -32,6 +32,7 @@ use C4::Context; > use autouse 'C4::Members' => qw(GetPatronImage GetMember); > use C4::Creators; > use C4::Patroncards; >+use Koha::List::Patron; > > my $cgi = new CGI; > >@@ -51,6 +52,7 @@ my $layout_id = $cgi->param('layout_id') || undef; > my $start_card = $cgi->param('start_card') || 1; > my @label_ids = $cgi->param('label_id') if $cgi->param('label_id'); > my @borrower_numbers = $cgi->param('borrower_number') if $cgi->param('borrower_number'); >+my $patronlist_id = $cgi->param('patronlist_id'); > > my $items = undef; # items = cards > my $new_page = 0; >@@ -92,6 +94,14 @@ elsif (@borrower_numbers) { > push(@{$items}, {borrower_number => $_}); > } @borrower_numbers; > } >+elsif ( $patronlist_id ) { >+ my ($list) = GetPatronLists( { patron_list_id => $patronlist_id } ); >+ my @borrowerlist = $list->patron_list_patrons()->search_related('borrowernumber') >+ ->get_column('borrowernumber')->all(); >+ grep { >+ push(@{$items}, {borrower_number => $_}); >+ } @borrowerlist; >+} > else { > $items = $batch->get_attr('items'); > } >diff --git a/patroncards/manage.pl b/patroncards/manage.pl >index bd420b9..da729b7 100755 >--- a/patroncards/manage.pl >+++ b/patroncards/manage.pl >@@ -30,6 +30,7 @@ use C4::Output qw(output_html_with_http_headers); > use C4::Creators; > use C4::Patroncards; > use C4::Labels; >+use Koha::List::Patron; > > my $cgi = new CGI; > my ( $template, $loggedinuser, $cookie ) = get_template_and_user( >@@ -107,6 +108,8 @@ else { # trap unsupported operations here > my $table = html_table($display_columns->{$card_element}, $db_rows); > > $template->param(print => 1) if ($card_element eq 'batch'); >+$template->param( patron_lists => [ GetPatronLists() ] ) if ($card_element eq 'batch'); >+ > $template->param( > error => $errstr, > ); >diff --git a/patroncards/print.pl b/patroncards/print.pl >index 6ba5226..2c674a4 100755 >--- a/patroncards/print.pl >+++ b/patroncards/print.pl >@@ -43,6 +43,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( > my $op = $cgi->param('op') || 'none'; > my @label_ids = $cgi->param('label_id') if $cgi->param('label_id'); # this will handle individual card printing; we use label_id to maintain consistency with the column names in the creator_batches table > my @batch_ids = $cgi->param('batch_id') if $cgi->param('batch_id'); >+my $patronlist_id = $cgi->param('patronlist_id') || undef; > my $layout_id = $cgi->param('layout_id') || undef; > my $template_id = $cgi->param('template_id') || undef; > my $start_card = $cgi->param('start_card') || 1; >@@ -104,6 +105,15 @@ if ($op eq 'export') { > referer => $referer, > ); > } >+ elsif ($patronlist_id ) { >+ $template->param( >+ patronlist_id => $patronlist_id, >+ template_id => $template_id, >+ layout_id => $layout_id, >+ start_card => $start_card, >+ referer => $referer, >+ ); >+ } > } > elsif ($op eq 'none') { > # setup select menus for selecting layout and template for this run... >@@ -119,6 +129,7 @@ elsif ($op eq 'none') { > batch_ids => \@batch_ids, > label_ids => \@label_ids, > borrower_numbers => \@borrower_numbers, >+ patronlist_id => $patronlist_id, > templates => $templates, > layouts => $layouts, > output_formats => $output_formats, >-- >1.7.10.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 14131
:
38792
|
38875
|
38876
|
42491
|
42821
|
43414
|
43415
|
43544
|
43805
|
43806
| 45634 |
45635
|
45636