Skip to content

Commit 9b24fe2

Browse files
author
Eric Neuhaus
committed
Added option to automatically move new projects to Production status
1 parent fd1d83e commit 9b24fe2

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

QuickProjects.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ UIOWA_QuickProjects.updateUrlText = function() {
7777
'surveys',
7878
'longitudinal',
7979
'autonumber',
80+
'prod',
8081
'userItem'
8182
];
8283

@@ -137,7 +138,7 @@ UIOWA_QuickProjects.updateUrlText = function() {
137138
}
138139
}
139140
}
140-
else if (paramList[i] == 'surveys' || paramList[i] == 'longitudinal' || paramList[i] == 'autonumber' || paramList[i] == 'storedXml') {
141+
else if (paramList[i] == 'surveys' || paramList[i] == 'longitudinal' || paramList[i] == 'autonumber' || paramList[i] == 'storedXml' || paramList[i] == 'prod') {
141142
if (projectInfo[j].checked && projectSetup == 'create') {
142143
paramStr += '&' + paramList[i] + '=' + '1';
143144
}

QuickProjects.php

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,20 @@ public function generateProject() {
353353
}
354354
}
355355

356+
if ($_REQUEST['prod'] == 1) {
357+
$sql = "
358+
UPDATE redcap_projects
359+
SET production_time = '".NOW."', inactive_time = NULL, status = 1
360+
WHERE project_id = ?";
361+
362+
$stmt = $conn->prepare($sql);
363+
$stmt->bind_param('i', $reservedPID);
364+
$stmt->execute();
365+
$stmt->close();
366+
367+
\REDCap::logEvent("Manage/Design","Move project to production status (Quick Projects)",$sql,null,null,$reservedPID);
368+
}
369+
356370
if ($_REQUEST['return'] == 'publicSurveyLink') {
357371
$sql = "
358372
SELECT s.project_id,s.form_name,s.title as survey_title
@@ -621,7 +635,9 @@ public function displayRequestBuilderPage() {
621635
<input type="checkbox" name="longitudinal" id="longitudinal" onclick="UIOWA_QuickProjects.updateUrlText()">
622636
<label for="longitudinal">Longitudinal study</label><br/>
623637
<input type="checkbox" name="autonumber" id="autonumber" onclick="UIOWA_QuickProjects.updateUrlText()">
624-
<label for="autonumber">Record autonumbering</label>
638+
<label for="autonumber">Record autonumbering</label><br/>
639+
<input type="checkbox" name="prod" id="prod" onclick="UIOWA_QuickProjects.updateUrlText()">
640+
<label for="prod">Move to Production status</label>
625641
</td>
626642
</tr>
627643
<tr>

0 commit comments

Comments
 (0)