function buildDocumentModel()
 {
     global $app_strings;
     try {
         $model = parent::buildDocumentModel();
         $this->generateEntityModel($this->focus, 'Potentials', 'potential_', $model);
         $entity = new Accounts();
         if ($this->focusColumnValue('related_to')) {
             $entity->retrieve_entity_info($this->focusColumnValue('related_to'), 'Accounts');
         }
         $this->generateEntityModel($entity, 'Accounts', 'account_', $model);
         $entity = new Contacts();
         if ($this->focusColumnValue('contact_id')) {
             $entity->retrieve_entity_info($this->focusColumnValue('contact_id'), 'Contacts');
         }
         $this->generateEntityModel($entity, 'Contacts', 'contact_', $model);
         $this->generateUi10Models($model);
         $this->generateRelatedListModels($model);
         $model->set('potential_no', $this->focusColumnValue('potential_no'));
         $model->set('potential_owner', getUserFullName($this->focusColumnValue('assigned_user_id')));
         return $model;
     } catch (Exception $e) {
         echo '<meta charset="utf-8" />';
         if ($e->getMessage() == $app_strings['LBL_RECORD_DELETE']) {
             echo $app_strings['LBL_RECORD_INCORRECT'];
             echo '<br><br>';
         } else {
             echo $e->getMessage();
             echo '<br><br>';
         }
         return null;
     }
 }
 function buildDocumentModel()
 {
     global $app_strings;
     try {
         $model = parent::buildDocumentModel();
         $this->generateEntityModel($this->focus, 'PurchaseOrder', 'purchaseorder_', $model);
         $entity = new Contacts();
         if ($this->focusColumnValue('contact_id')) {
             $entity->retrieve_entity_info($this->focusColumnValue('contact_id'), 'Contacts');
         }
         $this->generateEntityModel($entity, 'Contacts', 'contact_', $model);
         $entity = new Vendors();
         if ($this->focusColumnValue('vendor_id')) {
             $entity->retrieve_entity_info($this->focusColumnValue('vendor_id'), 'Vendors');
         }
         $this->generateEntityModel($entity, 'Vendors', 'vendor_', $model);
         $this->generateUi10Models($model);
         $this->generateRelatedListModels($model);
         $model->set('purchaseorder_no', $this->focusColumnValue('purchaseorder_no'));
         return $model;
     } catch (Exception $e) {
         echo '<meta charset="utf-8" />';
         if ($e->getMessage() == $app_strings['LBL_RECORD_DELETE']) {
             echo $app_strings['LBL_RECORD_INCORRECT'];
             echo '<br><br>';
         } else {
             echo $e->getMessage();
             echo '<br><br>';
         }
         return null;
     }
 }
예제 #3
0
 public function __construct($options = null)
 {
     $staff = new Contacts();
     $flos = $staff->getAttending();
     parent::__construct($options);
     ZendX_JQuery::enableForm($this);
     $decorators = array(array('ViewHelper'), array('Description', array('placement' => 'append', 'class' => 'info')), array('Errors', array('placement' => 'apppend', 'class' => 'error', 'tag' => 'li')), array('Label'), array('HtmlTag', array('tag' => 'li')));
     $this->setName('addFlo');
     $flo = new Zend_Form_Element_Select('staffID');
     $flo->setLabel('Finds officer present: ')->setRequired(true)->addFilters(array('StringTrim', 'StripTags'))->addValidator('Int')->setDecorators($decorators)->addMultiOptions(array(NULL => 'Choose attending officer', 'Our staff members' => $flos));
     $dateFrom = new ZendX_JQuery_Form_Element_DatePicker('dateFrom');
     $dateFrom->setLabel('Attended from: ')->setRequired(true)->addValidator('Date')->addFilters(array('StripTags', 'StringTrim'))->addValidator('NotEmpty')->setAttrib('size', 20)->addDecorator(array('ListWrapper' => 'HtmlTag'), array('tag' => 'li'))->removeDecorator('DtDdWrapper');
     $dateTo = new ZendX_JQuery_Form_Element_DatePicker('dateTo');
     $dateTo->setLabel('Attended to: ')->setRequired(true)->addValidator('Date')->addFilters(array('StripTags', 'StringTrim'))->setAttrib('size', 20)->addDecorator(array('ListWrapper' => 'HtmlTag'), array('tag' => 'li'))->removeDecorator('DtDdWrapper');
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submit')->setAttrib('class', 'large')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag');
     $hash = new Zend_Form_Element_Hash('csrf');
     $hash->setValue($this->_config->form->salt)->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('label')->setTimeout(60);
     $this->addElement($hash);
     $this->addElements(array($flo, $dateFrom, $dateTo, $submit));
     $this->addDisplayGroup(array('staffID', 'dateFrom', 'dateTo'), 'details')->removeDecorator('HtmlTag');
     $this->details->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul'))));
     $this->details->removeDecorator('DtDdWrapper');
     $this->details->removeDecorator('HtmlTag');
     $this->details->setLegend('Attending Finds Officers');
     $this->addDisplayGroup(array('submit'), 'submit');
     $this->submit->removeDecorator('DtDdWrapper');
     $this->submit->removeDecorator('HtmlTag');
 }
