Bugzilla – Attachment 155572 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: Patron's lists option are not in alphabetical order
Bug-32742-Patrons-lists-option-are-not-in-alphabet.patch (text/plain), 5.31 KB, created by
Emily-Rose Francoeur
on 2023-09-12 19:22:20 UTC
(
hide
)
Description:
Bug 32742: Patron's lists option are not in alphabetical order
Filename:
MIME Type:
Creator:
Emily-Rose Francoeur
Created:
2023-09-12 19:22:20 UTC
Size:
5.31 KB
patch
obsolete
>From a7e4ab1d1bbeb53501f35f72f0760716a321e3eb Mon Sep 17 00:00:00 2001 >From: Hammat Wele <hammat.wele@inlibro.com> >Date: Fri, 8 Sep 2023 22:04:05 +0000 >Subject: [PATCH] Bug 32742: Patron's lists option are not in alphabetical > order >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >This patch add sorting feature to the patron card lists export option > >To test > >1. Go to Tools > Patron lists >2. Create a new patron list >3. Add 10 patrons in a random order (not in alphabetical nor in cardnumber sequence) >4. Go back to Tools > Patron lists management page >5. Find your list, click on 'Action' and select 'Print patron cards' >6. Check the cards order in the pdf > --> notice these cards aren't in alphabetical order. >7. Apply the patch >8. Repeat step 4, 5 >9. Fill the «Order by» field and submit >10. Check the cards order in the pdf > --> notice the cards are now ordered. > >Signed-off-by: Ãmily-Rose Francoeur <emily-rose.francoeur@inLibro.com> >--- > .../prog/en/modules/patroncards/print.tt | 13 ++++++++++++- > patroncards/create-pdf.pl | 2 ++ > patroncards/print.pl | 2 ++ > 3 files changed, 16 insertions(+), 1 deletion(-) > >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 41a2ebc31a..f5f631e940 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/print.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/print.tt >@@ -40,7 +40,7 @@ > <div id="export_patron_list"> > <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 | html %]&template_id=[% template_id | html %]&layout_id=[% layout_id | html %]&layout_back_id=[% layout_back_id | html %]&start_card=[% start_card | html %]">label_patronlist_[% patronlist_id | html %].pdf</a> >+ <a class="document pdf" href="/cgi-bin/koha/patroncards/create-pdf.pl?patronlist_id=[% patronlist_id | html %]&template_id=[% template_id | html %]&layout_id=[% layout_id | html %]&layout_back_id=[% layout_back_id | html %]&start_card=[% start_card | html %]&order_by=[% order_by | html %]">label_patronlist_[% patronlist_id | html %].pdf</a> > </p> > </div> > [% ELSE %] >@@ -69,6 +69,17 @@ > [% 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"> >diff --git a/patroncards/create-pdf.pl b/patroncards/create-pdf.pl >index e994ddbbb2..5e86deac45 100755 >--- a/patroncards/create-pdf.pl >+++ b/patroncards/create-pdf.pl >@@ -49,6 +49,7 @@ my $start_card = $cgi->param('start_card') || 1; > my @label_ids = $cgi->multi_param('label_id'); > my @borrower_numbers = $cgi->multi_param('borrower_number'); > my $patronlist_id = $cgi->param('patronlist_id'); >+my $order_by = $cgi->param('order_by') || undef; > > my $items = undef; # items = cards > my $new_page = 0; >@@ -99,6 +100,7 @@ elsif ( $patronlist_id ) { > my ($list) = GetPatronLists( { patron_list_id => $patronlist_id } ); > my @borrowerlist = $list->patron_list_patrons()->search_related('borrowernumber') > ->get_column('borrowernumber')->all(); >+ @borrowerlist = map { $_->borrowernumber } Koha::Patrons->search( {borrowernumber => { -in => \@borrowerlist }}, { order_by => [$order_by]} )->as_list if($order_by); > grep { > push(@{$items}, {borrower_number => $_}); > } @borrowerlist; >diff --git a/patroncards/print.pl b/patroncards/print.pl >index ea154ea8e4..65697fee90 100755 >--- a/patroncards/print.pl >+++ b/patroncards/print.pl >@@ -47,6 +47,7 @@ my $start_card = $cgi->param('start_card') || 1; > my @borrower_numbers = $cgi->multi_param('borrower_number'); > my $output_format = $cgi->param('output_format') || 'pdf'; > my $referer = $cgi->param('referer') || undef; >+my $order_by = $cgi->param('order_by') || undef; > > my $layouts = undef; > my $templates = undef; >@@ -113,6 +114,7 @@ if ($op eq 'export') { > layout_back_id => $layout_back_id, > start_card => $start_card, > referer => $referer, >+ order_by => $order_by, > ); > } > } >-- >2.34.1
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