Created attachment 102923 [details] [review] Bug 25142: Fix wrong grep logical test To test and understand what's going on, you can try that bit of code: my @a = qw( a b c a); my @b = qw( b c d ); my @c; @c = grep { 'a' eq $_ } @a ? 'ok' : (); say @c; @c = ( grep { 'a' eq $_ } @a ) ? 'ok' : (); say @c; @c = grep { 'a' eq $_ } @a ? ('ok') : (undef); say @c; The problem here: Have patrons in 3 branches CPL, MPL, SPL Have a non superlibrarian with edit_borrowers permission but view_borrower_infos_from_any_libraries, from CPL Create a library group with CPL, MPL Use that non superlibrarian to search for patrons You can search for patrons fro CPL and MPL BUT, edit the value for CPL, use SPL (edit the DOM) Search and... oops Apply this patch, try again Also use a superlibrarian patron (and/or with view_borrower_infos_from_any_libraries) and confirm that they can see all patrons
This is NOT coming from bug 23084 and must be backported.
Mmmm, grep ( { $_ eq $b } @r ) != ( grep { $_ eq $b } @r ) Is this Ok?
(In reply to Bernardo Gonzalez Kriegel from comment #3) > Mmmm, > > grep ( { $_ eq $b } @r ) != ( grep { $_ eq $b } @r ) > > Is this Ok? Yes, that's what I wanted to write.
Created attachment 102928 [details] [review] Bug 25142: Fix wrong grep logical test To test and understand what's going on, you can try that bit of code: my @a = qw( a b c a); my @b = qw( b c d ); my @c; @c = grep { 'a' eq $_ } @a ? 'ok' : (); say @c; @c = ( grep { 'a' eq $_ } @a ) ? 'ok' : (); say @c; @c = grep { 'a' eq $_ } @a ? ('ok') : (undef); say @c; The problem here: Have patrons in 3 branches CPL, MPL, SPL Have a non superlibrarian with edit_borrowers permission but view_borrower_infos_from_any_libraries, from CPL Create a library group with CPL, MPL Use that non superlibrarian to search for patrons You can search for patrons fro CPL and MPL BUT, edit the value for CPL, use SPL (edit the DOM) Search and... oops Apply this patch, try again Also use a superlibrarian patron (and/or with view_borrower_infos_from_any_libraries) and confirm that they can see all patrons Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> Tested with edit_borrowers permission but NOT view_borrower_infos_from_any_libraries Editing the DOM I can search (not edit) from any branch With patch no entries found :)
Created attachment 102952 [details] [review] Bug 25142: Fix wrong grep logical test To test and understand what's going on, you can try that bit of code: my @a = qw( a b c a); my @b = qw( b c d ); my @c; @c = grep { 'a' eq $_ } @a ? 'ok' : (); say @c; @c = ( grep { 'a' eq $_ } @a ) ? 'ok' : (); say @c; @c = grep { 'a' eq $_ } @a ? ('ok') : (undef); say @c; The problem here: Have patrons in 3 branches CPL, MPL, SPL Have a non superlibrarian with edit_borrowers permission but without view_borrower_infos_from_any_libraries, from CPL Create a library group with CPL, MPL Use that non superlibrarian to search for patrons You can search for patrons fro CPL and MPL BUT, edit the value for CPL, use SPL (edit the DOM) Search and... oops Apply this patch, try again Also use a superlibrarian patron (and/or with view_borrower_infos_from_any_libraries) and confirm that they can see all patrons Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> Tested with edit_borrowers permission but NOT view_borrower_infos_from_any_libraries Editing the DOM I can search (not edit) from any branch With patch no entries found :) Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Amended test plan slightly (+ without)
Created attachment 102953 [details] [review] Bug 25142: Fix wrong grep logical test To test and understand what's going on, you can try that bit of code: my @a = qw( a b c a); my @b = qw( b c d ); my @c; @c = grep { 'a' eq $_ } @a ? 'ok' : (); say @c; @c = ( grep { 'a' eq $_ } @a ) ? 'ok' : (); say @c; @c = grep { 'a' eq $_ } @a ? ('ok') : (undef); say @c; The problem here: Have patrons in 3 branches CPL, MPL, SPL Have a non superlibrarian with edit_borrowers permission but without view_borrower_infos_from_any_libraries, from CPL Create a library group with CPL, MPL Use that non superlibrarian to search for patrons You can search for patrons fro CPL and MPL BUT, edit the value for CPL, use SPL (edit the DOM) Search and... oops Apply this patch, try again Also use a superlibrarian patron (and/or with view_borrower_infos_from_any_libraries) and confirm that they can see all patrons Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> Tested with edit_borrowers permission but NOT view_borrower_infos_from_any_libraries Editing the DOM I can search (not edit) from any branch With patch no entries found :) Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Amended test plan slightly (+ without)
This does not apply to 19.11.x branch. Please rebase.
(In reply to Joy Nelson from comment #8) > This does not apply to 19.11.x branch. Please rebase. Hi Joy, this can be 'backported' modifying line 41 of C4/Utils/DataTables/Members.pm, and it's needed because the bug is present in 19.11 (and previous I suppose) - ? grep { /^$branchcode$/ } @restricted_branchcodes + ? grep ( { /^$branchcode$/ } @restricted_branchcodes ) That's the equivalent code of the patch for 19.11 I would write something a little bit different - ? grep { /^$branchcode$/ } @restricted_branchcodes + ? ( grep { /^$branchcode$/ } @restricted_branchcodes ) Both works, can't understand why the first does.
Pushed to 19.11.x branch for 19.11.05
Backported to 18.11.x for 18.11.16
backported to 19.05.x for 19.05.10
Nice work everyone! Pushed to master for 20.05