예제 #4
0
 public function save()
 {
     $this->load->model('contacts');
     $contact = new Contacts();
     $contact->id = 1;
     $contact->name = $this->input->post('name');
     $contact->number = $this->input->post('number');
     $contact->city = $this->input->post('city');
     if ($contact->save()) {
         die('Saved');
     }
 }
예제 #5
0
 public function testGetRecordIds()
 {
     $_GET['Contacts'] = array('firstName' => 't', 'assignedTo' => 'Chris');
     $_GET['Contacts_sort'] = 'id.desc';
     $contact = new Contacts('search');
     $dataProvider = $contact->search(PHP_INT_MAX);
     $dataProvider->calculateChecksum = true;
     $data = $dataProvider->getData();
     $this->assertNotEquals(0, count($data));
     $ids = array();
     foreach ($data as $model) {
         $ids[] = $model->id;
     }
     $this->assertEquals($dataProvider->getRecordIds(), $ids);
     $contact = new Contacts('search');
     // lower page size so that record count is incorrect
     $dataProvider = $contact->search(10);
     $dataProvider->calculateChecksum = true;
     $data = $dataProvider->getData();
     $this->assertNotEquals(0, count($data));
     $ids = array();
     foreach ($data as $model) {
         $ids[] = $model->id;
     }
     $this->assertNotEquals($dataProvider->getRecordIds(), $ids);
     // ensure that default ordering gets applied in both cases (SmartActiveDataProvider applies
     // default id DESC ordering if /\bid\b/ isn't found in sort order)
     $_GET['Contacts'] = array('firstName' => 't', 'assignedTo' => 'Chris');
     $_GET['Contacts_sort'] = 'dupeCheck.desc';
     $contact = new Contacts('search');
     $dataProvider = $contact->search(PHP_INT_MAX);
     $dataProvider->calculateChecksum = true;
     $data = $dataProvider->getData();
     $this->assertNotEquals(0, count($data));
     $ids = array();
     foreach ($data as $model) {
         $ids[] = $model->id;
     }
     $this->assertEquals($dataProvider->getRecordIds(), $ids);
     // more filters, different sort order
     $_GET['Contacts'] = array('firstName' => 't', 'lastName' => '<>t', 'assignedTo' => 'Chloe', 'rating' => '<4');
     $_GET['Contacts_sort'] = 'rating.desc';
     $contact = new Contacts('search');
     $dataProvider = $contact->search(PHP_INT_MAX);
     $dataProvider->calculateChecksum = true;
     $data = $dataProvider->getData();
     $this->assertNotEquals(0, count($data));
     $ids = array();
     foreach ($data as $model) {
         $ids[] = $model->id;
     }
     $this->assertEquals($dataProvider->getRecordIds(), $ids);
 }
예제 #6
0
 /**
  * Add a new contact
  * @param $id
  * @param array $data
  * @return integer contact_id
  */
 public static function AddNew(array $data, $id = "")
 {
     if (is_numeric($id)) {
         $contact = self::find($id);
     } else {
         $contact = new Contacts();
     }
     $contact['contact'] = $data['contact'];
     $contact['type_id'] = $data['type_id'];
     $contact['customer_id'] = $data['customer_id'];
     $contact->save();
     return $contact['contact_id'];
 }
