Bug 32742

Summary: Add sorting options to patron list export
Product: Koha Reporter: Hammat wele <hammat.wele>
Component: PatronsAssignee: Hammat wele <hammat.wele>
Status: Pushed to main --- QA Contact: Lisette Scheer <lisette>
Severity: enhancement    
Priority: P5 - low CC: alexandre.noel, caroline.cyr-la-rose, cubingguy714, gmcharlt, kelly, kyle.m.hall, marie-luce.laflamme, philippe.blouin
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15196
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
25.05.00
Circulation function:
Attachments: Bug 32742: Patron's lists option are not in alphabetical order
Bug 32742: Patron's lists option are not in alphabetical order
Bug 32742: Patron's lists option are not in alphabetical order
Bug 32742: Patron's lists option are not in alphabetical
Bug 32742: Patron's lists option are not in alphabetical
Bug 32742: Patron's lists option are not in alphabetical order
Bug 32742: (follow-up) Add sorting feature when printing the patron cards from the patron card creator
Bug 32742: Patron's lists option are not in alphabetical order
Bug 32742: (follow-up) Add sorting feature when printing the patron cards from the patron card creator
Bug 32742: (follow-up) perltidy patroncards/create-pdf.pl and patroncards/print.pl
Bug 32742: Patron's lists option are not in alphabetical order
Bug 32742: (follow-up) Add sorting feature when printing the patron cards from the patron card creator
Bug 32742: (follow-up) perltidy patroncards/create-pdf.pl and patroncards/print.pl
Bug 32742: Patron's lists option are not in alphabetical order
Bug 32742: (follow-up) Add sorting feature when printing the patron cards from the patron card creator
Bug 32742: (follow-up) perltidy patroncards/create-pdf.pl and patroncards/print.pl

Description Hammat wele 2023-01-27 23:01:03 UTC
In the patron module, the list under 'Add to patron list' is not in alphabetical order
Comment 1 Marie-Luce Laflamme 2023-09-06 16:46:33 UTC
test plan

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.


Unfortunately, Koha sort them by the "patron_list_patron_id" order which it isn't always logical.
Comment 2 Hammat wele 2023-09-08 21:38:53 UTC Comment hidden (obsolete)
Comment 3 Hammat wele 2023-09-08 22:07:29 UTC
Created attachment 155469 [details] [review]
Bug 32742: Patron's lists option are not in alphabetical order

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.
Comment 4 Emily-Rose Francoeur 2023-09-12 19:22:20 UTC
Created attachment 155572 [details] [review]
Bug 32742: Patron's lists option are not in alphabetical order

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>
Comment 5 Katrin Fischer 2023-10-21 09:27:00 UTC
I am running out of time here, so please fix these yourself:

1) Please perltidy:

 OK	koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/print.tt

 WARN	patroncards/create-pdf.pl
   WARN	  tidiness
		The file is less tidy than before (bad/messy lines before: 181, now: 183)

 WARN	patroncards/print.pl
   WARN	  tidiness
		The file is less tidy than before (bad/messy lines before: 88, now: 90)


2) I feel like the Order by should be the last option in the form, going together with the "start with" option, instead of being the first in the form.

3) This should also be available when printing the patron cards from the patron card creator. Since the code for sorting is in patroncards/create-pdf.pl, I believe this would not require much more than a template change and it would give us nice consistency.

4) I think that if you change nothing the order will still be the order added ot the list - is this correct? (just a question, nothing to fix here)
Comment 6 Alexandre Noel 2024-06-21 12:24:21 UTC Comment hidden (obsolete)
Comment 7 Alexandre Noel 2024-06-25 13:44:18 UTC Comment hidden (obsolete)
Comment 8 Eric Garcia 2024-06-26 18:39:40 UTC
Tried testing encountered Bug 37205
Comment 9 Hammat wele 2024-08-27 20:59:25 UTC
Created attachment 170786 [details] [review]
Bug 32742: Patron's lists option are not in alphabetical order

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>
Comment 10 Hammat wele 2024-08-27 20:59:28 UTC
Created attachment 170787 [details] [review]
Bug 32742: (follow-up) Add sorting feature when printing the patron cards from the patron card creator

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.
Comment 11 Hammat wele 2024-08-27 21:37:51 UTC
(In reply to Katrin Fischer from comment #5)

> 3) This should also be available when printing the patron cards from the
> patron card creator. Since the code for sorting is in
> patroncards/create-pdf.pl, I believe this would not require much more than a
> template change and it would give us nice consistency.

I added the feature when printing the patron cards from the patron card creator but it required some edit in patroncards/create-pdf.pl because the order_by was only used for patronlist 

> 
> 4) I think that if you change nothing the order will still be the order
> added ot the list - is this correct? (just a question, nothing to fix here)

Yes it is correct, if we do not select an order, the order added at the list will be used
Comment 12 Hammat wele 2024-08-29 21:12:21 UTC
Created attachment 170882 [details] [review]
Bug 32742: Patron's lists option are not in alphabetical order

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>
Comment 13 Hammat wele 2024-08-29 21:12:25 UTC
Created attachment 170883 [details] [review]
Bug 32742: (follow-up) Add sorting feature when printing the patron cards from the patron card creator

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.
Comment 14 Hammat wele 2024-08-29 21:12:31 UTC
Created attachment 170884 [details] [review]
Bug 32742: (follow-up) perltidy patroncards/create-pdf.pl and patroncards/print.pl
Comment 15 ByWater Sandboxes 2024-08-30 16:00:56 UTC
Created attachment 170916 [details] [review]
Bug 32742: Patron's lists option are not in alphabetical order

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>
Signed-off-by: Kelly <kelly@bwatersolutions.com>
Comment 16 ByWater Sandboxes 2024-08-30 16:00:58 UTC
Created attachment 170917 [details] [review]
Bug 32742: (follow-up) Add sorting feature when printing the patron cards from the patron card creator

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>
Comment 17 ByWater Sandboxes 2024-08-30 16:01:01 UTC
Created attachment 170918 [details] [review]
Bug 32742: (follow-up) perltidy patroncards/create-pdf.pl and patroncards/print.pl

Signed-off-by: Kelly <kelly@bwatersolutions.com>
Comment 18 Lisette Scheer 2025-01-10 21:31:47 UTC
Created attachment 176400 [details] [review]
Bug 32742: Patron's lists option are not in alphabetical order

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>
Signed-off-by: Kelly <kelly@bwatersolutions.com>
Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com>
Comment 19 Lisette Scheer 2025-01-10 21:32:09 UTC
Created attachment 176401 [details] [review]
Bug 32742: (follow-up) Add sorting feature when printing the patron cards from the patron card creator

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>
Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com>
Comment 20 Lisette Scheer 2025-01-10 21:32:34 UTC
Created attachment 176402 [details] [review]
Bug 32742: (follow-up) perltidy patroncards/create-pdf.pl and patroncards/print.pl

Signed-off-by: Kelly <kelly@bwatersolutions.com>
Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com>
Comment 21 Katrin Fischer 2025-02-03 13:21:54 UTC
Dropping the perltidy patch in preparation of the global tidy.

@Lisette: please set QA contact, thanks! :)
Comment 22 Katrin Fischer 2025-02-03 13:29:10 UTC
Pushed for 25.05!

Well done everyone, thank you!