Right now, patron attributes are presented in code order. It would be nice to have a way to choose the order in which they are presented. I put this in OPAC because I noticed this in the self-registration form. But I guess it would be true for the staff interface too. My actual use case was for birth details of a baby. I had the birthdate, the number of weeks and the number of days of pregnancy, the weight of the baby, the surname of the baby, etc. I had specifically added them in the order I wanted because I thought the creation order would be the display order. But they were displayed in code order, and the order made no sense (file number, number of days of pregnancy, birth date of the baby, surname of the baby, weight at birth, number of weeks of pregnancy). I thought something like a "Display order" field like the ones we have in serial patterns and numbering and in the additional contents would be useful. To recreate: 1. Create several patron attributes with various codes 1.1. Go to Administration > Patron attribute types > New patron attribute type 1.2. Fill out the form - Code: enter any code, for example WEIGHT - Description: enter any description - Display in OPAC: check - Editable in OPAC: check 1.3. Click Save 1.4. Repeat to add a second code with a code alphabetically "before" the previous one, for example SURNAME 1.5. Optionnally, add more to really view the order 2. Enable self-registration 2.1. Go to Administration > System preferences 2.2. Search for selfreg 2.3. Set PatronSelfRegistration to Allow 2.4. Set a category in PatronSelfRegistrationDefaultCategory 2.5. Click Save all OPAC preferences 3. View self-registration form 3.1. Go to the OPAC 3.2. Click on Don't have an account? Register here. 3.3. Go to the bottom of the form --> Note that the patron attribute fields are presented in alphabetical order of the code.
Created attachment 159182 [details] [review] Bug 35145: Add ability to order patron attribute types Here is a summary of the changes: - Added the new column 'number' to 'borrower_attribute_types' table ---> Created an atomic update file (bug_35145_order_patron_attributes.pl) ---> Updated the kohastructure.sql file - Added the new column 'number' for '/cgi-bin/koha/admin/patron-attr-types.pl' table ---> The table now defaults to sorting based on the 'number' column - Added the field 'Appear in position' in the patron attribute types create/edit form - Changed the order of patron attribute types in the patron create/edit form (OPAC and staff interfcce) so it's now sorted by the assigned number TEST PLAN 1) Go to 'Koha administration > Patron attribute types > + New patron attribute type' 2) Fill out the form ---> Code: Enter any code, for example 'WEIGHT' ---> Description: Enter any description ---> Display in OPAC: Check ---> Editable in OPAC: Check ---> Class: Enter any class (but all the attribute types you will create should have the same), for example 'TEST' 3) Click 'Save' 4) Repeat to add a second code with a code alphabetically "before" the previous one, for example SURNAME (be sure to have the same class as the previous attribute types you created) 5) Optionally, add more to really view the order 6) Go to 'Koha administration > System preferences' 7) Search for 'selfreg' 8) Set 'PatronSelfRegistration' to 'Allow' 9) Set a category in 'PatronSelfRegistrationDefaultCategory' 10) Click on the 'Save all OPAC preferences' button 11) Go to the OPAC and click on the 'Create an account' button 12) Go to the bottom of the form ---> Note that the patron attribute fields are presented in alphabetical order of code 13) Apply the patch 14) Return to 'Koha administration > Patron attribute types' ---> Notice the new 'number' column in the tables 15) Choose one of the attribute types you created earlier and click on the 'edit' button ---> You should now see the 'Appear in position' field 16) Enter a number in the 'Appear in position' field and click on 'Save' 17) Repeat the last two steps for each attribute type you created ---> Notice that the patron attribute types tables are sorted by number by default 18) In the staff interface, go to 'Patrons > + New patron' ---> In the 'Additional attributes and identifiers' section, notice that the fields are in the given number order 19) In the OPAC, return to the patron creation form (step 11) ---> At the end of the form, notice that the fields are in the given number order
Created attachment 159193 [details] [review] Bug 35145: Add ability to order patron attribute types Here is a summary of the changes: - Added the new column 'number' to 'borrower_attribute_types' table ---> Created an atomic update file (bug_35145_order_patron_attributes.pl) ---> Updated the kohastructure.sql file - Added the new column 'number' for '/cgi-bin/koha/admin/patron-attr-types.pl' table ---> The table now defaults to sorting based on the 'number' column - Added the field 'Appear in position' in the patron attribute types create/edit form - Changed the order of patron attribute types in the patron create/edit form (OPAC and staff interfcce) so it's now sorted by the assigned number TEST PLAN 1) Go to 'Koha administration > Patron attribute types > + New patron attribute type' 2) Fill out the form ---> Code: Enter any code, for example 'WEIGHT' ---> Description: Enter any description ---> Display in OPAC: Check ---> Editable in OPAC: Check ---> Class: Keep it empty 3) Click 'Save' 4) Repeat to add a second code with a code alphabetically "before" the previous one, for example SURNAME 5) Optionally, add more to really view the order 6) Go to 'Koha administration > System preferences' 7) Search for 'selfreg' 8) Set 'PatronSelfRegistration' to 'Allow' 9) Set a category in 'PatronSelfRegistrationDefaultCategory' 10) Click on the 'Save all OPAC preferences' button 11) Go to the OPAC and click on the 'Create an account' button 12) Go to the bottom of the form ---> Note that the patron attribute fields are presented in alphabetical order of code 13) Apply the patch 14) Perform an atomic update (./installer/data/mysql/updatedatabase.pl) 15) Return to 'Koha administration > Patron attribute types' ---> Notice the new 'number' column in the tables 16) Choose one of the attribute types you created earlier and click on the 'edit' button ---> You should now see the 'Appear in position' field 17) Enter a number in the 'Appear in position' field and click on 'Save' 18) Repeat the last two steps for each attribute type you created ---> Notice that the patron attribute types tables are sorted by number by default 19) In the staff interface, go to 'Patrons > + New patron' ---> In the 'Additional attributes and identifiers' section, notice that the fields are in the given number order 20) In the OPAC, return to the patron creation form (step 11) ---> At the end of the form, notice that the fields are in the given number order
This looks like it's working well, but I think we should think about what happens to attributes which are not given a number. In my test system I have a lot of attributes, and if I add position numbers to just a few of them those attributes appear at the end of the list of attributes because nothing comes before something. I'm concerned that is counterintuitive to the general user. If so, we could consider applying automatic numbering to existing attributes? Or tell the display to put attributes with an empty number value after the numbered values? What do others think?
On IRC it was pointed out that this ordering scheme matches news and serial numbering, so it might not be completely new to the user, and we should definitely keep things consistent.
Created attachment 159344 [details] [review] Bug 35145: Add ability to order patron attribute types Here is a summary of the changes: - Added the new column 'number' to 'borrower_attribute_types' table ---> Created an atomic update file (bug_35145_order_patron_attributes.pl) ---> Updated the kohastructure.sql file - Added the new column 'number' for '/cgi-bin/koha/admin/patron-attr-types.pl' table ---> The table now defaults to sorting based on the 'number' column - Added the field 'Appear in position' in the patron attribute types create/edit form - Changed the order of patron attribute types in the patron create/edit form (OPAC and staff interfcce) so it's now sorted by the assigned number TEST PLAN 1) Go to 'Koha administration > Patron attribute types > + New patron attribute type' 2) Fill out the form ---> Code: Enter any code, for example 'WEIGHT' ---> Description: Enter any description ---> Display in OPAC: Check ---> Editable in OPAC: Check ---> Class: Keep it empty 3) Click 'Save' 4) Repeat to add a second code with a code alphabetically "before" the previous one, for example SURNAME 5) Optionally, add more to really view the order 6) Go to 'Koha administration > System preferences' 7) Search for 'selfreg' 8) Set 'PatronSelfRegistration' to 'Allow' 9) Set a category in 'PatronSelfRegistrationDefaultCategory' 10) Click on the 'Save all OPAC preferences' button 11) Go to the OPAC and click on the 'Create an account' button 12) Go to the bottom of the form ---> Note that the patron attribute fields are presented in alphabetical order of code 13) Apply the patch 14) Perform an atomic update (./installer/data/mysql/updatedatabase.pl) 15) Return to 'Koha administration > Patron attribute types' ---> Notice the new 'number' column in the tables 16) Choose one of the attribute types you created earlier and click on the 'edit' button ---> You should now see the 'Appear in position' field 17) Enter a number in the 'Appear in position' field and click on 'Save' 18) Repeat the last two steps for each attribute type you created ---> Notice that the patron attribute types tables are sorted by number by default 19) In the staff interface, go to 'Patrons > + New patron' ---> In the 'Additional attributes and identifiers' section, notice that the fields are in the given number order 20) In the OPAC, return to the patron creation form (step 11) ---> At the end of the form, notice that the fields are in the given number order Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Created attachment 159345 [details] [review] Bug 35145: (follow-up) Quiet perltidy warnings Signed-off-by: Owen Leonard <oleonard@myacpl.org>
1. DBIC schema file must NOT be part of a patch (or submitted separately) 2. Can we consider renaming the column with something more meaningful and less generic than "number"? item_groups has "display_order".
Created attachment 162347 [details] [review] Bug 35145: Add ability to order patron attribute types Here is a summary of the changes: - Added the new column 'number' to 'borrower_attribute_types' table ---> Created an atomic update file (bug_35145_order_patron_attributes.pl) ---> Updated the kohastructure.sql file - Added the new column 'number' for '/cgi-bin/koha/admin/patron-attr-types.pl' table ---> The table now defaults to sorting based on the 'number' column - Added the field 'Appear in position' in the patron attribute types create/edit form - Changed the order of patron attribute types in the patron create/edit form (OPAC and staff interfcce) so it's now sorted by the assigned number TEST PLAN 1) Go to 'Koha administration > Patron attribute types > + New patron attribute type' 2) Fill out the form ---> Code: Enter any code, for example 'WEIGHT' ---> Description: Enter any description ---> Display in OPAC: Check ---> Editable in OPAC: Check ---> Class: Keep it empty 3) Click 'Save' 4) Repeat to add a second code with a code alphabetically "before" the previous one, for example SURNAME 5) Optionally, add more to really view the order 6) Go to 'Koha administration > System preferences' 7) Search for 'selfreg' 8) Set 'PatronSelfRegistration' to 'Allow' 9) Set a category in 'PatronSelfRegistrationDefaultCategory' 10) Click on the 'Save all OPAC preferences' button 11) Go to the OPAC and click on the 'Create an account' button 12) Go to the bottom of the form ---> Note that the patron attribute fields are presented in alphabetical order of code 13) Apply the patch 14) Perform an atomic update (./installer/data/mysql/updatedatabase.pl) 15) Return to 'Koha administration > Patron attribute types' ---> Notice the new 'number' column in the tables 16) Choose one of the attribute types you created earlier and click on the 'edit' button ---> You should now see the 'Appear in position' field 17) Enter a number in the 'Appear in position' field and click on 'Save' 18) Repeat the last two steps for each attribute type you created ---> Notice that the patron attribute types tables are sorted by number by default 19) In the staff interface, go to 'Patrons > + New patron' ---> In the 'Additional attributes and identifiers' section, notice that the fields are in the given number order 20) In the OPAC, return to the patron creation form (step 11) ---> At the end of the form, notice that the fields are in the given number order Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Created attachment 162348 [details] [review] Bug 35145: (follow-up) Quiet perltidy warnings Signed-off-by: Owen Leonard <oleonard@myacpl.org>
I have successfully resolved the merge conflict.
Jonathan's reasons for FQA have not been addressed.
Created attachment 162619 [details] [review] - Seperate DBIC file - Rename “number” to “display_order”
Created attachment 162620 [details] [review] Bug 35145: (follow-up) Quiet perltidy warnings Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Created attachment 162621 [details] [review] Bug 35145 : Schema file
Created attachment 162622 [details] [review] Bug 35145 : (follow-up) Rename number to display_order
Hello, So per request of the QA, i renamed number to display_order and separate the DBIC schema file. However, I seem to have accidentally reattached the patch made by Emily-Rose and Owen Leonard while trying to resolve a merge conflict earlier, as you can see in my previous comment. Now I'm not sure what to do. Please verify that and proceed accordingly. Thank you for your understanding
Applying: Bug 35145 : Schema file Using index info to reconstruct a base tree... M Koha/Schema/Result/BorrowerAttributeType.pm Falling back to patching base and 3-way merge... Auto-merging Koha/Schema/Result/BorrowerAttributeType.pm CONFLICT (content): Merge conflict in Koha/Schema/Result/BorrowerAttributeType.pm error: Failed to merge in the changes. Patch failed at 0001 Bug 35145 : Schema file Patches don't apply on current master. Can you please submit a squashed version of the patches or make obsolete those not needed. Reach out on IRC, we can help with this if needed.
Created attachment 162676 [details] [review] Bug 35145 : (follow-up) Rename number to display_order - Seperate DBIC file - Rename “number” to “display_order”
Failing QA here: 1) Atomicupdate is not idempotent (look at unless( column_exists) from other db_revs entries). If you run updatedatabase twice in a row you get the following error: Duplicate column name 'display_order 2) Tests need to be added/updated, e.g. prove t/db_dependent/Koha/Patron/Attribute.t is failing with the message Unknown type int for display_order in BorrowerAttributeType. Look at bug 32610 for a starting point on where to add/check stuff. Reach out on mattermost if you need additional help.
Created attachment 166473 [details] [review] Bug 35145: (follow-up) Fix atomicupdate file and display_order's data type
Created attachment 166519 [details] [review] Bug 35145: Schema file PA amended: Fix commit title Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Created attachment 166520 [details] [review] Bug 35145: (follow-up) Rename number to display_order PA amended: Fix commit title Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Created attachment 166521 [details] [review] Bug 35145: (follow-up) Fix atomicupdate file and display_order's data type PA amended: Added DEFAULT NULL COMMENT 'the order in which this attribute type appears in patron form' to column entry to match what's in kohastructure.sql Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
The schema stuff was separated but then there is a follow-up where it is again included with the DB update stuff. Should the schema ( Schema/Result/BorrowerAttributeType.pm ) stuff be completely separated?
Created attachment 169256 [details] [review] Bug 35145: Schema file PA amended: Fix commit title Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Created attachment 169257 [details] [review] Bug 35145: (follow-up) Rename number to display_order PA amended: Fix commit title Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Created attachment 169258 [details] [review] Bug 35145: (follow-up) Fix atomicupdate file and display_order's data type PA amended: Added DEFAULT NULL COMMENT 'the order in which this attribute type appears in patron form' to column entry to match what's in kohastructure.sql Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
1) Please keep schema changes separate, so I can generate the files for main (avoids conflicts later). I can't just leave the first patch out as the last patch also touches it. 2) Please add AFTER mandatory to the database update statement, so we ensure the same sequence. 3) Please use say_success in the database update (wiki and skeleton.pl updates will be done soon, but you can peek at the other database updates 2406* 4) Please check if we are missing a change to moremember.pl to also display the attributes in right sequence there.
Created attachment 170330 [details] [review] Bug 35145: Schema file
Created attachment 170331 [details] [review] Bug 35145: Database updates
Created attachment 170332 [details] [review] Bug 35145: Add ability to order patron attribute types Here is a summary of the changes: - Added the new column 'display_order' to 'borrower_attribute_types' table ---> Created an atomic update file (bug_35145_order_patron_attributes.pl) ---> Updated the kohastructure.sql file - Added the new column 'Display order' for '/cgi-bin/koha/admin/patron-attr-types.pl' table ---> The table now defaults to sorting based on the 'display_order' column - Added the field 'Appear in position' in the patron attribute types create/edit form - Changed the order of patron attribute types in the patron create/edit form (OPAC and staff interfcce) so it's now sorted by the assigned display_order TEST PLAN 1) Go to 'Koha administration > Patron attribute types > + New patron attribute type' 2) Fill out the form ---> Code: Enter any code, for example 'WEIGHT' ---> Description: Enter any description ---> Display in OPAC: Check ---> Editable in OPAC: Check ---> Class: Keep it empty 3) Click 'Save' 4) Repeat to add a second code with a code alphabetically before the previous one, for example SURNAME 5) Optionally, add more to really view the order 6) Go to 'Koha administration > System preferences' 7) Search for 'selfreg' 8) Set 'PatronSelfRegistration' to 'Allow' 9) Set a category in 'PatronSelfRegistrationDefaultCategory' 10) Click on the 'Save all OPAC preferences' button 11) Go to the OPAC and click on the 'Create an account' button 12) Go to the bottom of the form ---> Note that the patron attribute fields are presented in alphabetical order of code 13) Apply the patch 14) Perform an atomic update (./installer/data/mysql/updatedatabase.pl) 15) Return to 'Koha administration > Patron attribute types' ---> Notice the new 'Display order' column in the tables 16) Choose one of the attribute types you created earlier and click on the 'edit' button ---> You should now see the 'Appear in position' field 17) Enter a number in the 'Appear in position' field and click on 'Save' 18) Repeat the last two steps for each attribute type you created ---> Notice that the patron attribute types tables are sorted by display_order by default 19) In the staff interface, go to 'Patrons > + New patron' ---> In the 'Additional attributes and identifiers' section, notice that the fields are in the given number order 20) In the OPAC, return to the patron creation form (step 11) ---> At the end of the form, notice that the fields are in the given number order
Testing this bug, if I don't add a "Display Order" in the Patron Attribute setup, that patron attribute will show up first. I added three patron attributes, 2 of them I added a display order, but the third one did not get a display order. Is that what should happen?
(In reply to Kelly McElligott from comment #32) > Testing this bug, if I don't add a "Display Order" in the Patron Attribute > setup, that patron attribute will show up first. I added three patron > attributes, 2 of them I added a display order, but the third one did not get > a display order. Is that what should happen? I think that is the way it works in other places where there are display orders. For example, in news, if you don't put a display order, the news appears in first place (equivalent to 0). Same with serial frequencies and numbering patterns. In all those cases, an empty display order is considered the same as 0, which is the first place. Then 1, 2, 3, etc. It's consistent with the regular behaviour.
Created attachment 170627 [details] [review] Bug 35145: Schema file Signed-off-by: Anneli Österman <anneli.osterman@koha-suomi.fi>
Created attachment 170628 [details] [review] Bug 35145: Database updates Signed-off-by: Anneli Österman <anneli.osterman@koha-suomi.fi>
Created attachment 170629 [details] [review] Bug 35145: Add ability to order patron attribute types Here is a summary of the changes: - Added the new column 'display_order' to 'borrower_attribute_types' table ---> Created an atomic update file (bug_35145_order_patron_attributes.pl) ---> Updated the kohastructure.sql file - Added the new column 'Display order' for '/cgi-bin/koha/admin/patron-attr-types.pl' table ---> The table now defaults to sorting based on the 'display_order' column - Added the field 'Appear in position' in the patron attribute types create/edit form - Changed the order of patron attribute types in the patron create/edit form (OPAC and staff interfcce) so it's now sorted by the assigned display_order TEST PLAN 1) Go to 'Koha administration > Patron attribute types > + New patron attribute type' 2) Fill out the form ---> Code: Enter any code, for example 'WEIGHT' ---> Description: Enter any description ---> Display in OPAC: Check ---> Editable in OPAC: Check ---> Class: Keep it empty 3) Click 'Save' 4) Repeat to add a second code with a code alphabetically before the previous one, for example SURNAME 5) Optionally, add more to really view the order 6) Go to 'Koha administration > System preferences' 7) Search for 'selfreg' 8) Set 'PatronSelfRegistration' to 'Allow' 9) Set a category in 'PatronSelfRegistrationDefaultCategory' 10) Click on the 'Save all OPAC preferences' button 11) Go to the OPAC and click on the 'Create an account' button 12) Go to the bottom of the form ---> Note that the patron attribute fields are presented in alphabetical order of code 13) Apply the patch 14) Perform an atomic update (./installer/data/mysql/updatedatabase.pl) 15) Return to 'Koha administration > Patron attribute types' ---> Notice the new 'Display order' column in the tables 16) Choose one of the attribute types you created earlier and click on the 'edit' button ---> You should now see the 'Appear in position' field 17) Enter a number in the 'Appear in position' field and click on 'Save' 18) Repeat the last two steps for each attribute type you created ---> Notice that the patron attribute types tables are sorted by display_order by default 19) In the staff interface, go to 'Patrons > + New patron' ---> In the 'Additional attributes and identifiers' section, notice that the fields are in the given number order 20) In the OPAC, return to the patron creation form (step 11) ---> At the end of the form, notice that the fields are in the given number order Signed-off-by: Anneli Österman <anneli.osterman@koha-suomi.fi>
Database update fails: ERROR: {UNKNOWN}: Undefined subroutine &C4::Installer::say_success called at /kohadevbox/koha/installer/data/mysql/atomicupdate/bug_35145_order_patron_attributes.pl line 21. at /kohadevbox/koha/C4/Installer.pm line 743