예제 #7
0
 private function createContact($con)
 {
     $con_model = new \Contacts();
     $con_model->attributes = $con;
     $con_model->ID_user = $this->tiUser->ID;
     try {
         if (!$con_model->save()) {
             new \Error(5, null, json_encode($con_model->getErrors()));
         }
     } catch (Exception $e) {
         new \Error(5, null, $e->getMessage());
     }
 }
예제 #8
0
 /** Set up view for individual contact
  */
 public function profileAction()
 {
     if ($this->_getParam('id', false)) {
         $id = $this->_getParam('id');
         $staffs = new Contacts();
         $this->view->staffs = $staffs->getPersonDetails($id);
         $findstotals = new Finds();
         $this->view->findstotals = $findstotals->getFindsFloQuarter($id);
         $periodtotals = new Finds();
         $this->view->periodtotals = $periodtotals->getFindsFloPeriod($id);
     } else {
         throw new Pas_Exception_Param($this->_missingParameter);
     }
 }
예제 #9
0
 /** Profile page
  * @access public
  * @return void
  * @throws Pas_Exception_Param
  */
 public function profileAction()
 {
     if ($this->getParam('id', false)) {
         $id = $this->getParam('id');
         $staffs = new Contacts();
         $this->view->persons = $staffs->getPersonDetails($id);
         $this->view->findstotals = $this->getFinds()->getFindsFloQuarter($id);
         $this->view->periodtotals = $this->getFinds()->getFindsFloPeriod($id);
         $accts = new OnlineAccounts();
         $this->view->accts = $accts->getAccounts($id);
     } else {
         throw new Pas_Exception_Param($this->_missingParameter, 500);
     }
 }
예제 #10
0
 /**
  * Test subscribing and then receiving data:
  */
 public function testSubscription()
 {
     // 1: Request to subscribe:
     $hookName = 'ContactsCreate';
     $hook = array('event' => 'RecordCreateTrigger', 'target_url' => TEST_WEBROOT_URL . '/api2HooksTest.php?name=' . $hookName);
     $ch = $this->getCurlHandle('POST', array('{suffix}' => ''), 'admin', $hook, array(CURLOPT_HEADER => 1));
     $response = curl_exec($ch);
     $this->assertResponseCodeIs(201, $ch, VERBOSE_MODE ? $response : '');
     $trigger = ApiHook::model()->findByAttributes($hook);
     // 2. Create a contact
     $contact = array('firstName' => 'Walter', 'lastName' => 'White', 'email' => '*****@*****.**', 'visibility' => 1);
     $ch = curl_init(TEST_BASE_URL . 'api2/Contacts');
     $options = array(CURLOPT_POSTFIELDS => json_encode($contact), CURLOPT_HTTPHEADER => array('Content-Type: application/json'), CURLOPT_POST => true, CURLOPT_RETURNTRANSFER => true, CURLOPT_HEADER => true);
     foreach ($this->authCurlOpts() as $opt => $optVal) {
         $options[$opt] = $optVal;
     }
     curl_setopt_array($ch, $options);
     $response = curl_exec($ch);
     $c = Contacts::model()->findByAttributes($contact);
     $this->assertResponseCodeIs(201, $ch);
     $this->assertNotEmpty($c);
     // 3. Test that the receiving end got the payload
     $outputDir = implode(DIRECTORY_SEPARATOR, array(Yii::app()->basePath, 'tests', 'data', 'output'));
     $this->assertFileExists($outputDir . DIRECTORY_SEPARATOR . "hook_{$hookName}.json");
     $contactPulled = json_decode(file_get_contents($outputDir . DIRECTORY_SEPARATOR . "hook_pulled_{$hookName}.json"), 1);
     foreach ($contact as $field => $value) {
         $this->assertEquals($value, $contactPulled[$field]);
     }
 }
