From fb103148f8d93ea04671cf13156a8abd22e50344 Mon Sep 17 00:00:00 2001 From: Jason Etheridge Date: Thu, 22 Sep 2011 09:17:50 -0400 Subject: [PATCH] SMS texting For SMS functionality we're basically converting a carrier and a phone number into an email address and sending via SMTP like other email notifications. There is administrative UI for configuring these mappings: Admin -> Server Settings -> SMS Carriers The permission ADMIN_SMS_CARRIER is needed to use this interface. In a stock Evergreen installation, this is given to the Global Administrator group. In this interface, any occurance of "$number" in the Email Gateway field will change into the pertinent SMS phone number when the mapping gets used. We're not doing anything fancy here for verifying or munging phone numbers, but you could do munging in the pertinent SMS Action/Trigger templates, or better, contribute code for the OPAC templates and/or the utility method get_sms_gateway_email in Trigger/Reactor.pm. Our set of stock mappings comes from http://en.wikipedia.org/wiki/List_of_SMS_gateways There's no automated process for keeping this up-to-date, though some volunteer with a Wikipedia account could add the page to their watchlist for changes and let us know if something needs changing. Set the org unit setting "SMS: Enable features that send SMS text messages." (database name "sms.enable") to True to expose the following: * SMS notification widgets in the TT-OPAC hold placement interface (to notify when a hold is ready for pickup) * "(SMS)" links next to call numbers on the TT-OPAC record details page. The interface spawned by these links require user authentication by default, but this can be changed by setting the org unit setting "SMS: Disable auth requirement for texting call numbers." to True. The database name for that setting is "sms.disable_authentication_requirement.callnumbers". * New options in TT-OPAC My Account -> Account Preferences -> Notification Preferences (we also add in some missing prefs for holds outside of SMS) There are two pertinent Action/Trigger templates under Admin -> Local Administration -> Notifications / Action Triggers: * SMS Call Number * Hold Ready for Pickup SMS Notification Don't disable these. We rely on the sms.enable YAOUS as the master on/off switch. Also, it's probably best to have just one sms.enable for the whole consortium. If you mix and match on/off settings here, then user preferences for SMS can get blown away if the user updates their settings in the TT-OPAC at an org where SMS is disabled. Hrmm, the same would probably happen if the user jumps between the TT-OPAC and the original JS-PAC. Signed-off-by: Jason Etheridge --- Open-ILS/examples/fm_IDL.xml | 22 + .../perlmods/lib/OpenILS/Application/Cat.pm | 69 + .../OpenILS/Application/Trigger/Reactor.pm | 60 + .../Application/Trigger/Reactor/SendSMS.pm | 21 + .../perlmods/lib/OpenILS/WWW/EGCatLoader.pm | 8 + .../lib/OpenILS/WWW/EGCatLoader/Account.pm | 112 +- .../lib/OpenILS/WWW/EGCatLoader/SMS.pm | 57 + Open-ILS/src/sql/Pg/002.schema.config.sql | 8 + Open-ILS/src/sql/Pg/090.schema.action.sql | 7 + Open-ILS/src/sql/Pg/950.data.seed-values.sql | 1368 +++++++++++++++- .../Pg/upgrade/XXXX.schema.sms_carriers.sql | 1411 +++++++++++++++++ .../conify/global/config/sms_carrier.tt2 | 27 + .../templates/opac/myopac/prefs_notify.tt2 | 65 + .../src/templates/opac/parts/place_hold.tt2 | 29 + .../opac/parts/record/copy_table.tt2 | 2 +- .../opac/parts/sms_carrier_selector.tt2 | 28 + .../opac/parts/sms_number_textbox.tt2 | 4 + Open-ILS/src/templates/opac/sms_cn.tt2 | 49 + .../conify/global/config/sms_carrier.js | 46 + Open-ILS/web/opac/locale/en-US/lang.dtd | 7 +- .../chrome/content/OpenILS/data.js | 25 +- .../chrome/content/main/constants.js | 1 + .../staff_client/chrome/content/main/menu.js | 4 + .../chrome/content/main/menu_frame_menus.xul | 2 + Open-ILS/xul/staff_client/server/circ/util.js | 30 + .../server/locale/en-US/circ.properties | 1 + .../server/locale/en-US/common.properties | 2 + .../server/locale/en-US/patron.properties | 18 + .../xul/staff_client/server/patron/holds.js | 127 ++ .../server/patron/holds_overlay.xul | 10 + 30 files changed, 3604 insertions(+), 16 deletions(-) create mode 100644 Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger/Reactor/SendSMS.pm create mode 100644 Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/SMS.pm create mode 100644 Open-ILS/src/sql/Pg/upgrade/XXXX.schema.sms_carriers.sql create mode 100644 Open-ILS/src/templates/conify/global/config/sms_carrier.tt2 create mode 100644 Open-ILS/src/templates/opac/parts/sms_carrier_selector.tt2 create mode 100644 Open-ILS/src/templates/opac/parts/sms_number_textbox.tt2 create mode 100644 Open-ILS/src/templates/opac/sms_cn.tt2 create mode 100644 Open-ILS/web/js/ui/default/conify/global/config/sms_carrier.js diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml index 07b98154a9..e9c6f1a310 100644 --- a/Open-ILS/examples/fm_IDL.xml +++ b/Open-ILS/examples/fm_IDL.xml @@ -725,6 +725,25 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + + + + + + + + + + + + + + + + + + + @@ -4510,6 +4529,8 @@ SELECT usr, + + @@ -4552,6 +4573,7 @@ SELECT usr, + diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat.pm index a018e3fdc3..e1d2c82ced 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat.pm @@ -1241,6 +1241,75 @@ sub create_update_asset_copy_template { $e->commit and return $retval; } +__PACKAGE__->register_method( + method => "acn_sms_msg", + api_name => "open-ils.cat.acn.send_sms_text", + signature => q^ + Send an SMS text from an A/T template for specified call numbers. + + First parameter is null or an auth token (whether a null is allowed + depends on the sms.disable_authentication_requirement.callnumbers OU + setting). + + Second parameter is the id of the context org. + + Third parameter is the code of the SMS carrier from the + config.sms_carrier table. + + Fourth parameter is the SMS number. + + Fifth parameter is the ACN id's to target, though currently only the + first ACN is used by the template (and the UI is only sending one). + ^ +); + +sub acn_sms_msg { + my($self, $conn, $auth, $org_id, $carrier, $number, $target_ids) = @_; + + my $sms_enable = $U->ou_ancestor_setting_value( + $org_id || $U->fetch_org_tree->id, + 'sms.enable' + ); + # We could maybe make a Validator for this on the templates + if (! $U->is_true($sms_enable)) { + return -1; + } + + my $disable_auth = $U->ou_ancestor_setting_value( + $org_id || $U->fetch_org_tree->id, + 'sms.disable_authentication_requirement.callnumbers' + ); + + my $e = new_editor( + (defined $auth) + ? (authtoken => $auth, xact => 1) + : (xact => 1) + ); + return $e->event unless $disable_auth || $e->checkauth; + + my $targets = $e->batch_retrieve_asset_call_number($target_ids); + + $e->rollback; # FIXME using transaction because of pgpool/slony setups, but not + # simply making this method authoritative because of weirdness + # with transaction handling in A/T code that causes rollback + # failure down the line if handling many targets + + return undef unless @$targets; + return $U->fire_object_event( + undef, # event_def + 'acn.format.sms_text', # hook + $targets, + $org_id, + undef, # granularity + { # user_data + sms_carrier => $carrier, + sms_notify => $number + } + ); +} + + + 1; # vi:et:ts=4:sw=4 diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger/Reactor.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger/Reactor.pm index 1bd0e436b2..a56a2cd9fe 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger/Reactor.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger/Reactor.pm @@ -125,6 +125,40 @@ $_TT_helpers = { } }, + # given a call number, returns the copy location with the most copies + get_most_populous_location => sub { + my $acn_id = shift; + + # FIXME - there's probably a more efficient way to do this with json_query/SQL + my $call_number = new_editor(xact=>1)->retrieve_asset_call_number([ + $acn_id, + { + flesh => 1, + flesh_fields => { + acn => ['copies'] + } + } + ]); + my %location_count = (); my $winning_location; my $winning_total; + use Data::Dumper; + foreach my $copy (@{$call_number->copies()}) { + if (! defined $location_count{ $copy->location() }) { + $location_count{ $copy->location() } = 1; + } else { + $location_count{ $copy->location() } += 1; + } + if ($location_count{ $copy->location() } > $winning_total) { + $winning_total = $location_count{ $copy->location() }; + $winning_location = $copy->location(); + } + } + + my $location = new_editor(xact=>1)->retrieve_asset_copy_location([ + $winning_location, {} + ]); + return $location; + }, + # returns the org unit setting value get_org_setting => sub { my($org_id, $setting) = @_; @@ -273,6 +307,32 @@ $_TT_helpers = { return $str ? (new XML::LibXML)->parse_string($str) : undef; }, + # returns an email addresses derived from sms_carrier and sms_notify + get_sms_gateway_email => sub { + my $sms_carrier = shift; + my $sms_notify = shift; + + if (! defined $sms_notify || $sms_notify eq '') { + return ''; + } + + my $query = { + select => {'csc' => ['id','name','email_gateway']}, + from => 'csc', + where => {id => $sms_carrier} + }; + my $carriers = new_editor()->json_query($query); + + my @addresses = (); + foreach my $carrier ( @{ $carriers } ) { + my $address = $carrier->{email_gateway}; + $address =~ s/\$number/$sms_notify/g; + push @addresses, $address; + } + + return join(',',@addresses); + }, + unapi_bre => sub { my ($bre_id, $unapi_args) = @_; $unapi_args ||= {}; diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger/Reactor/SendSMS.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger/Reactor/SendSMS.pm new file mode 100644 index 0000000000..de775ac7a6 --- /dev/null +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger/Reactor/SendSMS.pm @@ -0,0 +1,21 @@ +package OpenILS::Application::Trigger::Reactor::SendSMS; +use strict; use warnings; +use Error qw/:try/; +use Data::Dumper; +use Email::Send; +use Email::Simple; +use OpenSRF::Utils::SettingsClient; +use OpenILS::Application::Trigger::Reactor; +use OpenSRF::Utils::Logger qw/:logger/; +use Encode; +$Data::Dumper::Indent = 0; + +use base 'OpenILS::Application::Trigger::Reactor::SendEmail'; + +# This module is just another name for SendEmail, as a way to get around the +# "ev_def_owner_hook_val_react_clean_delay_once" index/constraint on the table +# action.event_definition. The template fed to SendSMS is responsible for +# using helpers.get_sms_email_gateway to, for example, convert .sms_carrier +# and .sms_notify off of a hold into an email address. + +1; diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm index 5091c5022c..b19b8bc200 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm @@ -21,6 +21,7 @@ use OpenILS::WWW::EGCatLoader::Account; use OpenILS::WWW::EGCatLoader::Search; use OpenILS::WWW::EGCatLoader::Record; use OpenILS::WWW::EGCatLoader::Container; +use OpenILS::WWW::EGCatLoader::SMS; my $U = 'OpenILS::Application::AppUtils'; @@ -127,6 +128,12 @@ sub load { ); } + my $org_unit = $self->cgi->param('loc') || $self->ctx->{aou_tree}->()->id; + my $skip_sms_auth = $self->ctx->{get_org_setting}->($org_unit, 'sms.disable_authentication_requirement.callnumbers'); + if ($skip_sms_auth) { + return $self->load_sms_cn if $path =~ m|opac/sms_cn|; + } + # ---------------------------------------------------------------- # Everything below here requires authentication # ---------------------------------------------------------------- @@ -152,6 +159,7 @@ sub load { return $self->load_myopac_prefs_notify if $path =~ m|opac/myopac/prefs_notify|; return $self->load_myopac_prefs_settings if $path =~ m|opac/myopac/prefs_settings|; return $self->load_myopac_prefs if $path =~ m|opac/myopac/prefs|; + return $self->load_sms_cn if $path =~ m|opac/sms_cn|; return Apache2::Const::OK; } diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm index 116f8c5e28..28fe7c8a2a 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm @@ -174,9 +174,46 @@ sub load_myopac_prefs_notify { $user_prefs = $self->update_optin_prefs($user_prefs) if $self->cgi->request_method eq 'POST'; - $self->ctx->{opt_in_settings} = $user_prefs; + $self->ctx->{opt_in_settings} = $user_prefs; - return Apache2::Const::OK; + my %settings; + my $set_map = $self->ctx->{user_setting_map}; + + foreach my $key (qw/ + opac.default_phone + opac.default_sms_notify + /) { + my $val = $self->cgi->param($key); + $settings{$key}= $val unless $$set_map{$key} eq $val; + } + + my $key = 'opac.default_sms_carrier'; + my $val = $self->cgi->param('sms_carrier'); + $settings{$key}= $val unless $$set_map{$key} eq $val; + + $key = 'opac.hold_notify'; + my @notify_methods = (); + if ($self->cgi->param($key . ".email") eq 'on') { + push @notify_methods, "email"; + } + if ($self->cgi->param($key . ".phone") eq 'on') { + push @notify_methods, "phone"; + } + if ($self->cgi->param($key . ".sms") eq 'on') { + push @notify_methods, "sms"; + } + $val = join("|",@notify_methods); + $settings{$key}= $val unless $$set_map{$key} eq $val; + + # Send the modified settings off to be saved + $U->simplereq( + 'open-ils.actor', + 'open-ils.actor.patron.settings.update', + $self->editor->authtoken, undef, \%settings); + + # re-fetch user prefs + $self->ctx->{updated_user_settings} = \%settings; + return $self->_load_user_with_prefs || Apache2::Const::OK; } sub fetch_optin_prefs { @@ -331,7 +368,7 @@ sub load_myopac_prefs_settings { $settings{$key} = undef if $$set_map{$key}; } } - + # Send the modified settings off to be saved $U->simplereq( 'open-ils.actor', @@ -537,6 +574,14 @@ sub load_place_hold { $ctx->{hold_type} = $cgi->param('hold_type'); $ctx->{default_pickup_lib} = $e->requestor->home_ou; # unless changed below + $ctx->{email_notify} = $cgi->param('email_notify'); + if ($cgi->param('phone_notify_checkbox')) { + $ctx->{phone_notify} = $cgi->param('phone_notify'); + } + if ($cgi->param('sms_notify_checkbox')) { + $ctx->{sms_notify} = $cgi->param('sms_notify'); + $ctx->{sms_carrier} = $cgi->param('sms_carrier'); + } return $self->generic_redirect unless @targets; @@ -550,12 +595,57 @@ sub load_place_hold { ) or return Apache2::Const::HTTP_BAD_REQUEST; $ctx->{default_pickup_lib} = $ctx->{patron_recipient}->home_ou; + } else { + $ctx->{staff_recipient} = $self->editor->retrieve_actor_user([ + $e->requestor->id, + { + flesh => 1, + flesh_fields => { + au => ['settings'] + } + } + ]) or return Apache2::Const::HTTP_INTERNAL_SERVER_ERROR; + } + my $user_setting_map = { + map { $_->name => OpenSRF::Utils::JSON->JSON2perl($_->value) } + @{ + $ctx->{patron_recipient} + ? $ctx->{patron_recipient}->settings + : $ctx->{staff_recipient}->settings + } + }; + $ctx->{user_setting_map} = $user_setting_map; + + my $default_notify = $$user_setting_map{'opac.hold_notify'} || ''; + if ($default_notify =~ /email/) { + $ctx->{default_email_notify} = 'checked'; + } else { + $ctx->{default_email_notify} = ''; + } + if ($default_notify =~ /phone/) { + $ctx->{default_phone_notify} = 'checked'; + } else { + $ctx->{default_phone_notify} = ''; + } + if ($default_notify =~ /sms/) { + $ctx->{default_sms_notify} = 'checked'; + } else { + $ctx->{default_sms_notify} = ''; } my $request_lib = $e->requestor->ws_ou; my @hold_data; $ctx->{hold_data} = \@hold_data; + sub data_filler { + my $hdata = shift; + if ($ctx->{email_notify}) { $hdata->{email_notify} = $ctx->{email_notify}; } + if ($ctx->{phone_notify}) { $hdata->{phone_notify} = $ctx->{phone_notify}; } + if ($ctx->{sms_notify}) { $hdata->{sms_notify} = $ctx->{sms_notify}; } + if ($ctx->{sms_carrier}) { $hdata->{sms_carrier} = $ctx->{sms_carrier}; } + return $hdata; + } + my $type_dispatch = { T => sub { my $recs = $e->batch_retrieve_biblio_record_entry(\@targets, {substream => 1}); @@ -589,12 +679,12 @@ sub load_place_hold { $part_required = 1 if $np_copies->[0]->{count} == 0; } - push(@hold_data, { - target => $rec, + push(@hold_data, data_filler({ + target => $rec, record => $rec, parts => $parts, part_required => $part_required - }); + })); } }, V => sub { @@ -607,7 +697,7 @@ sub load_place_hold { for my $id (@targets) { my ($vol) = grep {$_->id eq $id} @$vols; - push(@hold_data, {target => $vol, record => $vol->record}); + push(@hold_data, data_filler({target => $vol, record => $vol->record})); } }, C => sub { @@ -623,7 +713,7 @@ sub load_place_hold { for my $id (@targets) { my ($copy) = grep {$_->id eq $id} @$copies; - push(@hold_data, {target => $copy, record => $copy->call_number->record}); + push(@hold_data, data_filler({target => $copy, record => $copy->call_number->record})); } }, I => sub { @@ -638,7 +728,7 @@ sub load_place_hold { for my $id (@targets) { my ($iss) = grep {$_->id eq $id} @$isses; - push(@hold_data, {target => $iss, record => $iss->subscription->record_entry}); + push(@hold_data, data_filler({target => $iss, record => $iss->subscription->record_entry})); } } # ... @@ -758,10 +848,10 @@ sub attempt_hold_placement { my $breq = $bses->request( $method, $e->authtoken, - { patronid => $usr, + data_filler({ patronid => $usr, pickup_lib => $pickup_lib, hold_type => $hold_type - }, + }), \@create_targets ); diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/SMS.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/SMS.pm new file mode 100644 index 0000000000..bdaaddb66e --- /dev/null +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/SMS.pm @@ -0,0 +1,57 @@ +package OpenILS::WWW::EGCatLoader; +use strict; use warnings; +use Apache2::Const -compile => qw(OK DECLINED FORBIDDEN HTTP_INTERNAL_SERVER_ERROR REDIRECT HTTP_BAD_REQUEST); +use OpenSRF::Utils::Logger qw/$logger/; +use OpenILS::Utils::CStoreEditor qw/:funcs/; +use OpenILS::Utils::Fieldmapper; +use OpenILS::Application::AppUtils; +use OpenILS::Event; +use OpenSRF::Utils::JSON; +use Data::Dumper; +$Data::Dumper::Indent = 0; +use DateTime; +my $U = 'OpenILS::Application::AppUtils'; + +sub load_sms_cn { + my $self = shift; + my $ctx = $self->ctx; + my $gos = $ctx->{get_org_setting}; + my $e = $self->editor; + my $cgi = $self->cgi; + + my $org_unit = $cgi->param('loc') || $ctx->{aou_tree}->()->id; + + $self->_load_user_with_prefs() if($e->checkauth); + + $ctx->{page} = 'sms_cn'; + $ctx->{sms_carrier} = $cgi->param('sms_carrier'); + $ctx->{sms_notify} = $cgi->param('sms_notify'); + $ctx->{copy_id} = $cgi->param('copy_id'); + $ctx->{query} = $cgi->param('query'); + $ctx->{origin} = $cgi->param('origin'); + + my $acn_results = $e->json_query({ + select => { + acp => ['call_number'] + }, + from => 'acp', + where => {id => $ctx->{copy_id}} + }); + + my $acn_ids = [map { $_->{call_number} } @$acn_results]; + $ctx->{acn_ids} = $acn_ids; + + my $resp = $U->simplereq('open-ils.cat', 'open-ils.cat.acn.send_sms_text', + $e->authtoken, $org_unit, + $ctx->{sms_carrier}, $ctx->{sms_notify}, + $acn_ids + ); + + $ctx->{event} = $resp; + + $ctx->{orig_params} = $cgi->Vars; + + return Apache2::Const::OK; +} + + diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql index 1333f2745e..32bc358866 100644 --- a/Open-ILS/src/sql/Pg/002.schema.config.sql +++ b/Open-ILS/src/sql/Pg/002.schema.config.sql @@ -955,4 +955,12 @@ CREATE TRIGGER limit_logs_oust BEFORE INSERT OR UPDATE ON config.org_unit_setting_type_log FOR EACH ROW EXECUTE PROCEDURE limit_oustl(); +CREATE TABLE config.sms_carrier ( + id SERIAL PRIMARY KEY, + region TEXT, + name TEXT, + email_gateway TEXT, + active BOOLEAN DEFAULT TRUE +); + COMMIT; diff --git a/Open-ILS/src/sql/Pg/090.schema.action.sql b/Open-ILS/src/sql/Pg/090.schema.action.sql index 0ead48021b..715c64aec7 100644 --- a/Open-ILS/src/sql/Pg/090.schema.action.sql +++ b/Open-ILS/src/sql/Pg/090.schema.action.sql @@ -394,6 +394,8 @@ CREATE TABLE action.hold_request ( holdable_formats TEXT, phone_notify TEXT, email_notify BOOL NOT NULL DEFAULT TRUE, + sms_notify TEXT, + sms_carrier INT REFERENCES config.sms_carrier (id), frozen BOOL NOT NULL DEFAULT FALSE, thaw_date TIMESTAMP WITH TIME ZONE, shelf_time TIMESTAMP WITH TIME ZONE, @@ -402,6 +404,11 @@ CREATE TABLE action.hold_request ( shelf_expire_time TIMESTAMPTZ, current_shelf_lib INT REFERENCES actor.org_unit DEFERRABLE INITIALLY DEFERRED ); +ALTER TABLE action.hold_request ADD CONSTRAINT sms_check CHECK ( + sms_notify IS NULL + OR sms_carrier IS NOT NULL -- and implied sms_notify IS NOT NULL +); + CREATE INDEX hold_request_target_idx ON action.hold_request (target); CREATE INDEX hold_request_usr_idx ON action.hold_request (usr); diff --git a/Open-ILS/src/sql/Pg/950.data.seed-values.sql b/Open-ILS/src/sql/Pg/950.data.seed-values.sql index 328372724e..3d725ff473 100644 --- a/Open-ILS/src/sql/Pg/950.data.seed-values.sql +++ b/Open-ILS/src/sql/Pg/950.data.seed-values.sql @@ -2365,7 +2365,10 @@ INSERT INTO config.settings_group (name, label) VALUES ('recall', oils_i18n_gettext('config.settings_group.recall', 'Recalls', 'coust', 'label')), ('booking', oils_i18n_gettext('config.settings_group.booking', 'Booking', 'coust', 'label')), ('offline', oils_i18n_gettext('config.settings_group.offline', 'Offline', 'coust', 'label')), -('receipt_template', oils_i18n_gettext('config.settings_group.receipt_template', 'Receipt Template', 'coust', 'label')); +('receipt_template', oils_i18n_gettext('config.settings_group.receipt_template', 'Receipt Template', 'coust', 'label')), +('sms', oils_i18n_gettext('sms','SMS Text Messages','csg','label')) +; + -- org_unit setting types @@ -4512,6 +4515,34 @@ INSERT into config.org_unit_setting_type ), 'bool', null) +,( 'sms.enable', 'sms', + oils_i18n_gettext( + 'sms.enable', + 'Enable features that send SMS text messages.', + 'coust', + 'label' + ), + oils_i18n_gettext( + 'sms.enable', + 'Current features that use SMS include hold-ready-for-pickup notifications and a "Send Text" action for call numbers in the OPAC. If this setting is not enabled, the SMS options will not be offered to the user. Unless you are carefully silo-ing patrons and their use of the OPAC, the context org for this setting should be the top org in the org hierarchy, otherwise patrons can trample their user settings when jumping between orgs.', + 'coust', + 'description' + ), + 'bool', null) +,( 'sms.disable_authentication_requirement.callnumbers', 'sms', + oils_i18n_gettext( + 'sms.disable_authentication_requirement.callnumbers', + 'Disable auth requirement for texting call numbers.', + 'coust', + 'label' + ), + oils_i18n_gettext( + 'sms.disable_authentication_requirement.callnumbers', + 'Disable authentication requirement for sending call number information via SMS from the OPAC.', + 'coust', + 'description' + ), + 'bool', null) ; UPDATE config.org_unit_setting_type @@ -10432,4 +10463,1339 @@ INSERT INTO container.biblio_record_entry_bucket_type (code, label) VALUES ( oils_i18n_gettext('vandelay_queue', 'Vandelay Queue', 'cbrebt', 'label') ); +INSERT INTO config.usr_setting_type (name,grp,opac_visible,label,description,datatype,fm_class) VALUES ( + 'opac.default_sms_carrier', + 'sms', + TRUE, + oils_i18n_gettext( + 'opac.default_sms_carrier', + 'Default SMS/Text Carrier', + 'cust', + 'label' + ), + oils_i18n_gettext( + 'opac.default_sms_carrier', + 'Default SMS/Text Carrier', + 'cust', + 'description' + ), + 'link', + 'csc' +); + +INSERT INTO config.usr_setting_type (name,grp,opac_visible,label,description,datatype) VALUES ( + 'opac.default_sms_notify', + 'sms', + TRUE, + oils_i18n_gettext( + 'opac.default_sms_notify', + 'Default SMS/Text Number', + 'cust', + 'label' + ), + oils_i18n_gettext( + 'opac.default_sms_notify', + 'Default SMS/Text Number', + 'cust', + 'description' + ), + 'string' +); + +INSERT INTO config.usr_setting_type (name,grp,opac_visible,label,description,datatype) VALUES ( + 'opac.default_phone', + 'opac', + TRUE, + oils_i18n_gettext( + 'opac.default_phone', + 'Default Phone Number', + 'cust', + 'label' + ), + oils_i18n_gettext( + 'opac.default_phone', + 'Default Phone Number', + 'cust', + 'description' + ), + 'string' +); + +SELECT setval( 'config.sms_carrier_id_seq', 1000 ); +INSERT INTO config.sms_carrier VALUES + + -- Testing + ( + 1, + oils_i18n_gettext( + 1, + 'Local', + 'csc', + 'region' + ), + oils_i18n_gettext( + 1, + 'Test Carrier', + 'csc', + 'name' + ), + 'opensrf+$number@localhost', + FALSE + ), + + -- Canada & USA + ( + 2, + oils_i18n_gettext( + 2, + 'Canada & USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 2, + 'Rogers Wireless', + 'csc', + 'name' + ), + '$number@pcs.rogers.com', + TRUE + ), + ( + 3, + oils_i18n_gettext( + 3, + 'Canada & USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 3, + 'Rogers Wireless (Alternate)', + 'csc', + 'name' + ), + '1$number@mms.rogers.com', + TRUE + ), + ( + 4, + oils_i18n_gettext( + 4, + 'Canada & USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 4, + 'Telus Mobility', + 'csc', + 'name' + ), + '$number@msg.telus.com', + TRUE + ), + + -- Canada + ( + 5, + oils_i18n_gettext( + 5, + 'Canada', + 'csc', + 'region' + ), + oils_i18n_gettext( + 5, + 'Koodo Mobile', + 'csc', + 'name' + ), + '$number@msg.telus.com', + TRUE + ), + ( + 6, + oils_i18n_gettext( + 6, + 'Canada', + 'csc', + 'region' + ), + oils_i18n_gettext( + 6, + 'Fido', + 'csc', + 'name' + ), + '$number@fido.ca', + TRUE + ), + ( + 7, + oils_i18n_gettext( + 7, + 'Canada', + 'csc', + 'region' + ), + oils_i18n_gettext( + 7, + 'Bell Mobility & Solo Mobile', + 'csc', + 'name' + ), + '$number@txt.bell.ca', + TRUE + ), + ( + 8, + oils_i18n_gettext( + 8, + 'Canada', + 'csc', + 'region' + ), + oils_i18n_gettext( + 8, + 'Bell Mobility & Solo Mobile (Alternate)', + 'csc', + 'name' + ), + '$number@txt.bellmobility.ca', + TRUE + ), + ( + 9, + oils_i18n_gettext( + 9, + 'Canada', + 'csc', + 'region' + ), + oils_i18n_gettext( + 9, + 'Aliant', + 'csc', + 'name' + ), + '$number@sms.wirefree.informe.ca', + TRUE + ), + ( + 10, + oils_i18n_gettext( + 10, + 'Canada', + 'csc', + 'region' + ), + oils_i18n_gettext( + 10, + 'PC Telecom', + 'csc', + 'name' + ), + '$number@mobiletxt.ca', + TRUE + ), + ( + 11, + oils_i18n_gettext( + 11, + 'Canada', + 'csc', + 'region' + ), + oils_i18n_gettext( + 11, + 'SaskTel', + 'csc', + 'name' + ), + '$number@sms.sasktel.com', + TRUE + ), + ( + 12, + oils_i18n_gettext( + 12, + 'Canada', + 'csc', + 'region' + ), + oils_i18n_gettext( + 12, + 'MTS Mobility', + 'csc', + 'name' + ), + '$number@text.mtsmobility.com', + TRUE + ), + ( + 13, + oils_i18n_gettext( + 13, + 'Canada', + 'csc', + 'region' + ), + oils_i18n_gettext( + 13, + 'Virgin Mobile', + 'csc', + 'name' + ), + '$number@vmobile.ca', + TRUE + ), + + -- International + ( + 14, + oils_i18n_gettext( + 14, + 'International', + 'csc', + 'region' + ), + oils_i18n_gettext( + 14, + 'Iridium', + 'csc', + 'name' + ), + '$number@msg.iridium.com', + TRUE + ), + ( + 15, + oils_i18n_gettext( + 15, + 'International', + 'csc', + 'region' + ), + oils_i18n_gettext( + 15, + 'Globalstar', + 'csc', + 'name' + ), + '$number@msg.globalstarusa.com', + TRUE + ), + ( + 16, + oils_i18n_gettext( + 16, + 'International', + 'csc', + 'region' + ), + oils_i18n_gettext( + 16, + 'Bulletin.net', + 'csc', + 'name' + ), + '$number@bulletinmessenger.net', -- International Formatted number + TRUE + ), + ( + 17, + oils_i18n_gettext( + 17, + 'International', + 'csc', + 'region' + ), + oils_i18n_gettext( + 17, + 'Panacea Mobile', + 'csc', + 'name' + ), + '$number@api.panaceamobile.com', + TRUE + ), + + -- USA + ( + 18, + oils_i18n_gettext( + 18, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 18, + 'C Beyond', + 'csc', + 'name' + ), + '$number@cbeyond.sprintpcs.com', + TRUE + ), + ( + 19, + oils_i18n_gettext( + 19, + 'Alaska, USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 19, + 'General Communications, Inc.', + 'csc', + 'name' + ), + '$number@mobile.gci.net', + TRUE + ), + ( + 20, + oils_i18n_gettext( + 20, + 'California, USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 20, + 'Golden State Cellular', + 'csc', + 'name' + ), + '$number@gscsms.com', + TRUE + ), + ( + 21, + oils_i18n_gettext( + 21, + 'Cincinnati, Ohio, USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 21, + 'Cincinnati Bell', + 'csc', + 'name' + ), + '$number@gocbw.com', + TRUE + ), + ( + 22, + oils_i18n_gettext( + 22, + 'Hawaii, USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 22, + 'Hawaiian Telcom Wireless', + 'csc', + 'name' + ), + '$number@hawaii.sprintpcs.com', + TRUE + ), + ( + 23, + oils_i18n_gettext( + 23, + 'Midwest, USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 23, + 'i wireless (T-Mobile)', + 'csc', + 'name' + ), + '$number.iws@iwspcs.net', + TRUE + ), + ( + 24, + oils_i18n_gettext( + 24, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 24, + 'i-wireless (Sprint PCS)', + 'csc', + 'name' + ), + '$number@iwirelesshometext.com', + TRUE + ), + ( + 25, + oils_i18n_gettext( + 25, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 25, + 'MetroPCS', + 'csc', + 'name' + ), + '$number@mymetropcs.com', + TRUE + ), + ( + 26, + oils_i18n_gettext( + 26, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 26, + 'Kajeet', + 'csc', + 'name' + ), + '$number@mobile.kajeet.net', + TRUE + ), + ( + 27, + oils_i18n_gettext( + 27, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 27, + 'Element Mobile', + 'csc', + 'name' + ), + '$number@SMS.elementmobile.net', + TRUE + ), + ( + 28, + oils_i18n_gettext( + 28, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 28, + 'Esendex', + 'csc', + 'name' + ), + '$number@echoemail.net', + TRUE + ), + ( + 29, + oils_i18n_gettext( + 29, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 29, + 'Boost Mobile', + 'csc', + 'name' + ), + '$number@myboostmobile.com', + TRUE + ), + ( + 30, + oils_i18n_gettext( + 30, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 30, + 'BellSouth', + 'csc', + 'name' + ), + '$number@bellsouth.com', + TRUE + ), + ( + 31, + oils_i18n_gettext( + 31, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 31, + 'Bluegrass Cellular', + 'csc', + 'name' + ), + '$number@sms.bluecell.com', + TRUE + ), + ( + 32, + oils_i18n_gettext( + 32, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 32, + 'AT&T Enterprise Paging', + 'csc', + 'name' + ), + '$number@page.att.net', + TRUE + ), + ( + 33, + oils_i18n_gettext( + 33, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 33, + 'AT&T Mobility/Wireless', + 'csc', + 'name' + ), + '$number@txt.att.net', + TRUE + ), + ( + 34, + oils_i18n_gettext( + 34, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 34, + 'AT&T Global Smart Messaging Suite', + 'csc', + 'name' + ), + '$number@sms.smartmessagingsuite.com', + TRUE + ), + ( + 35, + oils_i18n_gettext( + 35, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 35, + 'Alltel (Allied Wireless)', + 'csc', + 'name' + ), + '$number@sms.alltelwireless.com', + TRUE + ), + ( + 36, + oils_i18n_gettext( + 36, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 36, + 'Alaska Communications', + 'csc', + 'name' + ), + '$number@msg.acsalaska.com', + TRUE + ), + ( + 37, + oils_i18n_gettext( + 37, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 37, + 'Ameritech', + 'csc', + 'name' + ), + '$number@paging.acswireless.com', + TRUE + ), + ( + 38, + oils_i18n_gettext( + 38, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 38, + 'Cingular (GoPhone prepaid)', + 'csc', + 'name' + ), + '$number@cingulartext.com', + TRUE + ), + ( + 39, + oils_i18n_gettext( + 39, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 39, + 'Cingular (Postpaid)', + 'csc', + 'name' + ), + '$number@cingular.com', + TRUE + ), + ( + 40, + oils_i18n_gettext( + 40, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 40, + 'Cellular One (Dobson) / O2 / Orange', + 'csc', + 'name' + ), + '$number@mobile.celloneusa.com', + TRUE + ), + ( + 41, + oils_i18n_gettext( + 41, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 41, + 'Cellular South', + 'csc', + 'name' + ), + '$number@csouth1.com', + TRUE + ), + ( + 42, + oils_i18n_gettext( + 42, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 42, + 'Cellcom', + 'csc', + 'name' + ), + '$number@cellcom.quiktxt.com', + TRUE + ), + ( + 43, + oils_i18n_gettext( + 43, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 43, + 'Chariton Valley Wireless', + 'csc', + 'name' + ), + '$number@sms.cvalley.net', + TRUE + ), + ( + 44, + oils_i18n_gettext( + 44, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 44, + 'Cricket', + 'csc', + 'name' + ), + '$number@sms.mycricket.com', + TRUE + ), + ( + 45, + oils_i18n_gettext( + 45, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 45, + 'Cleartalk Wireless', + 'csc', + 'name' + ), + '$number@sms.cleartalk.us', + TRUE + ), + ( + 46, + oils_i18n_gettext( + 46, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 46, + 'Edge Wireless', + 'csc', + 'name' + ), + '$number@sms.edgewireless.com', + TRUE + ), + ( + 47, + oils_i18n_gettext( + 47, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 47, + 'Syringa Wireless', + 'csc', + 'name' + ), + '$number@rinasms.com', + TRUE + ), + ( + 48, + oils_i18n_gettext( + 48, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 48, + 'T-Mobile', + 'csc', + 'name' + ), + '$number@tmomail.net', + TRUE + ), + ( + 49, + oils_i18n_gettext( + 49, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 49, + 'Straight Talk / PagePlus Cellular', + 'csc', + 'name' + ), + '$number@vtext.com', + TRUE + ), + ( + 50, + oils_i18n_gettext( + 50, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 50, + 'South Central Communications', + 'csc', + 'name' + ), + '$number@rinasms.com', + TRUE + ), + ( + 51, + oils_i18n_gettext( + 51, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 51, + 'Simple Mobile', + 'csc', + 'name' + ), + '$number@smtext.com', + TRUE + ), + ( + 52, + oils_i18n_gettext( + 52, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 52, + 'Sprint (PCS)', + 'csc', + 'name' + ), + '$number@messaging.sprintpcs.com', + TRUE + ), + ( + 53, + oils_i18n_gettext( + 53, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 53, + 'Nextel', + 'csc', + 'name' + ), + '$number@messaging.nextel.com', + TRUE + ), + ( + 54, + oils_i18n_gettext( + 54, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 54, + 'Pioneer Cellular', + 'csc', + 'name' + ), + '$number@zsend.com', -- nine digit number + TRUE + ), + ( + 55, + oils_i18n_gettext( + 55, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 55, + 'Qwest Wireless', + 'csc', + 'name' + ), + '$number@qwestmp.com', + TRUE + ), + ( + 56, + oils_i18n_gettext( + 56, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 56, + 'US Cellular', + 'csc', + 'name' + ), + '$number@email.uscc.net', + TRUE + ), + ( + 57, + oils_i18n_gettext( + 57, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 57, + 'Unicel', + 'csc', + 'name' + ), + '$number@utext.com', + TRUE + ), + ( + 58, + oils_i18n_gettext( + 58, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 58, + 'Teleflip', + 'csc', + 'name' + ), + '$number@teleflip.com', + TRUE + ), + ( + 59, + oils_i18n_gettext( + 59, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 59, + 'Virgin Mobile', + 'csc', + 'name' + ), + '$number@vmobl.com', + TRUE + ), + ( + 60, + oils_i18n_gettext( + 60, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 60, + 'Verizon Wireless', + 'csc', + 'name' + ), + '$number@vtext.com', + TRUE + ), + ( + 61, + oils_i18n_gettext( + 61, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 61, + 'USA Mobility', + 'csc', + 'name' + ), + '$number@usamobility.net', + TRUE + ), + ( + 62, + oils_i18n_gettext( + 62, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 62, + 'Viaero', + 'csc', + 'name' + ), + '$number@viaerosms.com', + TRUE + ), + ( + 63, + oils_i18n_gettext( + 63, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 63, + 'TracFone', + 'csc', + 'name' + ), + '$number@mmst5.tracfone.com', + TRUE + ), + ( + 64, + oils_i18n_gettext( + 64, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 64, + 'Centennial Wireless', + 'csc', + 'name' + ), + '$number@cwemail.com', + TRUE + ), + + -- South Korea and USA + ( + 65, + oils_i18n_gettext( + 65, + 'South Korea and USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 65, + 'Helio', + 'csc', + 'name' + ), + '$number@myhelio.com', + TRUE + ) +; + +INSERT INTO permission.perm_list ( id, code, description ) VALUES + ( + 517, + 'ADMIN_SMS_CARRIER', + oils_i18n_gettext( + 517, + 'Allows a user to add/create/delete SMS Carrier entries.', + 'ppl', + 'description' + ) + ) +; + +INSERT INTO permission.grp_perm_map (grp, perm, depth, grantable) + SELECT + pgt.id, perm.id, aout.depth, TRUE + FROM + permission.grp_tree pgt, + permission.perm_list perm, + actor.org_unit_type aout + WHERE + pgt.name = 'Global Administrator' AND + aout.name = 'Consortium' AND + perm.code = 'ADMIN_SMS_CARRIER'; + +INSERT INTO action_trigger.reactor ( + module, + description +) VALUES ( + 'SendSMS', + 'Send an SMS text message based on a user-defined template' +); + +INSERT INTO action_trigger.event_definition ( + active, + owner, + name, + hook, + validator, + reactor, + cleanup_success, + delay, + delay_field, + group_field, + template +) VALUES ( + true, + 1, -- admin + 'Hold Ready for Pickup SMS Notification', + 'hold.available', + 'HoldIsAvailable', + 'SendSMS', + 'CreateHoldNotification', + '00:30:00', + 'shelf_time', + 'sms_notify', + '[%- USE date -%] +[%- user = target.0.usr -%] +From: [%- params.sender_email || default_sender %] +To: [%- params.recipient_email || helpers.get_sms_gateway_email(target.0.sms_carrier,target.0.sms_notify) %] +Subject: [% target.size %] hold(s) ready + +[% FOR hold IN target %][%- + bibxml = helpers.xml_doc( hold.current_copy.call_number.record.marc ); + title = ""; + FOR part IN bibxml.findnodes(''//*[@tag="245"]/*[@code="a"]''); + title = title _ part.textContent; + END; + author = bibxml.findnodes(''//*[@tag="100"]/*[@code="a"]'').textContent; +%][% hold.usr.first_given_name %]:[% title %] @ [% hold.pickup_lib.name %] +[% END %] +' +); + +INSERT INTO action_trigger.environment ( + event_def, + path +) VALUES ( + currval('action_trigger.event_definition_id_seq'), + 'current_copy.call_number.record.simple_record' +), ( + currval('action_trigger.event_definition_id_seq'), + 'usr' +), ( + currval('action_trigger.event_definition_id_seq'), + 'pickup_lib.billing_address' +); + +INSERT INTO action_trigger.hook( + key, + core_type, + description, + passive +) VALUES ( + 'acn.format.sms_text', + 'acn', + oils_i18n_gettext( + 'acn.format.sms_text', + 'A text message has been requested for a call number.', + 'ath', + 'description' + ), + FALSE +); + +INSERT INTO action_trigger.event_definition ( + active, + owner, + name, + hook, + validator, + reactor, + template +) VALUES ( + true, + 1, -- admin + 'SMS Call Number', + 'acn.format.sms_text', + 'NOOP_True', + 'SendSMS', + '[%- USE date -%] +From: [%- params.sender_email || default_sender %] +To: [%- params.recipient_email || helpers.get_sms_gateway_email(user_data.sms_carrier,user_data.sms_notify) %] +Subject: Call Number + +[%- + bibxml = helpers.xml_doc( target.record.marc ); + title = ""; + FOR part IN bibxml.findnodes(''//*[@tag="245"]/*[@code="a" or @code="b"]''); + title = title _ part.textContent; + END; + author = bibxml.findnodes(''//*[@tag="100"]/*[@code="a"]'').textContent; +%] +Call Number: [% target.label %] +Location: [% helpers.get_most_populous_location( target.id ).name %] +Library: [% target.owning_lib.name %] +[%- IF title %] +Title: [% title %] +[%- END %] +[%- IF author %] +Author: [% author %] +[%- END %] +' +); + +INSERT INTO action_trigger.environment ( + event_def, + path +) VALUES ( + currval('action_trigger.event_definition_id_seq'), + 'record.simple_record' +), ( + currval('action_trigger.event_definition_id_seq'), + 'owning_lib.billing_address' +); + diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.sms_carriers.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.sms_carriers.sql new file mode 100644 index 0000000000..fc134d6d3d --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.sms_carriers.sql @@ -0,0 +1,1411 @@ +BEGIN; + +SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version); + +-- 950.data.seed-values.sql +INSERT INTO config.settings_group (name, label) VALUES + ( + 'sms', + oils_i18n_gettext( + 'sms', + 'SMS Text Messages', + 'csg', + 'label' + ) + ) +; + +INSERT INTO config.org_unit_setting_type (name, grp, label, description, datatype) VALUES + ( + 'sms.enable', + 'sms', + oils_i18n_gettext( + 'sms.enable', + 'Enable features that send SMS text messages.', + 'coust', + 'label' + ), + oils_i18n_gettext( + 'sms.enable', + 'Current features that use SMS include hold-ready-for-pickup notifications and a "Send Text" action for call numbers in the OPAC. If this setting is not enabled, the SMS options will not be offered to the user. Unless you are carefully silo-ing patrons and their use of the OPAC, the context org for this setting should be the top org in the org hierarchy, otherwise patrons can trample their user settings when jumping between orgs.', + 'coust', + 'description' + ), + 'bool' + ) + ,( + 'sms.disable_authentication_requirement.callnumbers', + 'sms', + oils_i18n_gettext( + 'sms.disable_authentication_requirement.callnumbers', + 'Disable auth requirement for texting call numbers.', + 'coust', + 'label' + ), + oils_i18n_gettext( + 'sms.disable_authentication_requirement.callnumbers', + 'Disable authentication requirement for sending call number information via SMS from the OPAC.', + 'coust', + 'description' + ), + 'bool' + ) +; + +-- 002.schema.config.sql +CREATE TABLE config.sms_carrier ( + id SERIAL PRIMARY KEY, + region TEXT, + name TEXT, + email_gateway TEXT, + active BOOLEAN DEFAULT TRUE +); + +-- 090.schema.action.sql +ALTER TABLE action.hold_request ADD COLUMN sms_notify TEXT; +ALTER TABLE action.hold_request ADD COLUMN sms_carrier INT REFERENCES config.sms_carrier (id); +ALTER TABLE action.hold_request ADD CONSTRAINT sms_check CHECK ( + sms_notify IS NULL + OR sms_carrier IS NOT NULL -- and implied sms_notify IS NOT NULL +); + +-- 950.data.seed-values.sql +INSERT INTO config.usr_setting_type (name,grp,opac_visible,label,description,datatype,fm_class) VALUES ( + 'opac.default_sms_carrier', + 'sms', + TRUE, + oils_i18n_gettext( + 'opac.default_sms_carrier', + 'Default SMS/Text Carrier', + 'cust', + 'label' + ), + oils_i18n_gettext( + 'opac.default_sms_carrier', + 'Default SMS/Text Carrier', + 'cust', + 'description' + ), + 'link', + 'csc' +); + +INSERT INTO config.usr_setting_type (name,grp,opac_visible,label,description,datatype) VALUES ( + 'opac.default_sms_notify', + 'sms', + TRUE, + oils_i18n_gettext( + 'opac.default_sms_notify', + 'Default SMS/Text Number', + 'cust', + 'label' + ), + oils_i18n_gettext( + 'opac.default_sms_notify', + 'Default SMS/Text Number', + 'cust', + 'description' + ), + 'string' +); + +INSERT INTO config.usr_setting_type (name,grp,opac_visible,label,description,datatype) VALUES ( + 'opac.default_phone', + 'opac', + TRUE, + oils_i18n_gettext( + 'opac.default_phone', + 'Default Phone Number', + 'cust', + 'label' + ), + oils_i18n_gettext( + 'opac.default_phone', + 'Default Phone Number', + 'cust', + 'description' + ), + 'string' +); + +SELECT setval( 'config.sms_carrier_id_seq', 1000 ); +INSERT INTO config.sms_carrier VALUES + + -- Testing + ( + 1, + oils_i18n_gettext( + 1, + 'Local', + 'csc', + 'region' + ), + oils_i18n_gettext( + 1, + 'Test Carrier', + 'csc', + 'name' + ), + 'opensrf+$number@localhost', + FALSE + ), + + -- Canada & USA + ( + 2, + oils_i18n_gettext( + 2, + 'Canada & USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 2, + 'Rogers Wireless', + 'csc', + 'name' + ), + '$number@pcs.rogers.com', + TRUE + ), + ( + 3, + oils_i18n_gettext( + 3, + 'Canada & USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 3, + 'Rogers Wireless (Alternate)', + 'csc', + 'name' + ), + '1$number@mms.rogers.com', + TRUE + ), + ( + 4, + oils_i18n_gettext( + 4, + 'Canada & USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 4, + 'Telus Mobility', + 'csc', + 'name' + ), + '$number@msg.telus.com', + TRUE + ), + + -- Canada + ( + 5, + oils_i18n_gettext( + 5, + 'Canada', + 'csc', + 'region' + ), + oils_i18n_gettext( + 5, + 'Koodo Mobile', + 'csc', + 'name' + ), + '$number@msg.telus.com', + TRUE + ), + ( + 6, + oils_i18n_gettext( + 6, + 'Canada', + 'csc', + 'region' + ), + oils_i18n_gettext( + 6, + 'Fido', + 'csc', + 'name' + ), + '$number@fido.ca', + TRUE + ), + ( + 7, + oils_i18n_gettext( + 7, + 'Canada', + 'csc', + 'region' + ), + oils_i18n_gettext( + 7, + 'Bell Mobility & Solo Mobile', + 'csc', + 'name' + ), + '$number@txt.bell.ca', + TRUE + ), + ( + 8, + oils_i18n_gettext( + 8, + 'Canada', + 'csc', + 'region' + ), + oils_i18n_gettext( + 8, + 'Bell Mobility & Solo Mobile (Alternate)', + 'csc', + 'name' + ), + '$number@txt.bellmobility.ca', + TRUE + ), + ( + 9, + oils_i18n_gettext( + 9, + 'Canada', + 'csc', + 'region' + ), + oils_i18n_gettext( + 9, + 'Aliant', + 'csc', + 'name' + ), + '$number@sms.wirefree.informe.ca', + TRUE + ), + ( + 10, + oils_i18n_gettext( + 10, + 'Canada', + 'csc', + 'region' + ), + oils_i18n_gettext( + 10, + 'PC Telecom', + 'csc', + 'name' + ), + '$number@mobiletxt.ca', + TRUE + ), + ( + 11, + oils_i18n_gettext( + 11, + 'Canada', + 'csc', + 'region' + ), + oils_i18n_gettext( + 11, + 'SaskTel', + 'csc', + 'name' + ), + '$number@sms.sasktel.com', + TRUE + ), + ( + 12, + oils_i18n_gettext( + 12, + 'Canada', + 'csc', + 'region' + ), + oils_i18n_gettext( + 12, + 'MTS Mobility', + 'csc', + 'name' + ), + '$number@text.mtsmobility.com', + TRUE + ), + ( + 13, + oils_i18n_gettext( + 13, + 'Canada', + 'csc', + 'region' + ), + oils_i18n_gettext( + 13, + 'Virgin Mobile', + 'csc', + 'name' + ), + '$number@vmobile.ca', + TRUE + ), + + -- International + ( + 14, + oils_i18n_gettext( + 14, + 'International', + 'csc', + 'region' + ), + oils_i18n_gettext( + 14, + 'Iridium', + 'csc', + 'name' + ), + '$number@msg.iridium.com', + TRUE + ), + ( + 15, + oils_i18n_gettext( + 15, + 'International', + 'csc', + 'region' + ), + oils_i18n_gettext( + 15, + 'Globalstar', + 'csc', + 'name' + ), + '$number@msg.globalstarusa.com', + TRUE + ), + ( + 16, + oils_i18n_gettext( + 16, + 'International', + 'csc', + 'region' + ), + oils_i18n_gettext( + 16, + 'Bulletin.net', + 'csc', + 'name' + ), + '$number@bulletinmessenger.net', -- International Formatted number + TRUE + ), + ( + 17, + oils_i18n_gettext( + 17, + 'International', + 'csc', + 'region' + ), + oils_i18n_gettext( + 17, + 'Panacea Mobile', + 'csc', + 'name' + ), + '$number@api.panaceamobile.com', + TRUE + ), + + -- USA + ( + 18, + oils_i18n_gettext( + 18, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 18, + 'C Beyond', + 'csc', + 'name' + ), + '$number@cbeyond.sprintpcs.com', + TRUE + ), + ( + 19, + oils_i18n_gettext( + 19, + 'Alaska, USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 19, + 'General Communications, Inc.', + 'csc', + 'name' + ), + '$number@mobile.gci.net', + TRUE + ), + ( + 20, + oils_i18n_gettext( + 20, + 'California, USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 20, + 'Golden State Cellular', + 'csc', + 'name' + ), + '$number@gscsms.com', + TRUE + ), + ( + 21, + oils_i18n_gettext( + 21, + 'Cincinnati, Ohio, USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 21, + 'Cincinnati Bell', + 'csc', + 'name' + ), + '$number@gocbw.com', + TRUE + ), + ( + 22, + oils_i18n_gettext( + 22, + 'Hawaii, USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 22, + 'Hawaiian Telcom Wireless', + 'csc', + 'name' + ), + '$number@hawaii.sprintpcs.com', + TRUE + ), + ( + 23, + oils_i18n_gettext( + 23, + 'Midwest, USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 23, + 'i wireless (T-Mobile)', + 'csc', + 'name' + ), + '$number.iws@iwspcs.net', + TRUE + ), + ( + 24, + oils_i18n_gettext( + 24, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 24, + 'i-wireless (Sprint PCS)', + 'csc', + 'name' + ), + '$number@iwirelesshometext.com', + TRUE + ), + ( + 25, + oils_i18n_gettext( + 25, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 25, + 'MetroPCS', + 'csc', + 'name' + ), + '$number@mymetropcs.com', + TRUE + ), + ( + 26, + oils_i18n_gettext( + 26, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 26, + 'Kajeet', + 'csc', + 'name' + ), + '$number@mobile.kajeet.net', + TRUE + ), + ( + 27, + oils_i18n_gettext( + 27, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 27, + 'Element Mobile', + 'csc', + 'name' + ), + '$number@SMS.elementmobile.net', + TRUE + ), + ( + 28, + oils_i18n_gettext( + 28, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 28, + 'Esendex', + 'csc', + 'name' + ), + '$number@echoemail.net', + TRUE + ), + ( + 29, + oils_i18n_gettext( + 29, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 29, + 'Boost Mobile', + 'csc', + 'name' + ), + '$number@myboostmobile.com', + TRUE + ), + ( + 30, + oils_i18n_gettext( + 30, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 30, + 'BellSouth', + 'csc', + 'name' + ), + '$number@bellsouth.com', + TRUE + ), + ( + 31, + oils_i18n_gettext( + 31, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 31, + 'Bluegrass Cellular', + 'csc', + 'name' + ), + '$number@sms.bluecell.com', + TRUE + ), + ( + 32, + oils_i18n_gettext( + 32, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 32, + 'AT&T Enterprise Paging', + 'csc', + 'name' + ), + '$number@page.att.net', + TRUE + ), + ( + 33, + oils_i18n_gettext( + 33, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 33, + 'AT&T Mobility/Wireless', + 'csc', + 'name' + ), + '$number@txt.att.net', + TRUE + ), + ( + 34, + oils_i18n_gettext( + 34, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 34, + 'AT&T Global Smart Messaging Suite', + 'csc', + 'name' + ), + '$number@sms.smartmessagingsuite.com', + TRUE + ), + ( + 35, + oils_i18n_gettext( + 35, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 35, + 'Alltel (Allied Wireless)', + 'csc', + 'name' + ), + '$number@sms.alltelwireless.com', + TRUE + ), + ( + 36, + oils_i18n_gettext( + 36, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 36, + 'Alaska Communications', + 'csc', + 'name' + ), + '$number@msg.acsalaska.com', + TRUE + ), + ( + 37, + oils_i18n_gettext( + 37, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 37, + 'Ameritech', + 'csc', + 'name' + ), + '$number@paging.acswireless.com', + TRUE + ), + ( + 38, + oils_i18n_gettext( + 38, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 38, + 'Cingular (GoPhone prepaid)', + 'csc', + 'name' + ), + '$number@cingulartext.com', + TRUE + ), + ( + 39, + oils_i18n_gettext( + 39, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 39, + 'Cingular (Postpaid)', + 'csc', + 'name' + ), + '$number@cingular.com', + TRUE + ), + ( + 40, + oils_i18n_gettext( + 40, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 40, + 'Cellular One (Dobson) / O2 / Orange', + 'csc', + 'name' + ), + '$number@mobile.celloneusa.com', + TRUE + ), + ( + 41, + oils_i18n_gettext( + 41, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 41, + 'Cellular South', + 'csc', + 'name' + ), + '$number@csouth1.com', + TRUE + ), + ( + 42, + oils_i18n_gettext( + 42, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 42, + 'Cellcom', + 'csc', + 'name' + ), + '$number@cellcom.quiktxt.com', + TRUE + ), + ( + 43, + oils_i18n_gettext( + 43, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 43, + 'Chariton Valley Wireless', + 'csc', + 'name' + ), + '$number@sms.cvalley.net', + TRUE + ), + ( + 44, + oils_i18n_gettext( + 44, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 44, + 'Cricket', + 'csc', + 'name' + ), + '$number@sms.mycricket.com', + TRUE + ), + ( + 45, + oils_i18n_gettext( + 45, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 45, + 'Cleartalk Wireless', + 'csc', + 'name' + ), + '$number@sms.cleartalk.us', + TRUE + ), + ( + 46, + oils_i18n_gettext( + 46, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 46, + 'Edge Wireless', + 'csc', + 'name' + ), + '$number@sms.edgewireless.com', + TRUE + ), + ( + 47, + oils_i18n_gettext( + 47, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 47, + 'Syringa Wireless', + 'csc', + 'name' + ), + '$number@rinasms.com', + TRUE + ), + ( + 48, + oils_i18n_gettext( + 48, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 48, + 'T-Mobile', + 'csc', + 'name' + ), + '$number@tmomail.net', + TRUE + ), + ( + 49, + oils_i18n_gettext( + 49, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 49, + 'Straight Talk / PagePlus Cellular', + 'csc', + 'name' + ), + '$number@vtext.com', + TRUE + ), + ( + 50, + oils_i18n_gettext( + 50, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 50, + 'South Central Communications', + 'csc', + 'name' + ), + '$number@rinasms.com', + TRUE + ), + ( + 51, + oils_i18n_gettext( + 51, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 51, + 'Simple Mobile', + 'csc', + 'name' + ), + '$number@smtext.com', + TRUE + ), + ( + 52, + oils_i18n_gettext( + 52, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 52, + 'Sprint (PCS)', + 'csc', + 'name' + ), + '$number@messaging.sprintpcs.com', + TRUE + ), + ( + 53, + oils_i18n_gettext( + 53, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 53, + 'Nextel', + 'csc', + 'name' + ), + '$number@messaging.nextel.com', + TRUE + ), + ( + 54, + oils_i18n_gettext( + 54, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 54, + 'Pioneer Cellular', + 'csc', + 'name' + ), + '$number@zsend.com', -- nine digit number + TRUE + ), + ( + 55, + oils_i18n_gettext( + 55, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 55, + 'Qwest Wireless', + 'csc', + 'name' + ), + '$number@qwestmp.com', + TRUE + ), + ( + 56, + oils_i18n_gettext( + 56, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 56, + 'US Cellular', + 'csc', + 'name' + ), + '$number@email.uscc.net', + TRUE + ), + ( + 57, + oils_i18n_gettext( + 57, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 57, + 'Unicel', + 'csc', + 'name' + ), + '$number@utext.com', + TRUE + ), + ( + 58, + oils_i18n_gettext( + 58, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 58, + 'Teleflip', + 'csc', + 'name' + ), + '$number@teleflip.com', + TRUE + ), + ( + 59, + oils_i18n_gettext( + 59, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 59, + 'Virgin Mobile', + 'csc', + 'name' + ), + '$number@vmobl.com', + TRUE + ), + ( + 60, + oils_i18n_gettext( + 60, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 60, + 'Verizon Wireless', + 'csc', + 'name' + ), + '$number@vtext.com', + TRUE + ), + ( + 61, + oils_i18n_gettext( + 61, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 61, + 'USA Mobility', + 'csc', + 'name' + ), + '$number@usamobility.net', + TRUE + ), + ( + 62, + oils_i18n_gettext( + 62, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 62, + 'Viaero', + 'csc', + 'name' + ), + '$number@viaerosms.com', + TRUE + ), + ( + 63, + oils_i18n_gettext( + 63, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 63, + 'TracFone', + 'csc', + 'name' + ), + '$number@mmst5.tracfone.com', + TRUE + ), + ( + 64, + oils_i18n_gettext( + 64, + 'USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 64, + 'Centennial Wireless', + 'csc', + 'name' + ), + '$number@cwemail.com', + TRUE + ), + + -- South Korea and USA + ( + 65, + oils_i18n_gettext( + 65, + 'South Korea and USA', + 'csc', + 'region' + ), + oils_i18n_gettext( + 65, + 'Helio', + 'csc', + 'name' + ), + '$number@myhelio.com', + TRUE + ) +; + +INSERT INTO permission.perm_list ( id, code, description ) VALUES + ( + 517, + 'ADMIN_SMS_CARRIER', + oils_i18n_gettext( + 517, + 'Allows a user to add/create/delete SMS Carrier entries.', + 'ppl', + 'description' + ) + ) +; + +INSERT INTO permission.grp_perm_map (grp, perm, depth, grantable) + SELECT + pgt.id, perm.id, aout.depth, TRUE + FROM + permission.grp_tree pgt, + permission.perm_list perm, + actor.org_unit_type aout + WHERE + pgt.name = 'Global Administrator' AND + aout.name = 'Consortium' AND + perm.code = 'ADMIN_SMS_CARRIER'; + +INSERT INTO action_trigger.reactor ( + module, + description +) VALUES ( + 'SendSMS', + 'Send an SMS text message based on a user-defined template' +); + +INSERT INTO action_trigger.event_definition ( + active, + owner, + name, + hook, + validator, + reactor, + cleanup_success, + delay, + delay_field, + group_field, + template +) VALUES ( + true, + 1, -- admin + 'Hold Ready for Pickup SMS Notification', + 'hold.available', + 'HoldIsAvailable', + 'SendSMS', + 'CreateHoldNotification', + '00:30:00', + 'shelf_time', + 'sms_notify', + '[%- USE date -%] +[%- user = target.0.usr -%] +From: [%- params.sender_email || default_sender %] +To: [%- params.recipient_email || helpers.get_sms_gateway_email(target.0.sms_carrier,target.0.sms_notify) %] +Subject: [% target.size %] hold(s) ready + +[% FOR hold IN target %][%- + bibxml = helpers.xml_doc( hold.current_copy.call_number.record.marc ); + title = ""; + FOR part IN bibxml.findnodes(''//*[@tag="245"]/*[@code="a"]''); + title = title _ part.textContent; + END; + author = bibxml.findnodes(''//*[@tag="100"]/*[@code="a"]'').textContent; +%][% hold.usr.first_given_name %]:[% title %] @ [% hold.pickup_lib.name %] +[% END %] +' +); + +INSERT INTO action_trigger.environment ( + event_def, + path +) VALUES ( + currval('action_trigger.event_definition_id_seq'), + 'current_copy.call_number.record.simple_record' +), ( + currval('action_trigger.event_definition_id_seq'), + 'usr' +), ( + currval('action_trigger.event_definition_id_seq'), + 'pickup_lib.billing_address' +); + +INSERT INTO action_trigger.hook( + key, + core_type, + description, + passive +) VALUES ( + 'acn.format.sms_text', + 'acn', + oils_i18n_gettext( + 'acn.format.sms_text', + 'A text message has been requested for a call number.', + 'ath', + 'description' + ), + FALSE +); + +INSERT INTO action_trigger.event_definition ( + active, + owner, + name, + hook, + validator, + reactor, + template +) VALUES ( + true, + 1, -- admin + 'SMS Call Number', + 'acn.format.sms_text', + 'NOOP_True', + 'SendSMS', + '[%- USE date -%] +From: [%- params.sender_email || default_sender %] +To: [%- params.recipient_email || helpers.get_sms_gateway_email(user_data.sms_carrier,user_data.sms_notify) %] +Subject: Call Number + +[%- + bibxml = helpers.xml_doc( target.record.marc ); + title = ""; + FOR part IN bibxml.findnodes(''//*[@tag="245"]/*[@code="a" or @code="b"]''); + title = title _ part.textContent; + END; + author = bibxml.findnodes(''//*[@tag="100"]/*[@code="a"]'').textContent; +%] +Call Number: [% target.label %] +Location: [% helpers.get_most_populous_location( target.id ).name %] +Library: [% target.owning_lib.name %] +[%- IF title %] +Title: [% title %] +[%- END %] +[%- IF author %] +Author: [% author %] +[%- END %] +' +); + +INSERT INTO action_trigger.environment ( + event_def, + path +) VALUES ( + currval('action_trigger.event_definition_id_seq'), + 'record.simple_record' +), ( + currval('action_trigger.event_definition_id_seq'), + 'owning_lib.billing_address' +); + + +-- DELETE FROM actor.usr_setting WHERE name = 'opac.default_phone' OR name in ( SELECT name FROM config.usr_setting_type WHERE grp = 'sms' ); DELETE FROM config.usr_setting_type WHERE name = 'opac.default_phone' OR grp = 'sms'; DELETE FROM actor.org_unit_setting WHERE name in ( SELECT name FROM config.org_unit_setting_type WHERE grp = 'sms' ); DELETE FROM config.org_unit_setting_type_log WHERE field_name in ( SELECT name FROM config.org_unit_setting_type WHERE grp = 'sms' ); DELETE FROM config.org_unit_setting_type WHERE grp = 'sms'; DELETE FROM config.settings_group WHERE name = 'sms'; DELETE FROM permission.grp_perm_map WHERE perm = 517; DELETE FROM permission.perm_list WHERE id = 517; ALTER TABLE action.hold_request DROP CONSTRAINT sms_check; ALTER TABLE action.hold_request DROP COLUMN sms_notify; ALTER TABLE action.hold_request DROP COLUMN sms_carrier; DROP TABLE config.sms_carrier; DELETE FROM action_trigger.event WHERE event_def = ( SELECT id FROM action_trigger.event_definition WHERE name = 'Hold Ready for Pickup SMS Notification' ); DELETE FROM action_trigger.environment WHERE event_def = ( SELECT id FROM action_trigger.event_definition WHERE name = 'Hold Ready for Pickup SMS Notification' ); DELETE FROM action_trigger.event_definition WHERE name = 'Hold Ready for Pickup SMS Notification'; DELETE FROM action_trigger.event WHERE event_def IN ( SELECT id FROM action_trigger.event_definition WHERE hook = 'acn.format.sms_text' ); DELETE FROM action_trigger.environment WHERE event_def IN ( SELECT id FROM action_trigger.event_definition WHERE hook = 'acn.format.sms_text' ); DELETE FROM action_trigger.event_definition WHERE hook = 'acn.format.sms_text'; DELETE FROM action_trigger.hook WHERE key = 'acn.format.sms_text'; DELETE FROM action_trigger.reactor WHERE module = 'SendSMS'; DELETE FROM config.upgrade_log WHERE version = 'XXXX'; + +COMMIT; diff --git a/Open-ILS/src/templates/conify/global/config/sms_carrier.tt2 b/Open-ILS/src/templates/conify/global/config/sms_carrier.tt2 new file mode 100644 index 0000000000..ce5d3d94c1 --- /dev/null +++ b/Open-ILS/src/templates/conify/global/config/sms_carrier.tt2 @@ -0,0 +1,27 @@ +[% WRAPPER base.tt2 %] +[% ctx.page_title = 'SMS Carriers' %] + + + + +
+
+
SMS Carriers
+
+ + +
+
+ +
+
+ +[% END %] + + diff --git a/Open-ILS/src/templates/opac/myopac/prefs_notify.tt2 b/Open-ILS/src/templates/opac/myopac/prefs_notify.tt2 index 17d0b67618..98cb03cf0c 100644 --- a/Open-ILS/src/templates/opac/myopac/prefs_notify.tt2 +++ b/Open-ILS/src/templates/opac/myopac/prefs_notify.tt2 @@ -12,6 +12,71 @@ class="opac-button" /> + [% setting = 'opac.hold_notify' %] + + + + + + [% IF ctx.updated_user_settings %] + + [% END %] + + + + + + + + + + + + + + [% IF ctx.get_org_setting(CGI.param('loc') OR ctx.aou_tree.id, 'sms.enable') == 1 %] + + + + + + + + + + + + + [% END %] + +
+
+ [% l('Account Successfully Updated') %] +
+
[% l('Notify by Email by default when a hold is ready for pickup?') %] + [% setting = 'opac.hold_notify' %] + +
[% l('Notify by Phone by default when a hold is ready for pickup?') %] + [% setting = 'opac.hold_notify' %] + +
[% l('Default Phone Number') %] + [% setting = 'opac.default_phone' %] + +
[% l('Notify by Text by default when a hold is ready for pickup?') %] + [% setting = 'opac.hold_notify' %] + +
[% l('Default Mobile Carrier') %][% INCLUDE "opac/parts/sms_carrier_selector.tt2" sms_carrier_hide_label="true" %]
[% l('Default Mobile Number') %] + [% setting = 'opac.default_sms_notify' %] + + [% l('Hint: use the full 10 digits of your phone #, no spaces, no dashes'); %] +
+ diff --git a/Open-ILS/src/templates/opac/parts/place_hold.tt2 b/Open-ILS/src/templates/opac/parts/place_hold.tt2 index adb14837be..bd95814ead 100644 --- a/Open-ILS/src/templates/opac/parts/place_hold.tt2 +++ b/Open-ILS/src/templates/opac/parts/place_hold.tt2 @@ -70,6 +70,35 @@ [% PROCESS "opac/parts/org_selector.tt2"; PROCESS build_org_selector name='pickup_lib' value=ctx.default_pickup_lib id='pickup_lib' can_have_vols_only=1 %]

