Пример #1
0
 /**
  * get translated right descriptions
  * 
  * @return  array with translated descriptions for this applications rights
  */
 public static function getTranslatedRightDescriptions()
 {
     $translate = Tinebase_Translation::getTranslation('Filemanager');
     $rightDescriptions = array(Tinebase_Acl_Rights::MANAGE_SHARED_FOLDERS => array('text' => $translate->_('manage shared folders'), 'description' => $translate->_('Create new shared folders')));
     $rightDescriptions = array_merge($rightDescriptions, parent::getTranslatedRightDescriptions());
     return $rightDescriptions;
 }
Пример #2
0
 /**
  * get translated right descriptions
  * 
  * @return  array with translated descriptions for this applications rights
  */
 public static function getTranslatedRightDescriptions()
 {
     $translate = Tinebase_Translation::getTranslation('Timetracker');
     $rightDescriptions = array(self::MANAGE_TIMEACCOUNTS => array('text' => $translate->_('Manage timeaccounts'), 'description' => $translate->_('Add, edit and delete timeaccounts (includes all timesheet grants)')), self::ADD_TIMEACCOUNTS => array('text' => $translate->_('Add timeaccounts'), 'description' => $translate->_('Add timeaccounts')), Tinebase_Acl_Rights::MANAGE_SHARED_FAVORITES => array('text' => $translate->_('Manage shared timetracker favorites'), 'description' => $translate->_('Create or update shared timetracker favorites')));
     $rightDescriptions = array_merge($rightDescriptions, parent::getTranslatedRightDescriptions());
     return $rightDescriptions;
 }
