This will add a new column (hidden by default) in the results table to displays all attributes associated to the corresponding patron.
Created attachment 70243 [details] [review] Bug 19909: Show attributes in patron search results Add a new column (hidden by default) in the results table which displays all attributes associated to the corresponding patron. New subroutine Koha::Patron::Attribute::display_value that returns the authorised value description and defaults to the raw value if the attribute's type is not associated to an authorised value category Test plan: 1. Create some patron attribute types, with and without an associated authorised value category 2. Choose an existing patron and set a value for each attribute 3. Go to patron search and do a search that will return your patron (and some others to avoid the redirection) 4. Show column 'Extended attributes' by clicking on 'Column visibility' button 5. Note that all attributes are displayed correctly 6. prove t/db_dependent/Koha/Patron/Attributes.t
Patch doesn't apply on sandbox biblibre n°1
conflicts: ~/d/koha ❯❯❯ git bz apply 19909 ✘ 141 Bug 19909 - Show attributes in patron search results 70243 - Bug 19909: Show attributes in patron search results Apply? [(y)es, (n)o, (i)nteractive] y Application de Bug 19909: Show attributes in patron search results Utilisation de l'information de l'index pour reconstruire un arbre de base... M C4/Utils/DataTables/Members.pm M admin/columns_settings.yml M koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt .git/rebase-apply/patch:182: new blank line at EOF. + warning: 1 ligne a ajouté des erreurs d'espace. Retour à un patch de la base et fusion à 3 points... Fusion automatique de koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt CONFLIT (contenu) : Conflit de fusion dans koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt Fusion automatique de admin/columns_settings.yml Fusion automatique de C4/Utils/DataTables/Members.pm error: Échec d'intégration des modifications. le patch a échoué à 0001 Bug 19909: Show attributes in patron search results La copie du patch qui a échoué se trouve dans : .git/rebase-apply/patch When you have resolved this problem run "git bz apply --continue". If you would prefer to skip this patch, instead run "git bz apply --skip". To restore the original branch and stop patching run "git bz apply --abort". Patch left in /tmp/Bug-19909-Show-a
Created attachment 77161 [details] [review] Bug 19909: Show attributes in patron search results Add a new column (hidden by default) in the results table which displays all attributes associated to the corresponding patron. New subroutine Koha::Patron::Attribute::display_value that returns the authorised value description and defaults to the raw value if the attribute's type is not associated to an authorised value category Test plan: 1. Create some patron attribute types, with and without an associated authorised value category 2. Choose an existing patron and set a value for each attribute 3. Go to patron search and do a search that will return your patron (and some others to avoid the redirection) 4. Show column 'Extended attributes' by clicking on 'Column visibility' button 5. Note that all attributes are displayed correctly 6. prove t/db_dependent/Koha/Patron/Attributes.t
Nice enhancement, rebased master.
Patch tested with a sandbox, by Cab Vinton <bibliwho@gmail.com>
Created attachment 77467 [details] [review] Bug 19909: Show attributes in patron search results Add a new column (hidden by default) in the results table which displays all attributes associated to the corresponding patron. New subroutine Koha::Patron::Attribute::display_value that returns the authorised value description and defaults to the raw value if the attribute's type is not associated to an authorised value category Test plan: 1. Create some patron attribute types, with and without an associated authorised value category 2. Choose an existing patron and set a value for each attribute 3. Go to patron search and do a search that will return your patron (and some others to avoid the redirection) 4. Show column 'Extended attributes' by clicking on 'Column visibility' button 5. Note that all attributes are displayed correctly 6. prove t/db_dependent/Koha/Patron/Attributes.t Signed-off-by: Cab Vinton <bibliwho@gmail.com>
(just linking similar stuffs - https://gitlab.com/joubu/Koha/blob/bug_20443/Koha/Patron/Attribute.pm)
This is working well for me and is a really nice addition. Wondering 2 things: - We got a system preference for turning on/off patron attributes. Should the column not be visible when the pref is turned off? (ExtendedPatronAttributes) - The display_value method somehow looks not quite right to me. I think this may be what Jonathan was trying to point out in his comment, that there could be another way of doing it. Could you take a look and comment? I rebased the patch for testing, I will attach the rebased patch.
Created attachment 78213 [details] [review] Bug 19909: Show attributes in patron search results Add a new column (hidden by default) in the results table which displays all attributes associated to the corresponding patron. New subroutine Koha::Patron::Attribute::display_value that returns the authorised value description and defaults to the raw value if the attribute's type is not associated to an authorised value category Test plan: 1. Create some patron attribute types, with and without an associated authorised value category 2. Choose an existing patron and set a value for each attribute 3. Go to patron search and do a search that will return your patron (and some others to avoid the redirection) 4. Show column 'Extended attributes' by clicking on 'Column visibility' button 5. Note that all attributes are displayed correctly 6. prove t/db_dependent/Koha/Patron/Attributes.t Signed-off-by: Cab Vinton <bibliwho@gmail.com>
Created attachment 105267 [details] [review] Bug 19909: Show attributes in patron search results Add a new column (hidden by default) in the results table which displays all attributes associated to the corresponding patron. Test plan: 1. Enable ExtendedPatronAttributes 2. Create some patron attribute types, with and without an associated authorised value category 3. Choose an existing patron and set a value for each attribute 4. Go to patron search and do a search that will return your patron (and some others to avoid the redirection) 5. Show column 'Extended attributes' by clicking on 'Column visibility' button 6. Note that all attributes are displayed correctly 7. prove t/db_dependent/Koha/Patron/Attributes.t 8. Disable syspref ExtendedPatronAttributes and verify that the column is not displayed Signed-off-by: Cab Vinton <bibliwho@gmail.com>
(In reply to Katrin Fischer from comment #9) > This is working well for me and is a really nice addition. > > Wondering 2 things: > - We got a system preference for turning on/off patron attributes. Should > the column not be visible when the pref is turned off? > (ExtendedPatronAttributes) I added checks for this syspref. The column should be hidden now when syspref is disabled > - The display_value method somehow looks not quite right to me. I think this > may be what Jonathan was trying to point out in his comment, that there > could be another way of doing it. Could you take a look and comment? I removed it. There is now a 'description' method which does the same thing.
Created attachment 105281 [details] [review] Bug 19909: Show attributes in patron search results Add a new column (hidden by default) in the results table which displays all attributes associated to the corresponding patron. Test plan: 1. Enable ExtendedPatronAttributes 2. Create some patron attribute types, with and without an associated authorised value category 3. Choose an existing patron and set a value for each attribute 4. Go to patron search and do a search that will return your patron (and some others to avoid the redirection) 5. Show column 'Extended attributes' by clicking on 'Column visibility' button 6. Note that all attributes are displayed correctly 7. prove t/db_dependent/Koha/Patron/Attributes.t 8. Disable syspref ExtendedPatronAttributes and verify that the column is not displayed Signed-off-by: Cab Vinton <bibliwho@gmail.com> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Created attachment 106528 [details] [review] Bug 19909: Show attributes in patron search results Add a new column (hidden by default) in the results table which displays all attributes associated to the corresponding patron. Test plan: 1. Enable ExtendedPatronAttributes 2. Create some patron attribute types, with and without an associated authorised value category 3. Choose an existing patron and set a value for each attribute 4. Go to patron search and do a search that will return your patron (and some others to avoid the redirection) 5. Show column 'Extended attributes' by clicking on 'Column visibility' button 6. Note that all attributes are displayed correctly 7. prove t/db_dependent/Koha/Patron/Attributes.t 8. Disable syspref ExtendedPatronAttributes and verify that the column is not displayed Signed-off-by: Cab Vinton <bibliwho@gmail.com> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Salut Julian, Could you add a unit test and replace + $patron->{attributes} = Koha::Patron::Attributes->search({ borrowernumber => $patron_object->borrowernumber }); with a call to $patron->extended_attributes? Also a question: const extendedAttributesColumnIndex = columns_settings.findIndex(column => column.columnname === 'extended_attributes'); columns_settings.splice(extendedAttributesColumnIndex, 1); findIndex returns -1 if not found. It should not happen I'd say, but should not we prevent side-effects and check if extendedAttributesColumnIndex != -1?