Bugzilla – Attachment 170917 Details for
Bug 32742
Add sorting options to patron list export
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 32742: (follow-up) Add sorting feature when printing the patron cards from the patron card creator
Bug-32742-follow-up-Add-sorting-feature-when-print.patch (text/plain), 9.98 KB, created by
ByWater Sandboxes
on 2024-08-30 16:00:58 UTC
(
hide
)
Description:
Bug 32742: (follow-up) Add sorting feature when printing the patron cards from the patron card creator
Filename:
MIME Type:
Creator:
ByWater Sandboxes
Created:
2024-08-30 16:00:58 UTC
Size:
9.98 KB
patch
obsolete
>From ab2744c21bb683a545765c88bd0081cac6c4b960 Mon Sep 17 00:00:00 2001 >From: Hammat Wele <hammat.wele@inlibro.com> >Date: Tue, 27 Aug 2024 20:56:28 +0000 >Subject: [PATCH] Bug 32742: (follow-up) Add sorting feature when printing the > patron cards from the patron card creator >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >This patch also put the «Order by» field at the last position in the form > >To test > >1. Go to Tools > Patron card creator >2. Create a new Card batch >3. Add some patrons >4. Select all cards by clicking on checkbox in the select colunm >5. Click on «Export selected card(s)», an Export patron cards windows is opened >6. Fill the «Order by» field and submit >7. Check the cards order in the pdf > --> notice the cards are now ordered. >8. Close the window opened in step 5 >9. Click on «Export card batch», an Export patron cards windows is opened >10. repeat step 6 and 7 > --> notice the cards are now ordered. >11. Close the window opened in step 9 >12. Fill the «Batch description» field and click on «Save description» >13. Click on Manage -> Card Batches >14. Click on Export button >15. repeat step 6 and 7 > --> notice the cards are now ordered. >16. Select a batch to export and click on «Export selected batches» button >17. repeat step 6 and 7 > --> notice the cards are now ordered. > >Signed-off-by: Kelly <kelly@bwatersolutions.com> >--- > .../prog/en/modules/patroncards/print.tt | 28 +++++++++---------- > patroncards/create-pdf.pl | 26 +++++++++++++++-- > patroncards/print.pl | 3 ++ > 3 files changed, 41 insertions(+), 16 deletions(-) > >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 eac2ea58f1..887f10f02f 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/print.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/print.tt >@@ -23,17 +23,17 @@ > [% IF ( batche.label_ids ) %] > <legend>[% batche.card_count | html %] Single patron cards</legend> > <p> >- <a class="document pdf" href="/cgi-bin/koha/patroncards/[% batche.create_script | html %]?batch_id=[% batche.batch_id | html %]&template_id=[% batche.template_id | html %]&layout_id=[% batche.layout_id | html %]]&layout_back_id=[% batche.layout_back_id | html %]&start_card=[% batche.start_card | html %][% batche.label_ids | html %]">label_single_[% batche.card_count | html %].pdf</a> >+ <a class="document pdf" href="/cgi-bin/koha/patroncards/[% batche.create_script | html %]?batch_id=[% batche.batch_id | html %]&template_id=[% batche.template_id | html %]&layout_id=[% batche.layout_id | html %]]&layout_back_id=[% batche.layout_back_id | html %]&start_card=[% batche.start_card | html %][% batche.label_ids | html %]&order_by=[% order_by | html %]">label_single_[% batche.card_count | html %].pdf</a> > </p> > [% ELSIF ( batche.borrower_numbers ) %] > <legend>[% batche.card_count | html %] Single patron cards</legend> > <p> >- <a class="document pdf" href="/cgi-bin/koha/patroncards/[% batche.create_script | html %]?template_id=[% batche.template_id | html %]&layout_id=[% batche.layout_id | html %]&layout_back_id=[% batche.layout_back_id | html %]&start_card=[% batche.start_card | html %][% batche.borrower_numbers | html %]">label_single_[% batche.card_count | html %].pdf</a> >+ <a class="document pdf" href="/cgi-bin/koha/patroncards/[% batche.create_script | html %]?template_id=[% batche.template_id | html %]&layout_id=[% batche.layout_id | html %]&layout_back_id=[% batche.layout_back_id | html %]&start_card=[% batche.start_card | html %][% batche.borrower_numbers | html %]&order_by=[% order_by | html %]">label_single_[% batche.card_count | html %].pdf</a> > </p> > [% ELSE %] > <legend>Card batch number [% batche.batch_id | html %]</legend> > <p> >- <a class="document pdf" href="/cgi-bin/koha/patroncards/create-pdf.pl?batch_id=[% batche.batch_id | html %]&template_id=[% batche.template_id | html %]&layout_id=[% batche.layout_id | html %]&layout_back_id=[% batche.layout_back_id | html %]&start_card=[% batche.start_card | html %]">label_batch_[% batche.batch_id | html %].pdf</a> >+ <a class="document pdf" href="/cgi-bin/koha/patroncards/create-pdf.pl?batch_id=[% batche.batch_id | html %]&template_id=[% batche.template_id | html %]&layout_id=[% batche.layout_id | html %]&layout_back_id=[% batche.layout_back_id | html %]&start_card=[% batche.start_card | html %]&order_by=[% order_by | html %]">label_batch_[% batche.batch_id | html %].pdf</a> > </p> > [% END %] > [% END %] >@@ -76,17 +76,6 @@ > [% IF (patronlist_id) %] <input type="hidden" name="patronlist_id" value="[% patronlist_id | html %]" /> [% END %] > <fieldset class="rows"> > <ol> >- [% IF (patronlist_id) %] >- <li> >- <label style="width:9em" for="order_by">Order by: </label> >- <select name="order_by" id="order_by"> >- <option value=""></option> >- <option value="cardnumber">Card number</option> >- <option value="firstname">First name</option> >- <option value="surname">Surname</option> >- </select> >- </li> >- [% END %] > <li> > <label style="width:9em" for="template_id">Select a template to be applied: </label> > <select name="template_id" id="template_id"> >@@ -118,6 +107,17 @@ > <label style="width:9em" for="start_card">Enter starting card position: </label> > <input type="text" size="5" id="start_card" name="start_card" class="focus" title="Starting card number" value="1" /> > </li> >+ [% IF patronlist_id || batch_id %] >+ <li> >+ <label style="width:9em" for="order_by">Order by: </label> >+ <select name="order_by" id="order_by"> >+ <option value=""></option> >+ <option value="cardnumber">Card number</option> >+ <option value="firstname">First name</option> >+ <option value="surname">Surname</option> >+ </select> >+ </li> >+ [% END %] > </ol> > </fieldset> > <fieldset class="action"> >diff --git a/patroncards/create-pdf.pl b/patroncards/create-pdf.pl >index 5e86deac45..a6ba2bbd4b 100755 >--- a/patroncards/create-pdf.pl >+++ b/patroncards/create-pdf.pl >@@ -86,12 +86,25 @@ my ($llx, $lly) = 0,0; > > if (@label_ids) { > my $batch_items = $batch->get_attr('items'); >+ my @borrowernumbers; > grep { > my $label_id = $_; >- push(@{$items}, grep{$_->{'label_id'} == $label_id;} @{$batch_items}); >+ push( @borrowernumbers, grep { $_->{'label_id'} == $label_id; } @{$batch_items} ); > } @label_ids; >+ @borrowernumbers = map { $_->{borrower_number} } @borrowernumbers; >+ @borrowernumbers = >+ map { $_->borrowernumber } >+ Koha::Patrons->search( { borrowernumber => { -in => \@borrowernumbers } }, { order_by => [$order_by] } ) >+ ->as_list >+ if ($order_by); >+ grep { push( @{$items}, { borrower_number => $_ } ); } @borrowernumbers; > } > elsif (@borrower_numbers) { >+ @borrower_numbers = >+ map { $_->borrowernumber } >+ Koha::Patrons->search( { borrowernumber => { -in => \@borrower_numbers } }, { order_by => [$order_by] } ) >+ ->as_list >+ if ($order_by); > grep { > push(@{$items}, {borrower_number => $_}); > } @borrower_numbers; >@@ -106,7 +119,16 @@ elsif ( $patronlist_id ) { > } @borrowerlist; > } > else { >- $items = $batch->get_attr('items'); >+ my $batch_items = $batch->get_attr('items'); >+ my @borrowernumbers = map { $_->{borrower_number} } @{$batch_items}; >+ @borrowernumbers = >+ map { $_->borrowernumber } >+ Koha::Patrons->search( { borrowernumber => { -in => \@borrowernumbers } }, { order_by => [$order_by] } ) >+ ->as_list >+ if ($order_by); >+ grep { >+ push(@{$items}, {borrower_number => $_}); >+ } @borrowernumbers; > } > > my $layout_xml = XMLin($layout->get_attr('layout_xml'), ForceArray => 1); >diff --git a/patroncards/print.pl b/patroncards/print.pl >index efee812233..c9fb194310 100755 >--- a/patroncards/print.pl >+++ b/patroncards/print.pl >@@ -73,6 +73,7 @@ if ($op eq 'export') { > $template->param( > batches => \@batches, > referer => $referer, >+ order_by => $order_by, > ); > } > elsif (@borrower_numbers) { >@@ -89,6 +90,7 @@ if ($op eq 'export') { > $template->param( > batches => \@batches, > referer => $referer, >+ order_by => $order_by, > ); > } > elsif (@batch_ids) { >@@ -104,6 +106,7 @@ if ($op eq 'export') { > $template->param( > batches => \@batches, > referer => $referer, >+ order_by => $order_by, > ); > } > elsif ($patronlist_id ) { >-- >2.39.2
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 32742
:
155468
|
155469
|
155572
|
167956
|
168069
|
170786
|
170787
|
170882
|
170883
|
170884
|
170916
|
170917
|
170918
|
176400
|
176401
|
176402