Пример #3
0
 /**
  * get translated right descriptions
  * 
  * @return  array with translated descriptions for this applications rights
  */
 public static function getTranslatedRightDescriptions()
 {
     $translate = Tinebase_Translation::getTranslation('Calendar');
     $rightDescriptions = array(Tinebase_Acl_Rights::MANAGE_SHARED_FOLDERS => array('text' => $translate->_('manage shared calendars'), 'description' => $translate->_('Create new shared calendars')), Tinebase_Acl_Rights::MANAGE_SHARED_FAVORITES => array('text' => $translate->_('manage shared calendars favorites'), 'description' => $translate->_('Create or update shared calendars favorites')), self::MANAGE_RESOURCES => array('text' => $translate->_('manage resources'), 'description' => $translate->_('All Rights to administrate resources')));
     $rightDescriptions = array_merge($rightDescriptions, parent::getTranslatedRightDescriptions());
     return $rightDescriptions;
 }
 /**
  * get translated right descriptions
  *
  * @return  array with translated descriptions for this applications rights
  */
 public static function getTranslatedRightDescriptions()
 {
     $translate = Tinebase_Translation::getTranslation('HumanResources');
     $rightDescriptions = array(self::EDIT_PRIVATE => array('text' => $translate->_('edit private employee data'), 'description' => $translate->_('Edit birthday, account data and other private information of employee records')));
     $rightDescriptions = array_merge($rightDescriptions, parent::getTranslatedRightDescriptions());
     return $rightDescriptions;
 }
 /**
  * get translated right descriptions
  * 
  * @return  array with translated descriptions for this applications rights
  */
 public static function getTranslatedRightDescriptions()
 {
     $translate = Tinebase_Translation::getTranslation('Sipgate');
     $rightDescriptions = array(self::MANAGE_ACCOUNTS => array('text' => $translate->_('manage accounts'), 'description' => $translate->_('enables the account module in the application')), self::SYNC_LINES => array('text' => $translate->_('sync lines'), 'description' => $translate->_('allows the user to sync the call history')), self::MANAGE_SHARED_ACCOUNTS => array('text' => $translate->_('manage shared accounts'), 'description' => $translate->_('add, edit and delete shared accounts')), self::MANAGE_PRIVATE_ACCOUNTS => array('text' => $translate->_('manage private accounts'), 'description' => $translate->_('add, edit and delete private accounts')));
     $rightDescriptions = array_merge($rightDescriptions, parent::getTranslatedRightDescriptions());
     return $rightDescriptions;
 }
 /**
  * do the rendering
  *
  * @param array $result
  */
 protected function _onAfterExportRecords($result)
 {
     $templateProcessor = $this->getDocument();
     // first step: generate layout
     $dayblock = $templateProcessor->cloneBlock('DAYBLOCK', 1, false);
     $seperator = $templateProcessor->cloneBlock('SEPARATOR', 1, false);
     $dayCount = count($this->_daysEventMatrix);
     $daysblock = $dayCount ? $dayblock : '';
     for ($i = 1; $i < $dayCount; $i++) {
         $daysblock .= $seperator;
         $daysblock .= $dayblock;
     }
     $templateProcessor->replaceBlock('DAYBLOCK', $daysblock);
     $templateProcessor->deleteBlock('SEPARATOR');
     // second step: render events
     foreach ($this->_daysEventMatrix as $dayString => $dayEvents) {
         $this->processDay($dayString, $dayEvents);
     }
     // third step: render generics
     if ($this->_from instanceof Tinebase_DateTime) {
         $templateProcessor->setValue('from', Tinebase_Translation::dateToStringInTzAndLocaleFormat($this->_from, null, null, $this->_config->dateformat));
     }
     if ($this->_until instanceof Tinebase_DateTime) {
         $templateProcessor->setValue('until', Tinebase_Translation::dateToStringInTzAndLocaleFormat($this->_until->getClone()->subSecond(1), null, null, $this->_config->dateformat));
     }
     parent::_onAfterExportRecords($result);
 }
 /**
  * resolves all virtual fields for the address
  *
  * @param array $address
  * @return array with property => value
  */
 public function resolveVirtualFields($address)
 {
     if (!isset($address['type'])) {
         if (Tinebase_Core::isLogLevel(Zend_Log::WARN)) {
             Tinebase_Core::getLogger()->warn(__METHOD__ . '::' . __LINE__ . ' Invalid address for resolving: ' . print_r($address, true));
         }
         return $address;
     }
     $ft = '';
     $i18n = Tinebase_Translation::getTranslation($this->_applicationName)->getAdapter();
     $type = $address['type'];
     $ft .= !empty($address['prefix1']) ? $address['prefix1'] : '';
     $ft .= !empty($address['prefix1']) && !empty($address['prefix2']) ? ' ' : '';
     $ft .= !empty($address['prefix2']) ? $address['prefix2'] : '';
     $ft .= !empty($address['prefix1']) || !empty($address['prefix2']) ? ', ' : '';
     $ft .= !empty($address['postbox']) ? $address['postbox'] : (!empty($address['street']) ? $address['street'] : '');
     $ft .= !empty($address['postbox']) || !empty($address['street']) ? ', ' : '';
     $ft .= !empty($address['postalcode']) ? $address['postalcode'] . ' ' : '';
     $ft .= !empty($address['locality']) ? $address['locality'] : '';
     $ft .= ' (';
     $ft .= $i18n->_($type);
     if ($type == 'billing') {
         $ft .= ' - ' . $address['custom1'];
     }
     $ft .= ')';
     $address['fulltext'] = $ft;
     return $address;
 }
Пример #8
0
 /**
  * get translated right descriptions
  * 
  * @return  array with translated descriptions for this applications rights
  */
 public static function getTranslatedRightDescriptions()
 {
     $translate = Tinebase_Translation::getTranslation('Sales');
     $rightDescriptions = array(self::MANAGE_PRODUCTS => array('text' => $translate->_('manage products'), 'description' => $translate->_('add, edit and delete products')));
     $rightDescriptions = array_merge($rightDescriptions, parent::getTranslatedRightDescriptions());
     return $rightDescriptions;
 }
