View | Details | Raw Unified | Return to bug 27634
Collapse All | Expand All

(-)a/opac/opac-memberentry.pl (-11 / +12 lines)
Lines 56-67 my ( $template, $borrowernumber, $cookie ) = get_template_and_user( Link Here
56
    }
56
    }
57
);
57
);
58
58
59
unless ( C4::Context->preference('PatronSelfRegistration') || $borrowernumber )
60
{
61
    print $cgi->redirect("/cgi-bin/koha/opac-main.pl");
62
    exit;
63
}
64
65
my $action = $cgi->param('action') || q{};
59
my $action = $cgi->param('action') || q{};
66
if ( $borrowernumber && ( $action eq 'create' || $action eq 'new' ) ) {
60
if ( $borrowernumber && ( $action eq 'create' || $action eq 'new' ) ) {
67
    print $cgi->redirect("/cgi-bin/koha/opac-main.pl");
61
    print $cgi->redirect("/cgi-bin/koha/opac-main.pl");
Lines 77-82 if ( $action eq q{} ) { Link Here
77
    }
71
    }
78
}
72
}
79
73
74
my $PatronSelfRegistrationDefaultCategory = C4::Context->preference('PatronSelfRegistrationDefaultCategory');
75
my $defaultCategory = Koha::Patron::Categories->find($PatronSelfRegistrationDefaultCategory);
76
# Having a valid PatronSelfRegistrationDefaultCategory is mandatory
77
if ( !C4::Context->preference('PatronSelfRegistration') && !$borrowernumber
78
    || ( ( $action eq 'new' || $action eq 'create' ) && !$defaultCategory ) )
79
{
80
    print $cgi->redirect("/cgi-bin/koha/opac-main.pl");
81
    exit;
82
}
83
80
my $mandatory = GetMandatoryFields($action);
84
my $mandatory = GetMandatoryFields($action);
81
85
82
my $params = {};
86
my $params = {};
Lines 95-102 if ( defined $min ) { Link Here
95
     );
99
     );
96
 }
100
 }
97
101
98
my $defaultCategory = Koha::Patron::Categories->find(C4::Context->preference('PatronSelfRegistrationDefaultCategory'));
99
100
$template->param(
102
$template->param(
101
    action            => $action,
103
    action            => $action,
102
    hidden            => GetHiddenFields( $mandatory, $action ),
104
    hidden            => GetHiddenFields( $mandatory, $action ),
Lines 127-133 if ( $action eq 'create' ) { Link Here
127
    my %borrower = ParseCgiForBorrower($cgi);
129
    my %borrower = ParseCgiForBorrower($cgi);
128
130
129
    %borrower = DelEmptyFields(%borrower);
131
    %borrower = DelEmptyFields(%borrower);
130
    $borrower{categorycode} ||= C4::Context->preference('PatronSelfRegistrationDefaultCategory');
132
    $borrower{categorycode} ||= $PatronSelfRegistrationDefaultCategory;
131
133
132
    my @empty_mandatory_fields = (CheckMandatoryFields( \%borrower, $action ), CheckMandatoryAttributes( \%borrower, $attributes ) );
134
    my @empty_mandatory_fields = (CheckMandatoryFields( \%borrower, $action ), CheckMandatoryAttributes( \%borrower, $attributes ) );
133
    my $invalidformfields = CheckForInvalidFields(\%borrower);
135
    my $invalidformfields = CheckForInvalidFields(\%borrower);
Lines 235-241 if ( $action eq 'create' ) { Link Here
235
                        { borrowernumber => $patron->borrowernumber },
237
                        { borrowernumber => $patron->borrowernumber },
236
                        $template,
238
                        $template,
237
                        1,
239
                        1,
238
                        C4::Context->preference('PatronSelfRegistrationDefaultCategory')
240
                        $PatronSelfRegistrationDefaultCategory
239
                    );
241
                    );
240
                }
242
                }
241
243
242
- 

Return to bug 27634