From 2696e945078edb1263e718028b7cbac8d3cd77ff Mon Sep 17 00:00:00 2001 From: Jason Stephenson Date: Wed, 20 Oct 2021 15:00:11 -0400 Subject: [PATCH] Apply CW MARS Customization to Quipu Ecard Form --- .../perlmods/lib/OpenILS/WWW/EGCatLoader/Ecard.pm | 50 ++++++++++------------ Open-ILS/src/templates/opac/ecard/form.tt2 | 24 ++++++++--- 2 files changed, 41 insertions(+), 33 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 1b16c94c2c..be9bb19228 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Ecard.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Ecard.pm @@ -27,8 +27,8 @@ my @api_fields = ( {name => 'day_phone', class => 'au', required => 0}, {name => 'dob', class => 'au', required => 1}, {name => 'home_ou', class => 'au', required => 1}, - {name => 'ident_type', class => 'au', required => 1}, - {name => 'ident_value', class => 'au', required => 1}, + {name => 'ident_type', class => 'au', required => 0}, + {name => 'ident_value', class => 'au', required => 0}, {name => 'guardian', class => 'au', notes => "AKA parent/guardian", @@ -56,6 +56,7 @@ my @api_fields = ( {name => 'mailing_country', class => 'aua', required => 1}, {name => 'voter_registration', class => 'asvr', required => 0}, {name => 'in_house_registration', required => 0}, + {name => 'newsletter', required => 0}, ); @@ -256,6 +257,7 @@ sub load_ecard_submit { return $self->compile_response unless $self->make_user; return $self->compile_response unless $self->add_addresses; + return $self->compile_response unless $self->add_stat_cats; return $self->compile_response unless $self->check_dupes; return $self->compile_response unless $self->add_card; # Add survey responses commented out because it is not universal. @@ -393,6 +395,9 @@ sub make_user { $au->$field($val); } + # CW MARS: Force ident_type to 1. + $au->ident_type(1); + return undef if $ctx->{response}->{status}; return $ctx->{user} = $au; } @@ -605,34 +610,23 @@ sub add_survey_responses { return 1; } -# TODO: this is KCLS-specific, but maybe we can make it something +# TODO: this is CW MARS-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 $newsletter = $cgi->param('newsletter'); + my $map = Fieldmapper::actor::stat_cat_entry_user_map->new; + $map->isnew(1); + $map->stat_cat(28); + $map->stat_cat_entry($newsletter ? 'Yes' : 'No'); + + $user->stat_cat_entries([$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/ecard/form.tt2 b/Open-ILS/src/templates/opac/ecard/form.tt2 index 4f29711536..012fee9e7a 100644 --- a/Open-ILS/src/templates/opac/ecard/form.tt2 +++ b/Open-ILS/src/templates/opac/ecard/form.tt2 @@ -2,20 +2,34 @@ PROCESS "opac/parts/org_selector.tt2"; WRAPPER "opac/parts/base.tt2"; INCLUDE "opac/parts/topnav.tt2"; - ctx.page_title = l("Request Electronic Card"); + ctx.page_title = l("Get a CW MARS eCard"); ctx_org = ctx.physical_loc || ctx.search_ou || ctx.aou_tree.id; %]
-
+

[% ctx.page_title %]

[% IF ctx.ecard.enabled && ctx.ecard.quipu_id %]
-

-[% l('Fill out the application below to get immediate access to electronic services, such as e-books, audiobooks, magazines, and databases, provided by your local library.') %] -

+ +

An eCard is a CW MARS library card that you can register for online to access electronic materials, such as ebooks, audiobooks, magazines, and databases.

+ +

The eCard is for patrons who do not already have a CW MARS library card and may be upgraded to a physical library card with borrowing privileges by visiting your local library. For more information about the eCard, read our FAQ.

+ +

You are eligible to apply for a CW MARS eCard, if you...

+ + +

Contact your local library if you are not eligible to register online or to renew an expired card.

+ +

Funding for electronic content is provided by CW MARS member libraries, and the Massachusetts Board of Library Commissioners with funding from the Institute of Museum and Library Services and the Commonwealth of Massachusetts.

+
-- 2.11.0