Пример #9
0
 /**
  * get translated right descriptions
  * 
  * @return  array with translated descriptions for this applications rights
  */
 public static function getTranslatedRightDescriptions()
 {
     $translate = Tinebase_Translation::getTranslation('Tasks');
     $rightDescriptions = array(Tinebase_Acl_Rights::MANAGE_SHARED_FOLDERS => array('text' => $translate->_('manage shared task lists'), 'description' => $translate->_('Create new shared tasks lists')), Tinebase_Acl_Rights::MANAGE_SHARED_FAVORITES => array('text' => $translate->_('manage shared tasks favorites'), 'description' => $translate->_('Create or update shared tasks favorites')));
     $rightDescriptions = array_merge($rightDescriptions, parent::getTranslatedRightDescriptions());
     return $rightDescriptions;
 }
 /**
  * get translated right descriptions
  * 
  * @return  array with translated descriptions for this applications rights
  */
 public static function getTranslatedRightDescriptions()
 {
     $translate = Tinebase_Translation::getTranslation('Filemanager');
     $rightDescriptions = array(Tinebase_Acl_Rights::MANAGE_SHARED_FOLDERS => array('text' => $translate->_('manage shared folders'), 'description' => $translate->_('Create new shared folders')), self::MANAGE_DOWNLOADLINKS => array('text' => $translate->_('Manage anonymous download links'), 'description' => $translate->_('Allow to see, add and delete download links of files and folders')));
     $rightDescriptions = array_merge($rightDescriptions, parent::getTranslatedRightDescriptions());
     return $rightDescriptions;
 }
 /**
  * get translated right descriptions
  * 
  * @return  array with translated descriptions for this applications rights
  */
 public static function getTranslatedRightDescriptions()
 {
     $translate = Tinebase_Translation::getTranslation('Projects');
     $rightDescriptions = array(self::MANAGE_SHARED_PROJECT_FAVORITES => array('text' => $translate->_('Manage shared project favorites'), 'description' => $translate->_('Create new shared project favorites')));
     $rightDescriptions = array_merge($rightDescriptions, parent::getTranslatedRightDescriptions());
     return $rightDescriptions;
 }
 /**
  * public function to access the directory
  * 
  * @param string $mac
  */
 public function directory($mac)
 {
     $this->_authenticate();
     # get the phone
     Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' phone ' . $mac);
     $phone = Voipmanager_Controller_Snom_Phone::getInstance()->getByMacAddress($mac);
     Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' phone ' . $phone->template_id);
     $template = Voipmanager_Controller_Snom_Template::getInstance()->get($phone->template_id);
     Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' phone ' . $template->setting_id);
     $settings = Voipmanager_Controller_Snom_Setting::getInstance()->get($template->setting_id);
     $language = $settings->language ? $settings->language : 'en';
     $translate = Tinebase_Translation::getTranslation($this->_applicationName, new Zend_Locale('de'));
     Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' phone ' . $language);
     $baseUrl = $this->_getBaseUrl();
     $xml = '<?xml version="1.0" encoding="UTF-8"?>
         <SnomIPPhoneInput>
             <Prompt>Prompt</Prompt>
             <URL>' . $baseUrl . '</URL>
             <InputItem>
                 <DisplayName>' . $translate->_('Enter search') . ':</DisplayName>
                 <QueryStringParam>method=Phone.searchContacts&TINE20SESSID=' . Tinebase_Session::getId() . '&mac=' . $mac . '&query</QueryStringParam>
                 <DefaultValue/>
                 <InputFlags>a</InputFlags>
             </InputItem>
         </SnomIPPhoneInput>
     ';
     header('Content-Type: text/xml');
     echo $xml;
 }
 /**
  * get translated right descriptions
  * 
  * @return  array with translated descriptions for this applications rights
  */
 public static function getTranslatedRightDescriptions()
 {
     /** @var Zend_Translate_Adapter $translate */
     $translate = Tinebase_Translation::getTranslation('Tinebase');
     $rightDescriptions = array(self::ADMIN => array('text' => $translate->_('admin'), 'description' => $translate->_('admin right description')), self::RUN => array('text' => $translate->_('run'), 'description' => $translate->_('run right description')), self::USE_PERSONAL_TAGS => array('text' => $translate->_('Personal tags'), 'description' => $translate->_('Use and see personal tags')));
     return $rightDescriptions;
 }
 /**
  * @todo it's just a fake test // the test has to use a list_id when backend logic is implemented finaly
  */
 public function testGetPrincipalByGroupPath()
 {
     $list = Tinebase_Group::getInstance()->getGroupById(Tinebase_Core::getUser()->accountPrimaryGroup);
     $principal = $this->_backend->getPrincipalByPath(Tinebase_WebDav_PrincipalBackend::PREFIX_GROUPS . '/' . $list->list_id);
     //var_dump($principal);
     $this->assertEquals(Tinebase_WebDav_PrincipalBackend::PREFIX_GROUPS . '/' . $list->list_id, $principal['uri']);
     $this->assertEquals($list->name . ' (' . Tinebase_Translation::getTranslation('Calendar')->_('Group') . ')', $principal['{DAV:}displayname']);
 }
