{name => 'home_ou', class => 'au', required => 1},
{name => 'ident_type', class => 'au', required => 1},
{name => 'ident_value', class => 'au', required => 1},
- {name => 'guardian',
+ {name => 'ident_value2',
class => 'au',
notes => "AKA parent/guardian",
required_if => 'Patron is less than 18 years old'
# TODO: wrap the following in a check for a library setting as to whether or not
# to require emailed verification
-# Random 6-character alpha-numeric code that avoids look-alike characters
-# https://ux.stackexchange.com/questions/53341/are-there-any-letters-numbers-that-should-be-avoided-in-an-id
-# Also exclude vowels to avoid creating any real (potentially offensive) words.
-my @code_chars = ('C','D','F','H','J'..'N','P','R','T','V','W','X','3','4','7','9');
-sub generate_verify_code {
- my $string = '';
- $string .= $code_chars[rand @code_chars] for 1..6;
- return $string;
-}
-
-
-# only if we're verifying the card via email
-sub load_ecard_verify {
- my $self = shift;
- my $cgi = $self->cgi;
- $self->collect_header_footer;
-
- # Loading the form.
- return Apache2::Const::OK if $cgi->request_method eq 'GET';
-
- #$self->verify_ecard;
- return Apache2::Const::OK;
-}
-
-sub verify_ecard {
- my $self = shift;
- my $cgi = $self->cgi;
- my $ctx = $self->ctx;
- $self->log_params;
-
- my $verify_code = $ctx->{verify_code} = $cgi->param('verification_code');
- my $barcode = $ctx->{barcode} = $cgi->param('barcode');
-
- $ctx->{verify_failed} = 1;
-
- my $e = new_editor();
-
- my $au = $e->search_actor_user({
- profile => $PROVISIONAL_ECARD_GRP,
- ident_type => $ECARD_VERIFY_IDENT,
- ident_value => $verify_code
- })->[0];
-
- if (!$au) {
- $logger->warn(
- "ECARD: No provisional ecard found with code $verify_code");
- sleep 2; # Mitigate brute-force attacks
- return;
- }
-
- my $card = $e->search_actor_card({
- usr => $au->id,
- barcode => $barcode
- })->[0];
-
- if (!$card) {
- $logger->warn("ECARD: Failed to match verify code ".
- "($verify_code) with provided barcode ($barcode)");
- sleep 2; # Mitigate brute-force attacks
- return;
- }
-
- # Verification looks good. Update the account.
-
- my $grp = new_editor()->retrieve_permission_grp_tree($FULL_ECARD_GRP);
-
- $au->profile($grp->id);
- $au->expire_date(
- DateTime->now(time_zone => 'local')->add(
- seconds => interval_to_seconds($grp->perm_interval))->iso8601()
- );
-
- $e->xact_begin;
-
- unless ($e->update_actor_user($au)) {
- $logger->error("ECARD update failed for $barcode: " . $e->die_event);
- return;
- }
-
- $e->commit;
- $logger->info("ECARD: Update to full ecard succeeded for $barcode");
-
- $ctx->{verify_success} = 1;
- $ctx->{verify_failed} = 0;
-
- return;
-}
+## Random 6-character alpha-numeric code that avoids look-alike characters
+## https://ux.stackexchange.com/questions/53341/are-there-any-letters-numbers-that-should-be-avoided-in-an-id
+## Also exclude vowels to avoid creating any real (potentially offensive) words.
+#my @code_chars = ('C','D','F','H','J'..'N','P','R','T','V','W','X','3','4','7','9');
+#sub generate_verify_code {
+# my $string = '';
+# $string .= $code_chars[rand @code_chars] for 1..6;
+# return $string;
+#}
+#
+#
+## only if we're verifying the card via email
+#sub load_ecard_verify {
+# my $self = shift;
+# my $cgi = $self->cgi;
+# $self->collect_header_footer;
+#
+# # Loading the form.
+# return Apache2::Const::OK if $cgi->request_method eq 'GET';
+#
+# #$self->verify_ecard;
+# return Apache2::Const::OK;
+#}
+#
+#sub verify_ecard {
+# my $self = shift;
+# my $cgi = $self->cgi;
+# my $ctx = $self->ctx;
+# $self->log_params;
+#
+# my $verify_code = $ctx->{verify_code} = $cgi->param('verification_code');
+# my $barcode = $ctx->{barcode} = $cgi->param('barcode');
+#
+# $ctx->{verify_failed} = 1;
+#
+# my $e = new_editor();
+#
+# my $au = $e->search_actor_user({
+# profile => $PROVISIONAL_ECARD_GRP,
+# ident_type => $ECARD_VERIFY_IDENT,
+# ident_value => $verify_code
+# })->[0];
+#
+# if (!$au) {
+# $logger->warn(
+# "ECARD: No provisional ecard found with code $verify_code");
+# sleep 2; # Mitigate brute-force attacks
+# return;
+# }
+#
+# my $card = $e->search_actor_card({
+# usr => $au->id,
+# barcode => $barcode
+# })->[0];
+#
+# if (!$card) {
+# $logger->warn("ECARD: Failed to match verify code ".
+# "($verify_code) with provided barcode ($barcode)");
+# sleep 2; # Mitigate brute-force attacks
+# return;
+# }
+#
+# # Verification looks good. Update the account.
+#
+# my $grp = new_editor()->retrieve_permission_grp_tree($FULL_ECARD_GRP);
+#
+# $au->profile($grp->id);
+# $au->expire_date(
+# DateTime->now(time_zone => 'local')->add(
+# seconds => interval_to_seconds($grp->perm_interval))->iso8601()
+# );
+#
+# $e->xact_begin;
+#
+# unless ($e->update_actor_user($au)) {
+# $logger->error("ECARD update failed for $barcode: " . $e->die_event);
+# return;
+# }
+#
+# $e->commit;
+# $logger->info("ECARD: Update to full ecard succeeded for $barcode");
+#
+# $ctx->{verify_success} = 1;
+# $ctx->{verify_failed} = 0;
+#
+# return;
+#}
sub log_params {
my $val = $cgi->param($field);
+ $field = 'guardian' if $field eq 'ident_value2' && $val;
$au->juvenile(1) if $field eq 'guardian' && $val;
- $au->day_phone(undef) if $field eq 'day_phone' && $val eq '--';
if ($field_info->{required} && !$val) {
my $msg = "Value required for field: '$field'";
$logger->error("ECARD $msg");
}
+ $val = undef if $field eq 'day_phone' && $val eq '--';
$self->verify_dob($val) if $field eq 'dob' && $val;
$au->$field($val);
}
if ($field =~ /physical/) {
(my $col_field = $field) =~ s/physical_//g;
- $physical_addr->$col_field($val);
+ $physical_addr->$col_field($val) if $val;
} else {
(my $col_field = $field) =~ s/mailing_//g;
- $mailing_addr->$col_field($val);
+ $mailing_addr->$col_field($val) if $val;
}
}
# TODO: this is KCLS-specific, but maybe we can make it something
# generic for adding stat cats to the patron
-sub add_stat_cats {
- my $self = shift;
- my $cgi = $self->cgi;
- my $user = $self->ctx->{user};
-
- my $ds_map = Fieldmapper::actor::stat_cat_entry_user_map->new;
- $ds_map->isnew(1);
- $ds_map->stat_cat(12);
- $ds_map->stat_cat_entry('KCLS');
-
- my $events = $cgi->param('events_mailing');
- my $em_map = Fieldmapper::actor::stat_cat_entry_user_map->new;
- $em_map->isnew(1);
- $em_map->stat_cat(3);
- $em_map->stat_cat_entry($events ? 'Y' : 'N');
-
- my $foundation = $cgi->param('foundation_mailing');
- my $fm_map = Fieldmapper::actor::stat_cat_entry_user_map->new;
- $fm_map->isnew(1);
- $fm_map->stat_cat(4);
- $fm_map->stat_cat_entry($foundation ? 'Y' : 'N');
-
- $user->stat_cat_entries([$ds_map, $em_map, $fm_map]);
- return 1;
-}
+#sub add_stat_cats {
+# my $self = shift;
+# my $cgi = $self->cgi;
+# my $user = $self->ctx->{user};
+#
+# my $ds_map = Fieldmapper::actor::stat_cat_entry_user_map->new;
+# $ds_map->isnew(1);
+# $ds_map->stat_cat(12);
+# $ds_map->stat_cat_entry('KCLS');
+#
+# my $events = $cgi->param('events_mailing');
+# my $em_map = Fieldmapper::actor::stat_cat_entry_user_map->new;
+# $em_map->isnew(1);
+# $em_map->stat_cat(3);
+# $em_map->stat_cat_entry($events ? 'Y' : 'N');
+#
+# my $foundation = $cgi->param('foundation_mailing');
+# my $fm_map = Fieldmapper::actor::stat_cat_entry_user_map->new;
+# $fm_map->isnew(1);
+# $fm_map->stat_cat(4);
+# $fm_map->stat_cat_entry($foundation ? 'Y' : 'N');
+#
+# $user->stat_cat_entries([$ds_map, $em_map, $fm_map]);
+# return 1;
+#}
# Returns true if no dupes found, false if dupes are found.
sub check_dupes {
[% IF !ctx.is_staff %]
<div id="footer-wrap">
<div id="footer">
- [% IF ctx.get_org_setting(
- ctx.physical_loc || ctx.aou_tree.id, 'opac.allow_pending_user') %]
- <a href="[% mkurl(ctx.opac_root _ '/register') %]">
- <img alt="[% l('Request Library Card') %]" src="[% ctx.media_prefix %]/images/pines-dot.png" />
- [% l('Request Library Card') %]</a>
- [% END %]
- <!-- <a href="/eg/kpac/home">[% l("Kids Catalog") %]</a> | -->
- <!-- <a href="http://pines.georgialibraries.org/pinesLocator/locator.html">[% l('Library Locations') %]</a> | -->
- <!-- <a href="http://pines.georgialibraries.org/catalog-help">[% l('Help') %]</a> | -->
+<div id="footer-menu-wrapper">
<a href="http://pines.georgialibraries.org/about">
- <img alt="[% l('About PINES') %]" src="[% ctx.media_prefix %]/images/pines-dot.png" /> [%- l('Learn More About PINES') %]</a> <!-- | -->
-
+ <img alt="[% l('About PINES') %]" src="[% ctx.media_prefix %]/images/pines-dot.png" /> [%- l('Learn More About PINES') %]</a>
+
<a href="http://pines.georgialibraries.org/catalog-help">
<img alt="[% l('Help') %]" src="[% ctx.media_prefix %]/images/pines-dot.png" />
[% l('Help') %]</a>
-
-
- <!-- | -->
- <!-- <a href="/">[% l('Dynamic catalog') -%]</a> | -->
- <!-- [% gurl = mkurl(ctx.opac_root _ '/galileo', {}, 1) %]
- <a href="[% gurl %]"> [% l('GALILEO') %] </a> -->
</div>
<div id="footer-menu-slim">
<a href="/eg/opac/home">[% l("Home") %]</a><br/>
- <a href="http://pines.georgialibraries.org/pinesLocator/locator.html">
- [% l('Library Locations') %]</a><br/>
+ <a href="http://pines.georgialibraries.org/pinesLocator/locator.html">
+ [% l('Library Locations') %]</a><br/>
<a href="/eg/kpac/home">
- [% l("Kids' Catalog") %]</a><br/>
+ [% l("Kids' Catalog") %]</a><br/>
[% IF ctx.get_org_setting(
ctx.physical_loc || ctx.aou_tree.id, 'opac.allow_pending_user') %]
- <a href="[% mkurl(ctx.opac_root _ '/register') %]">
- [% l('Request Library Card') %]</a><br/>
+ <a href="[% mkurl(ctx.opac_root _ '/register') %]">
+ [% l('Request Library Card') %]</a><br/>
[% END %]
[% IF ctx.physical_loc;
# patron is at the branch, no redirect needed
# send patron to galileo auth redirector
gurl = mkurl(ctx.opac_root _ '/galileo', {}, 1);
END %]
- <a href="[% gurl %]">
- [% l('GALILEO Research Databases') %]</a><br/>
- <a href="http://pines.georgialibraries.org/about">
- [%- l('Learn More About PINES') %]</a><br/>
- <a href="http://pines.georgialibraries.org/news-2017-03-07-app">
+ <a href="[% gurl %]">
+ [% l('GALILEO Research Databases') %]</a><br/>
+ <a href="http://pines.georgialibraries.org/about">
+ [%- l('Learn More About PINES') %]</a><br/>
+ <a href="https://play.google.com/store/apps/details?id=net.kenstir.apps.pines">
PINES Android App</a><br/>
<a href="http://pines.georgialibraries.org/catalog-help">
- [% l('Help') %]</a>
-
- <hr style="margin-top:20px;">
-</div>
-
+ [% l('Help') %]</a>
+
+ <hr style="margin-top:20px;">
+</div>
+
[% IF ctx.timing %]
<div id="timing">
[% FOR event IN ctx.timing %]
<div style="float:left; margin:10px 10px 0px 0px;"><a href="http://www.imls.gov">
<img src="[% ctx.media_prefix %]/images/IMLS-logo.jpg" style="border:none; width: 150px;" alt="IMLS"></a>
</div>
- <p style="font-weight:normal;font-style:italic;">
- [% l('Funding Note') %]</p>
+ <p style="font-weight:normal;font-style:italic;">
+ [% l('Funding Note') %]</p>
</div>
</div>
</div>
<div id="gold-links-holder">
<div id="gold-links">
- <div id="header-links">
- <a href="/eg/opac/home">
- <img alt="[% l('PINES Home Page') %]" src="[% ctx.media_prefix %]/images/pines-dot.png" />
- [% l("Home") %]</a>
- <!--
- [% IF ctx.get_org_setting(
- ctx.physical_loc || ctx.aou_tree.id, 'opac.allow_pending_user') %]
- <a href="[% mkurl(ctx.opac_root _ '/register') %]">[%
- l('Apply for a PINES Library Card') %]</a>
- [% END %]
- -->
- <a href="http://pines.georgialibraries.org/pinesLocator/locator.html">
- <img alt="[% l('Library Locations') %]" src="[% ctx.media_prefix %]/images/pines-dot.png" />
- [% l('Library Locations') %]</a>
- <a href="/eg/kpac/home">
- <img alt="[% l('Kids Catalog') %]" src="[% ctx.media_prefix %]/images/pines-dot.png" />
- [% l("Kids Catalog") %]</a>
- <a href="https://pines.georgialibraries.org/app">
- <img alt="[% l('PINES App') %]" src="[% ctx.media_prefix %]/images/pines-dot.png" />
- [% l("Download the PINES App") %]</a>
- [% IF ctx.physical_loc;
- # patron is at the branch, no redirect needed
- gurl = 'http://www.galileo.usg.edu/express';
- ELSE;
- # send patron to galileo auth redirector
- gurl = mkurl(ctx.opac_root _ '/galileo', {}, 1);
- END %]
- <a href="[% gurl %]">
- <img alt="[% l('GALILEO') %]" src="[% ctx.media_prefix %]/images/pines-dot.png" />
- [% l('GALILEO Virtual Library') %]</a>
- </div>
+ <div id="header-links">
+ <a href="/eg/opac/home">
+ <img alt="[% l('PINES Home Page') %]" src="[% ctx.media_prefix %]/images/pines-dot.png" />
+ [% l("Home") %]</a>
+ <a href="http://pines.georgialibraries.org/pinesLocator/locator.html">
+ <img alt="[% l('Library Locations') %]" src="[% ctx.media_prefix %]/images/pines-dot.png" />
+ [% l('Library Locations') %]</a>
+ <a href="/eg/kpac/home">
+ <img alt="[% l('Kids Catalog') %]" src="[% ctx.media_prefix %]/images/pines-dot.png" />
+ [% l("Kids Catalog") %]</a>
+ <a href="https://pines.georgialibraries.org/app">
+ <img alt="[% l('PINES App') %]" src="[% ctx.media_prefix %]/images/pines-dot.png" />
+ [% l("Download the PINES App") %]</a>
+ [% IF ctx.physical_loc;
+ # patron is at the branch, no redirect needed
+ gurl = 'http://www.galileo.usg.edu/express';
+ ELSE;
+ # send patron to galileo auth redirector
+ gurl = mkurl(ctx.opac_root _ '/galileo', {}, 1);
+ END %]
+ <a href="[% gurl %]">
+ <img alt="[% l('GALILEO') %]" src="[% ctx.media_prefix %]/images/pines-dot.png" />
+ [% l('GALILEO Virtual Library') %]</a>
+ [% IF ctx.get_org_setting(
+ ctx.physical_loc || ctx.aou_tree.id, 'opac.allow_pending_user') %]
+ <a href="[% mkurl(ctx.opac_root _ '/register') %]">
+ <img alt="[% l('Apply for a PINES Library Card') %]" src="[% ctx.media_prefix %]/images/pines-dot.png" />
+ [% l('Apply for a PINES Library Card') %]</a>
+ [% END %]
+ </div>
</div>
</div>
+
+<div style="clear:both;" />