diff --git a/package/src/custom/Extension/application/Ext/EntryPointRegistry/getCampaign.php b/package/src/custom/Extension/application/Ext/EntryPointRegistry/getCampaign.php deleted file mode 100644 index d255696c..00000000 --- a/package/src/custom/Extension/application/Ext/EntryPointRegistry/getCampaign.php +++ /dev/null @@ -1,6 +0,0 @@ - 'custom/src/application_campaign/GetCampaignEntrypoint.php', - 'auth' => false -); diff --git a/package/src/custom/modules/Campaigns/clients/base/api/OnlineApplicationsAPI.php b/package/src/custom/modules/Campaigns/clients/base/api/OnlineApplicationsAPI.php new file mode 100644 index 00000000..f85b0ac0 --- /dev/null +++ b/package/src/custom/modules/Campaigns/clients/base/api/OnlineApplicationsAPI.php @@ -0,0 +1,85 @@ + array( + + //request type + 'reqType' => 'GET', + + //set authentication + 'noLoginRequired' => true, + + //endpoint path + 'path' => array('Campaigns', 'getOnlineApplicationsCampaignId'), + + //method to call + 'method' => 'getOnlineApplicationsCampaignId', + + //short help string to be displayed in the help documentation + 'shortHelp' => 'Get the ID of the most recently updated Campaign with the name \'Online Applications\'', + + //long help to be displayed in the help documentation + 'longHelp' => 'custom/modules/Campaigns/clients/base/api/help/GetOnlineApplicationsCampaignId.html', + ), + ); + } + + /** + * Get the ID of the most recently updated Campaign with the name 'Online Applications' + * + * @return an array containing the ID of the most recently updated Campaign with the name 'Online Applications' + */ + public function getOnlineApplicationsCampaignId() + { + // Get the most recently updated Campaign with the name 'Online Applications' + $q = $this->getSugarQuery(); + $q->select(array('id', 'name')); + $q->from($this->getNewCampaignBean(), array('team_security' => false)); + $q->where()->equals('name', 'Online Applications'); + $q->orderBy('date_modified', 'desc'); + $q->limit(1); + + $results = $q->execute(); + + if(sizeof($results) != 1 || !$results[0]['id']){ + throw new \SugarApiExceptionError("Unable to find ID for the Campaign named Online Applications"); + } + + return array('id' => $results[0]['id']); + } + + /** + * Get Sugar Query. + * This function exists so we can mock the SugarQuery in automated tests. + * + * @return \SugarQuery + */ + protected function getSugarQuery() + { + return new \SugarQuery(); + } + + /** + * Get a new Campaign Bean. + * This function exists so we can mock the Campaigns Bean in automated tests. + * + * @return null|\SugarBean + */ + protected function getNewCampaignBean() + { + return \BeanFactory::newBean('Campaigns'); + } + +} diff --git a/package/src/custom/modules/Campaigns/clients/base/api/help/GetOnlineApplicationsCampaignId.html b/package/src/custom/modules/Campaigns/clients/base/api/help/GetOnlineApplicationsCampaignId.html new file mode 100644 index 00000000..339d3b39 --- /dev/null +++ b/package/src/custom/modules/Campaigns/clients/base/api/help/GetOnlineApplicationsCampaignId.html @@ -0,0 +1,35 @@ +
Name | +Type | +Description | +
---|---|---|
+ id + | ++ String + | ++ The ID of the most recently updated Campaign with the name 'Online Applications'. + | +
+{ + "id": "f56b6d18-52e1-11e8-a080-34363bc46900" +} +diff --git a/package/src/custom/online_application_form/ApplyOnline.html b/package/src/custom/online_application_form/ApplyOnline.html index 118bbf1a..0ef7d092 100644 --- a/package/src/custom/online_application_form/ApplyOnline.html +++ b/package/src/custom/online_application_form/ApplyOnline.html @@ -52,223 +52,227 @@
-
-