Пример #15
0
 /**
  * returns list of all available translations
  *
  * @return array list of all available translations
  */
 public function getAvailableTranslations()
 {
     $availableTranslations = Tinebase_Translation::getAvailableTranslations();
     foreach ($availableTranslations as &$info) {
         unset($info['path']);
     }
     return array('results' => array_values($availableTranslations), 'totalcount' => count($availableTranslations));
 }
Пример #16
0
 /**
  * creates the initial folder for new accounts
  *
  * @param mixed[int|Tinebase_Model_User] $_account   the accountd object
  * @return Tinebase_Record_RecordSet                            of subtype Tinebase_Model_Container
  */
 public function createPersonalFolder($_accountId)
 {
     $translation = Tinebase_Translation::getTranslation('ExampleApplication');
     $account = Tinebase_User::getInstance()->getUserById($_accountId);
     $newContainer = new Tinebase_Model_Container(array('name' => sprintf($translation->_("%s's personal example records"), $account->accountFullName), 'type' => Tinebase_Model_Container::TYPE_PERSONAL, 'owner_id' => $_accountId, 'backend' => 'Sql', 'application_id' => Tinebase_Application::getInstance()->getApplicationByName('ExampleApplication')->getId()));
     $personalContainer = Tinebase_Container::getInstance()->addContainer($newContainer);
     $container = new Tinebase_Record_RecordSet('Tinebase_Model_Container', array($personalContainer));
     return $container;
 }
 /**
  * testGetTranslatedValue
  * 
  * @see 0008600: Fix fatal error in Calendar/Model/Event.php
  */
 public function testGetTranslatedValue()
 {
     $event = new Calendar_Model_Event(array('dtstart' => new Tinebase_DateTime('2011-11-23 14:25:00'), 'dtend' => new Tinebase_DateTime('2011-11-23 15:25:00'), 'summary' => 'test event', 'organizer' => Tinebase_Core::getUser()->contact_id));
     $translation = Tinebase_Translation::getTranslation('Calendar');
     $timezone = Tinebase_Core::getPreference()->getValueForUser(Tinebase_Preference::TIMEZONE, Tinebase_Core::getUser()->getId());
     $fileas = Calendar_Model_Event::getTranslatedValue('organizer', $event->organizer, $translation, $timezone);
     $userContact = Addressbook_Controller_Contact::getInstance()->getContactByUserId(Tinebase_Core::getUser()->getId());
     $this->assertEquals($userContact->n_fileas, $fileas);
 }
 /**
  * creates the initial folder for new accounts
  *
  * @param mixed[int|Tinebase_Model_User] $_account   the accountd object
  * @return Tinebase_Record_RecordSet                            of subtype Tinebase_Model_Container
  */
 public function createPersonalFolder($_account)
 {
     $translation = Tinebase_Translation::getTranslation($this->_applicationName);
     $account = Tinebase_User::getInstance()->getUserById($_account);
     $newContainer = new Tinebase_Model_Container(array('name' => sprintf($translation->_("%s's personal Projects"), $account->accountFullName), 'type' => Tinebase_Model_Container::TYPE_PERSONAL, 'owner_id' => $account->getId(), 'backend' => 'Sql', 'application_id' => Tinebase_Application::getInstance()->getApplicationByName($this->_applicationName)->getId(), 'model' => static::$_defaultModel));
     $personalContainer = Tinebase_Container::getInstance()->addContainer($newContainer);
     $container = new Tinebase_Record_RecordSet('Tinebase_Model_Container', array($personalContainer));
     return $container;
 }
 /**
  * returns existing nodes info as array
  *
  * @return array
  */
 public function toArray()
 {
     try {
         $translation = Tinebase_Translation::getTranslation($this->_appName);
         return array('code' => $this->getCode(), 'message' => $translation->_($this->getMessage()), 'title' => $translation->_($this->getTitle()));
     } catch (Exception $e) {
         return array('code' => $this->getCode(), 'message' => $this->getMessage(), 'title' => $this->getTitle());
     }
 }
