From fde33d7a4caffb452fafc3ecb79685aeaeb3711e Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Wed, 14 Sep 2022 11:27:03 +0000 Subject: [PATCH] Bug 31562: Treat flags as other borrower fields Rather than generate a custom hash for these fields, we should treat them as other borrower data fields To test: 1 - Edit a patron, note the 'Lost card' and 'Gone no address' fields 2 - Edit syspref BorrowerunwantedField 3 - Set gonenoaddress and lost as unwanted 4 - Edit patron, the fields remain 5 - Apply patch 6 - Edit a patron, fields are hidden 7 - Unhide one of the fields 8 - Edit a patron and confirm it shows and saves correctly 9 - Unhide the other field 10 - Confirm it can be edited and saved Signed-off-by: David Nind Signed-off-by: Martin Renvoize Signed-off-by: Tomas Cohen Arazi --- .../prog/en/modules/members/memberentrygen.tt | 56 ++++++++++++++----- members/memberentry.pl | 24 -------- 2 files changed, 41 insertions(+), 39 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt index 2235b4c325..5c9a6e1108 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt @@ -1309,38 +1309,64 @@ legend:hover { [% END # UNLESS nouserid && nopassword && !CanUpdatePasswordExpiration %] - [% UNLESS ( opadd || opduplicate ) %] + [% UNLESS ( opadd || opduplicate || ( nogonenoaddress && nolost ) ) %]
Patron account flags
    - [% FOREACH flagloo IN flagloop %] + [% UNLESS nogonenoaddress %]
  1. -
  2. - [% END # /FOREACH flagloo %] + [% END # /UNLESS nogonenoaddress %] + [% UNLESS nolost %] +
  3. + + [% IF CAN_user_circulate_manage_restrictions %] + + + [% ELSE %] + [% IF borrower_data.lost %]Yes[% ELSE %]No[% END %] + [% END # /IF CAN_user_circulate_manage_restrictions %] +
  4. + [% END # /UNLESS nogonenoaddress %]
diff --git a/members/memberentry.pl b/members/memberentry.pl index 1b6aac6d1b..95f6e9dd58 100755 --- a/members/memberentry.pl +++ b/members/memberentry.pl @@ -688,29 +688,6 @@ while (@relationships) { push(@relshipdata, \%row); } -my %flags = ( - 'gonenoaddress' => ['gonenoaddress'], - 'lost' => ['lost'] -); - -my @flagdata; -foreach ( keys(%flags) ) { - my $key = $_; - my %row = ( - 'key' => $key, - 'name' => $flags{$key}[0] - ); - if ( $data{$key} ) { - $row{'yes'} = ' checked'; - $row{'no'} = ''; - } - else { - $row{'yes'} = ''; - $row{'no'} = ' checked'; - } - push @flagdata, \%row; -} - # get Branch Loop # in modify mod: userbranch value comes from borrowers table # in add mod: userbranch value comes from branches table (ip correspondence) @@ -794,7 +771,6 @@ $template->param( borrowernumber => $borrowernumber, #register number relshiploop => \@relshipdata, btitle=> $default_borrowertitle, - flagloop => \@flagdata, modify => $modify, nok => $nok,#flag to know if an error NoUpdateLogin => $NoUpdateLogin, -- 2.39.5