From 374269698bde6005022b92c8148ed7a7306a186a Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Tue, 6 Aug 2013 11:48:32 -0400 Subject: [PATCH] LP1207396 Patron self-registration web form Signed-off-by: Bill Erickson --- .../lib/OpenILS/WWW/EGCatLoader/Register.pm | 12 +++++++ Open-ILS/src/templates/opac/register.tt2 | 42 ++++++++++++++++------ 2 files changed, 44 insertions(+), 10 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Register.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Register.pm index 661b5758d4..de7dee7ffe 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Register.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Register.pm @@ -38,14 +38,26 @@ sub load_patron_reg { $user->$_($val); } + # make sure the selected home org unit is in the list + # of valid orgs. This can happen if the selector + # defaults to CONS, for example. + $ctx->{register}{invalid}{bad_home_ou} = 1 unless + grep {$_ eq $user->home_ou} @{$ctx->{register}{valid_orgs}}; + # address + my $has_addr = 0; foreach (grep /^stgma\./, $cgi->param) { my $val = $cgi->param($_); $self->inspect_register_value($_, $val); s/^stgma\.//g; $addr->$_($val); + $has_addr = 1; } + # if the form contains no address fields, do not + # attempt to create a pending address + $addr = undef unless $has_addr; + # At least one value was invalid. Exit early and re-render. return Apache2::Const::OK if $ctx->{register}{invalid}; diff --git a/Open-ILS/src/templates/opac/register.tt2 b/Open-ILS/src/templates/opac/register.tt2 index 46c353e0a6..f87c6bd7f0 100644 --- a/Open-ILS/src/templates/opac/register.tt2 +++ b/Open-ILS/src/templates/opac/register.tt2 @@ -12,6 +12,13 @@ ctx_org = ctx.physical_loc || ctx.search_ou || ctx.aou_tree.id; # list of the registration fields to (potentially) # display in the order they should be shown +# post_code is the only field below that is required in the database and +# post_code is only required if an address is created. +# To prevent any of these fields from showing locally, regardless org unit +# settings, simply remove the fields from this list. In the case of +# addresses, if all address fields are removed, no attempt at creating +# an address will be made (and post_code will no longer be required). + register_fields = [ {class => 'stgu', name = 'first_given_name', label => l('First Name')}, {class => 'stgu', name = 'second_given_name', label => l('Middle Name')}, @@ -36,25 +43,34 @@ register_fields = [
[% IF ctx.register.success %] -

[% |l %] - Registration successful! - Please see library staff to complete your registration. - [% END %]

+

[% l('Registration successful!') %]

+

[% l('Please see library staff to complete your registration.') %]

[% IF ctx.register.username_taken %]

[% |l %] - Note: The selected username may be in use by another - patron. You may select another username when finalizing - your registration or in the online catalog. + Note: The selected username may be in use by another patron. + You may select another username when finalizing your + registration or in the online catalog. [% END %]

[% END %] +
+

+ [% l('Return to the Catalog') %] +

+ [% ELSIF ctx.register.error %] -

[% |l %] - An registration error has occurred. Please see library staff. - [% END %]

+

[% l('An registration error has occurred') %]

+

[% l('Please see library staff to complete your registration.') %]

+ +
+

+ [% l('Return to the Catalog') %] +

[% ELSE %] @@ -71,6 +87,12 @@ register_fields = [ valid_org_list=ctx.register.valid_orgs %] + + [% IF ctx.register.invalid.bad_home_ou %] + + [% l('Please select a valid library') %] + + [% END %] [% # <=== shifting code left for readability -- 2.11.0