Пример #20
0
 /**
  * creates the initial folder for new accounts
  *
  * @param mixed[int|Tinebase_Model_User] $_account   the accountd object
  * @return Tinebase_Record_RecordSet of subtype Tinebase_Model_Container
  */
 public function createPersonalFolder($_account)
 {
     $translation = Tinebase_Translation::getTranslation('Filemanager');
     $user = Tinebase_User::getInstance()->getUserById($_account);
     $newContainer = new Tinebase_Model_Container(array('name' => sprintf($translation->_("%s's personal files"), $user->accountFullName), 'type' => Tinebase_Model_Container::TYPE_PERSONAL, 'owner_id' => $_account, 'backend' => 'Sql', 'application_id' => Tinebase_Application::getInstance()->getApplicationByName('Filemanager')->getId()));
     $personalContainer = Tinebase_Container::getInstance()->addContainer($newContainer);
     mkdir('tine20:///' . Tinebase_Application::getInstance()->getApplicationByName('Filemanager')->getId() . '/folders/personal/' . $user->getId() . '/' . $personalContainer->getId(), 0777, true);
     $container = new Tinebase_Record_RecordSet('Tinebase_Model_Container', array($personalContainer));
     return $container;
 }
 /**
  * init department
  * 
  * @see 0010554: create default department (school) on Courses installation
  */
 public static function _initializeDepartment()
 {
     // create a default department if none exists
     $departments = Tinebase_Department::getInstance()->getAll();
     if (count($departments) === 0) {
         $translation = Tinebase_Translation::getTranslation('Courses');
         $school = new Tinebase_Model_Department(array('name' => $translation->_('School'), 'description' => $translation->_('Defaul school for Courses application')));
         Tinebase_Department::getInstance()->create($school);
     }
 }
 /**
  * init example workingtime models
  */
 function _initializeWorkingTimeModels()
 {
     $translate = Tinebase_Translation::getTranslation('HumanResources');
     $_record = new HumanResources_Model_WorkingTime(array('title' => $translate->_('Full-time 40 hours'), 'working_hours' => '40', 'type' => 'static', 'json' => '{"days":[8,8,8,8,8,0,0]}'));
     HumanResources_Controller_WorkingTime::getInstance()->create($_record);
     $_record = new HumanResources_Model_WorkingTime(array('title' => $translate->_('Full-time 37.5 hours'), 'working_hours' => '37.5', 'type' => 'static', 'json' => '{"days":[8,8,8,8,5.5,0,0]}'));
     HumanResources_Controller_WorkingTime::getInstance()->create($_record);
     $_record = new HumanResources_Model_WorkingTime(array('title' => $translate->_('Part-time 20 hours'), 'working_hours' => '20', 'type' => 'static', 'json' => '{"days":[4,4,4,4,4,0,0]}'));
     HumanResources_Controller_WorkingTime::getInstance()->create($_record);
 }
