[Koha-bugs] [Bug 30735] Filtering by patron attribute with AV does not work in overdues report

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Fri May 13 15:32:25 CEST 2022


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30735

Owen Leonard <oleonard at myacpl.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #134905|0                           |1
        is obsolete|                            |

--- Comment #3 from Owen Leonard <oleonard at myacpl.org> ---
Created attachment 134971
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=134971&action=edit
Bug 30735: Fix filtering by patron attribute with AV in overdues report

In Circulation > Overdues, if there are seachable patron attributes
they can be used in left filters. Search does not work if this attribute
is linked to an authorized values category.

The problem is that AV code is compared to the AV desciption in :
  if (grep { $attrval eq lc($_->[1]) } @{ $pattrs->{$code} }) {

Looking at a Data::Dumper of the var $pattrs you see for example :
$VAR1 = {
          'ATT1' => [
                      [
                        'afr',
                        'Afrikaans'
                      ]
                    ]
        };
First row is attribute code and second row is desciption.
It works for an attribute without AV because in this case
'avdescription' is undefined so code is stored as description :
          push @{ $pattrs->{$row->{attrcode}} }, [
            $row->{attrval},
            defined $row->{avdescription} ? $row->{avdescription} :
$row->{attrval},
        ];

This patch fixes the code and removes commented line.
Also reviews the SQL query :
  - avcategory is useless
  - use alias attrcode for borrower_attributes.code to be more explicit

Test plan :
1) Create a patron A with overdues
2) Go to Circulation > Overdues
3) Check you see the patron A
4) Create a patron attribute, searchable, with an authorized value
   category, ie LANG
5) Edit patron A to set a value in this attribute
6) Go to Circulation > Overdues
7) Select attribute value and apply filter
8) Check you see the patron A
9) Redo test plan with a patron attribute, searchable, without an
   authorized value category

Signed-off-by: Owen Leonard <oleonard at myacpl.org>

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list