22
22
*/
23
23
24
24
/*
25
- * This function adds a 'Purchase Request Workflow' menu to the Workflow Sheet when opened
25
+ * This function adds a 'Purchase Request Workflow' menu to the workflow Sheet when opened
26
26
*/
27
27
function onOpen ( ) {
28
28
const ui = SpreadsheetApp . getUi ( ) ; // Sheet UI
@@ -52,7 +52,7 @@ class Workflow {
52
52
}
53
53
54
54
/*
55
- * This static method populates the Workflow Sheet's 'Config' sheet with workflow
55
+ * This static method populates the workflow Sheet's 'Config' tab with workflow
56
56
* asset URLs and associates the workflow Form destination with the workflow Sheet
57
57
*/
58
58
static configure ( ) {
@@ -63,7 +63,7 @@ class Workflow {
63
63
/*
64
64
* This static method generates a new purchase request document from a form submission,
65
65
* replaces template markers, shares document with requester/supervisor and sends email notification
66
- * @param {Object } e - event object passed to onSubmit function
66
+ * @param {Object } e - event object passed to the form submit function
67
67
*/
68
68
static generate ( e ) {
69
69
const workflow = new Workflow ( ) ;
@@ -84,18 +84,18 @@ class Workflow {
84
84
if ( viewers . emails . length > 0 ) {
85
85
requestFile . addViewers ( viewers . emails ) . setSharing ( DriveApp . Access . PRIVATE , DriveApp . Permission . VIEW ) ;
86
86
}
87
- // Update workflow request range in form submission sheet
87
+ // Update workflow request range in form submission tab
88
88
workflow . updateWorkflowFields_ ( e . range . getRow ( ) , [ [ requestFile . getUrl ( ) , 'New' , '' , workflow . getFormattedDate_ ( date , "M/d/yyyy k:mm:ss" ) ] ] ) ;
89
- // Generate notification email body and send to requester/ supervisor/business owner
89
+ // Generate notification email body and send to requester, supervisor and Sheet owner
90
90
email = `New Purchase Request from: <strong>${ viewers . requester . name } <\/strong><br><br>
91
91
See request document <a href="${ doc . getUrl ( ) } ">here<\/a>` ;
92
92
viewers . emails . push ( Session . getEffectiveUser ( ) . getEmail ( ) ) ;
93
93
workflow . sendNotification_ ( viewers . emails , `New ${ doc . getName ( ) } ` , email ) ;
94
94
}
95
95
96
96
/*
97
- * This static method adds additional fields and formatting to the form submission sheet
98
- * and setups the form submit trigger
97
+ * This static method adds additional fields and formatting to the form submission tab
98
+ * and sets up the form submit trigger
99
99
* @param {string } triggerFunction - name of trigger function to execute on form submission
100
100
*/
101
101
static initialize ( triggerFunction = 'Workflow.generate' ) {
@@ -106,7 +106,7 @@ class Workflow {
106
106
107
107
/*
108
108
* This static method updates the purchase request document with status updates
109
- * from form submission sheet highlighted row and sends email notification
109
+ * from form submission tab highlighted row and sends email notification
110
110
*/
111
111
static update ( ) {
112
112
const workflow = new Workflow ( ) ;
@@ -130,7 +130,7 @@ class Workflow {
130
130
// Update workflow request range 'Last Update' cell with formatted timestamp
131
131
activeRowValues [ 0 ] [ 3 ] = workflow . getFormattedDate_ ( date , "M/d/yyyy k:mm:ss" ) ;
132
132
workflow . updateWorkflowFields_ ( activeRowRange . getRow ( ) , activeRowValues ) ;
133
- // Generate notification email body and send to requester, supervisor and to Sheet owner
133
+ // Generate notification email body and send to requester, supervisor and Sheet owner
134
134
email = `Purchase Request Status Update: <strong>${ activeRowValues [ 0 ] [ 1 ] } <\/strong><br><br>
135
135
See request document <a href="${ doc . getUrl ( ) } ">here<\/a>` ;
136
136
workflow . sendNotification_ ( recipients . join ( ',' ) , `Updated Status: ${ doc . getName ( ) } ` , email ) ;
@@ -158,15 +158,15 @@ class Workflow {
158
158
}
159
159
160
160
/*
161
- * This method adds additional fields and formatting to the form submission sheet and setups the submit trigger
161
+ * This method adds additional fields and formatting to the form submission tab and sets up the submit trigger
162
162
* @param {string } triggerFunction - name of trigger function to execute on form submission
163
163
* @return {Workflow } this object for chaining
164
164
*/
165
165
initializeRequestSheet_ ( triggerFunction ) {
166
166
const self = this , // active spreadsheet
167
- formSheet = self . ss . getSheets ( ) [ 0 ] ; // form submission sheet - assumes first sheet
167
+ formSheet = self . ss . getSheets ( ) [ 0 ] ; // form submission tab - assumes first location
168
168
formSheet . activate ( ) ;
169
- // Get form submission sheet header row, update background color (yellow) and fold font
169
+ // Get form submission tab header row, update background color (yellow) and bold font
170
170
formSheet . getRange ( 1 , 1 , 1 , formSheet . getLastColumn ( ) )
171
171
. setBackground ( '#fff2cc' )
172
172
. setFontWeight ( 'bold' ) ;
@@ -196,7 +196,7 @@ class Workflow {
196
196
197
197
/*
198
198
* This method formats a date using the Google Sheet timezone
199
- * @param {Date } date - Javascript date object
199
+ * @param {Date } date - Javascript Date object
200
200
* @param {string } format - string representing the desired date format
201
201
* @return {string } formatted date string
202
202
*/
@@ -217,7 +217,7 @@ class Workflow {
217
217
let supervisor ;
218
218
// Shift off header row
219
219
employees . shift ( ) ;
220
- // Find requester who submitted the form request
220
+ // Find form submit requester
221
221
viewers . requester = employees . filter ( row => row [ 0 ] === requesterName )
222
222
. map ( ( row ) => ( { name : row [ 0 ] , email : row [ 1 ] , phone : row [ 2 ] , supervisor : row [ 3 ] } ) ) [ 0 ] ;
223
223
viewers . emails = viewers . requester . email !== '' ? [ viewers . requester . email ] : [ ] ;
@@ -236,15 +236,15 @@ class Workflow {
236
236
}
237
237
238
238
/*
239
- * This method retrieves the workflow request range of selected row (if selection is valid)
239
+ * This method retrieves the workflow request range for selected row (if selection is valid)
240
240
* If selection is invalid display a Sheet message
241
241
* @return {Range } workflow fields range from active selection
242
242
*/
243
243
getWorkflowFields_ ( ) {
244
244
const self = this ,
245
245
activeSheet = self . ss . getActiveSheet ( ) ;
246
246
let activeRowRange = null , activeRange , activeRowNum ;
247
- // Ensure user is on form submission sheet - if not show an error and exit
247
+ // Ensure user is on form submission tab - if not show an error and exit
248
248
if ( activeSheet . getIndex ( ) !== 1 ) {
249
249
self . sendSSMsg_ ( 'Select sheet containing purchase requests.' , 'Operation Not Valid on Sheet!' ) ;
250
250
return activeRowRange ;
@@ -295,7 +295,7 @@ class Workflow {
295
295
}
296
296
297
297
/*
298
- * This method replaces request document template markers with both values passed from form submission and other data
298
+ * This method replaces request document template markers with values passed from form submission and other data
299
299
* @param {Document } doc - generated request document
300
300
* @param {Object } requestVals - form submission fields
301
301
* @param {Object } viewers - requester and supervisor information
@@ -344,7 +344,7 @@ class Workflow {
344
344
}
345
345
346
346
/*
347
- * This method populates the 'Config' sheet with workflow asset URLs
347
+ * This method populates the 'Config' tab with workflow asset URLs
348
348
* and associates the workflow Form destination with the workflow Sheet
349
349
* @return {Workflow } this object for chaining
350
350
*/
@@ -358,7 +358,7 @@ class Workflow {
358
358
templateDoc = ssFolder . getFilesByType ( MimeType . GOOGLE_DOCS ) . next ( ) ;
359
359
requestForm = ssFolder . getFilesByType ( MimeType . GOOGLE_FORMS ) . next ( ) ;
360
360
requestsFolder = ssFolder . getFolders ( ) . next ( ) ;
361
- // Add workflow asset URLs to ‘Config’ sheet
361
+ // Add workflow asset URLs to ‘Config’ tab
362
362
self . configSheet . getRange ( 1 , 2 , 3 ) . setValues ( [ [ requestForm . getUrl ( ) ] , [ templateDoc . getUrl ( ) ] , [ requestsFolder . getUrl ( ) ] ] ) ;
363
363
// Set the workflow Form destination to the workflow Sheet
364
364
FormApp . openById ( requestForm . getId ( ) ) . setDestination ( FormApp . DestinationType . SPREADSHEET , self . ss . getId ( ) ) ;
@@ -385,7 +385,7 @@ class Workflow {
385
385
}
386
386
387
387
/*
388
- * This method updates the selected request workflow range in the form submission sheet
388
+ * This method updates the selected request workflow range in the form submission tab
389
389
* @param {number } row - selected request row number
390
390
* @param {string[][] } vals - two-dimensional array of workflow field values to be written to selected row
391
391
* @return {Workflow } this object for chaining
0 commit comments