Пример #23
0
 /**
  * creates the initial folder for new accounts
  *
  * @param mixed[int|Tinebase_Model_User] $_account   the accountd object
  * @return Tinebase_Record_RecordSet                            of subtype Tinebase_Model_Container
  */
 public function createPersonalFolder($_accountId)
 {
     $translation = Tinebase_Translation::getTranslation('Projects');
     $accountId = Tinebase_Model_User::convertUserIdToInt($_accountId);
     $account = Tinebase_User::getInstance()->getUserById($accountId);
     $newContainer = new Tinebase_Model_Container(array('name' => sprintf($translation->_("%s's personal Projects"), $account->accountFullName), 'type' => Tinebase_Model_Container::TYPE_PERSONAL, 'backend' => 'Sql', 'application_id' => Tinebase_Application::getInstance()->getApplicationByName('Projects')->getId()));
     $personalContainer = Tinebase_Container::getInstance()->addContainer($newContainer, NULL, FALSE, $accountId);
     $container = new Tinebase_Record_RecordSet('Tinebase_Model_Container', array($personalContainer));
     return $container;
 }
Пример #24
0
 /**
  * try to check getting application rights
  */
 public function testGetTranslatedRightDescriptions()
 {
     $all = Admin_Acl_Rights::getTranslatedRightDescriptions();
     $text = $all[Admin_Acl_Rights::MANAGE_ROLES];
     $this->assertNotEquals('', $text['text']);
     $this->assertNotEquals('', $text['description']);
     $this->assertNotEquals(Admin_Acl_Rights::MANAGE_ROLES . ' right', $text['description']);
     $translate = Tinebase_Translation::getTranslation('Admin');
     $this->assertEquals($translate->_('manage roles'), $text['text']);
 }
 /**
  * returns human readable diff text
  * 
  * @return string
  * 
  * @todo add translated model name?
  */
 public function getTranslatedDiffText()
 {
     $result = array();
     $translate = Tinebase_Translation::getTranslation('Tinebase');
     foreach (array('added', 'removed', 'modified') as $action) {
         if (count($this->{$action}) > 0) {
             $result[] = count($this->{$action}) . ' ' . $translate->_($action);
         }
     }
     return implode(', ', $result);
 }
