From e8d56bc16a2efe693dfbe2a8ef932f79db56596a Mon Sep 17 00:00:00 2001 From: Terran McCanna Date: Tue, 1 Sep 2020 14:06:15 -0400 Subject: [PATCH] Quipu Customizations Move library card application link to top menu instead of bottom menu, cleaned up a lot of whitespace issues and old commented out text, added CSS controls for parts of the Quipu form. Signed-off-by: Terran McCanna --- .../perlmods/lib/OpenILS/WWW/EGCatLoader/Ecard.pm | 233 +++++++++++---------- Open-ILS/src/templates/opac/css/style.css.tt2 | 21 ++ Open-ILS/src/templates/opac/parts/footer.tt2 | 54 ++--- Open-ILS/src/templates/opac/parts/topnav_links.tt2 | 63 +++--- 4 files changed, 190 insertions(+), 181 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Ecard.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Ecard.pm index 1e47c2ad32..bbef61de8b 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Ecard.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Ecard.pm @@ -29,7 +29,7 @@ my @api_fields = ( {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' @@ -62,93 +62,93 @@ my @api_fields = ( # 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 { @@ -346,8 +346,8 @@ sub make_user { 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'"; @@ -356,6 +356,7 @@ sub make_user { $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); } @@ -499,10 +500,10 @@ sub add_addresses { 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; } } @@ -554,31 +555,31 @@ sub add_survey_responses { # 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 { diff --git a/Open-ILS/src/templates/opac/css/style.css.tt2 b/Open-ILS/src/templates/opac/css/style.css.tt2 index b73be0efdd..53938eb696 100644 --- a/Open-ILS/src/templates/opac/css/style.css.tt2 +++ b/Open-ILS/src/templates/opac/css/style.css.tt2 @@ -3563,6 +3563,27 @@ label[for*=expert_] color: #00593d; } +/* QUIPU CUSTOMIZATIONS */ +.radioLabel { + text-decoration: none; + color: #000; + padding-right: 10px; +} + +.eCARDPreferredNameDivClass { + padding: 10px; + font-size: .9em; +} + +.eCARDPatronNumber { + border:3px solid forestgreen; + padding:20px;max-width:700px; + font-weight:bold; + text-align:center; +} + + + @media only screen and (max-width: 1200px) { .carousel { margin-left:430px; diff --git a/Open-ILS/src/templates/opac/parts/footer.tt2 b/Open-ILS/src/templates/opac/parts/footer.tt2 index 6c41aaa585..044007661b 100644 --- a/Open-ILS/src/templates/opac/parts/footer.tt2 +++ b/Open-ILS/src/templates/opac/parts/footer.tt2 @@ -1,38 +1,24 @@ [% IF !ctx.is_staff %] diff --git a/Open-ILS/src/templates/opac/parts/topnav_links.tt2 b/Open-ILS/src/templates/opac/parts/topnav_links.tt2 index 2db429d957..52bc570a66 100644 --- a/Open-ILS/src/templates/opac/parts/topnav_links.tt2 +++ b/Open-ILS/src/templates/opac/parts/topnav_links.tt2 @@ -1,35 +1,36 @@ + +
-- 2.11.0