]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/sql/Pg/upgrade/0666.schema.sms_carriers.sql
LP#1117808: release notes for New Access points for MARC Overlay
[Evergreen.git] / Open-ILS / src / sql / Pg / upgrade / 0666.schema.sms_carriers.sql
1 BEGIN;
2
3 SELECT evergreen.upgrade_deps_block_check('0666', :eg_version);
4
5 -- 950.data.seed-values.sql
6 INSERT INTO config.settings_group (name, label) VALUES
7     (
8         'sms',
9         oils_i18n_gettext(
10             'sms',
11             'SMS Text Messages',
12             'csg',
13             'label'
14         )
15     )
16 ;
17
18 INSERT INTO config.org_unit_setting_type (name, grp, label, description, datatype) VALUES
19     (
20         'sms.enable',
21         'sms',
22         oils_i18n_gettext(
23             'sms.enable',
24             'Enable features that send SMS text messages.',
25             'coust',
26             'label'
27         ),
28         oils_i18n_gettext(
29             'sms.enable',
30             '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.',
31             'coust',
32             'description'
33         ),
34         'bool'
35     )
36     ,(
37         'sms.disable_authentication_requirement.callnumbers',
38         'sms',
39         oils_i18n_gettext(
40             'sms.disable_authentication_requirement.callnumbers',
41             'Disable auth requirement for texting call numbers.',
42             'coust',
43             'label'
44         ),
45         oils_i18n_gettext(
46             'sms.disable_authentication_requirement.callnumbers',
47             'Disable authentication requirement for sending call number information via SMS from the OPAC.',
48             'coust',
49             'description'
50         ),
51         'bool'
52     )
53 ;
54
55 -- 002.schema.config.sql
56 CREATE TABLE config.sms_carrier (
57     id              SERIAL PRIMARY KEY,
58     region          TEXT,
59     name            TEXT,
60     email_gateway   TEXT,
61     active          BOOLEAN DEFAULT TRUE
62 );
63
64 -- 090.schema.action.sql
65 ALTER TABLE action.hold_request ADD COLUMN sms_notify TEXT;
66 ALTER TABLE action.hold_request ADD COLUMN sms_carrier INT REFERENCES config.sms_carrier (id);
67 ALTER TABLE action.hold_request ADD CONSTRAINT sms_check CHECK (
68     sms_notify IS NULL
69     OR sms_carrier IS NOT NULL -- and implied sms_notify IS NOT NULL
70 );
71
72 -- 950.data.seed-values.sql
73 INSERT INTO config.usr_setting_type (name,grp,opac_visible,label,description,datatype,fm_class) VALUES (
74     'opac.default_sms_carrier',
75     'sms',
76     TRUE,
77     oils_i18n_gettext(
78         'opac.default_sms_carrier',
79         'Default SMS/Text Carrier',
80         'cust',
81         'label'
82     ),
83     oils_i18n_gettext(
84         'opac.default_sms_carrier',
85         'Default SMS/Text Carrier',
86         'cust',
87         'description'
88     ),
89     'link',
90     'csc'
91 );
92
93 INSERT INTO config.usr_setting_type (name,grp,opac_visible,label,description,datatype) VALUES (
94     'opac.default_sms_notify',
95     'sms',
96     TRUE,
97     oils_i18n_gettext(
98         'opac.default_sms_notify',
99         'Default SMS/Text Number',
100         'cust',
101         'label'
102     ),
103     oils_i18n_gettext(
104         'opac.default_sms_notify',
105         'Default SMS/Text Number',
106         'cust',
107         'description'
108     ),
109     'string'
110 );
111
112 INSERT INTO config.usr_setting_type (name,grp,opac_visible,label,description,datatype) VALUES (
113     'opac.default_phone',
114     'opac',
115     TRUE,
116     oils_i18n_gettext(
117         'opac.default_phone',
118         'Default Phone Number',
119         'cust',
120         'label'
121     ),
122     oils_i18n_gettext(
123         'opac.default_phone',
124         'Default Phone Number',
125         'cust',
126         'description'
127     ),
128     'string'
129 );
130
131 SELECT setval( 'config.sms_carrier_id_seq', 1000 );
132 INSERT INTO config.sms_carrier VALUES
133
134     -- Testing
135     (
136         1,
137         oils_i18n_gettext(
138             1,
139             'Local',
140             'csc',
141             'region'
142         ),
143         oils_i18n_gettext(
144             1,
145             'Test Carrier',
146             'csc',
147             'name'
148         ),
149         'opensrf+$number@localhost',
150         FALSE
151     ),
152
153     -- Canada & USA
154     (
155         2,
156         oils_i18n_gettext(
157             2,
158             'Canada & USA',
159             'csc',
160             'region'
161         ),
162         oils_i18n_gettext(
163             2,
164             'Rogers Wireless',
165             'csc',
166             'name'
167         ),
168         '$number@pcs.rogers.com',
169         TRUE
170     ),
171     (
172         3,
173         oils_i18n_gettext(
174             3,
175             'Canada & USA',
176             'csc',
177             'region'
178         ),
179         oils_i18n_gettext(
180             3,
181             'Rogers Wireless (Alternate)',
182             'csc',
183             'name'
184         ),
185         '1$number@mms.rogers.com',
186         TRUE
187     ),
188     (
189         4,
190         oils_i18n_gettext(
191             4,
192             'Canada & USA',
193             'csc',
194             'region'
195         ),
196         oils_i18n_gettext(
197             4,
198             'Telus Mobility',
199             'csc',
200             'name'
201         ),
202         '$number@msg.telus.com',
203         TRUE
204     ),
205
206     -- Canada
207     (
208         5,
209         oils_i18n_gettext(
210             5,
211             'Canada',
212             'csc',
213             'region'
214         ),
215         oils_i18n_gettext(
216             5,
217             'Koodo Mobile',
218             'csc',
219             'name'
220         ),
221         '$number@msg.telus.com',
222         TRUE
223     ),
224     (
225         6,
226         oils_i18n_gettext(
227             6,
228             'Canada',
229             'csc',
230             'region'
231         ),
232         oils_i18n_gettext(
233             6,
234             'Fido',
235             'csc',
236             'name'
237         ),
238         '$number@fido.ca',
239         TRUE
240     ),
241     (
242         7,
243         oils_i18n_gettext(
244             7,
245             'Canada',
246             'csc',
247             'region'
248         ),
249         oils_i18n_gettext(
250             7,
251             'Bell Mobility & Solo Mobile',
252             'csc',
253             'name'
254         ),
255         '$number@txt.bell.ca',
256         TRUE
257     ),
258     (
259         8,
260         oils_i18n_gettext(
261             8,
262             'Canada',
263             'csc',
264             'region'
265         ),
266         oils_i18n_gettext(
267             8,
268             'Bell Mobility & Solo Mobile (Alternate)',
269             'csc',
270             'name'
271         ),
272         '$number@txt.bellmobility.ca',
273         TRUE
274     ),
275     (
276         9,
277         oils_i18n_gettext(
278             9,
279             'Canada',
280             'csc',
281             'region'
282         ),
283         oils_i18n_gettext(
284             9,
285             'Aliant',
286             'csc',
287             'name'
288         ),
289         '$number@sms.wirefree.informe.ca',
290         TRUE
291     ),
292     (
293         10,
294         oils_i18n_gettext(
295             10,
296             'Canada',
297             'csc',
298             'region'
299         ),
300         oils_i18n_gettext(
301             10,
302             'PC Telecom',
303             'csc',
304             'name'
305         ),
306         '$number@mobiletxt.ca',
307         TRUE
308     ),
309     (
310         11,
311         oils_i18n_gettext(
312             11,
313             'Canada',
314             'csc',
315             'region'
316         ),
317         oils_i18n_gettext(
318             11,
319             'SaskTel',
320             'csc',
321             'name'
322         ),
323         '$number@sms.sasktel.com',
324         TRUE
325     ),
326     (
327         12,
328         oils_i18n_gettext(
329             12,
330             'Canada',
331             'csc',
332             'region'
333         ),
334         oils_i18n_gettext(
335             12,
336             'MTS Mobility',
337             'csc',
338             'name'
339         ),
340         '$number@text.mtsmobility.com',
341         TRUE
342     ),
343     (
344         13,
345         oils_i18n_gettext(
346             13,
347             'Canada',
348             'csc',
349             'region'
350         ),
351         oils_i18n_gettext(
352             13,
353             'Virgin Mobile',
354             'csc',
355             'name'
356         ),
357         '$number@vmobile.ca',
358         TRUE
359     ),
360
361     -- International
362     (
363         14,
364         oils_i18n_gettext(
365             14,
366             'International',
367             'csc',
368             'region'
369         ),
370         oils_i18n_gettext(
371             14,
372             'Iridium',
373             'csc',
374             'name'
375         ),
376         '$number@msg.iridium.com',
377         TRUE
378     ),
379     (
380         15,
381         oils_i18n_gettext(
382             15,
383             'International',
384             'csc',
385             'region'
386         ),
387         oils_i18n_gettext(
388             15,
389             'Globalstar',
390             'csc',
391             'name'
392         ),
393         '$number@msg.globalstarusa.com',
394         TRUE
395     ),
396     (
397         16,
398         oils_i18n_gettext(
399             16,
400             'International',
401             'csc',
402             'region'
403         ),
404         oils_i18n_gettext(
405             16,
406             'Bulletin.net',
407             'csc',
408             'name'
409         ),
410         '$number@bulletinmessenger.net', -- International Formatted number
411         TRUE
412     ),
413     (
414         17,
415         oils_i18n_gettext(
416             17,
417             'International',
418             'csc',
419             'region'
420         ),
421         oils_i18n_gettext(
422             17,
423             'Panacea Mobile',
424             'csc',
425             'name'
426         ),
427         '$number@api.panaceamobile.com',
428         TRUE
429     ),
430
431     -- USA
432     (
433         18,
434         oils_i18n_gettext(
435             18,
436             'USA',
437             'csc',
438             'region'
439         ),
440         oils_i18n_gettext(
441             18,
442             'C Beyond',
443             'csc',
444             'name'
445         ),
446         '$number@cbeyond.sprintpcs.com',
447         TRUE
448     ),
449     (
450         19,
451         oils_i18n_gettext(
452             19,
453             'Alaska, USA',
454             'csc',
455             'region'
456         ),
457         oils_i18n_gettext(
458             19,
459             'General Communications, Inc.',
460             'csc',
461             'name'
462         ),
463         '$number@mobile.gci.net',
464         TRUE
465     ),
466     (
467         20,
468         oils_i18n_gettext(
469             20,
470             'California, USA',
471             'csc',
472             'region'
473         ),
474         oils_i18n_gettext(
475             20,
476             'Golden State Cellular',
477             'csc',
478             'name'
479         ),
480         '$number@gscsms.com',
481         TRUE
482     ),
483     (
484         21,
485         oils_i18n_gettext(
486             21,
487             'Cincinnati, Ohio, USA',
488             'csc',
489             'region'
490         ),
491         oils_i18n_gettext(
492             21,
493             'Cincinnati Bell',
494             'csc',
495             'name'
496         ),
497         '$number@gocbw.com',
498         TRUE
499     ),
500     (
501         22,
502         oils_i18n_gettext(
503             22,
504             'Hawaii, USA',
505             'csc',
506             'region'
507         ),
508         oils_i18n_gettext(
509             22,
510             'Hawaiian Telcom Wireless',
511             'csc',
512             'name'
513         ),
514         '$number@hawaii.sprintpcs.com',
515         TRUE
516     ),
517     (
518         23,
519         oils_i18n_gettext(
520             23,
521             'Midwest, USA',
522             'csc',
523             'region'
524         ),
525         oils_i18n_gettext(
526             23,
527             'i wireless (T-Mobile)',
528             'csc',
529             'name'
530         ),
531         '$number.iws@iwspcs.net',
532         TRUE
533     ),
534     (
535         24,
536         oils_i18n_gettext(
537             24,
538             'USA',
539             'csc',
540             'region'
541         ),
542         oils_i18n_gettext(
543             24,
544             'i-wireless (Sprint PCS)',
545             'csc',
546             'name'
547         ),
548         '$number@iwirelesshometext.com',
549         TRUE
550     ),
551     (
552         25,
553         oils_i18n_gettext(
554             25,
555             'USA',
556             'csc',
557             'region'
558         ),
559         oils_i18n_gettext(
560             25,
561             'MetroPCS',
562             'csc',
563             'name'
564         ),
565         '$number@mymetropcs.com',
566         TRUE
567     ),
568     (
569         26,
570         oils_i18n_gettext(
571             26,
572             'USA',
573             'csc',
574             'region'
575         ),
576         oils_i18n_gettext(
577             26,
578             'Kajeet',
579             'csc',
580             'name'
581         ),
582         '$number@mobile.kajeet.net',
583         TRUE
584     ),
585     (
586         27,
587         oils_i18n_gettext(
588             27,
589             'USA',
590             'csc',
591             'region'
592         ),
593         oils_i18n_gettext(
594             27,
595             'Element Mobile',
596             'csc',
597             'name'
598         ),
599         '$number@SMS.elementmobile.net',
600         TRUE
601     ),
602     (
603         28,
604         oils_i18n_gettext(
605             28,
606             'USA',
607             'csc',
608             'region'
609         ),
610         oils_i18n_gettext(
611             28,
612             'Esendex',
613             'csc',
614             'name'
615         ),
616         '$number@echoemail.net',
617         TRUE
618     ),
619     (
620         29,
621         oils_i18n_gettext(
622             29,
623             'USA',
624             'csc',
625             'region'
626         ),
627         oils_i18n_gettext(
628             29,
629             'Boost Mobile',
630             'csc',
631             'name'
632         ),
633         '$number@myboostmobile.com',
634         TRUE
635     ),
636     (
637         30,
638         oils_i18n_gettext(
639             30,
640             'USA',
641             'csc',
642             'region'
643         ),
644         oils_i18n_gettext(
645             30,
646             'BellSouth',
647             'csc',
648             'name'
649         ),
650         '$number@bellsouth.com',
651         TRUE
652     ),
653     (
654         31,
655         oils_i18n_gettext(
656             31,
657             'USA',
658             'csc',
659             'region'
660         ),
661         oils_i18n_gettext(
662             31,
663             'Bluegrass Cellular',
664             'csc',
665             'name'
666         ),
667         '$number@sms.bluecell.com',
668         TRUE
669     ),
670     (
671         32,
672         oils_i18n_gettext(
673             32,
674             'USA',
675             'csc',
676             'region'
677         ),
678         oils_i18n_gettext(
679             32,
680             'AT&T Enterprise Paging',
681             'csc',
682             'name'
683         ),
684         '$number@page.att.net',
685         TRUE
686     ),
687     (
688         33,
689         oils_i18n_gettext(
690             33,
691             'USA',
692             'csc',
693             'region'
694         ),
695         oils_i18n_gettext(
696             33,
697             'AT&T Mobility/Wireless',
698             'csc',
699             'name'
700         ),
701         '$number@txt.att.net',
702         TRUE
703     ),
704     (
705         34,
706         oils_i18n_gettext(
707             34,
708             'USA',
709             'csc',
710             'region'
711         ),
712         oils_i18n_gettext(
713             34,
714             'AT&T Global Smart Messaging Suite',
715             'csc',
716             'name'
717         ),
718         '$number@sms.smartmessagingsuite.com',
719         TRUE
720     ),
721     (
722         35,
723         oils_i18n_gettext(
724             35,
725             'USA',
726             'csc',
727             'region'
728         ),
729         oils_i18n_gettext(
730             35,
731             'Alltel (Allied Wireless)',
732             'csc',
733             'name'
734         ),
735         '$number@sms.alltelwireless.com',
736         TRUE
737     ),
738     (
739         36,
740         oils_i18n_gettext(
741             36,
742             'USA',
743             'csc',
744             'region'
745         ),
746         oils_i18n_gettext(
747             36,
748             'Alaska Communications',
749             'csc',
750             'name'
751         ),
752         '$number@msg.acsalaska.com',
753         TRUE
754     ),
755     (
756         37,
757         oils_i18n_gettext(
758             37,
759             'USA',
760             'csc',
761             'region'
762         ),
763         oils_i18n_gettext(
764             37,
765             'Ameritech',
766             'csc',
767             'name'
768         ),
769         '$number@paging.acswireless.com',
770         TRUE
771     ),
772     (
773         38,
774         oils_i18n_gettext(
775             38,
776             'USA',
777             'csc',
778             'region'
779         ),
780         oils_i18n_gettext(
781             38,
782             'Cingular (GoPhone prepaid)',
783             'csc',
784             'name'
785         ),
786         '$number@cingulartext.com',
787         TRUE
788     ),
789     (
790         39,
791         oils_i18n_gettext(
792             39,
793             'USA',
794             'csc',
795             'region'
796         ),
797         oils_i18n_gettext(
798             39,
799             'Cingular (Postpaid)',
800             'csc',
801             'name'
802         ),
803         '$number@cingular.com',
804         TRUE
805     ),
806     (
807         40,
808         oils_i18n_gettext(
809             40,
810             'USA',
811             'csc',
812             'region'
813         ),
814         oils_i18n_gettext(
815             40,
816             'Cellular One (Dobson) / O2 / Orange',
817             'csc',
818             'name'
819         ),
820         '$number@mobile.celloneusa.com',
821         TRUE
822     ),
823     (
824         41,
825         oils_i18n_gettext(
826             41,
827             'USA',
828             'csc',
829             'region'
830         ),
831         oils_i18n_gettext(
832             41,
833             'Cellular South',
834             'csc',
835             'name'
836         ),
837         '$number@csouth1.com',
838         TRUE
839     ),
840     (
841         42,
842         oils_i18n_gettext(
843             42,
844             'USA',
845             'csc',
846             'region'
847         ),
848         oils_i18n_gettext(
849             42,
850             'Cellcom',
851             'csc',
852             'name'
853         ),
854         '$number@cellcom.quiktxt.com',
855         TRUE
856     ),
857     (
858         43,
859         oils_i18n_gettext(
860             43,
861             'USA',
862             'csc',
863             'region'
864         ),
865         oils_i18n_gettext(
866             43,
867             'Chariton Valley Wireless',
868             'csc',
869             'name'
870         ),
871         '$number@sms.cvalley.net',
872         TRUE
873     ),
874     (
875         44,
876         oils_i18n_gettext(
877             44,
878             'USA',
879             'csc',
880             'region'
881         ),
882         oils_i18n_gettext(
883             44,
884             'Cricket',
885             'csc',
886             'name'
887         ),
888         '$number@sms.mycricket.com',
889         TRUE
890     ),
891     (
892         45,
893         oils_i18n_gettext(
894             45,
895             'USA',
896             'csc',
897             'region'
898         ),
899         oils_i18n_gettext(
900             45,
901             'Cleartalk Wireless',
902             'csc',
903             'name'
904         ),
905         '$number@sms.cleartalk.us',
906         TRUE
907     ),
908     (
909         46,
910         oils_i18n_gettext(
911             46,
912             'USA',
913             'csc',
914             'region'
915         ),
916         oils_i18n_gettext(
917             46,
918             'Edge Wireless',
919             'csc',
920             'name'
921         ),
922         '$number@sms.edgewireless.com',
923         TRUE
924     ),
925     (
926         47,
927         oils_i18n_gettext(
928             47,
929             'USA',
930             'csc',
931             'region'
932         ),
933         oils_i18n_gettext(
934             47,
935             'Syringa Wireless',
936             'csc',
937             'name'
938         ),
939         '$number@rinasms.com',
940         TRUE
941     ),
942     (
943         48,
944         oils_i18n_gettext(
945             48,
946             'USA',
947             'csc',
948             'region'
949         ),
950         oils_i18n_gettext(
951             48,
952             'T-Mobile',
953             'csc',
954             'name'
955         ),
956         '$number@tmomail.net',
957         TRUE
958     ),
959     (
960         49,
961         oils_i18n_gettext(
962             49,
963             'USA',
964             'csc',
965             'region'
966         ),
967         oils_i18n_gettext(
968             49,
969             'Straight Talk / PagePlus Cellular',
970             'csc',
971             'name'
972         ),
973         '$number@vtext.com',
974         TRUE
975     ),
976     (
977         50,
978         oils_i18n_gettext(
979             50,
980             'USA',
981             'csc',
982             'region'
983         ),
984         oils_i18n_gettext(
985             50,
986             'South Central Communications',
987             'csc',
988             'name'
989         ),
990         '$number@rinasms.com',
991         TRUE
992     ),
993     (
994         51,
995         oils_i18n_gettext(
996             51,
997             'USA',
998             'csc',
999             'region'
1000         ),
1001         oils_i18n_gettext(
1002             51,
1003             'Simple Mobile',
1004             'csc',
1005             'name'
1006         ),
1007         '$number@smtext.com',
1008         TRUE
1009     ),
1010     (
1011         52,
1012         oils_i18n_gettext(
1013             52,
1014             'USA',
1015             'csc',
1016             'region'
1017         ),
1018         oils_i18n_gettext(
1019             52,
1020             'Sprint (PCS)',
1021             'csc',
1022             'name'
1023         ),
1024         '$number@messaging.sprintpcs.com',
1025         TRUE
1026     ),
1027     (
1028         53,
1029         oils_i18n_gettext(
1030             53,
1031             'USA',
1032             'csc',
1033             'region'
1034         ),
1035         oils_i18n_gettext(
1036             53,
1037             'Nextel',
1038             'csc',
1039             'name'
1040         ),
1041         '$number@messaging.nextel.com',
1042         TRUE
1043     ),
1044     (
1045         54,
1046         oils_i18n_gettext(
1047             54,
1048             'USA',
1049             'csc',
1050             'region'
1051         ),
1052         oils_i18n_gettext(
1053             54,
1054             'Pioneer Cellular',
1055             'csc',
1056             'name'
1057         ),
1058         '$number@zsend.com', -- nine digit number
1059         TRUE
1060     ),
1061     (
1062         55,
1063         oils_i18n_gettext(
1064             55,
1065             'USA',
1066             'csc',
1067             'region'
1068         ),
1069         oils_i18n_gettext(
1070             55,
1071             'Qwest Wireless',
1072             'csc',
1073             'name'
1074         ),
1075         '$number@qwestmp.com',
1076         TRUE
1077     ),
1078     (
1079         56,
1080         oils_i18n_gettext(
1081             56,
1082             'USA',
1083             'csc',
1084             'region'
1085         ),
1086         oils_i18n_gettext(
1087             56,
1088             'US Cellular',
1089             'csc',
1090             'name'
1091         ),
1092         '$number@email.uscc.net',
1093         TRUE
1094     ),
1095     (
1096         57,
1097         oils_i18n_gettext(
1098             57,
1099             'USA',
1100             'csc',
1101             'region'
1102         ),
1103         oils_i18n_gettext(
1104             57,
1105             'Unicel',
1106             'csc',
1107             'name'
1108         ),
1109         '$number@utext.com',
1110         TRUE
1111     ),
1112     (
1113         58,
1114         oils_i18n_gettext(
1115             58,
1116             'USA',
1117             'csc',
1118             'region'
1119         ),
1120         oils_i18n_gettext(
1121             58,
1122             'Teleflip',
1123             'csc',
1124             'name'
1125         ),
1126         '$number@teleflip.com',
1127         TRUE
1128     ),
1129     (
1130         59,
1131         oils_i18n_gettext(
1132             59,
1133             'USA',
1134             'csc',
1135             'region'
1136         ),
1137         oils_i18n_gettext(
1138             59,
1139             'Virgin Mobile',
1140             'csc',
1141             'name'
1142         ),
1143         '$number@vmobl.com',
1144         TRUE
1145     ),
1146     (
1147         60,
1148         oils_i18n_gettext(
1149             60,
1150             'USA',
1151             'csc',
1152             'region'
1153         ),
1154         oils_i18n_gettext(
1155             60,
1156             'Verizon Wireless',
1157             'csc',
1158             'name'
1159         ),
1160         '$number@vtext.com',
1161         TRUE
1162     ),
1163     (
1164         61,
1165         oils_i18n_gettext(
1166             61,
1167             'USA',
1168             'csc',
1169             'region'
1170         ),
1171         oils_i18n_gettext(
1172             61,
1173             'USA Mobility',
1174             'csc',
1175             'name'
1176         ),
1177         '$number@usamobility.net',
1178         TRUE
1179     ),
1180     (
1181         62,
1182         oils_i18n_gettext(
1183             62,
1184             'USA',
1185             'csc',
1186             'region'
1187         ),
1188         oils_i18n_gettext(
1189             62,
1190             'Viaero',
1191             'csc',
1192             'name'
1193         ),
1194         '$number@viaerosms.com',
1195         TRUE
1196     ),
1197     (
1198         63,
1199         oils_i18n_gettext(
1200             63,
1201             'USA',
1202             'csc',
1203             'region'
1204         ),
1205         oils_i18n_gettext(
1206             63,
1207             'TracFone',
1208             'csc',
1209             'name'
1210         ),
1211         '$number@mmst5.tracfone.com',
1212         TRUE
1213     ),
1214     (
1215         64,
1216         oils_i18n_gettext(
1217             64,
1218             'USA',
1219             'csc',
1220             'region'
1221         ),
1222         oils_i18n_gettext(
1223             64,
1224             'Centennial Wireless',
1225             'csc',
1226             'name'
1227         ),
1228         '$number@cwemail.com',
1229         TRUE
1230     ),
1231
1232     -- South Korea and USA
1233     (
1234         65,
1235         oils_i18n_gettext(
1236             65,
1237             'South Korea and USA',
1238             'csc',
1239             'region'
1240         ),
1241         oils_i18n_gettext(
1242             65,
1243             'Helio',
1244             'csc',
1245             'name'
1246         ),
1247         '$number@myhelio.com',
1248         TRUE
1249     )
1250 ;
1251
1252 INSERT INTO permission.perm_list ( id, code, description ) VALUES
1253     (
1254         519,
1255         'ADMIN_SMS_CARRIER',
1256         oils_i18n_gettext(
1257             519,
1258             'Allows a user to add/create/delete SMS Carrier entries.',
1259             'ppl',
1260             'description'
1261         )
1262     )
1263 ;
1264
1265 INSERT INTO permission.grp_perm_map (grp, perm, depth, grantable)
1266     SELECT
1267         pgt.id, perm.id, aout.depth, TRUE
1268     FROM
1269         permission.grp_tree pgt,
1270         permission.perm_list perm,
1271         actor.org_unit_type aout
1272     WHERE
1273         pgt.name = 'Global Administrator' AND
1274         aout.name = 'Consortium' AND
1275         perm.code = 'ADMIN_SMS_CARRIER';
1276
1277 INSERT INTO action_trigger.reactor (
1278     module,
1279     description
1280 ) VALUES (
1281     'SendSMS',
1282     'Send an SMS text message based on a user-defined template'
1283 );
1284
1285 INSERT INTO action_trigger.event_definition (
1286     active,
1287     owner,
1288     name,
1289     hook,
1290     validator,
1291     reactor,
1292     cleanup_success,
1293     delay,
1294     delay_field,
1295     group_field,
1296     template
1297 ) VALUES (
1298     true,
1299     1, -- admin
1300     'Hold Ready for Pickup SMS Notification',
1301     'hold.available',
1302     'HoldIsAvailable',
1303     'SendSMS',
1304     'CreateHoldNotification',
1305     '00:30:00',
1306     'shelf_time',
1307     'sms_notify',
1308     '[%- USE date -%]
1309 [%- user = target.0.usr -%]
1310 From: [%- params.sender_email || default_sender %]
1311 To: [%- params.recipient_email || helpers.get_sms_gateway_email(target.0.sms_carrier,target.0.sms_notify) %]
1312 Subject: [% target.size %] hold(s) ready
1313
1314 [% FOR hold IN target %][%-
1315   bibxml = helpers.xml_doc( hold.current_copy.call_number.record.marc );
1316   title = "";
1317   FOR part IN bibxml.findnodes(''//*[@tag="245"]/*[@code="a"]'');
1318     title = title _ part.textContent;
1319   END;
1320   author = bibxml.findnodes(''//*[@tag="100"]/*[@code="a"]'').textContent;
1321 %][% hold.usr.first_given_name %]:[% title %] @ [% hold.pickup_lib.name %]
1322 [% END %]
1323 '
1324 );
1325
1326 INSERT INTO action_trigger.environment (
1327     event_def,
1328     path
1329 ) VALUES (
1330     currval('action_trigger.event_definition_id_seq'),
1331     'current_copy.call_number.record.simple_record'
1332 ), (
1333     currval('action_trigger.event_definition_id_seq'),
1334     'usr'
1335 ), (
1336     currval('action_trigger.event_definition_id_seq'),
1337     'pickup_lib.billing_address'
1338 );
1339
1340 INSERT INTO action_trigger.hook(
1341     key,
1342     core_type,
1343     description,
1344     passive
1345 ) VALUES (
1346     'acn.format.sms_text',
1347     'acn',
1348     oils_i18n_gettext(
1349         'acn.format.sms_text',
1350         'A text message has been requested for a call number.',
1351         'ath',
1352         'description'
1353     ),
1354     FALSE
1355 );
1356
1357 INSERT INTO action_trigger.event_definition (
1358     active,
1359     owner,
1360     name,
1361     hook,
1362     validator,
1363     reactor,
1364     template
1365 ) VALUES (
1366     true,
1367     1, -- admin
1368     'SMS Call Number',
1369     'acn.format.sms_text',
1370     'NOOP_True',
1371     'SendSMS',
1372     '[%- USE date -%]
1373 From: [%- params.sender_email || default_sender %]
1374 To: [%- params.recipient_email || helpers.get_sms_gateway_email(user_data.sms_carrier,user_data.sms_notify) %]
1375 Subject: Call Number
1376
1377 [%-
1378   bibxml = helpers.xml_doc( target.record.marc );
1379   title = "";
1380   FOR part IN bibxml.findnodes(''//*[@tag="245"]/*[@code="a" or @code="b"]'');
1381     title = title _ part.textContent;
1382   END;
1383   author = bibxml.findnodes(''//*[@tag="100"]/*[@code="a"]'').textContent;
1384 %]
1385 Call Number: [% target.label %]
1386 Location: [% helpers.get_most_populous_location( target.id ).name %]
1387 Library: [% target.owning_lib.name %]
1388 [%- IF title %]
1389 Title: [% title %]
1390 [%- END %]
1391 [%- IF author %]
1392 Author: [% author %]
1393 [%- END %]
1394 '
1395 );
1396
1397 INSERT INTO action_trigger.environment (
1398     event_def,
1399     path
1400 ) VALUES (
1401     currval('action_trigger.event_definition_id_seq'),
1402     'record.simple_record'
1403 ), (
1404     currval('action_trigger.event_definition_id_seq'),
1405     'owning_lib.billing_address'
1406 );
1407
1408
1409 -- 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 = 519; DELETE FROM permission.perm_list WHERE id = 519; 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';
1410
1411 COMMIT;