+

+ [% l('Notify when hold is ready for pickup?') %] +

+ + [% l('Yes, by Email') %]
+ + [% l('Yes, by Phone') %]
+
+ [% l('Phone Number:') %] +
+ [% IF ctx.get_org_setting(CGI.param('loc') OR ctx.aou_tree.id, 'sms.enable') == 1 %] + + [% l('Yes, by Text Messaging') %]
+
+ [% INCLUDE "opac/parts/sms_carrier_selector.tt2" %]
+ [% INCLUDE "opac/parts/sms_number_textbox.tt2" %]
+
+ [% END %] +
+

+

+ [% |l %]If you use the Traveling Library Center (TLC) and ABC Express + services, please select "Outreach" to have the item delivered + during your scheduled visit.[% END %] +

       diff --git a/Open-ILS/src/templates/opac/parts/record/copy_table.tt2 b/Open-ILS/src/templates/opac/parts/record/copy_table.tt2 index f6af5b1c09..c06c694eb9 100644 --- a/Open-ILS/src/templates/opac/parts/record/copy_table.tt2 +++ b/Open-ILS/src/templates/opac/parts/record/copy_table.tt2 @@ -48,7 +48,7 @@ END; org_name | html -%] - + [%- IF has_parts == 'true' %] [%- END %] diff --git a/Open-ILS/src/templates/opac/parts/sms_carrier_selector.tt2 b/Open-ILS/src/templates/opac/parts/sms_carrier_selector.tt2 new file mode 100644 index 0000000000..919ba074d1 --- /dev/null +++ b/Open-ILS/src/templates/opac/parts/sms_carrier_selector.tt2 @@ -0,0 +1,28 @@ +[% + setting = 'opac.default_sms_carrier'; + IF ctx.user_setting_map.$setting; + default_carrier = ctx.user_setting_map.$setting; + END; + + temp = ctx.search_csc('active','t'); + + # turn the list of objects into a list of hashes to + # leverage TT's array.sort('') behavior + carriers = []; + FOR o IN temp; + carriers.push({ + id => o.id, + region => o.region, + name => o.name + }); + END; +%] +[% IF NOT sms_carrier_hide_label; l('Mobile carrier:'); END; %] + +[% IF NOT sms_carrier_hide_warning; l('Note: carrier charges may apply'); END; %] diff --git a/Open-ILS/src/templates/opac/parts/sms_number_textbox.tt2 b/Open-ILS/src/templates/opac/parts/sms_number_textbox.tt2 new file mode 100644 index 0000000000..e8d7eb8029 --- /dev/null +++ b/Open-ILS/src/templates/opac/parts/sms_number_textbox.tt2 @@ -0,0 +1,4 @@ +[% IF NOT sms_number_hide_label; l('Mobile number:'); END; %] + +[% IF NOT sms_number_hide_hint; l('Hint: use the full 10 digits of your phone #, no spaces, no dashes'); END; %] diff --git a/Open-ILS/src/templates/opac/sms_cn.tt2 b/Open-ILS/src/templates/opac/sms_cn.tt2 new file mode 100644 index 0000000000..6a1dc16db5 --- /dev/null +++ b/Open-ILS/src/templates/opac/sms_cn.tt2 @@ -0,0 +1,49 @@ +[% PROCESS "opac/parts/header.tt2"; + WRAPPER "opac/parts/base.tt2"; + INCLUDE "opac/parts/topnav.tt2"; + ctx.page_title = l("Send Call Number via Text/SMS") %] +
+ [% INCLUDE "opac/parts/searchbar.tt2" %] +
+
+
+
+
+

+ [% IF ctx.event != -1 %] +
+ [% IF ctx.sms_notify %] +

Your message has been sent!

+ Return to record +
[% ctx.event.template_output.data %]
+ [% ELSE %] +

Text call number

+ Return to record +
[% ctx.event.template_output.data %]
+
+
+
+ + + [% INCLUDE "opac/parts/sms_carrier_selector.tt2" sms_carrier_hide_warning="true" %]
+ [% INCLUDE "opac/parts/sms_number_textbox.tt2" %]
+ +
[% l('Note: carrier charges may apply'); %] +
+ +
+ [% END %] + [% ELSE %] + SMS not enabled for this site. + [% END %] +

+
+
+
+
+[% END %] diff --git a/Open-ILS/web/js/ui/default/conify/global/config/sms_carrier.js b/Open-ILS/web/js/ui/default/conify/global/config/sms_carrier.js new file mode 100644 index 0000000000..80407e5418 --- /dev/null +++ b/Open-ILS/web/js/ui/default/conify/global/config/sms_carrier.js @@ -0,0 +1,46 @@ +dojo.require('dojox.grid.DataGrid'); +dojo.require('openils.widget.AutoGrid'); +dojo.require('dojox.grid.cells.dijit'); +dojo.require('dojo.data.ItemFileWriteStore'); +dojo.require('dijit.Dialog'); +dojo.require('openils.PermaCrud'); + +var thingList; + +function thingInit() { + + thingGrid.disableSelectorForRow = function(rowIdx) { + var item = thingGrid.getItem(rowIdx); + return (thingGrid.store.getValue(item, 'id') < 0); + } + + buildGrid(); +} + +function buildGrid() { + + fieldmapper.standardRequest( + ['open-ils.pcrud', 'open-ils.pcrud.search.csc.atomic'], + { async: true, + params: [ + openils.User.authtoken, + {"id":{"!=":null}}, + {"order_by":{"csc":"name"}} + ], + oncomplete: function(r) { + if(thingList = openils.Util.readResponse(r)) { + thingList = openils.Util.objectSort(thingList,'name'); + dojo.forEach(thingList, + function(e) { + thingGrid.store.newItem(csc.toStoreItem(e)); + } + ); + } + } + } + ); +} + +openils.Util.addOnLoad(thingInit); + + diff --git a/Open-ILS/web/opac/locale/en-US/lang.dtd b/Open-ILS/web/opac/locale/en-US/lang.dtd index c26e5b8050..e2bc1bbf61 100644 --- a/Open-ILS/web/opac/locale/en-US/lang.dtd +++ b/Open-ILS/web/opac/locale/en-US/lang.dtd @@ -729,6 +729,7 @@ + @@ -2510,8 +2511,12 @@ - + + + + + diff --git a/Open-ILS/xul/staff_client/chrome/content/OpenILS/data.js b/Open-ILS/xul/staff_client/chrome/content/OpenILS/data.js index c256315f8c..0dda428d5f 100644 --- a/Open-ILS/xul/staff_client/chrome/content/OpenILS/data.js +++ b/Open-ILS/xul/staff_client/chrome/content/OpenILS/data.js @@ -436,7 +436,7 @@ OpenILS.data.prototype = { }, 'hold_slip' : { 'type' : 'holds', - 'header' : 'This item needs to be routed to %route_to%:
\r\nBarcode: %item_barcode%
\r\nTitle: %item_title%
\r\n
\r\n%hold_for_msg%
\r\nBarcode: %PATRON_BARCODE%
\r\nNotify by phone: %notify_by_phone%
\r\nNotify by email: %notify_by_email%
\r\n', + 'header' : 'This item needs to be routed to %route_to%:
\r\nBarcode: %item_barcode%
\r\nTitle: %item_title%
\r\n
\r\n%hold_for_msg%
\r\nBarcode: %PATRON_BARCODE%
\r\nNotify by phone: %notify_by_phone%
\r\nNotified by text: %notify_by_text%
\r\nNotified by email: %notify_by_email%
\r\n', 'line_item' : '%formatted_note%
\r\n', 'footer' : '
\r\nRequest date: %request_date%
\r\nSlip Date: %TODAY_TRIM%
\r\nPrinted by %STAFF_FIRSTNAME% at %SHORTNAME%
\r\n
\r\n' }, @@ -448,7 +448,7 @@ OpenILS.data.prototype = { }, 'hold_transit_slip' : { 'type' : 'transits', - 'header' : 'This item needs to be routed to %route_to%:
\r\n%route_to_org_fullname%
\r\n%street1%
\r\n%street2%
\r\n%city_state_zip%
\r\n
\r\nBarcode: %item_barcode%
\r\nTitle: %item_title%
\r\nAuthor: %item_author%
\r\n
\r\n%hold_for_msg%
\r\nBarcode: %PATRON_BARCODE%
\r\nNotify by phone: %notify_by_phone%
\r\nNotify by email: %notify_by_email%
\r\n', + 'header' : 'This item needs to be routed to %route_to%:
\r\n%route_to_org_fullname%
\r\n%street1%
\r\n%street2%
\r\n%city_state_zip%
\r\n
\r\nBarcode: %item_barcode%
\r\nTitle: %item_title%
\r\nAuthor: %item_author%
\r\n
\r\n%hold_for_msg%
\r\nBarcode: %PATRON_BARCODE%
\r\nNotify by phone: %notify_by_phone%
\r\nNotified by text: %notify_by_text%
\r\nNotified by email: %notify_by_email%
\r\n', 'line_item' : '%formatted_note%
\r\n', 'footer' : '
\r\nRequest date: %request_date%
\r\nSlip Date: %TODAY_TRIM%
\r\nPrinted by %STAFF_FIRSTNAME% at %SHORTNAME%
\r\n
\r\n' }, @@ -923,6 +923,27 @@ OpenILS.data.prototype = { } ); + this.chain.push( + function() { + var f = gen_fm_retrieval_func( + 'csc', + [ + api.FM_CSC_RETRIEVE_VIA_PCRUD.app, + api.FM_CSC_RETRIEVE_VIA_PCRUD.method, + [ obj.session.key, {"id":{"!=":null}}, {"order_by":{"csc":"name"}} ], + false + ] + ); + try { + f(); + } catch(E) { + var error = 'Error: ' + js2JSON(E); + obj.error.sdump('D_ERROR',error); + throw(E); + } + } + ); + this.chain.push( function() { var f = gen_fm_retrieval_func( diff --git a/Open-ILS/xul/staff_client/chrome/content/main/constants.js b/Open-ILS/xul/staff_client/chrome/content/main/constants.js index f7ecfe0f1f..4120b6feb9 100644 --- a/Open-ILS/xul/staff_client/chrome/content/main/constants.js +++ b/Open-ILS/xul/staff_client/chrome/content/main/constants.js @@ -258,6 +258,7 @@ var api = { 'FM_CNAL_RETRIEVE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.net_access_level.retrieve.all', 'secure' : false }, 'FM_CNCT_RETRIEVE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.non_cat_types.retrieve.all', 'secure' : false }, 'FM_CRAHP_RETRIEVE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.config.rules.age_hold_protect.retrieve.all', 'secure' : false }, + 'FM_CSC_RETRIEVE_VIA_PCRUD' : { 'app' : 'open-ils.pcrud', 'method' : 'open-ils.pcrud.search.csc.atomic' }, 'FM_CSP_PCRUD_SEARCH' : { 'app' : 'open-ils.pcrud', 'method' : 'open-ils.pcrud.search.csp.atomic', 'secure' : false }, 'FM_CST_RETRIEVE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.standings.retrieve', 'secure' : false }, 'FM_MB_CREATE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.money.billing.create' }, diff --git a/Open-ILS/xul/staff_client/chrome/content/main/menu.js b/Open-ILS/xul/staff_client/chrome/content/main/menu.js index ac82ea4868..402acb0e3c 100644 --- a/Open-ILS/xul/staff_client/chrome/content/main/menu.js +++ b/Open-ILS/xul/staff_client/chrome/content/main/menu.js @@ -1000,6 +1000,10 @@ main.menu.prototype = { ['oncommand'], function(event) { open_eg_web_page('conify/global/acq/distribution_formula', null, event); } ], + 'cmd_server_admin_sms_carrier' : [ + ['oncommand'], + function(event) { open_eg_web_page('conify/global/config/sms_carrier', null, event); } + ], 'cmd_server_admin_z39_source' : [ ['oncommand'], function(event) { open_eg_web_page('conify/global/config/z3950_source', null, event); } diff --git a/Open-ILS/xul/staff_client/chrome/content/main/menu_frame_menus.xul b/Open-ILS/xul/staff_client/chrome/content/main/menu_frame_menus.xul index 923000ba29..dd1f479cee 100644 --- a/Open-ILS/xul/staff_client/chrome/content/main/menu_frame_menus.xul +++ b/Open-ILS/xul/staff_client/chrome/content/main/menu_frame_menus.xul @@ -190,6 +190,7 @@ + + diff --git a/Open-ILS/xul/staff_client/server/circ/util.js b/Open-ILS/xul/staff_client/server/circ/util.js index 3b16945843..de7f0e35d1 100644 --- a/Open-ILS/xul/staff_client/server/circ/util.js +++ b/Open-ILS/xul/staff_client/server/circ/util.js @@ -2144,6 +2144,24 @@ circ.util.hold_columns = function(modify,params) { 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.ahr.phone_notify(); } }, + { + 'persist' : 'hidden width ordinal', + 'id' : 'sms_notify', + 'label' : document.getElementById('commonStrings').getString('staff.ahr_sms_notify_label'), + 'flex' : 1, + 'primary' : false, + 'hidden' : true, + 'editable' : false, 'render' : function(my) { return my.ahr.sms_notify(); } + }, + { + 'persist' : 'hidden width ordinal', + 'id' : 'sms_carrier', + 'label' : document.getElementById('commonStrings').getString('staff.ahr_sms_carrier_label'), + 'flex' : 1, + 'primary' : false, + 'hidden' : true, + 'editable' : false, 'render' : function(my) { return data.hash.csc[ my.ahr.sms_carrier() ].name(); } + }, { 'persist' : 'hidden width ordinal', 'id' : 'prev_check_time', @@ -2931,6 +2949,12 @@ circ.util.checkin_via_barcode2 = function(session,params,backdate,auto_print,che msg += print_data.notify_by_phone_msg; msg += '\n'; } + if (check.payload.hold.sms_notify()) { + print_data.notify_by_text_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.hold.sms_notify', [check.payload.hold.sms_notify()]); + print_data.notify_by_text = check.payload.hold.sms_notify(); + msg += print_data.notify_by_text_msg; + msg += '\n'; + } if (get_bool(check.payload.hold.email_notify())) { var payload_email = au_obj.email() ? au_obj.email() : ''; print_data.notify_by_email_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.hold.email_notify', [payload_email]); @@ -3309,6 +3333,12 @@ circ.util.checkin_via_barcode2 = function(session,params,backdate,auto_print,che msg += print_data.notify_by_phone_msg; msg += '\n'; } + if (check.payload.hold.sms_notify()) { + print_data.notify_by_text_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.hold.sms_notify', [check.payload.hold.sms_notify()]); + print_data.notify_by_text = check.payload.hold.sms_notify(); + msg += print_data.notify_by_text_msg; + msg += '\n'; + } if (get_bool(check.payload.hold.email_notify())) { var payload_email = au_obj.email() ? au_obj.email() : ''; print_data.notify_by_email_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.hold.email_notify', [payload_email]); diff --git a/Open-ILS/xul/staff_client/server/locale/en-US/circ.properties b/Open-ILS/xul/staff_client/server/locale/en-US/circ.properties index a8d2ce3fdb..2dc7a100d7 100644 --- a/Open-ILS/xul/staff_client/server/locale/en-US/circ.properties +++ b/Open-ILS/xul/staff_client/server/locale/en-US/circ.properties @@ -364,6 +364,7 @@ staff.circ.utils.holds.shelf_expire_time=Shelf Expire Time staff.circ.utils.payload.hold.patron=Hold for patron %1$s, %2$s %3$s staff.circ.utils.payload.hold.patron_alias=Hold for patron %1$s staff.circ.utils.payload.hold.phone_notify=Notify by phone: %1$s +staff.circ.utils.payload.hold.sms_notify=Notify by text: %1$s staff.circ.utils.payload.hold.email_notify=Notify by email: %1$s staff.circ.utils.payload.hold.request_date=Request Date: %1$s staff.circ.utils.payload.hold.slip_date=Slip Date: %1$s diff --git a/Open-ILS/xul/staff_client/server/locale/en-US/common.properties b/Open-ILS/xul/staff_client/server/locale/en-US/common.properties index f73ab08a97..ce0ac8e692 100644 --- a/Open-ILS/xul/staff_client/server/locale/en-US/common.properties +++ b/Open-ILS/xul/staff_client/server/locale/en-US/common.properties @@ -57,6 +57,8 @@ staff.ahr_holdable_part_label=Holdable Part staff.ahr_issuance_label_label=Issuance Label staff.ahr_id_label=Hold ID staff.ahr_phone_notify_label=Phone Notify +staff.ahr_sms_notify_label=Text Notify +staff.ahr_sms_carrier_label=Text Carrier staff.ahr_pickup_lib_label=Pickup Library staff.ahr_prev_check_time_label=Previous Check Time staff.ahr_requestor_label=Requestor diff --git a/Open-ILS/xul/staff_client/server/locale/en-US/patron.properties b/Open-ILS/xul/staff_client/server/locale/en-US/patron.properties index 4f0ced6a83..f910d3702a 100644 --- a/Open-ILS/xul/staff_client/server/locale/en-US/patron.properties +++ b/Open-ILS/xul/staff_client/server/locale/en-US/patron.properties @@ -171,6 +171,24 @@ staff.patron.holds.holds_edit_phone_notify.choose_phone_number=Choose a Hold Not staff.patron.holds.holds_edit_phone_notify.confirm_phone_number_change.singular=Are you sure you would like to change the Notification Phone Number for hold %1$s to "%2$s"? staff.patron.holds.holds_edit_phone_notify.confirm_phone_number_change.plural=Are you sure you would like to change the Notification Phone Number for holds %1$s to "%2$s"? staff.patron.holds.holds_edit_phone_notify.modifying_holds_title=Modifying Holds +staff.patron.holds.holds_edit_sms_notify.new_phone_number=Please enter a new mobile number for hold notification via text (leave the field empty to disable): +staff.patron.holds.holds_edit_sms_notify.btn_done.label=Done +staff.patron.holds.holds_edit_sms_notify.btn_done.accesskey=D +staff.patron.holds.holds_edit_sms_notify.btn_cancel.label=Cancel +staff.patron.holds.holds_edit_sms_notify.btn_cancel.accesskey=C +staff.patron.holds.holds_edit_sms_notify.choose_phone_number=Choose a Hold Notification Mobile Text Number +staff.patron.holds.holds_edit_sms_notify.confirm_phone_number_change.singular=Are you sure you would like to change the Notification Mobile/Text Number for hold %1$s to "%2$s"? +staff.patron.holds.holds_edit_sms_notify.confirm_phone_number_change.plural=Are you sure you would like to change the Notification Mobile/Text Number for holds %1$s to "%2$s"? +staff.patron.holds.holds_edit_sms_notify.modifying_holds_title=Modifying Holds +staff.patron.holds.holds_edit_sms_carrier.new_carrier=Please select a new mobile carrier for hold notification via text: +staff.patron.holds.holds_edit_sms_carrier.btn_done.label=Done +staff.patron.holds.holds_edit_sms_carrier.btn_done.accesskey=D +staff.patron.holds.holds_edit_sms_carrier.btn_cancel.label=Cancel +staff.patron.holds.holds_edit_sms_carrier.btn_cancel.accesskey=C +staff.patron.holds.holds_edit_sms_carrier.choose_carrier=Select a Hold Notification Mobile Text Carrier +staff.patron.holds.holds_edit_sms_carrier.confirm_carrier_change.singular=Are you sure you would like to change the Notification Mobile/Text Carrier for hold %1$s to "%2$s"? +staff.patron.holds.holds_edit_sms_carrier.confirm_carrier_change.plural=Are you sure you would like to change the Notification Mobile/Text Carrier for holds %1$s to "%2$s"? +staff.patron.holds.holds_edit_sms_carrier.modifying_holds_title=Modifying Holds staff.patron.holds.holds_edit_email_notify.description=Send email notifications (when appropriate)? The email address used is found in the hold recipient account. staff.patron.holds.holds_edit_email_notify.btn_email.label=Email staff.patron.holds.holds_edit_email_notify.btn_email.accesskey=E diff --git a/Open-ILS/xul/staff_client/server/patron/holds.js b/Open-ILS/xul/staff_client/server/patron/holds.js index 190d630ed3..bec92d3c9c 100644 --- a/Open-ILS/xul/staff_client/server/patron/holds.js +++ b/Open-ILS/xul/staff_client/server/patron/holds.js @@ -598,6 +598,133 @@ patron.holds.prototype = { } } ], + + 'cmd_holds_edit_sms_notify' : [ + ['command'], + function() { + try { + var xml = ''; + xml += ''+$("patronStrings").getString('staff.patron.holds.holds_edit_sms_notify.new_phone_number')+''; + xml += ''; + xml += ''; + var bot_xml = ''; + bot_xml += '
[% l('Notifation Type') %] [% callnum | html %][% callnum | html %] [% IF ctx.get_org_setting(CGI.param('loc') OR ctx.aou_tree.id, 'sms.enable') == 1 %](Text)[% END %][% copy_info.part_label | html %]