/** * Constructor */ function __construct($contact_id) { // Contact $configContact = CRM_Lidmaatschapwijziging_ConfigContact::singleton($contact_id); $this->contact = $configContact->getContact(); $this->contact_id = $contact_id; }
/** * Constructor */ function __construct($contact_id) { // Contact $configContact = CRM_Lidmaatschapwijziging_ConfigContact::singleton($contact_id); $this->contact = $configContact->getContact(); $this->contact_id = $contact_id; // Registratie Opleiding Belangstelling $this->setRegiOplBelCustomGroup(); $this->setRegiOplBelCustomFields(); $this->setRegiOplBelCustomFieldsOptionValues(); $this->setRegiOplBelCustomValues(); }
/** * Constructor */ function __construct($contact_id) { // Contact $configContact = CRM_Lidmaatschapwijziging_ConfigContact::singleton($contact_id); $this->contact = $configContact->getContact(); $this->contact_id = $contact_id; // membership $this->setMemberships(); $this->setMembershipFields(); $this->setMembershipTypes(); $this->setMembershipStatus(); $this->setMembershipCustomGroup(); $this->setMembershipCustomFields(); $this->setMembershipCustomFieldsOptionValues(); }
/** * Constructor */ function __construct($contact_id) { // Contact $configContact = CRM_Lidmaatschapwijziging_ConfigContact::singleton($contact_id); $this->contact = $configContact->getContact(); $this->contact_id = $contact_id; // Relationship Type //$this->setRelationshipTypeEmployerOf(); // Relationship Current Employer //$this->setRelationshipCurrentEmployer(); // Relationships $this->setRelationships(); $this->setrelatiosnhipTypes(); // Relationship last, Contact a en b //$this->setRelationshipLast(); // Contact a en b //$this->setContactA(); //$this->setContactB(); }
function postProcess() { $values = $this->exportValues(); $this->_configContact = CRM_Lidmaatschapwijziging_ConfigContact::singleton($this->_contactId); // set current_employer // current employer if (isset($values['current_employer_id']) and is_numeric($values['current_employer_id'])) { $values['current_employer'] = $values['current_employer_id']; } // api create contact try { $params = array('version' => 3, 'sequential' => 1, 'id' => $this->_contactId, 'contact_type' => $values['contact_type'], 'current_employer' => $values['current_employer'], 'job_title' => $values['job_title'], 'source' => $values['source']); // for the custom values in contact, the need to be custom_35 foreach ($this->_configContact->getVnvInfoCustomFields() as $key => $field) { if (isset($values[$field['name']])) { $params['custom_' . $field['id']] = $values[$field['name']]; } } foreach ($this->_configContact->getWerkgeverCustomFields() as $key => $field) { if (isset($values[$field['name']])) { $params['custom_' . $field['id']] = $values[$field['name']]; } } $result = civicrm_api('Contact', 'create', $params); // check no error if (isset($result['is_error']) and !$result['is_error']) { // if there is no error // set message $session = CRM_Core_Session::singleton(); $session->setStatus(ts('%1 is opgeslagen !', $this->_display_name), ts('Lidmaatschap Wijziging - Contact'), 'success'); // redirect user $url = CRM_Utils_System::url('civicrm/lidmaatschapwijziging/membership', 'reset=1&request=choose&cid=' . $this->_contactId); CRM_Utils_System::redirect($url); } else { // if there is a error // set message $session = CRM_Core_Session::singleton(); $session->setStatus(ts('Er is een error: %1, %2 is niet opgeslagen !', array($result['error_message'], $this->_display_name)), ts('Lidmaatschap Wijziging - Contact'), 'error'); // redirect user $url = CRM_Utils_System::url('civicrm/lidmaatschapwijziging/contact', 'reset=1&cid=' . $this->_contactId); CRM_Utils_System::redirect($url); } } catch (CiviCRM_API3_Exception $ex) { throw new Exception('Could not create contact, ' . 'error from Api Contact create: ' . $ex->getMessage()); } }