Merge pull request #4616 from Edzelopez/CRM-15642
[civicrm-core.git] / CRM / Grant / BAO / Grant.php
index a1687b38aa3329cf682598d8a32e298bf8f7a1c4..17e5362bf56088e1d3f8fa637f1fb975999cf167 100644 (file)
@@ -49,10 +49,12 @@ class CRM_Grant_BAO_Grant extends CRM_Grant_DAO_Grant {
   }
 
   /**
-   * Function to get events Summary
+   * get events Summary
    *
    * @static
    *
+   * @param bool $admin
+   *
    * @return array Array of event summary values
    */
   static function getGrantSummary($admin = FALSE) {
@@ -87,7 +89,7 @@ class CRM_Grant_BAO_Grant extends CRM_Grant_DAO_Grant {
   }
 
   /**
-   * Function to get events Summary
+   * get events Summary
    *
    * @static
    *
@@ -109,10 +111,12 @@ class CRM_Grant_BAO_Grant extends CRM_Grant_DAO_Grant {
   }
 
   /**
-   * Function to retrieve statistics for grants.
+   * retrieve statistics for grants.
    *
    * @static
    *
+   * @param bool $admin
+   *
    * @return array Array of grant summary statistics
    */
   static function getGrantStatistics($admin = FALSE) {
@@ -120,16 +124,12 @@ class CRM_Grant_BAO_Grant extends CRM_Grant_DAO_Grant {
   }
 
   /**
-   * Takes a bunch of params that are needed to match certain criteria and
-   * retrieves the relevant objects. Typically the valid params are only
-   * contact_id. We'll tweak this function to be more full featured over a period
-   * of time. This is the inverse function of create. It also stores all the retrieved
-   * values in the default array
+   * Fetch object based on array of properties
    *
    * @param array $params   (reference ) an assoc array of name/value pairs
    * @param array $defaults (reference ) an assoc array to hold the flattened values
    *
-   * @return object CRM_Grant_BAO_ManageGrant object
+   * @return CRM_Grant_BAO_ManageGrant object
    * @access public
    * @static
    */
@@ -248,8 +248,9 @@ class CRM_Grant_BAO_Grant extends CRM_Grant_DAO_Grant {
    * function to create the event
    *
    * @param array $params reference array contains the values submitted by the form
-   * @param array $ids    reference array contains the id
+   * @param array $ids reference array contains the id
    *
+   * @return object
    * @access public
    * @static
    *
@@ -269,7 +270,7 @@ class CRM_Grant_BAO_Grant extends CRM_Grant_DAO_Grant {
     if (!$id) {
       $id = CRM_Utils_Array::value('contact_id', $params);
     }
-    if (!empty($params['note']) || CRM_Utils_Array::value('id', CRM_Utils_Array::value('note',$ids))) {
+    if (!empty($params['note']) || CRM_Utils_Array::value('id', CRM_Utils_Array::value('note', $ids))) {
       $noteParams = array(
         'entity_table' => 'civicrm_grant',
         'note' => $params['note'] = $params['note'] ? $params['note'] : "null",
@@ -278,7 +279,7 @@ class CRM_Grant_BAO_Grant extends CRM_Grant_DAO_Grant {
         'modified_date' => date('Ymd'),
       );
 
-      CRM_Core_BAO_Note::add($noteParams, $ids['note']);
+      CRM_Core_BAO_Note::add($noteParams, (array) CRM_Utils_Array::value('note', $ids));
     }
     // Log the information on successful add/edit of Grant
     $logParams = array(
@@ -309,11 +310,12 @@ class CRM_Grant_BAO_Grant extends CRM_Grant_DAO_Grant {
   /**
    * Function to delete the Contact
    *
-   * @param int $cid  contact id
+   * @param int $id contact id
+   *
+   * @return bool
    *
    * @access public
    * @static
-   *
    */
   static function deleteContact($id) {
     $grant = new CRM_Grant_DAO_Grant();
@@ -325,8 +327,9 @@ class CRM_Grant_BAO_Grant extends CRM_Grant_DAO_Grant {
   /**
    * Function to delete the grant
    *
-   * @param int $id  grant id
+   * @param int $id grant id
    *
+   * @return bool|mixed
    * @access public
    * @static
    *
@@ -412,7 +415,7 @@ class CRM_Grant_BAO_Grant extends CRM_Grant_DAO_Grant {
   /**
    * Function to get grant record count for a Contact
    *
-   * @param int $contactId Contact ID
+   * @param int $contactID
    *
    * @return int count of grant records
    * @access public