<?php // Copyright SQCRM. For licensing, reuse, modification and distribution see license.txt /** * @author Abhik Chakraborty */ use sendwithus\API; require_once BASE_PATH . '/plugins/EmailerSendWithUs/libs/sendwithus/vendor/autoload.php'; $sqcrm_record_id = (int) $_GET["sqrecord"]; $emailer = new EmailerSendWithUs(); $contact_detail = $emailer->get_contacts_detail($sqcrm_record_id); if (count($contact_detail) > 0) { $email_found = true; $primary_email = ''; $secondary_email = ''; if ($contact_detail[0]['email'] == '' && $contact_detail[0]['secondary_email'] == '') { $email_found = false; } if ($contact_detail[0]['email'] != '') { $primary_email = $contact_detail[0]['email']; } if ($contact_detail[0]['secondary_email'] != '') { $secondary_email = $contact_detail[0]['secondary_email']; } $api = $emailer->get_api_instance(); $err = ''; if (false === $email_found) { $err = _('No email found to fetch the activity from sendwithus'); } else { if ($primary_email != '') { $primary_email_log = $api->get_customer_logs($primary_email);
<?php // Copyright SQCRM. For licensing, reuse, modification and distribution see license.txt /** * @author Abhik Chakraborty */ use sendwithus\API; require_once BASE_PATH . '/plugins/EmailerSendWithUs/libs/sendwithus/vendor/autoload.php'; $emailer = new EmailerSendWithUs(); $api_key = $emailer->get_api_key(); $entity_selected = false; $templates_found = false; $groups_found = false; $api = new API($api_key); // get the templates $templates = $api->emails(); $templates_array = array(); if (is_array($templates) && count($templates) > 0) { foreach ($templates as $key => $templateObj) { if (property_exists($templateObj, 'name') && property_exists($templateObj, 'id')) { $templates_array[$templateObj->id] = $templateObj->name; } } $templates_found = true; } //get the groups, sending email to a selected group feature is not added yet /*$groups = $api->list_groups(); $groups_array = array(); if (is_array($groups->groups) && count($groups->groups) > 0) { foreach ($groups->groups as $key=>$groupsObj) { $groups_array[$groupsObj->id] = $groupsObj->name;