From 36ca0f04f43d1728324e089019d0aeb510177ee0 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 --- .../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 2988157361..b905c2462b 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.20.1