Пример #26
0
 /**
  * send notification to a single attender
  * 
  * @param Webconference_Model_Event       $_event
  * @param Tinebase_Model_FullAccount      $_updater
  * @return void
  */
 public function sendNotificationToAttender($users, $moderator, $roomName)
 {
     $translate = Tinebase_Translation::getTranslation('Webconference');
     try {
         /*        
                     // find organizer account
                     if ($_event->organizer && $_event->resolveOrganizer()->account_id) {
                         $organizer = Tinebase_User::getInstance()->getFullUserById($_event->resolveOrganizer()->account_id);
                     } else {
                         // use creator as organizer
                         $organizer = Tinebase_User::getInstance()->getFullUserById($_event->created_by);
                     }
           // get prefered language, timezone and notification level
                     $prefUser = $_attender->getUserAccountId();
                     $locale = Tinebase_Translation::getLocale(Tinebase_Core::getPreference()->getValueForUser(Tinebase_Preference::LOCALE, $prefUser ? $prefUser : $organizer->getId()));
                     $timezone = Tinebase_Core::getPreference()->getValueForUser(Tinebase_Preference::TIMEZONE, $prefUser ? $prefUser : $organizer->getId());
                     
         //            $translate = Tinebase_Translation::getTranslation('Calendar', $locale);
         
           // get date strings
                     $startDateString = Tinebase_Translation::dateToStringInTzAndLocaleFormat($_event->dtstart, $timezone, $locale);
                     $endDateString = Tinebase_Translation::dateToStringInTzAndLocaleFormat($_event->dtend, $timezone, $locale);
                     $messageSubject = sprintf($translate->_('Attendee changes for event "%1$s" at %2$s' ), $_event->summary, $startDateString);
         */
         $fullUser = Tinebase_Core::getUser();
         foreach ($users as $user) {
             $userName = $user[n_fn];
             $url = Webconference_Controller_BigBlueButton::getInstance()->joinRoom($roomName, $moderator, $userName)->bbbUrl->bbbUrl;
             //$webconfMail = new Webconference_Model_Invite($url, $roomName, $moderator, $fullUser, $userName);
             $webconfMail = new Webconference_Model_Invite(array('url' => $url, 'roomName' => $roomName, 'moderator' => $moderator, 'createdBy' => $fullUser, 'to' => $userName), true);
             $messageSubject = $translate->_("Webconference Invite");
             $view = new Zend_View();
             $view->setScriptPath(dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'views');
             $view->translate = $translate;
             //$view->timezone     = $timezone;
             $view->url = $url;
             $view->fullUser = $fullUser;
             $method = 'Webconference';
             $messageBody = $view->render('eventNotification.php');
             $mailPart = new Zend_Mime_Part(serialize($webconfMail));
             $mailPart->charset = 'UTF-8';
             $mailPart->type = 'text/webconference; method=' . $method;
             $mailPart->encoding = Zend_Mime::ENCODING_QUOTEDPRINTABLE;
             $attachments = null;
             $contact = new Addressbook_Model_Contact($user);
             $sender = $fullUser;
             $result = Tinebase_Notification::getInstance()->send($sender, array($contact), $messageSubject, $messageBody, $mailPart, $attachments);
         }
     } catch (Exception $e) {
         Tinebase_Core::getLogger()->WARN(__METHOD__ . '::' . __LINE__ . " could not send notification :" . $e);
         return array('message' => $e->getMessage(), 'result' => $translate->_('An error has occured inviting users'));
     }
     return array('success' => TRUE, 'message' => $translate->_('Users invited successfully') . '!');
 }
 /**
  * test csv export
  * 
  * @return void
  * 
  * @see 0007242: add customer address fields to lead csv export
  */
 public function testExportCsv()
 {
     $this->_filename = $this->_instance->generate();
     $export = file_get_contents($this->_filename);
     $translate = Tinebase_Translation::getTranslation('Crm');
     $defaultContainerId = Tinebase_Container::getInstance()->getDefaultContainer('Crm')->getId();
     $this->assertContains('"lead_name","leadstate_id","Leadstate","leadtype_id","Leadtype","leadsource_id","Leadsource","container_id","start"' . ',"description","end","turnover","probableTurnover","probability","end_scheduled","resubmission_date","tags","attachments","notes","seq","tags",' . '"CUSTOMER-org_name","CUSTOMER-n_family","CUSTOMER-n_given","CUSTOMER-adr_one_street","CUSTOMER-adr_one_postalcode","CUSTOMER-adr_one_locality",' . '"CUSTOMER-adr_one_countryname","CUSTOMER-tel_work","CUSTOMER-tel_cell","CUSTOMER-email",' . '"PARTNER","RESPONSIBLE","TASK"', $export, 'headline wrong: ' . substr($export, 0, 360));
     $this->assertContains('"PHPUnit","1","' . $translate->_('open') . '","1","' . $translate->_('Customer') . '","1","' . $translate->_('Market') . '","' . $defaultContainerId . '"', $export, 'data #1 wrong');
     $this->assertContains('"Metaways Infosystems GmbH","Kneschke","Lars","Pickhuben 4","24xxx","Hamburg","DE","+49TELWORK","+49TELCELL","*****@*****.**"' . ',"","","phpunit: crm test task"', $export, 'relations wrong');
     $dateString = Tinebase_Translation::dateToStringInTzAndLocaleFormat(NULL, NULL, NULL, 'date');
     $this->assertContains($dateString, $export, 'note date wrong');
 }