예제 #11
0
 private function fetchSpecificContact()
 {
     $con_model = Contacts::model()->findAllByAttributes($this->contacts);
     foreach ($con_model as $data) {
         $this->data[] = $data->attributes;
     }
 }
 /**
  * Return user object
  *
  * @param void
  * @return Contact
  */
 function getUser()
 {
     if (is_null($this->user)) {
         $this->user = Contacts::findById($this->getContactId());
     }
     return $this->user;
 }
 /**
  *	
  * @param array $permissions with the member and the changed_pgs
  */
 function afterMemberPermissionChanged($permissions)
 {
     $member = array_var($permissions, 'member');
     //get all users in the set of permissions groups
     $permissionGroupIds = array();
     foreach (array_var($permissions, 'changed_pgs') as $pg_id) {
         $permissionGroupId = $pg_id;
         if (!in_array($permissionGroupId, $permissionGroupIds)) {
             $permissionGroupIds[] = $permissionGroupId;
         }
     }
     if (count($permissionGroupIds) > 0) {
         $usersIds = ContactPermissionGroups::getAllContactsIdsByPermissionGroupIds($permissionGroupIds);
         foreach ($usersIds as $us_id) {
             $user = Contacts::findById($us_id);
             ContactMemberCaches::updateContactMemberCache($user, $member->getId());
         }
     } else {
         //update this member for all user in cache
         $contacts = Contacts::getAllUsers();
         foreach ($contacts as $contact) {
             ContactMemberCaches::updateContactMemberCache($contact, $member->getId());
         }
     }
 }
예제 #14
0
 public function run()
 {
     $actionParams = Yii::app()->controller->getActionParams();
     $address = '';
     if (Yii::app()->controller->module != null && Yii::app()->controller->module->id == 'contacts' && Yii::app()->controller->action->id == 'view' && isset($actionParams['id'])) {
         // must have an actual ID value
         $currentRecord = Contacts::model()->findByPk($actionParams['id']);
         if (!empty($currentRecord->city)) {
             if (!empty($currentRecord->address)) {
                 $address .= $currentRecord->address . ', ';
             }
             $address .= $currentRecord->city . ', ';
         }
         if (!empty($currentRecord->state)) {
             $address .= $currentRecord->state . ' ';
         }
         if (!empty($currentRecord->zipcode)) {
             $address .= $currentRecord->zipcode . ' ';
         }
         if (!empty($currentRecord->country)) {
             $address .= $currentRecord->country;
         }
     }
     $this->render('googleMaps', array('address' => $address));
 }
