Details
-
Type: Task
-
Status: Done/Fixed
-
Priority: Major
-
Resolution: Fixed/Completed
-
Affects Version/s: None
-
Fix Version/s: 1.5
-
Component/s: None
-
Labels:None
Description
Introduction
=========
Quest admin staff needs a way to easily search/filter the student (contact) records based on whether the student has completed the Pre-application or not. Since we do not currently support searching based on task status, the easiest way to do this is to have a standalone PHP script that divides the contacts into groups based on the task status.
Implementation
============
Standalone PHP script will use civicrm APIs to do the following steps:
1. Insert the following 2 civicrm_group records (if they don't already exist):
- id = 2, domain=1, name='Preapplication_Completed', title='Preapplication Completed', visibility=''User and User Admin Only'
- id = 3, domain=1, name='Preapplication_Not_Completed', title='Preapplication Not Completed', visibility="'User and User Admin Only
2. Loop through all contact records WHERE contact_sub_type = 'Student'. For each contact, use getApplicationStatus() to retrieve the status. If status = 'Completed', add contact to Preapplication Completed group (id=2). Else add to group 3. [ crm_add_group_contacts() ].
Quest should be able to invoke the script multiple times on the same DB - so it needs to handle both "first time running" and "additional runs" cases. During additional runs the script will NOT need to create the groups (script checks if group 2 and 3 exists before doing inserts) - but will verify whether each student is assigned to the correct group based on their status - and do add/remove from group operations as needed.