Пример #28
0
 /**
  * test csv export
  * 
  * @return void
  */
 public function testExportCsv()
 {
     $csvFilename = $this->_instance->generate();
     $export = file_get_contents($csvFilename);
     $translate = Tinebase_Translation::getTranslation('Crm');
     $defaultContainerId = Tinebase_Container::getInstance()->getDefaultContainer('Crm')->getId();
     $this->assertContains('"lead_name","leadstate_id","Leadstate","leadtype_id","Leadtype","leadsource_id","Leadsource","container_id","start"' . ',"description","end","turnover","probableTurnover","probability","end_scheduled","tags","notes","tags","CUSTOMER","PARTNER","RESPONSIBLE","TASK"', $export, 'headline wrong');
     $this->assertContains('"PHPUnit","1","' . $translate->_('open') . '","1","' . $translate->_('Customer') . '","1","' . $translate->_('Market') . '","' . $defaultContainerId . '"', $export, 'data #1 wrong');
     $this->assertContains('"Kneschke, Lars","","phpunit: crm test task"', $export, 'relations wrong');
     $dateString = Tinebase_Translation::dateToStringInTzAndLocaleFormat(NULL, NULL, NULL, 'date');
     $this->assertContains($dateString, $export, 'note date wrong');
     unlink($csvFilename);
 }
Пример #29
0
 /**
  * Sets up the fixture.
  * This method is called before a test is executed.
  *
  * @access protected
  */
 protected function setUp()
 {
     $this->objects['application'] = Tinebase_Application::getInstance()->getApplicationByName('Crm');
     $this->objects['user'] = new Tinebase_Model_FullUser(array('accountId' => 10, 'accountLoginName' => 'tine20phpunit', 'accountDisplayName' => 'tine20phpunit', 'accountStatus' => 'enabled', 'accountExpires' => NULL, 'accountPrimaryGroup' => Tinebase_Group::getInstance()->getGroupByName('Users')->getId(), 'accountLastName' => 'Tine 2.0', 'accountFirstName' => 'PHPUnit', 'accountEmailAddress' => '*****@*****.**'));
     $this->objects['role'] = new Tinebase_Model_Role(array('id' => 10, 'name' => 'phpunitrole', 'description' => 'test role for phpunit'));
     $this->objects['role_2'] = new Tinebase_Model_Role(array('id' => 11, 'name' => 'phpunitrole 2', 'description' => 'test role 2 for phpunit'));
     $translate = Tinebase_Translation::getTranslation('Tinebase');
     // add account for group / role member tests
     try {
         $user = Tinebase_User::getInstance()->getUserById($this->objects['user']->accountId);
     } catch (Tinebase_Exception_NotFound $e) {
         $user = Tinebase_User::getInstance()->addUser($this->objects['user']);
         Tinebase_Group::getInstance()->addGroupMember($user->accountPrimaryGroup, $user);
     }
     return;
 }
Пример #30
0
 /**
  * try to add a system note
  *
  */
 public function testAddSystemNote()
 {
     $translate = Tinebase_Translation::getTranslation('Tinebase');
     $translatedNoteString = $translate->_('created') . ' ' . $translate->_('by');
     $this->_instance->addSystemNote($this->_objects['contact'], Zend_Registry::get('currentAccount')->getId(), Tinebase_Model_Note::SYSTEM_NOTE_NAME_CREATED);
     $filter = new Tinebase_Model_NoteFilter(array(array('field' => 'query', 'operator' => 'contains', 'value' => $translatedNoteString)));
     $notes = $this->_instance->searchNotes($filter, new Tinebase_Model_Pagination());
     $this->assertGreaterThan(0, count($notes));
     $found = FALSE;
     foreach ($notes as $note) {
         if ($translatedNoteString . ' ' . Zend_Registry::get('currentAccount')->accountDisplayName == $note->note) {
             $found = TRUE;
             break;
         }
     }
     $this->assertTrue($found);
 }