|
Lines 57-68
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
Link Here
|
| 57 |
} |
57 |
} |
| 58 |
); |
58 |
); |
| 59 |
|
59 |
|
| 60 |
unless ( C4::Context->preference('PatronSelfRegistration') || $borrowernumber ) |
|
|
| 61 |
{ |
| 62 |
print $cgi->redirect("/cgi-bin/koha/opac-main.pl"); |
| 63 |
exit; |
| 64 |
} |
| 65 |
|
| 66 |
my $action = $cgi->param('action') || q{}; |
60 |
my $action = $cgi->param('action') || q{}; |
| 67 |
if ( $borrowernumber && ( $action eq 'create' || $action eq 'new' ) ) { |
61 |
if ( $borrowernumber && ( $action eq 'create' || $action eq 'new' ) ) { |
| 68 |
print $cgi->redirect("/cgi-bin/koha/opac-main.pl"); |
62 |
print $cgi->redirect("/cgi-bin/koha/opac-main.pl"); |
|
Lines 78-83
if ( $action eq q{} ) {
Link Here
|
| 78 |
} |
72 |
} |
| 79 |
} |
73 |
} |
| 80 |
|
74 |
|
|
|
75 |
my $PatronSelfRegistrationDefaultCategory = C4::Context->preference('PatronSelfRegistrationDefaultCategory'); |
| 76 |
my $defaultCategory = Koha::Patron::Categories->find($PatronSelfRegistrationDefaultCategory); |
| 77 |
# Having a valid PatronSelfRegistrationDefaultCategory is mandatory |
| 78 |
if ( !C4::Context->preference('PatronSelfRegistration') && !$borrowernumber |
| 79 |
|| ( ( $action eq 'new' || $action eq 'create' ) && !$defaultCategory ) ) |
| 80 |
{ |
| 81 |
print $cgi->redirect("/cgi-bin/koha/opac-main.pl"); |
| 82 |
exit; |
| 83 |
} |
| 84 |
|
| 81 |
my $mandatory = GetMandatoryFields($action); |
85 |
my $mandatory = GetMandatoryFields($action); |
| 82 |
|
86 |
|
| 83 |
my $params = {}; |
87 |
my $params = {}; |
|
Lines 96-103
if ( defined $min ) {
Link Here
|
| 96 |
); |
100 |
); |
| 97 |
} |
101 |
} |
| 98 |
|
102 |
|
| 99 |
my $defaultCategory = Koha::Patron::Categories->find(C4::Context->preference('PatronSelfRegistrationDefaultCategory')); |
|
|
| 100 |
|
| 101 |
$template->param( |
103 |
$template->param( |
| 102 |
action => $action, |
104 |
action => $action, |
| 103 |
hidden => GetHiddenFields( $mandatory, $action ), |
105 |
hidden => GetHiddenFields( $mandatory, $action ), |
|
Lines 128-134
if ( $action eq 'create' ) {
Link Here
|
| 128 |
my %borrower = ParseCgiForBorrower($cgi); |
130 |
my %borrower = ParseCgiForBorrower($cgi); |
| 129 |
|
131 |
|
| 130 |
%borrower = DelEmptyFields(%borrower); |
132 |
%borrower = DelEmptyFields(%borrower); |
| 131 |
$borrower{categorycode} ||= C4::Context->preference('PatronSelfRegistrationDefaultCategory'); |
133 |
$borrower{categorycode} ||= $PatronSelfRegistrationDefaultCategory; |
| 132 |
|
134 |
|
| 133 |
my @empty_mandatory_fields = (CheckMandatoryFields( \%borrower, $action ), CheckMandatoryAttributes( \%borrower, $attributes ) ); |
135 |
my @empty_mandatory_fields = (CheckMandatoryFields( \%borrower, $action ), CheckMandatoryAttributes( \%borrower, $attributes ) ); |
| 134 |
my $invalidformfields = CheckForInvalidFields(\%borrower); |
136 |
my $invalidformfields = CheckForInvalidFields(\%borrower); |
|
Lines 251-257
if ( $action eq 'create' ) {
Link Here
|
| 251 |
{ borrowernumber => $patron->borrowernumber }, |
253 |
{ borrowernumber => $patron->borrowernumber }, |
| 252 |
$template, |
254 |
$template, |
| 253 |
1, |
255 |
1, |
| 254 |
C4::Context->preference('PatronSelfRegistrationDefaultCategory') |
256 |
$PatronSelfRegistrationDefaultCategory |
| 255 |
); |
257 |
); |
| 256 |
} |
258 |
} |
| 257 |
|
259 |
|
| 258 |
- |
|
|