/** * Function to compare if an input field is existing in array of adhoc charges * * * @param array $fields input parameters to find adhoc charges * @param array $array array of adhoc charges * * @return boolean, id of matching adhoc charges * * @access public * @static */ static function findExistingAdhocCharges($fields, $adhocChargesList) { $keysToUnset = array('id', 'quantity', 'is_cancelled', 'is_deleted'); CRM_Booking_Utils_Array::unsetArray($fields, $keysToUnset); foreach ($adhocChargesList as $key => $value) { $id = $value['id']; CRM_Booking_Utils_Array::unsetArray($value, $keysToUnset); if ($fields == $value) { return array(TRUE, $id); } } return array(FALSE, NULL); }
/** * Function to compare if an input field is existing in array of slots * * * @param array $fields input parameters to find slot * @param array $array array of slots * * @return boolean, id of matching slot * * @access public * @static */ static function findExistingSubSlot($fields, $slots) { $keysToUnset = array('id', 'quantity', 'note'); CRM_Booking_Utils_Array::unsetArray($fields, $keysToUnset); foreach ($slots as $key => $value) { $id = $value['id']; CRM_Booking_Utils_Array::unsetArray($value, $keysToUnset); $value['time_required'] = CRM_Utils_Date::processDate($value['time_required']); if ($fields == $value) { return array(TRUE, $id); } } return array(FALSE, NULL); }