Created
March 14, 2016 22:19
-
-
Save tommymarshall/dea71570fd1ed2a92c09 to your computer and use it in GitHub Desktop.
Main Import Class
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class ImportGrantRecordJob extends Job | |
{ | |
/** | |
* Workflow States that may be imported | |
* | |
* @var array | |
*/ | |
private $allowableStates = [ | |
'granted', | |
'closed', | |
'closed_unsatisfactory', | |
'cd_grant_closure_unsatisfactory', | |
'gm_grant_closure_satisfactory', | |
'gm_grant_closure_unsatisfactory', | |
'active_grant_info_required_to_close', | |
]; | |
/** | |
* Grant Authorities that may be imported | |
* | |
* @var array | |
*/ | |
private $allowableAuthorities = [ | |
'Board', | |
'Expedited', | |
'AFNY', | |
'MANG', | |
'NYCT', | |
'SG', | |
'SLAE CONSULTANCY', | |
]; | |
/** | |
* Check if grant may be imported (Ensure type and status correct) | |
* | |
* @param object $grant_record Grant | |
* @return boolean | |
*/ | |
private function mayImportGrant($grant_record) | |
{ | |
return ( ! property_exists($grant_record, 'please_omit_this_grant_from_web_publishing_hgrants_feed') || | |
$grant_record->please_omit_this_grant_from_web_publishing_hgrants_feed != true) && | |
property_exists($grant_record, 'workflow_state') && | |
in_array($grant_record->workflow_state, $this->allowableStates) && | |
property_exists($grant_record, 'grant_authority') && | |
in_array($grant_record->grant_authority, $this->allowableAuthorities); | |
} | |
// Rest of code here | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment