From 7d7d8e111820ae3fe466856ed62f6b822883e281 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Wed, 14 Sep 2022 11:27:03 +0000 Subject: [PATCH] Bug 31562: [21.11.x] 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 Bug 31562: Remove gonenoaddress and lost from OPAC borrower field preferences These are not shown, so cannot be unwanted or mandatory Signed-off-by: David Nind Signed-off-by: Martin Renvoize Bug 31562: Respect mandatory fields pref To test: 1 - Set gonenoaddress and lost in BorrowerMandatoryField 2 - Edit a patron, confirm fields are required Signed-off-by: David Nind Signed-off-by: Martin Renvoize Signed-off-by: Lucas Gass (cherry picked from commit 3d6607567cd5ed274245428ce66e157863febb9c) Signed-off-by: Arthur Suzuki --- .../en/modules/admin/preferences/opac.pref | 12 +++- .../prog/en/modules/members/memberentrygen.tt | 69 +++++++++++++++---- members/memberentry.pl | 24 ------- 3 files changed, 64 insertions(+), 41 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref index 95f4948ef5..f2a7d19ba5 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref @@ -818,24 +818,30 @@ OPAC: class: integer - "days after account creation." - "
NOTE: This system preference requires the misc/cronjobs/cleanup_database.pl cronjob. Ask your system administrator to schedule it.
No patrons will be deleted if you set the pref to zero or make it empty." + - + - "The following database columns must be filled in on the patron modification screen:" + - pref: PatronSelfModificationMandatoryField + type: modalselect + source: borrowers + exclusions: password|cardnumber|dateexpiry|categorycode|sort1|sort2|opacnote|borrowernotes|gonenoaddress|lost - - "The following database columns must be filled in on the patron entry screen:" - pref: PatronSelfRegistrationBorrowerMandatoryField type: modalselect source: borrowers - exclusions: sort1|sort2 + exclusions: sort1|sort2|opacnote|borrowernotes|gonenoaddress|lost - - "The following database columns will not appear on the patron self-registration screen:" - pref: PatronSelfRegistrationBorrowerUnwantedField type: modalselect source: borrowers - exclusions: branchcode|sort1|sort2 + exclusions: branchcode|sort1|sort2|gonenoaddress|lost - - "The following database columns will not appear on the patron self-modification screen:" - pref: PatronSelfModificationBorrowerUnwantedField type: modalselect source: borrowers - exclusions: sort1|sort2 + exclusions: sort1|sort2|gonenoaddress|lost - - "Display the following additional instructions for patrons who self register via the OPAC ( HTML is allowed ):" - pref: PatronSelfRegistrationAdditionalInstructions 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 41a8cdca96..4ed150baa3 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt @@ -1279,38 +1279,79 @@ legend:hover { [% END # UNLESS nouserid && nopassword %] - [% UNLESS ( opadd || opduplicate ) %] + [% UNLESS ( opadd || opduplicate || ( nogonenoaddress && nolost ) ) %]
Patron account flags
    - [% FOREACH flagloo IN flagloop %] + [% UNLESS nogonenoaddress %]
  1. -
  2. + + [% END # /UNLESS nogonenoaddress %] + [% UNLESS nolost %] +
  3. + [% IF mandatorylost %] +
  4. - [% END # /FOREACH flagloo %] + [% END # /UNLESS nogonenoaddress %]
diff --git a/members/memberentry.pl b/members/memberentry.pl index fb1faa4cd5..fcebb7607b 100755 --- a/members/memberentry.pl +++ b/members/memberentry.pl @@ -719,29 +719,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) @@ -834,7 +811,6 @@ $template->param( borrowernumber => $borrowernumber, #register number relshiploop => \@relshipdata, btitle=> $default_borrowertitle, - flagloop => \@flagdata, category_type =>$category_type, modify => $modify, nok => $nok,#flag to know if an error -- 2.39.5