Ticket #3064: Trac_3064.sql

File Trac_3064.sql, 18.0 KB (added by Benjamin Haag, 21 months ago)

SQL used to create and populate email template table.

Line 
1USE [gringlobal]
2GO
3IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[email_template]') AND type in (N'U'))
4ALTER TABLE [dbo].[email_template] DROP CONSTRAINT IF EXISTS [fk_et_owned]
5GO
6IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[email_template]') AND type in (N'U'))
7ALTER TABLE [dbo].[email_template] DROP CONSTRAINT IF EXISTS [fk_et_modified]
8GO
9IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[email_template]') AND type in (N'U'))
10ALTER TABLE [dbo].[email_template] DROP CONSTRAINT IF EXISTS [fk_et_created]
11GO
12/****** Object: Table [dbo].[email_template] Script Date: 2/17/2025 1:57:10 PM ******/
13DROP TABLE IF EXISTS [dbo].[email_template]
14GO
15/****** Object: Table [dbo].[email_template] Script Date: 2/17/2025 1:57:10 PM ******/
16SET ANSI_NULLS ON
17GO
18SET QUOTED_IDENTIFIER ON
19GO
20CREATE TABLE [dbo].[email_template](
21 [email_template_id] [int] IDENTITY(1,1) NOT NULL,
22 [title] [nvarchar](120) NULL,
23 [category_code] [nvarchar](3) NULL,
24 [email_from] [nvarchar](200) NULL,
25 [email_to] [nvarchar](1000) NULL,
26 [email_cc] [nvarchar](1000) NULL,
27 [email_bcc] [nvarchar](1000) NULL,
28 [email_reply_to] [nvarchar](200) NULL,
29 [subject] [nvarchar](500) NULL,
30 [body] [nvarchar](max) NULL,
31 [is_html] [nvarchar](1) NOT NULL,
32 [created_date] [datetime2](7) NOT NULL,
33 [created_by] [int] NOT NULL,
34 [modified_date] [datetime2](7) NULL,
35 [modified_by] [int] NULL,
36 [owned_date] [datetime2](7) NOT NULL,
37 [owned_by] [int] NOT NULL,
38 CONSTRAINT [PK_email_template] PRIMARY KEY CLUSTERED
39(
40 [email_template_id] ASC
41)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
42) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
43GO
44SET IDENTITY_INSERT [dbo].[email_template] ON
45GO
46INSERT [dbo].[email_template] ([email_template_id], [title], [category_code], [email_from], [email_to], [email_cc], [email_bcc], [email_reply_to], [subject], [body], [is_html], [created_date], [created_by], [modified_date], [modified_by], [owned_date], [owned_by]) VALUES (3, N'Requestor Rejection Letter', N'RRJ', N'gringlobal.orders@usda.gov', NULL, NULL, NULL, NULL, N'Regarding Your Germplasm Request (Order #[ID_HERE])', N'<p>Germplasm Requestor:</p>
47
48<p>The U.S. National Plant Germplasm System&nbsp; (NPGS) provides plant material in small quantities to research and educational entities for projects where genetic diversity is required. Accessions maintained by the NPGS are not intended or available for home, personal, or community gardening. Requests for educational purposes are generally approved only for college-level projects requiring unique germplasm that is not readily available from commercial sources.&nbsp;</p>
49
50<p>Your request does not meet the criteria to receive germplasm from the NPGS and has been cancelled.</p>
51
52<p>For more information about the NPGS, please view a 6-minute video that describes our mission and purpose at <a href="https://www.youtube.com/watch?v=uHOclGNELuw">https://www.youtube.com/watch?v=uHOclGNELuw</a>.</p>
53
54<p>If you believe this decision is an error, please provide additional relevant information about your project to justify the need for specific NPGS germplasm, instead of using commercially available plant material. Send your email to <strong>gringlobal.orders@usda.gov</strong>, and include the web order number<strong> [ID_HERE]</strong>.</p>
55
56<p>Thank you.&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</p>
57', N'0', CAST(N'2021-06-17T00:00:00.0000000' AS DateTime2), 48, CAST(N'2023-02-06T15:05:32.0933333' AS DateTime2), 48, CAST(N'2021-06-17T00:00:00.0000000' AS DateTime2), 48)
58GO
59INSERT [dbo].[email_template] ([email_template_id], [title], [category_code], [email_from], [email_to], [email_cc], [email_bcc], [email_reply_to], [subject], [body], [is_html], [created_date], [created_by], [modified_date], [modified_by], [owned_date], [owned_by]) VALUES (4, N'Curator Approval Notification', N'CAP', N'gringlobal.orders@usda.gov', NULL, NULL, NULL, NULL, N'NRR Review Notification: Order [ID_HERE] Approved', N'<p>Web Order Request [ID_HERE] has been reviewed and <strong>approved</strong> by the NRR Review Committee.</p>
60
61<p>It is now visible in the Order Wizard as a Submitted&nbsp;web order request, and may be viewed in the OW and in the Curator Tool as well.</p>
62', N'0', CAST(N'2021-06-17T00:00:00.0000000' AS DateTime2), 48, CAST(N'2023-02-06T15:05:32.0933333' AS DateTime2), 48, CAST(N'2021-06-17T00:00:00.0000000' AS DateTime2), 48)
63GO
64INSERT [dbo].[email_template] ([email_template_id], [title], [category_code], [email_from], [email_to], [email_cc], [email_bcc], [email_reply_to], [subject], [body], [is_html], [created_date], [created_by], [modified_date], [modified_by], [owned_date], [owned_by]) VALUES (5, N'Curator Cancellation Notiification', N'CCL', N'gringlobal.orders@usda.gov', NULL, NULL, NULL, NULL, N'NRR Review Notification: Order [ID_HERE] Cancelled', N'<p>&nbsp;Web Order Request [ID_HERE] has been reviewed and <strong>cancelled</strong> by the NRR Review Committee.</p>
65
66<p>&nbsp;The requestor has been notified via email. &nbsp;</p>
67
68<p>&nbsp;No further action is needed from your site (or any sites included by the request). &nbsp;If you would like to review the WOR, for future reference, it is now visible in the Order Wizard as a Cancelled web order request and may be viewed in the OW and in the Curator Tool as well.</p>
69', N'0', CAST(N'2021-06-17T00:00:00.0000000' AS DateTime2), 48, CAST(N'2023-02-06T15:05:32.0933333' AS DateTime2), 48, CAST(N'2021-06-17T00:00:00.0000000' AS DateTime2), 48)
70GO
71INSERT [dbo].[email_template] ([email_template_id], [title], [category_code], [email_from], [email_to], [email_cc], [email_bcc], [email_reply_to], [subject], [body], [is_html], [created_date], [created_by], [modified_date], [modified_by], [owned_date], [owned_by]) VALUES (6, N'Request For Information', N'RQI', N'gringlobal.orders@usda.gov', NULL, NULL, NULL, NULL, N'Request For Additional Information: Order [ID_HERE]', N'<p>Dear Germplasm&nbsp;Requestor:</p>
72
73<p>The U.S.National Plant Germplasm System&nbsp; (NPGS) provides plant material in small quantities to research and educational entities&nbsp;for&nbsp;projects where genetic diversity is required. Accessions maintained by the NPGS are not intended or available&nbsp;for&nbsp;home, personal, or community gardening. Requests for educational purposes are generally approved only for college-level projects requiring unique germplasm that is not readily available from commercial sources.&nbsp;</p>
74
75<p>Please provide additional relevant information about your project to justify the need&nbsp;for&nbsp;specific NPGS germplasm, instead of using commercially available plant material.</p>
76
77<p>Send your email to <a href="mailto:gringlobal.orders@usda.gov">gringlobal.orders@usda.gov</a>, and include the web order number <strong> [ID_HERE]</strong>.</p>
78
79<p>For&nbsp;more information about the NPGS, please view a 6 - minute video that describes our mission and purpose at&nbsp;<a href="https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DuHOclGNELuw&amp;data=04%7C01%7C%7Ce9adf597c0134eb8debe08d952b88539%7Ced5b36e701ee4ebc867ee03cfa0d4697%7C0%7C0%7C637631774727050819%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=2Y5FCXfBkmrBHxn7Yt3palxIGl7%2BhCpLLxURHNUvygg%3D&amp;reserved=0" target="_blank">https://www.youtube.com/watch?v=uHOclGNELuw</a><br />
80<br />
81Thank you.</p>
82', N'0', CAST(N'2021-06-17T00:00:00.0000000' AS DateTime2), 48, CAST(N'2023-02-06T15:05:32.0933333' AS DateTime2), 48, CAST(N'2021-06-17T00:00:00.0000000' AS DateTime2), 48)
83GO
84INSERT [dbo].[email_template] ([email_template_id], [title], [category_code], [email_from], [email_to], [email_cc], [email_bcc], [email_reply_to], [subject], [body], [is_html], [created_date], [created_by], [modified_date], [modified_by], [owned_date], [owned_by]) VALUES (8, N'NRR Flag Notification', N'NRR', N'gringlobal.orders@usda.gov', NULL, NULL, NULL, NULL, N'NRR (Potential) -- GRIN-Global Web Order #[ID_HERE]', N'<p>Please Note:</p>
85
86<p>Web Order <strong>[ID_HERE]</strong> has been flagged for review because it meets one or more Non-Research Request (NRR) criteria. &nbsp;This email is simply for your information. You should not proceed to address the request at this time.</p>
87
88<p>The request has been forwarded to, and will be reviewed by, the NRR Review Committee. <strong>Please note that this web order will not appear in the Order Wizard until their review is completed.</strong></p>
89
90<p>Eventually you will receive one more notification, indicating the committee&rsquo;s decision. If the committee&hellip;</p>
91
92<ul>
93 <li>denies the request, then no further action is required by you. The web order status will be &ldquo;CANCELLED.&rdquo;</li>
94 <li>approves the request, then proceed as usual to process your site&rsquo;s portion of the request. (e.g., use the Order Wizard) &nbsp;</li>
95</ul>
96
97<p>In some cases (such as when the request was not an obvious NRR), the committee has requested more details from the requestor.&nbsp; The request will remain &ldquo;NRR_FLAGGED.&rdquo;&nbsp; Any delay in the committee&rsquo;s final &ldquo;accepted&rdquo; or &ldquo;denied&rdquo; designation is dependent on the requestor&rsquo;s responsiveness.</p>
98
99<p>If you have questions, or can provide information regarding this web order, please contact the NRR Review Committee:</p>
100
101<ul>
102 <li><a href="mailto:@gary.kinard@usda.gov">Gary Kinard</a></li>
103 <li><a href="mailto:@harold.bockleman@usda.gov">Harold Bockelman</a></li>
104 <li><a href="mailto:@marty.reisinger@usda.gov">Martin Reisinger</a></li>
105</ul>
106', N'0', CAST(N'2021-08-01T18:03:49.2333333' AS DateTime2), 48, CAST(N'2023-02-06T15:05:32.0933333' AS DateTime2), 48, CAST(N'2021-08-01T18:03:49.2333333' AS DateTime2), 48)
107GO
108INSERT [dbo].[email_template] ([email_template_id], [title], [category_code], [email_from], [email_to], [email_cc], [email_bcc], [email_reply_to], [subject], [body], [is_html], [created_date], [created_by], [modified_date], [modified_by], [owned_date], [owned_by]) VALUES (13, N'Curator Email', N'CUR', N'gringlobal.orders@usda.gov', NULL, NULL, NULL, NULL, N'Curator Inquiry', N'<p>General question</p>', N'1', CAST(N'2022-02-08T00:00:00.0000000' AS DateTime2), 48, CAST(N'2023-02-06T15:05:32.0933333' AS DateTime2), 48, CAST(N'2022-02-08T00:00:00.0000000' AS DateTime2), 48)
109GO
110INSERT [dbo].[email_template] ([email_template_id], [title], [category_code], [email_from], [email_to], [email_cc], [email_bcc], [email_reply_to], [subject], [body], [is_html], [created_date], [created_by], [modified_date], [modified_by], [owned_date], [owned_by]) VALUES (17, N'Curator New-Account Notification', N'CNA', N'grinlobal-support@usda.gov', NULL, NULL, NULL, NULL, N'Your GRIN-Global Curator Tool Account Has Been Created', N'Dear [FIRST_NAME] [LAST_NAME]:
111<p>
112 You are receiving this email because a [ENVIRONMENT] Curator Tool account has been requested for you. We have created and activated this account.
113
114 <p>Please note that you have two accounts:</p>
115 <ul>
116 <li>
117 Your <b>Curator Tool </b>account, which allows you read/write access to the Curator Tool<ul>
118 <li>
119 Your password will expire within 30 days of its most recent
120 change. To reset it, refer to
121 the <a href="https://npgsweb.ars-grin.gov/ggtools/Login/RequestPasswordReset" target="_blank">Self-Service Password Utility</a>.
122 </li>
123 <li>For information related to downloading and installing the Curator Tool, please refer to:<ul><li><a href="https://www.grin-global.org/download_ct.html" target="_blank">Curator Tool Installation Page</a></li></ul></li>
124 </ul>
125 </li>
126 <li>Your <b>Public Website</b> account, allows you to log into access the <a href="https://www.grin-global.org/sql_examples.htm" target="_blank">Web Query</a> tool, as well as certain reports.</li>
127 </ul>
128 <p>Your account credentials appear below.</p>
129 <table width="100%">
130 <tbody>
131 <tr>
132 <td colspan="2"><strong>CT Account</strong></td>
133 <td colspan="2"><strong>Website Account</strong></td>
134 </tr>
135 <tr>
136 <td><strong>Username</strong></td>
137 <td>[CURATOR_TOOL_USER_NAME]</td>
138 <td><strong>Username</strong></td>
139 <td>[WEB_USER_NAME]</td>
140
141 </tr>
142 <tr>
143 <td><b>Password</b></td>
144 <td>[CURATOR_TOOL_PASSWORD]</td>
145 <td><b>Password</b></td>
146 <td>[WEB_USER_PASSWORD]</td>
147 </tr>
148 <tr>
149 <td><strong>Expires</strong></td>
150 <td>[CURATOR_TOOL_PASSWORD_EXPIRATION_DATE]</td>
151 <td></td>
152 <td></td>
153 </tr>
154 </tbody>
155 </table>
156</p>', N'1', CAST(N'2023-09-13T00:00:00.0000000' AS DateTime2), 48, CAST(N'2024-08-23T09:33:17.4800000' AS DateTime2), 48, CAST(N'2023-09-13T00:00:00.0000000' AS DateTime2), 48)
157GO
158INSERT [dbo].[email_template] ([email_template_id], [title], [category_code], [email_from], [email_to], [email_cc], [email_bcc], [email_reply_to], [subject], [body], [is_html], [created_date], [created_by], [modified_date], [modified_by], [owned_date], [owned_by]) VALUES (18, N'Curator New-Account Request', N'CNR', N'grinlobal-support@usda.gov', NULL, NULL, NULL, NULL, N'Request For GRIN-Global Curator Tool Account', N'<p>A [ENVIRONMENT] GRIN-Global Curator Tool account has been requested:</p>
159 <table width="100%">
160 <tbody>
161 <tr>
162 <td colspan="2"><strong>First Name</strong></td>
163 <td colspan="2">[FIRST_NAME]</td>
164 </tr>
165 <tr>
166 <td colspan="2"><strong>Last Name</strong></td>
167 <td colspan="2">[LAST_NAME]</td>
168 </tr>
169 <tr>
170 <td colspan="2"><strong>Email Address</strong></td>
171 <td colspan="2">[EMAIL_ADDRESS]</td>
172 </tr>
173 <tr>
174 <td colspan="2"><strong>Email Address</strong></td>
175 <td colspan="2">[PRIMARY_PHONE]</td>
176 </tr>
177 <tr>
178 <td colspan="2"><strong>Job Title</strong></td>
179 <td colspan="2">[JOB_TITLE]</td>
180 </tr>
181 <tr>
182 <td colspan="2"><strong>Site</strong></td>
183 <td colspan="2">[SITE_LONG_NAME]</td>
184 </tr>
185 <tr>
186 <td colspan="2"><strong>Address</strong></td>
187 <td colspan="2">[ADDRESS_1]</td>
188 </tr>
189 <tr>
190 <td colspan="2"><strong></strong></td>
191 <td colspan="2">[ADDRESS_2]</td>
192 </tr>
193 <tr>
194 <td colspan="2"><strong></strong></td>
195 <td colspan="2">[ADDRESS_3]</td>
196 </tr>
197 <tr>
198 <td colspan="2"><strong>City, State, ZIP</strong></td>
199 <td colspan="2">[CITY], [STATE] [POSTAL_CODE]</td>
200 </tr>
201 <br>
202 <tr>
203 <td colspan="2"><strong>Notes</strong></td>
204 <td colspan="2"><strong>[NOTE]</strong></td>
205 </tr>
206 </tbody>
207 </table>', N'1', CAST(N'2023-09-13T00:00:00.0000000' AS DateTime2), 48, CAST(N'2024-08-23T09:33:17.4766667' AS DateTime2), 48, CAST(N'2023-09-13T00:00:00.0000000' AS DateTime2), 48)
208GO
209INSERT [dbo].[email_template] ([email_template_id], [title], [category_code], [email_from], [email_to], [email_cc], [email_bcc], [email_reply_to], [subject], [body], [is_html], [created_date], [created_by], [modified_date], [modified_by], [owned_date], [owned_by]) VALUES (21, N'Country Hold Notification', N'HLC', NULL, NULL, NULL, NULL, NULL, N'Regarding Your Germplasm Request (Order #[ID_HERE])', N'TO BE DETERMINED', N'Y', CAST(N'2025-01-22T15:45:05.8800000' AS DateTime2), 48, NULL, NULL, CAST(N'2025-01-22T15:45:05.8800000' AS DateTime2), 48)
210GO
211SET IDENTITY_INSERT [dbo].[email_template] OFF
212GO
213ALTER TABLE [dbo].[email_template] WITH CHECK ADD CONSTRAINT [fk_et_created] FOREIGN KEY([created_by])
214REFERENCES [dbo].[cooperator] ([cooperator_id])
215GO
216ALTER TABLE [dbo].[email_template] CHECK CONSTRAINT [fk_et_created]
217GO
218ALTER TABLE [dbo].[email_template] WITH CHECK ADD CONSTRAINT [fk_et_modified] FOREIGN KEY([modified_by])
219REFERENCES [dbo].[cooperator] ([cooperator_id])
220GO
221ALTER TABLE [dbo].[email_template] CHECK CONSTRAINT [fk_et_modified]
222GO
223ALTER TABLE [dbo].[email_template] WITH CHECK ADD CONSTRAINT [fk_et_owned] FOREIGN KEY([owned_by])
224REFERENCES [dbo].[cooperator] ([cooperator_id])
225GO
226ALTER TABLE [dbo].[email_template] CHECK CONSTRAINT [fk_et_owned]
227GO