예제 #15
0
 /**
  * Ensure that update and create trigger appropriate flows
  */
 public function testContacts()
 {
     X2FlowTestingAuxLib::clearLogs($this);
     $this->action = 'model';
     $this->assertEquals(array(), TriggerLog::model()->findAll());
     // Create
     $contact = array('firstName' => 'Walt', 'lastName' => 'White', 'email' => '*****@*****.**', 'visibility' => 1, 'trackingKey' => '1234');
     $ch = $this->getCurlHandle('POST', array('{modelAction}' => 'Contacts'), 'admin', $contact);
     $response = json_decode(curl_exec($ch), 1);
     $id = $response['id'];
     $this->assertResponseCodeIs(201, $ch);
     $this->assertTrue((bool) ($newContact = Contacts::model()->findBySql('SELECT * FROM x2_contacts
             WHERE firstName="Walt" 
             AND lastName="White" 
             AND email="*****@*****.**"
             AND trackingKey="1234"')));
     $logs = TriggerLog::model()->findAll();
     $this->assertEquals(1, count($logs));
     $trace = X2FlowTestingAuxLib::getTraceByFlowId($this->flows('flow1')->id);
     $this->assertTrue(is_array($trace));
     $this->assertTrue(X2FlowTestingAuxLib::checkTrace($trace));
     // Update
     $contact['firstName'] = 'Walter';
     $ch = $this->getCurlHandle('PUT', array('{modelAction}' => "Contacts/{$id}.json"), 'admin', $contact);
     $response = json_decode(curl_exec($ch), 1);
     $this->assertResponseCodeIs(200, $ch);
     $newContact->refresh();
     $this->assertEquals($contact['firstName'], $newContact['firstName']);
     $logs = TriggerLog::model()->findAll();
     $this->assertEquals(2, count($logs));
     $trace = X2FlowTestingAuxLib::getTraceByFlowId($this->flows('flow2')->id);
     $this->assertTrue(is_array($trace));
     $this->assertTrue(X2FlowTestingAuxLib::checkTrace($trace));
 }
예제 #16
0
 public function addMoreContactAction()
 {
     if ($this->request->isPost() == true) {
         $group_id = $this->request->getPost('group_id');
         $user_id = $this->request->getPost('user_id');
         $groucontact = GroupContact::find("group_id={$group_id}");
         $contact_ids = array();
         foreach ($groucontact as $contact) {
             $contact_ids[] = $contact->contact_id;
         }
         $contacts = '';
         $contacts = implode(',', $contact_ids);
         if (count($contact_ids) > 0) {
             $other_contacts = Contacts::find(array('conditions' => 'id NOT IN (' . $contacts . ') AND user_id=' . $user_id . ' AND deleted=0', 'columns' => 'id,name,number,email'));
         } else {
             $other_contacts = Contacts::find(array('conditions' => 'user_id=' . $user_id . ' AND deleted=0', 'columns' => 'id,name,number,email'));
         }
         $morecontacts = array();
         foreach ($other_contacts as $other_contact) {
             $morecontacts[] = array('id' => $other_contact->id, 'name' => $other_contact->name, 'number' => $other_contact->number, 'email' => $other_contact->email);
         }
         $this->response->setContent(json_encode(array('morecontacts' => $morecontacts)));
         // $this->flash->error($other_contacts->getMessages());
         $this->response->send();
     } else {
     }
 }
예제 #17
0
 /**
  * Return parent user
  *
  * @param void
  * @return User
  */
 function getUser()
 {
     if (is_null($this->contact)) {
         $this->contact = Contacts::findById($this->getContactId());
     }
     // if
     return $this->contact;
 }
예제 #18
0
 /**
  * Generates a string of contact info used for the popup tooltips.
  *
  * @param integer contact ID
  * @param integer site ID
  * @return string info string
  */
 private static function _contact($contactID, $siteID)
 {
     $contacts = new Contacts($siteID);
     $infoRS = $contacts->get($contactID);
     if (empty($infoRS)) {
         return 'The specified contact could not be found.';
     }
     $infoString = sprintf('<span class="bold">Contact:</span>&nbsp;%s %s', htmlspecialchars($infoRS['firstName']), htmlspecialchars($infoRS['lastName']));
     if (!empty($infoRS['title'])) {
         $infoString .= sprintf('<br /><span class="bold">Title:</span>&nbsp;%s', htmlspecialchars($infoRS['title']));
     }
     if (!empty($infoRS['companyName'])) {
         $infoString .= sprintf('<br /><span class="bold">Company:</span>&nbsp;%s', htmlspecialchars($infoRS['companyName']));
     }
     if (!empty($infoRS['department'])) {
         $infoString .= sprintf('<br /><span class="bold">Department:</span>&nbsp;%s', htmlspecialchars($infoRS['department']));
     }
     if (!empty($infoRS['email1'])) {
         $infoString .= sprintf('<br /><span class="bold">Primary Email:</span>&nbsp;%s', htmlspecialchars($infoRS['email1']));
     }
     if (!empty($infoRS['email2'])) {
         $infoString .= sprintf('<br /><span class="bold">Secondary Email:</span>&nbsp;%s', htmlspecialchars($infoRS['email2']));
     }
     if (!empty($infoRS['phoneWork'])) {
         $infoString .= sprintf('<br /><span class="bold">Work Phone:</span>&nbsp;%s', htmlspecialchars($infoRS['phoneWork']));
     }
     if (!empty($infoRS['phoneCell'])) {
         $infoString .= sprintf('<br /><span class="bold">Cell Phone:</span>&nbsp;%s', htmlspecialchars($infoRS['phoneCell']));
     }
     if (!empty($infoRS['phoneOther'])) {
         $infoString .= sprintf('<br /><span class="bold">Other Phone:</span>&nbsp;%s', htmlspecialchars($infoRS['phoneOther']));
     }
     if (!empty($infoRS['address'])) {
         $infoString .= sprintf('<br /><span class="bold">Address:</span><br />&nbsp;&nbsp;%s', htmlspecialchars($infoRS['address']));
         if (!empty($infoRS['city'])) {
             $infoString .= sprintf('&nbsp;%s', htmlspecialchars($infoRS['city']));
         }
         if (!empty($infoRS['state'])) {
             $infoString .= sprintf('&nbsp;%s', htmlspecialchars($infoRS['state']));
         }
         if (!empty($infoRS['zip'])) {
             $infoString .= sprintf('&nbsp;%s', htmlspecialchars($infoRS['zip']));
         }
     }
     return $infoString;
 }
예제 #19
0
 function getUserName()
 {
     $user = Contacts::findById($this->getCreatedById());
     if ($user instanceof Contact) {
         return $user->getUsername();
     } else {
         return null;
     }
 }
 public function actionSendContact()
 {
     $model = new Contacts();
     if (isset($_POST['Contacts'])) {
         $model->attributes = $_POST['Contacts'];
         $model->date = new CDbExpression('NOW()');
         if ($model->save()) {
             echo 'Thank you for contacting us. We will respond to you as soon as possible.';
         } else {
             echo 'Send contact failed, please fix some error:';
             foreach ($model->errors as $err) {
                 echo '<br>' . ' - ' . $err[0];
             }
         }
     } else {
         echo 'Error ';
     }
 }
예제 #21
0
 /** The constructor
  * @access public
  * @param array $options
  * @return void
  */
 public function __construct(array $options = null)
 {
     $f = new Contacts();
     $flos = $f->getFloEmailsForForm();
     parent::__construct($options);
     $this->setName('notifyFlo');
     $flo = new Zend_Form_Element_Select('flo');
     $flo->setLabel('Which flo is yours?: ')->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->setRequired(true)->addMultiOptions(array(null => 'Choose your FLO', 'Available FLOs' => $flos));
     $type = new Zend_Form_Element_Select('type');
     $type->setLabel('Message type: ')->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->setRequired(true)->addMultiOptions(array(null => 'Choose reason', 'Choose error type' => array('Can you publish this please?' => 'Can you publish this please?', 'More info' => 'I have further information', 'Image problem' => 'Image problem', 'Grid reference issues' => 'Grid reference issues', 'Duplicated record' => 'Duplicated record', 'Data problems apparent' => 'Data problems - what do I do?', 'Other' => 'Other reason')))->addErrorMessage('You must enter an error report type');
     $content = new Pas_Form_Element_CKEditor('content');
     $content->setLabel('Enter your comment: ')->setRequired(true)->addFilter('StringTrim')->setAttrib('Height', 400)->setAttrib('ToolbarSet', 'Basic')->addFilters(array('StringTrim', 'WordChars', 'HtmlBody', 'EmptyParagraph'))->addErrorMessage('Please enter something in the comments box!');
     $hash = new Zend_Form_Element_Hash('csrf');
     $hash->setValue($this->_salt)->setTimeout(60);
     $submit = new Zend_Form_Element_Submit('submit');
     $this->addElements(array($content, $flo, $type, $submit, $hash));
     $this->addDisplayGroup(array('flo', 'type', 'content'), 'details');
     $this->addDisplayGroup(array('submit'), 'buttons');
     parent::init();
 }
예제 #22
0
 /** The constructor
  * @access public
  * @param array $options
  * @return void
  */
 public function __construct(array $options = null)
 {
     $staff = new Contacts();
     $flos = $staff->getAttending();
     parent::__construct($options);
     ZendX_JQuery::enableForm($this);
     $this->setName('addFlo');
     $flo = new Zend_Form_Element_Select('staffID');
     $flo->setLabel('Finds officer present: ')->setRequired(true)->addFilters(array('StringTrim', 'StripTags'))->addValidator('Int')->addMultiOptions(array(null => 'Choose attending officer', 'Our staff members' => $flos))->setAttribs(array('class' => 'input-xxlarge selectpicker show-menu-arrow'));
     $dateFrom = new ZendX_JQuery_Form_Element_DatePicker('dateFrom');
     $dateFrom->setLabel('Attended from: ')->setRequired(true)->setJQueryParam('dateFormat', 'yy-mm-dd')->addFilters(array('StripTags', 'StringTrim'))->addValidator('NotEmpty')->setAttrib('size', 20);
     $dateTo = new ZendX_JQuery_Form_Element_DatePicker('dateTo');
     $dateTo->setLabel('Attended to: ')->setRequired(false)->setJQueryParam('dateFormat', 'yy-mm-dd')->addFilters(array('StripTags', 'StringTrim'))->setAttrib('size', 20);
     $submit = new Zend_Form_Element_Submit('submit');
     $this->addElements(array($flo, $dateFrom, $dateTo, $submit));
     $this->addDisplayGroup(array('staffID', 'dateFrom', 'dateTo'), 'details');
     $this->details->setLegend('Attending Finds Officers');
     $this->addDisplayGroup(array('submit'), 'buttons');
     parent::init();
 }
예제 #23
0
function get_contacts_columns($user_name, $session)
{
    if (!validateSession($user_name, $session)) {
        return null;
    }
    global $current_user, $log;
    require_once "modules/Users/Users.php";
    $seed_user = new Users();
    $user_id = $seed_user->retrieve_user_id($user_name);
    $current_user = $seed_user;
    $current_user->retrieve_entity_info($user_id, 'Users');
    if (isPermitted("Contacts", "index") == "yes") {
        require_once 'modules/Contacts/Contacts.php';
        $contact = new Contacts();
        $log->debug($contact->getColumnNames());
        return $contact->getColumnNames();
    } else {
        $return_array = array();
        return $return_array;
    }
}
예제 #24
0
 /** Set up view for index page
  * @access public
  * @return void
  */
 public function indexAction()
 {
     $contacts = new Contacts();
     if (!in_array($this->_helper->contextSwitch()->getCurrentContext(), array('kml', 'json', 'rss', 'atom', 'foaf', 'xml'))) {
         $this->view->centrals = $contacts->getCentralUnit();
         $this->view->flos = $contacts->getLiaisonOfficers();
         $this->view->treasures = $contacts->getTreasures();
         $this->view->advisers = $contacts->getAdvisers();
         $this->view->schemes = $contacts->getCurrent();
         $this->view->pastexplorers = $contacts->getPastExplorers();
     } else {
         $this->view->staff = $contacts->getCurrent();
     }
 }
예제 #25
0
 private static function setRecipients()
 {
     if (self::$model->recipients_source === MsgSmsOutbox::RECIPIENTS_SOURCE_GROUPS) {
         if (empty(self::$model->group_id)) {
             throw new CException("group_id cannot be empty");
         }
         self::$model->recipients = ContactsInGroupView::model()->getPhoneNumbers(self::$model->group_id);
     } else {
         if (self::$model->recipients_source === MsgSmsOutbox::RECIPIENTS_SOURCE_PHONEBOOK) {
             self::$model->recipients = Contacts::model()->getAllPhoneNumbers(self::$model->org_id);
         }
     }
 }
예제 #26
0
 /**
  * Displays a particular model.
  * @param integer $id the ID of the model to be displayed
  */
 public function actionView($id)
 {
     $type = 'opportunities';
     $model = $this->loadModel($id);
     $model->associatedContacts = Contacts::getContactLinks($model->associatedContacts);
     if ($this->checkPermissions($model, 'view')) {
         // add opportunity to user's recent item list
         User::addRecentItem('o', $id, Yii::app()->user->getId());
         parent::view($model, $type);
     } else {
         $this->redirect('index');
     }
 }
예제 #27
0
 public function run()
 {
     $actionParams = Yii::app()->controller->getActionParams();
     $twitter = null;
     if (isset(Yii::app()->controller->module) && Yii::app()->controller->module instanceof ContactsModule && Yii::app()->controller->action->id == 'view' && isset($actionParams['id'])) {
         // must have an actual ID value
         $currentRecord = Contacts::model()->findByPk($actionParams['id']);
         if (!empty($currentRecord->twitter)) {
             $twitter = $currentRecord->twitter;
         }
     }
     $this->render('twitterFeed', array('twitter' => $twitter));
 }
 function buildDocumentModel()
 {
     global $app_strings;
     try {
         $model = parent::buildDocumentModel();
         $this->generateEntityModel($this->focus, 'HelpDesk', 'helpdesk_', $model);
         $entity = new Products();
         if ($this->focusColumnValue('product_id')) {
             $entity->retrieve_entity_info($this->focusColumnValue('product_id'), 'Products');
         }
         $this->generateEntityModel($entity, 'Products', 'product_', $model);
         if ($this->focusColumnValue('parent_id')) {
             $setype = getSalesEntityType($this->focusColumnValue('parent_id'));
         }
         $account = new Accounts();
         $contact = new Contacts();
         if ($setype == 'Accounts') {
             $account->retrieve_entity_info($this->focusColumnValue('parent_id'), $setype);
         } elseif ($setype == 'Contacts') {
             $contact->retrieve_entity_info($this->focusColumnValue('parent_id'), $setype);
         }
         $this->generateEntityModel($account, 'Accounts', 'account_', $model);
         $this->generateEntityModel($contact, 'Contacts', 'contact_', $model);
         $this->generateUi10Models($model);
         $this->generateRelatedListModels($model);
         $model->set('helpdesk_owner', getUserFullName($this->focusColumnValue('assigned_user_id')));
         return $model;
     } catch (Exception $e) {
         echo '<meta charset="utf-8" />';
         if ($e->getMessage() == $app_strings['LBL_RECORD_DELETE']) {
             echo $app_strings['LBL_RECORD_INCORRECT'];
             echo '<br><br>';
         } else {
             echo $e->getMessage();
             echo '<br><br>';
         }
         return null;
     }
 }
예제 #29
0
 public static function getInvestorConversations($investorID)
 {
     global $db;
     $conversations = $db->select('conversations', '*', ['investor' => $investorID]);
     $toReturn = [];
     foreach ($conversations as $conversation) {
         $contact = Contacts::getContact($conversation['contact']);
         if ($contact['crm'] == 1) {
             array_push($toReturn, $conversation);
         }
     }
     return $conversations;
 }
예제 #30
0
function Contacts_sendCustomerPortalLoginDetails($entityData)
{
    $adb = PearDatabase::getInstance();
    $moduleName = $entityData->getModuleName();
    $wsId = $entityData->getId();
    $parts = explode('x', $wsId);
    $entityId = $parts[1];
    $email = $entityData->get('email');
    if ($entityData->get('portal') == 'on' || $entityData->get('portal') == '1') {
        $sql = "SELECT id, user_name, user_password, isactive FROM vtiger_portalinfo WHERE id=?";
        $result = $adb->pquery($sql, array($entityId));
        $insert = false;
        if ($adb->num_rows($result) == 0) {
            $insert = true;
        } else {
            $dbusername = $adb->query_result($result, 0, 'user_name');
            $isactive = $adb->query_result($result, 0, 'isactive');
            if ($email == $dbusername && $isactive == 1 && !$entityData->isNew()) {
                $update = false;
            } else {
                if ($entityData->get('portal') == 'on' || $entityData->get('portal') == '1') {
                    $sql = "UPDATE vtiger_portalinfo SET user_name=?, isactive=1 WHERE id=?";
                    $adb->pquery($sql, array($email, $entityId));
                    $password = $adb->query_result($result, 0, 'user_password');
                    $update = true;
                } else {
                    $sql = "UPDATE vtiger_portalinfo SET user_name=?, isactive=? WHERE id=?";
                    $adb->pquery($sql, array($email, 0, $entityId));
                    $update = false;
                }
            }
        }
        if ($insert == true) {
            $password = makeRandomPassword();
            $sql = "INSERT INTO vtiger_portalinfo(id,user_name,user_password,type,isactive) VALUES(?,?,?,?,?)";
            $params = array($entityId, $email, $password, 'C', 1);
            $adb->pquery($sql, $params);
        }
        if ($insert == true || $update == true) {
            require_once "modules/Emails/mail.php";
            global $current_user;
            $emailData = Contacts::getPortalEmailContents($entityData, $password, 'LoginDetails');
            $subject = $emailData['subject'];
            $contents = $emailData['body'];
            $mail_status = send_mail('Contacts', $entityData->get('email'), $current_user->user_name, "", $subject, $contents);
        }
    } else {
        $sql = "UPDATE vtiger_portalinfo SET user_name=?,isactive=0 WHERE id=?";
        $adb->pquery($sql, array($email, $entityId));
    }
}