diff --git a/CRM/Civiquickbooks/Contact.php b/CRM/Civiquickbooks/Contact.php index 5cebaa7..c18a795 100644 --- a/CRM/Civiquickbooks/Contact.php +++ b/CRM/Civiquickbooks/Contact.php @@ -257,6 +257,7 @@ public function push($params) { $abort_loop = TRUE; throw new CiviCRM_API3_Exception('Authentication failure doing QBO contact push, aborting', 9000 + $error_code); break; + default: $account_contact['error_data'] = json_encode(['failures' => ++$failure_count, 'error' => $error_message]); throw new Exception('"' . implode("\n", $error_message) . '"'); @@ -328,6 +329,12 @@ public function push($params) { } } + /** + * @param array $contact + * + * @return mixed|string + * @throws \CRM_Core_Exception + */ public static function getBillingEmail($contact) { if (is_array($contact)) { $contact = $contact['id']; @@ -361,6 +368,12 @@ public static function getBillingEmail($contact) { return ''; } + /** + * @param array $contact + * + * @return array + * @throws \CRM_Core_Exception + */ public static function getBillingAddr($contact) { if (is_array($contact)) { $contact = $contact['id']; @@ -415,6 +428,12 @@ public static function getBillingAddr($contact) { return []; } + /** + * @param array $contact + * + * @return mixed|string + * @throws \CRM_Core_Exception + */ public static function getBillingPhone($contact) { if (is_array($contact)) { $contact = $contact['id']; @@ -451,7 +470,14 @@ public static function getBillingPhone($contact) { return ''; } - + /** + * @param array $contact + * @param string $accountsID + * @param array|NULL $customer_data + * + * @return mixed|null + * @throws \Exception + */ protected function mapToCustomer($contact, $accountsID, $customer_data) { $customer = [ "BillAddr" => self::getBillingAddr($contact), @@ -494,6 +520,11 @@ protected function mapToCustomer($contact, $accountsID, $customer_data) { /** * Get all the customers from Quickbooks by providing a modification date. + * + * @param string $start_date_string + * + * @return array + * @throws \CRM_Civiquickbooks_Contact_Exception */ protected function getQBOContacts($start_date_string) { $date = date('c', strtotime($start_date_string)); @@ -534,9 +565,9 @@ protected function getQBOContacts($start_date_string) { * function reflects the same by accepting either a FullyQualifiedName or * FamilyName + GivenName pair * - * @param $name Family Name for Individuals or Company / + * @param string $name Family Name for Individuals or Company / * Fully Qualified Name for Organisations - * @param $givenName Given Name for Individuals if present; Contact is assumed + * @param string $givenName Given Name for Individuals if present; Contact is assumed * to be an Organisation otherwise. */ protected function getQBOContactByName($name, $givenName = NULL) { @@ -566,7 +597,6 @@ protected function getQBOContactByName($name, $givenName = NULL) { } } - } /**