Bugzilla – Attachment 147531 Details for
Bug 27634
Turn off patron self-registration if no default category is set
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27634: Turn off patron self-registration if no default category is set
Bug-27634-Turn-off-patron-self-registration-if-no-.patch (text/plain), 3.65 KB, created by
Jonathan Druart
on 2023-03-01 07:15:23 UTC
(
hide
)
Description:
Bug 27634: Turn off patron self-registration if no default category is set
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2023-03-01 07:15:23 UTC
Size:
3.65 KB
patch
obsolete
>From e95c02bb24ce64d5faa2decb19aceeb1d39284d3 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 5 Feb 2021 10:53:54 +0100 >Subject: [PATCH] Bug 27634: Turn off patron self-registration if no default > category is set > >If there is no default category defined in PatronSelfRegistrationDefaultCategory the full feature must be displayed. > >We already hide the link from the OPAC main page, but the form is still accessible. > >Test plan (for the whole patch set): >1. Turn on PatronSelfRegistration >2. Don't set PatronSelfRegistrationDefaultCategory >3. Go to the OPAC main page and confirm that the "Register here" link is >not displayed >4. Hit opac-memberentry.pl and confirm that you are redirected to the >OPAC main page >5. Go to the about page and confirm that you see a warning in the >"System information" tab >6. Set PatronSelfRegistrationDefaultCategory to an invalid patron's >category >7. Repeat 3, 4, 5 >8. Set PatronSelfRegistrationDefaultCategory to a valid patron's >category >9. Self-register a patron and confirm it works as expected >10. Edit PatronSelfRegistrationBorrowerUnwantedField and confirm that >you cannot remove dateexpiry and categorycode >--- > opac/opac-memberentry.pl | 22 ++++++++++++---------- > 1 file changed, 12 insertions(+), 10 deletions(-) > >diff --git a/opac/opac-memberentry.pl b/opac/opac-memberentry.pl >index 0115d78f989..9a85894f9ec 100755 >--- a/opac/opac-memberentry.pl >+++ b/opac/opac-memberentry.pl >@@ -56,12 +56,6 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( > } > ); > >-unless ( C4::Context->preference('PatronSelfRegistration') || $borrowernumber ) >-{ >- print $cgi->redirect("/cgi-bin/koha/opac-main.pl"); >- exit; >-} >- > my $action = $cgi->param('action') || q{}; > if ( $borrowernumber && ( $action eq 'create' || $action eq 'new' ) ) { > print $cgi->redirect("/cgi-bin/koha/opac-main.pl"); >@@ -77,6 +71,16 @@ if ( $action eq q{} ) { > } > } > >+my $PatronSelfRegistrationDefaultCategory = C4::Context->preference('PatronSelfRegistrationDefaultCategory'); >+my $defaultCategory = Koha::Patron::Categories->find($PatronSelfRegistrationDefaultCategory); >+# Having a valid PatronSelfRegistrationDefaultCategory is mandatory >+if ( !C4::Context->preference('PatronSelfRegistration') && !$borrowernumber >+ || ( ( $action eq 'new' || $action eq 'create' ) && !$defaultCategory ) ) >+{ >+ print $cgi->redirect("/cgi-bin/koha/opac-main.pl"); >+ exit; >+} >+ > my $mandatory = GetMandatoryFields($action); > > my $params = {}; >@@ -95,8 +99,6 @@ if ( defined $min ) { > ); > } > >-my $defaultCategory = Koha::Patron::Categories->find(C4::Context->preference('PatronSelfRegistrationDefaultCategory')); >- > $template->param( > action => $action, > hidden => GetHiddenFields( $mandatory, $action ), >@@ -127,7 +129,7 @@ if ( $action eq 'create' ) { > my %borrower = ParseCgiForBorrower($cgi); > > %borrower = DelEmptyFields(%borrower); >- $borrower{categorycode} ||= C4::Context->preference('PatronSelfRegistrationDefaultCategory'); >+ $borrower{categorycode} ||= $PatronSelfRegistrationDefaultCategory; > > my @empty_mandatory_fields = (CheckMandatoryFields( \%borrower, $action ), CheckMandatoryAttributes( \%borrower, $attributes ) ); > my $invalidformfields = CheckForInvalidFields(\%borrower); >@@ -235,7 +237,7 @@ if ( $action eq 'create' ) { > { borrowernumber => $patron->borrowernumber }, > $template, > 1, >- C4::Context->preference('PatronSelfRegistrationDefaultCategory') >+ $PatronSelfRegistrationDefaultCategory > ); > } > >-- >2.25.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 27634
:
116378
|
116379
|
116380
|
116381
|
116382
|
116383
|
116491
|
145599
|
145600
|
145601
|
145602
|
145603
|
145604
|
145605
|
145922
|
147531
|
147532
|
147533
|
147534
|
147535
|
147536
|
147537
|
149746
|
149747
|
149748
|
149896
|
149897
|
149898
|
149899
|
149900
|
149901
|
149902
|
150083
|
150084
|
150085
|
150086
|
150087
|
150088
|
150089
|
150090
|
151046
|
151047
|
151048
|
151049
|
155863
|
155864
|
155865
|
155866
|
155867
|
155868
|
155869
|
155870
|
156203