Exemplo n.º 1
0
 function process(Vtiger_Request $request)
 {
     $moduleName = $request->getModule();
     $record = $request->get('record');
     vimport('~~modules/com_vtiger_workflow/include.inc');
     vimport('~~modules/com_vtiger_workflow/VTEntityCache.inc');
     vimport('~~modules/com_vtiger_workflow/include.inc');
     vimport('~~include/Webservices/Utils.php');
     vimport('~~include/Webservices/Retrieve.php');
     $adb = PearDatabase::getInstance();
     $wfs = new VTWorkflowManager($adb);
     $workflows = $wfs->getWorkflowsForModule($moduleName, VTWorkflowManager::$TRIGGER);
     $currentUser = Users_Record_Model::getCurrentUserModel();
     $wsId = vtws_getWebserviceEntityId($moduleName, $record);
     $entityCache = new VTEntityCache($currentUser);
     $entityData = $entityCache->forId($wsId);
     foreach ($workflows as $id => $workflow) {
         if (!$workflow->evaluate($entityCache, $entityData->getId())) {
             unset($workflows[$id]);
         }
     }
     $viewer = $this->getViewer($request);
     $viewer->assign('RECORD', $record);
     $viewer->assign('MODULE', $moduleName);
     $viewer->assign('WORKFLOWS', $workflows);
     $viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());
     $viewer->view('WorkflowTrigger.tpl', $moduleName);
 }
Exemplo n.º 2
0
 /**
  * Function to get the list of listview links for the module
  * @param <Array> $linkParams
  * @return <Array> - Associate array of Link Type to List of Vtiger_Link_Model instances
  */
 public function getListViewLinks($linkParams)
 {
     $currentUserModel = Users_Record_Model::getCurrentUserModel();
     $moduleModel = $this->getModule();
     $linkTypes = array('LISTVIEWBASIC', 'LISTVIEW', 'LISTVIEWSETTING');
     $links = Vtiger_Link_Model::getAllByType($moduleModel->getId(), $linkTypes, $linkParams);
     $createPermission = Users_Privileges_Model::isPermitted($moduleModel->getName(), 'EditView');
     if ($createPermission) {
         $basicLinks = array(array('linktype' => 'LISTVIEWBASIC', 'linklabel' => 'LBL_ADD_RECORD', 'linkurl' => $moduleModel->getCreateRecordUrl(), 'linkicon' => ''));
         foreach ($basicLinks as $basicLink) {
             $links['LISTVIEWBASIC'][] = Vtiger_Link_Model::getInstanceFromValues($basicLink);
         }
     }
     $exportPermission = Users_Privileges_Model::isPermitted($moduleModel->getName(), 'Export');
     if ($exportPermission) {
         $advancedLink = array('linktype' => 'LISTVIEW', 'linklabel' => 'LBL_EXPORT', 'linkurl' => 'javascript:Vtiger_List_Js.triggerExportAction("' . $moduleModel->getExportUrl() . '")', 'linkicon' => '');
         $links['LISTVIEW'][] = Vtiger_Link_Model::getInstanceFromValues($advancedLink);
     }
     if ($currentUserModel->isAdminUser()) {
         $settingsLinks = $this->getSettingLinks();
         foreach ($settingsLinks as $settingsLink) {
             $links['LISTVIEWSETTING'][] = Vtiger_Link_Model::getInstanceFromValues($settingsLink);
         }
     }
     return $links;
 }
Exemplo n.º 3
0
 public function process(Vtiger_Request $request)
 {
     $recordId = $request->get('record');
     $qualifiedModuleName = $request->getModule(false);
     $mode = '';
     $selectedFieldsList = $allFieldsList = array();
     if ($recordId) {
         $recordModel = Settings_Webforms_Record_Model::getInstanceById($recordId, $qualifiedModuleName);
         $selectedFieldsList = $recordModel->getSelectedFieldsList();
         $allFieldsList = $recordModel->getAllFieldsList();
         $sourceModule = $recordModel->get('targetmodule');
         $mode = 'edit';
     } else {
         $recordModel = Settings_Webforms_Record_Model::getCleanInstance($qualifiedModuleName);
         $sourceModule = $request->get('sourceModule');
         if (!$sourceModule) {
             $sourceModule = reset(array_keys(Settings_Webforms_Module_Model::getSupportedModulesList()));
         }
         $allFieldsList = $recordModel->getAllFieldsList($sourceModule);
     }
     $recordStructure = Vtiger_RecordStructure_Model::getInstanceFromRecordModel($recordModel, Vtiger_RecordStructure_Model::RECORD_STRUCTURE_MODE_EDIT);
     $viewer = $this->getViewer($request);
     $viewer->assign('MODE', $mode);
     $viewer->assign('RECORD_ID', $recordId);
     $viewer->assign('RECORD_MODEL', $recordModel);
     $viewer->assign('MODULE', $qualifiedModuleName);
     $viewer->assign('QUALIFIED_MODULE', $qualifiedModuleName);
     $viewer->assign('SOURCE_MODULE', $sourceModule);
     $viewer->assign('ALL_FIELD_MODELS_LIST', $allFieldsList);
     $viewer->assign('SELECTED_FIELD_MODELS_LIST', $selectedFieldsList);
     $viewer->assign('RECORD_STRUCTURE_MODEL', $recordStructure);
     $viewer->assign('RECORD_STRUCTURE', $recordStructure->getStructure());
     $viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());
     $viewer->view('EditView.tpl', $qualifiedModuleName);
 }
	public function process(Vtiger_Request $request)
	{
		$currentUser = Users_Record_Model::getCurrentUserModel();
		$viewer = $this->getViewer($request);
		$moduleName = $request->getModule();

		$stateActivityLabels = Calendar_Module_Model::getComponentActivityStateLabel();

		$page = $request->get('page');
		$linkId = $request->get('linkid');
		$sortOrder = $request->get('sortorder');
		$orderBy = $request->get('orderby');
		$params = ['status' => $stateActivityLabels['in_realization']];
		if ($request->get('switchParams')) {
			$params = ['status' => $request->get('switchParams')];
		}

		$widget = Vtiger_Widget_Model::getInstance($linkId, $currentUser->getId());
		if (!$request->has('owner'))
			$owner = Settings_WidgetsManagement_Module_Model::getDefaultUserId($widget);
		else
			$owner = $request->get('owner');

		$pagingModel = new Vtiger_Paging_Model();
		$pagingModel->set('page', $page);
		$pagingModel->set('limit', (int) $widget->get('limit'));
		$pagingModel->set('orderby', $orderBy);
		$pagingModel->set('sortorder', $sortOrder);

		$moduleModel = Vtiger_Module_Model::getInstance($moduleName);
		$calendarActivities = ($owner === false) ? array() : $moduleModel->getCalendarActivities('upcoming', $pagingModel, $owner, false, $params);

		$switchLabels = [];
		$switchLabels[] = ['label' => vtranslate($stateActivityLabels['in_realization'], 'Calendar'), 'name' => $stateActivityLabels['in_realization']];
		$switchLabels[] = ['label' => vtranslate($stateActivityLabels['not_started'], 'Calendar'), 'name' => $stateActivityLabels['not_started']];

		$msgLabel = 'LBL_NO_SCHEDULED_ACTIVITIES';
		if ($params['status'] == $stateActivityLabels['in_realization']) {
			$msgLabel = 'LBL_NO_CURRENT_ACTIVITIES';
		}
		$viewer->assign('WIDGET', $widget);
		$viewer->assign('MODULE_NAME', $moduleName);
		$viewer->assign('ACTIVITIES', $calendarActivities);
		$viewer->assign('PAGING', $pagingModel);
		$viewer->assign('CURRENTUSER', $currentUser);
		$title_max_length = vglobal('title_max_length');
		$href_max_length = vglobal('href_max_length');
		$viewer->assign('NAMELENGHT', $title_max_length);
		$viewer->assign('OWNER', $owner);
		$viewer->assign('HREFNAMELENGHT', $href_max_length);
		$viewer->assign('NODATAMSGLABLE', $msgLabel);
		$viewer->assign('SWITCH', $switchLabels);
		$viewer->assign('LISTVIEWLINKS', true);
		$content = $request->get('content');
		if (!empty($content)) {
			$viewer->view('dashboards/CalendarActivitiesContents.tpl', $moduleName);
		} else {
			$viewer->view('dashboards/CalendarActivities.tpl', $moduleName);
		}
	}
 public function process(Vtiger_Request $request)
 {
     $recordId = $request->get('record');
     $qualifiedModuleName = $request->getModule(false);
     $sourceModule = $request->get('sourceModule');
     $viewer = $this->getViewer($request);
     $mode = '';
     $selectedFieldsList = array();
     if ($recordId) {
         $recordModel = Settings_Webforms_Record_Model::getInstanceById($recordId, $qualifiedModuleName);
         $mode = 'edit';
         if ($sourceModule === $recordModel->get('targetmodule')) {
             $selectedFieldsList = $recordModel->getSelectedFieldsList();
         }
     } else {
         $recordModel = Settings_Webforms_Record_Model::getCleanInstance($qualifiedModuleName);
     }
     $viewer->assign('MODE', $mode);
     $viewer->assign('SOURCE_MODULE', $sourceModule);
     $viewer->assign('MODULE', $qualifiedModuleName);
     $viewer->assign('SELECTED_FIELD_MODELS_LIST', $selectedFieldsList);
     $viewer->assign('ALL_FIELD_MODELS_LIST', $recordModel->getAllFieldsList($sourceModule));
     $viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());
     $viewer->view('FieldsEditView.tpl', $qualifiedModuleName);
 }
Exemplo n.º 6
0
 public function initialize(Vtiger_Request $request)
 {
     $viewer = $this->getViewer($request);
     $moduleName = $request->getModule();
     $qualifiedModuleName = $request->getModule(false);
     $record = $request->get('record');
     $fromRecord = $request->get('from_record');
     if (!empty($record)) {
         $recordModel = Settings_Profiles_Record_Model::getInstanceById($record);
         $viewer->assign('MODE', 'edit');
     } elseif (!empty($fromRecord)) {
         $recordModel = Settings_Profiles_Record_Model::getInstanceById($fromRecord);
         $recordModel->getModulePermissions();
         $recordModel->getGlobalPermissions();
         $recordModel->set('profileid', '');
         $viewer->assign('MODE', '');
         $viewer->assign('IS_DUPLICATE_RECORD', $fromRecord);
     } else {
         $recordModel = new Settings_Profiles_Record_Model();
         $viewer->assign('MODE', '');
     }
     $viewer->assign('ALL_PROFILES', $recordModel->getAll());
     $viewer->assign('QUALIFIED_MODULE', $qualifiedModuleName);
     $viewer->assign('ALL_BASIC_ACTIONS', Vtiger_Action_Model::getAllBasic(true));
     $viewer->assign('ALL_UTILITY_ACTIONS', Vtiger_Action_Model::getAllUtility(true));
     $viewer->assign('RECORD_MODEL', $recordModel);
     $viewer->assign('RECORD_ID', $record);
     $viewer->assign('MODULE', $moduleName);
     $viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());
 }
Exemplo n.º 7
0
 /**
  * Funtioin to process the Edit view
  * @param Vtiger_Request $request
  */
 public function process(Vtiger_Request $request)
 {
     $viewer = $this->getViewer($request);
     $moduleName = $request->getModule();
     $record = $request->get('record');
     if (!empty($record)) {
         $recordModel = EmailTemplates_Record_Model::getInstanceById($record);
         $viewer->assign('RECORD_ID', $record);
         $viewer->assign('MODE', 'edit');
     } else {
         $recordModel = new EmailTemplates_Record_Model();
         $viewer->assign('MODE', '');
         $recordModel->set('templatename', '');
         $recordModel->set('description', '');
         $recordModel->set('subject', '');
         $recordModel->set('body', '');
     }
     $recordModel->setModule('EmailTemplates');
     if (!$this->record) {
         $this->record = $recordModel;
     }
     $allFiledsOptions = $this->record->getEmailTemplateFields();
     $viewer->assign('RECORD', $this->record);
     $viewer->assign('MODULE', $moduleName);
     $viewer->assign('CURRENTDATE', date('Y-n-j'));
     $viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());
     $viewer->assign('ALL_FIELDS', $allFiledsOptions);
     $viewer->view('EditView.tpl', $moduleName);
 }
Exemplo n.º 8
0
 /**
  * Function to get the list of Header Links
  * @return <Array> - List of Vtiger_Link_Model instances
  */
 function getHeaderLinks()
 {
     global $log;
     $appUniqueKey = vglobal('application_unique_key');
     $vtigerCurrentVersion = vglobal('vtiger_current_version');
     $site_URL = vglobal('site_URL');
     $userModel = Users_Record_Model::getCurrentUserModel();
     $userEmail = $userModel->get('email1');
     $headerLinks = array(array('linktype' => 'HEADERLINK', 'linklabel' => 'LBL_FEEDBACK', 'linkurl' => "javascript:window.open('http://vtiger.com/products/crm/od-feedback/index.php?version=" . $vtigerCurrentVersion . "&email=" . $userEmail . "&uid=" . $appUniqueKey . "&ui=6','feedbackwin','height=400,width=550,top=200,left=300')", 'linkicon' => 'info.png', 'childlinks' => array(array('linktype' => 'HEADERLINK', 'linklabel' => 'LBL_DOCUMENTATION', 'linkurl' => 'https://wiki.vtiger.com/vtiger6/index.php/Main_Page', 'linkicon' => '', 'target' => '_blank'), array('linktype' => 'HEADERLINK', 'linklabel' => 'LBL_VIDEO_TUTORIAL', 'linkurl' => 'https://www.vtiger.com/crm/videos', 'linkicon' => '', 'target' => '_blank'), array('linktype' => 'HEADERLINK', 'linklabel' => 'LBL_FEEDBACK', 'linkurl' => "javascript:window.open('http://vtiger.com/products/crm/od-feedback/index.php?version=" . $vtigerCurrentVersion . "&email=" . $userEmail . "&uid=" . $appUniqueKey . "&ui=6','feedbackwin','height=400,width=550,top=200,left=300')", 'linkicon' => ''))));
     if ($userModel->isAdminUser()) {
         $crmSettingsLink = array('linktype' => 'HEADERLINK', 'linklabel' => 'LBL_CRM_SETTINGS', 'linkurl' => '', 'linkicon' => 'setting.png', 'childlinks' => array(array('linktype' => 'HEADERLINK', 'linklabel' => 'LBL_CRM_SETTINGS', 'linkurl' => '?module=Vtiger&parent=Settings&view=Index', 'linkicon' => ''), array(), array('linktype' => 'HEADERLINK', 'linklabel' => 'LBL_MANAGE_USERS', 'linkurl' => '?module=Users&parent=Settings&view=List', 'linkicon' => '')));
         array_push($headerLinks, $crmSettingsLink);
     }
     $userPersonalSettingsLinks = array('linktype' => 'HEADERLINK', 'linklabel' => $userModel->getDisplayName(), 'linkurl' => '', 'linkicon' => '', 'childlinks' => array(array('linktype' => 'HEADERLINK', 'linklabel' => 'LBL_MY_PREFERENCES', 'linkurl' => $userModel->getPreferenceDetailViewUrl(), 'linkicon' => ''), array(), array('linktype' => 'HEADERLINK', 'linklabel' => 'LBL_SIGN_OUT', 'linkurl' => '?module=Users&parent=Settings&action=Logout', 'linkicon' => '')));
     array_push($headerLinks, $userPersonalSettingsLinks);
     $headerLinkInstances = array();
     $index = 0;
     foreach ($headerLinks as $headerLink) {
         $headerLinkInstance = Vtiger_Link_Model::getInstanceFromValues($headerLink);
         foreach ($headerLink['childlinks'] as $childLink) {
             $headerLinkInstance->addChildLink(Vtiger_Link_Model::getInstanceFromValues($childLink));
         }
         $headerLinkInstances[$index++] = $headerLinkInstance;
     }
     $headerLinks = Vtiger_Link_Model::getAllByType(Vtiger_Link::IGNORE_MODULE, array('HEADERLINK'));
     foreach ($headerLinks as $headerType => $headerLinks) {
         foreach ($headerLinks as $headerLink) {
             $headerLinkInstances[$index++] = Vtiger_Link_Model::getInstanceFromLinkObject($headerLink);
         }
     }
     return $headerLinkInstances;
 }
Exemplo n.º 9
0
 public function process(Vtiger_Request $request, $widget = NULL)
 {
     $currentUser = Users_Record_Model::getCurrentUserModel();
     $viewer = $this->getViewer($request);
     $moduleName = $request->getModule();
     // Initialize Widget to the right-state of information
     if ($widget && !$request->has('widgetid')) {
         $widgetId = $widget->get('id');
     } else {
         $widgetId = $request->get('widgetid');
     }
     $widget = Vtiger_Widget_Model::getInstanceWithWidgetId($widgetId, $currentUser->getId());
     if (!$request->has('owner')) {
         $owner = Settings_WidgetsManagement_Module_Model::getDefaultUserId($widget);
     } else {
         $owner = $request->get('owner');
     }
     $minilistWidgetModel = new Vtiger_MiniList_Model();
     $minilistWidgetModel->setWidgetModel($widget);
     $viewer->assign('WIDGET', $widget);
     $viewer->assign('MODULE_NAME', $moduleName);
     $viewer->assign('USER', $owner);
     $viewer->assign('CURRENTUSER', $currentUser);
     $viewer->assign('MINILIST_WIDGET_MODEL', $minilistWidgetModel);
     $viewer->assign('BASE_MODULE', $minilistWidgetModel->getTargetModule());
     $viewer->assign('SCRIPTS', $this->getFooterScripts());
     $content = $request->get('content');
     if (!empty($content)) {
         $viewer->view('dashboards/MiniListContents.tpl', $moduleName);
     } else {
         $widget->set('title', $minilistWidgetModel->getTitle());
         $viewer->view('dashboards/MiniList.tpl', $moduleName);
     }
 }
Exemplo n.º 10
0
 public function process(Vtiger_Request $request)
 {
     $LIMIT = 10;
     $currentUser = Users_Record_Model::getCurrentUserModel();
     $viewer = $this->getViewer($request);
     $moduleName = $request->getModule();
     $type = $request->get('type');
     $page = $request->get('page');
     $linkId = $request->get('linkid');
     if (empty($page)) {
         $page = 1;
     }
     $pagingModel = new Vtiger_Paging_Model();
     $pagingModel->set('page', $page);
     $pagingModel->set('limit', $LIMIT);
     $moduleModel = Vtiger_Module_Model::getInstance($moduleName);
     $history = $moduleModel->getHistory($pagingModel, $type);
     $widget = Vtiger_Widget_Model::getInstance($linkId, $currentUser->getId());
     $modCommentsModel = Vtiger_Module_Model::getInstance('ModComments');
     $viewer->assign('WIDGET', $widget);
     $viewer->assign('MODULE_NAME', $moduleName);
     $viewer->assign('HISTORIES', $history);
     $viewer->assign('PAGE', $page);
     $viewer->assign('NEXTPAGE', count($history) < $LIMIT ? 0 : $page + 1);
     $viewer->assign('COMMENTS_MODULE_MODEL', $modCommentsModel);
     $content = $request->get('content');
     if (!empty($content)) {
         $viewer->view('dashboards/HistoryContents.tpl', $moduleName);
     } else {
         $viewer->view('dashboards/History.tpl', $moduleName);
     }
 }
    function content_54d2436e8ce6e($_smarty_tpl)
    {
        ?>
<!DOCTYPE html><html><head><title><?php 
        echo vtranslate($_smarty_tpl->tpl_vars['PAGETITLE']->value, $_smarty_tpl->tpl_vars['MODULE_NAME']->value);
        ?>
</title><link REL="SHORTCUT ICON" HREF="layouts/vlayout/skins/images/favicon.ico"><meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><link rel="stylesheet" href="libraries/jquery/chosen/chosen.css" type="text/css" media="screen" /><link rel="stylesheet" href="libraries/jquery/jquery-ui/css/custom-theme/jquery-ui-1.8.16.custom.css" type="text/css" media="screen" /><link rel="stylesheet" href="libraries/jquery/select2/select2.css" type="text/css" media="screen" /><link rel="stylesheet" href="libraries/bootstrap/css/bootstrap.css" type="text/css" media="screen" /><link rel="stylesheet" href="resources/styles.css" type="text/css" media="screen" /><link rel="stylesheet" href="libraries/jquery/posabsolute-jQuery-Validation-Engine/css/validationEngine.jquery.css" /><link rel="stylesheet" href="libraries/jquery/select2/select2.css" /><link rel="stylesheet" href="libraries/guidersjs/guiders-1.2.6.css"/><link rel="stylesheet" href="libraries/jquery/pnotify/jquery.pnotify.default.css"/><link rel="stylesheet" href="libraries/jquery/pnotify/use for pines style icons/jquery.pnotify.default.icons.css"/><link rel="stylesheet" media="screen" type="text/css" href="libraries/jquery/datepicker/css/datepicker.css" /><?php 
        $_smarty_tpl->tpl_vars['cssModel'] = new Smarty_Variable();
        $_smarty_tpl->tpl_vars['cssModel']->_loop = false;
        $_smarty_tpl->tpl_vars['index'] = new Smarty_Variable();
        $_from = $_smarty_tpl->tpl_vars['STYLES']->value;
        if (!is_array($_from) && !is_object($_from)) {
            settype($_from, 'array');
        }
        foreach ($_from as $_smarty_tpl->tpl_vars['cssModel']->key => $_smarty_tpl->tpl_vars['cssModel']->value) {
            $_smarty_tpl->tpl_vars['cssModel']->_loop = true;
            $_smarty_tpl->tpl_vars['index']->value = $_smarty_tpl->tpl_vars['cssModel']->key;
            ?>
<link rel="<?php 
            echo $_smarty_tpl->tpl_vars['cssModel']->value->getRel();
            ?>
" href="<?php 
            echo $_smarty_tpl->tpl_vars['cssModel']->value->getHref();
            ?>
?&v=<?php 
            echo $_smarty_tpl->tpl_vars['VTIGER_VERSION']->value;
            ?>
" type="<?php 
            echo $_smarty_tpl->tpl_vars['cssModel']->value->getType();
            ?>
" media="<?php 
            echo $_smarty_tpl->tpl_vars['cssModel']->value->getMedia();
            ?>
" /><?php 
        }
        ?>
<style type="text/css">@media print {.noprint { display:none; }}</style><script type="text/javascript" src="libraries/jquery/jquery.min.js"></script></head><body data-skinpath="<?php 
        echo $_smarty_tpl->tpl_vars['SKIN_PATH']->value;
        ?>
" data-language="<?php 
        echo $_smarty_tpl->tpl_vars['LANGUAGE']->value;
        ?>
"><div id="js_strings" class="hide noprint"><?php 
        echo Zend_Json::encode($_smarty_tpl->tpl_vars['LANGUAGE_STRINGS']->value);
        ?>
</div><?php 
        $_smarty_tpl->tpl_vars['CURRENT_USER_MODEL'] = new Smarty_variable(Users_Record_Model::getCurrentUserModel(), null, 0);
        ?>
<input type="hidden" id="start_day" value="<?php 
        echo $_smarty_tpl->tpl_vars['CURRENT_USER_MODEL']->value->get('dayoftheweek');
        ?>
" /><input type="hidden" id="row_type" value="<?php 
        echo $_smarty_tpl->tpl_vars['CURRENT_USER_MODEL']->value->get('rowheight');
        ?>
" /><input type="hidden" id="current_user_id" value="<?php 
        echo $_smarty_tpl->tpl_vars['CURRENT_USER_MODEL']->value->get('id');
        ?>
" /><div id="page"><!-- container which holds data temporarly for pjax calls --><div id="pjaxContainer" class="hide noprint"></div>
<?php 
    }
Exemplo n.º 12
0
 /**
  * Function that saves SMS records
  * @param Vtiger_Request $request
  */
 public function process(Vtiger_Request $request)
 {
     $moduleName = $request->getModule();
     $currentUserModel = Users_Record_Model::getCurrentUserModel();
     $recordIds = $this->getRecordsListFromRequest($request);
     $phoneFieldList = $request->get('fields');
     $message = $request->get('message');
     foreach ($recordIds as $recordId) {
         $recordModel = Vtiger_Record_Model::getInstanceById($recordId);
         $numberSelected = false;
         foreach ($phoneFieldList as $fieldname) {
             $fieldValue = $recordModel->get($fieldname);
             if (!empty($fieldValue)) {
                 $toNumbers[] = $fieldValue;
                 $numberSelected = true;
             }
         }
         if ($numberSelected) {
             $recordIds[] = $recordId;
         }
     }
     $response = new Vtiger_Response();
     if (!empty($toNumbers)) {
         SMSNotifier_Record_Model::SendSMS($message, $toNumbers, $currentUserModel->getId(), $recordIds, $moduleName);
         $response->setResult(true);
     } else {
         $response->setResult(false);
     }
     return $response;
 }
Exemplo n.º 13
0
	/**
	 * Function to get the Display Value, for the current field type with given DB Insert Value
	 * @param <Object> $value
	 * @return <Object>
	 */
	public function getDisplayValue($values)
	{
		if ($values == NULL && !is_array($values))
			return;
		foreach ($values as $value) {
			if (self::getOwnerType($value) === 'User') {
				$userModel = Users_Record_Model::getCleanInstance('Users');
				$userModel->set('id', $value);
				$detailViewUrl = $userModel->getDetailViewUrl();
				$currentUser = Users_Record_Model::getCurrentUserModel();
				if (!$currentUser->isAdminUser()) {
					return getOwnerName($value);
				}
			} else {
				$currentUser = Users_Record_Model::getCurrentUserModel();
				if (!$currentUser->isAdminUser()) {
					return getOwnerName($value);
				}
				$recordModel = new Settings_Groups_Record_Model();
				$recordModel->set('groupid', $value);
				$detailViewUrl = $recordModel->getDetailViewUrl();
			}
			$displayvalue[] = "<a href=" . $detailViewUrl . ">" . getOwnerName($value) . "</a>&nbsp";
		}
		$displayvalue = implode(',', $displayvalue);
		return $displayvalue;
	}
Exemplo n.º 14
0
 function preProcess(Vtiger_Request $request, $display = true)
 {
     parent::preProcess($request, false);
     $viewer = $this->getViewer($request);
     $menuModelsList = Vtiger_Menu_Model::getAll(true);
     $selectedModule = $request->getModule();
     $menuStructure = Vtiger_MenuStructure_Model::getInstanceFromMenuList($menuModelsList, $selectedModule);
     $companyDetails = Vtiger_CompanyDetails_Model::getInstanceById();
     $companyLogo = $companyDetails->getLogo();
     $currentDate = Vtiger_Date_UIType::getDisplayDateValue(date('Y-n-j'));
     $viewer->assign('CURRENTDATE', $currentDate);
     $viewer->assign('MODULE', $selectedModule);
     $viewer->assign('MODULE_NAME', $selectedModule);
     $viewer->assign('QUALIFIED_MODULE', $selectedModule);
     $viewer->assign('PARENT_MODULE', $request->get('parent'));
     $viewer->assign('VIEW', $request->get('view'));
     // Order by pre-defined automation process for QuickCreate.
     uksort($menuModelsList, array('Vtiger_MenuStructure_Model', 'sortMenuItemsByProcess'));
     $viewer->assign('MENUS', $menuModelsList);
     $viewer->assign('MENU_STRUCTURE', $menuStructure);
     $viewer->assign('MENU_SELECTED_MODULENAME', $selectedModule);
     $viewer->assign('MENU_TOPITEMS_LIMIT', $menuStructure->getLimit());
     $viewer->assign('COMPANY_LOGO', $companyLogo);
     $viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());
     $homeModuleModel = Vtiger_Module_Model::getInstance('Home');
     $viewer->assign('HOME_MODULE_MODEL', $homeModuleModel);
     $viewer->assign('HEADER_LINKS', $this->getHeaderLinks());
     $viewer->assign('ANNOUNCEMENT', $this->getAnnouncement());
     $viewer->assign('SEARCHABLE_MODULES', Vtiger_Module_Model::getSearchableModules());
     if ($display) {
         $this->preProcessDisplay($request);
     }
 }
Exemplo n.º 15
0
 /**
  * Function to get list view query for popup window
  * @param <String> $sourceModule Parent module
  * @param <String> $field parent fieldname
  * @param <Integer> $record parent id
  * @param <String> $listQuery
  * @return <String> Listview Query
  */
 public function getQueryByModuleField($sourceModule, $field, $record, $listQuery)
 {
     if ($sourceModule == 'Accounts' && $field == 'account_id' && $record || in_array($sourceModule, array('Campaigns', 'Products', 'Services', 'Emails', 'Potentials'))) {
         if ($sourceModule === 'Campaigns') {
             $condition = " vtiger_account.accountid NOT IN (SELECT accountid FROM vtiger_campaignaccountrel WHERE campaignid = '{$record}')";
         } elseif ($sourceModule === 'Products') {
             $condition = " vtiger_account.accountid NOT IN (SELECT crmid FROM vtiger_seproductsrel WHERE productid = '{$record}')";
         } elseif ($sourceModule === 'Services') {
             $condition = " vtiger_account.accountid NOT IN (SELECT relcrmid FROM vtiger_crmentityrel WHERE crmid = '{$record}' UNION SELECT crmid FROM vtiger_crmentityrel WHERE relcrmid = '{$record}') ";
         } elseif ($sourceModule === 'Emails') {
             $condition = ' vtiger_account.emailoptout = 0';
         } elseif ($sourceModule === 'Potentials') {
             $config = Settings_SalesProcesses_Module_Model::getConfig('potential');
             $currentUser = Users_Record_Model::getCurrentUserModel();
             $accessibleGroups = $currentUser->getAccessibleGroupForModule('Accounts');
             if ($config['add_potential'] && $accessibleGroups) {
                 $condition = " vtiger_crmentity.smownerid NOT IN (" . implode(',', array_keys($accessibleGroups)) . ")";
             } else {
                 return $listQuery;
             }
         } else {
             $condition = " vtiger_account.accountid != '{$record}'";
         }
         $position = stripos($listQuery, 'where');
         if ($position) {
             $overRideQuery = $listQuery . ' AND ' . $condition;
         } else {
             $overRideQuery = $listQuery . ' WHERE ' . $condition;
         }
         return $overRideQuery;
     }
 }
Exemplo n.º 16
0
 public function process(Vtiger_Request $request)
 {
     $viewer = $this->getViewer($request);
     $moduleName = $request->getModule();
     $qualifiedModuleName = $request->getModule(false);
     $record = $request->get('record');
     $parentRoleId = $request->get('parent_roleid');
     $roleDirectlyRelated = false;
     if (!empty($record)) {
         $recordModel = Settings_Roles_Record_Model::getInstanceById($record);
         $viewer->assign('MODE', 'edit');
     } else {
         $recordModel = new Settings_Roles_Record_Model();
         $recordModel->setParent(Settings_Roles_Record_Model::getInstanceById($parentRoleId));
         $viewer->assign('MODE', '');
         $roleDirectlyRelated = true;
     }
     $profileId = $recordModel->getDirectlyRelatedProfileId();
     if ($profileId) {
         $viewer->assign('PROFILE_ID', $profileId);
         $roleDirectlyRelated = true;
     }
     $viewer->assign('PROFILE_DIRECTLY_RELATED_TO_ROLE', $roleDirectlyRelated);
     $viewer->assign('ALL_PROFILES', Settings_Profiles_Record_Model::getAll());
     $viewer->assign('ROLE_USERS', $recordModel->getUsers());
     $viewer->assign('RECORD_MODEL', $recordModel);
     $viewer->assign('RECORD_ID', $record);
     $viewer->assign('MODULE', $moduleName);
     $viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());
     $viewer->view('EditView.tpl', $qualifiedModuleName);
 }
Exemplo n.º 17
0
 function postupdate()
 {
     global $log, $adb;
     if ($this->filesToDeleteNew) {
         foreach ($this->filesToDeleteNew as $path) {
             $this->recurseDelete($path);
         }
     }
     $result = true;
     self::recurseCopy('cache/updates/files_new', '', true);
     $this->recurseDelete('cache/updates');
     Vtiger_Deprecated::createModuleMetaFile();
     Vtiger_Access::syncSharingAccess();
     $adb->query('SET FOREIGN_KEY_CHECKS = 1;');
     $currentUser = Users_Record_Model::getCurrentUserModel();
     $adb->query("INSERT INTO `yetiforce_updates` (`user`, `name`, `from_version`, `to_version`, `result`) VALUES ('" . $currentUser->get('user_name') . "', '" . $this->modulenode->label . "', '" . $this->modulenode->from_version . "', '" . $this->modulenode->to_version . "','" . $result . "');", true);
     if ($result) {
         $adb->query("UPDATE vtiger_version SET current_version = '" . $this->modulenode->to_version . "';");
     }
     $dirName = 'cache/updates';
     $this->recurseDelete($dirName . '/files');
     $this->recurseDelete($dirName . '/init.php');
     $this->recurseDelete('cache/templates_c');
     header('Location: ' . vglobal('site_URL'));
     exit;
     return true;
 }
Exemplo n.º 18
0
 public function process(Vtiger_Request $request)
 {
     $moduleName = $request->getModule();
     $viewer = $this->getViewer($request);
     $qualifiedModuleName = $request->getModule(false);
     $lang = $request->get('lang');
     $mod = $request->get('mod');
     $tpl = $request->get('tpl');
     $ShowDifferences = $request->get('sd');
     $moduleModel = Settings_LangManagement_Module_Model::getInstance($qualifiedModuleName);
     if ($lang != '' && $mod != '') {
         if ($tpl == 'editLang') {
             $data = $moduleModel->loadLangTranslation($lang, $mod, $ShowDifferences);
         } else {
             $data = $moduleModel->loadAllFieldsFromModule($lang, $mod, $ShowDifferences);
         }
     }
     $Mods = $moduleModel->getModFromLang($lang);
     $Langs = $moduleModel->getLang();
     $viewer->assign('MODS', $Mods);
     $viewer->assign('MODULE_MODEL', $moduleModel);
     $viewer->assign('REQUEST', $request);
     $viewer->assign('LANGS', $Langs);
     $viewer->assign('DATA', $data);
     $viewer->assign('LANGS', $Langs);
     $viewer->assign('SD', $ShowDifferences);
     $viewer->assign('QUALIFIED_MODULE', $qualifiedModuleName);
     $viewer->assign('MODULE', $moduleName);
     $viewer->assign('CURRENT_USER_MODEL', Users_Record_Model::getCurrentUserModel());
     if ($tpl == 'editLang') {
         $viewer->view('Edit.tpl', $qualifiedModuleName);
     } else {
         $viewer->view('EditHelpIcon.tpl', $qualifiedModuleName);
     }
 }
Exemplo n.º 19
0
 function NoteBookCreate(Vtiger_Request $request)
 {
     $adb = PearDatabase::getInstance();
     $userModel = Users_Record_Model::getCurrentUserModel();
     $linkId = $request->get('linkId');
     $noteBookName = $request->get('notePadName');
     $noteBookContent = $request->get('notePadContent');
     $blockid = $request->get('blockid');
     $isdefault = $request->get('isdefault');
     $width = $request->get('width');
     $height = $request->get('height');
     $date_var = date("Y-m-d H:i:s");
     $date = $adb->formatDate($date_var, true);
     $dataValue = array();
     $dataValue['contents'] = $noteBookContent;
     $dataValue['lastSavedOn'] = $date;
     $data = Zend_Json::encode((object) $dataValue);
     $size = Zend_Json::encode(array('width' => $width, 'height' => $height));
     $query = "INSERT INTO vtiger_module_dashboard(`linkid`, `blockid`, `filterid`, `title`, `data`, `isdefault`, `size`) VALUES(?,?,?,?,?,?,?)";
     $params = array($linkId, $blockid, 0, $noteBookName, $data, $isdefault, $size);
     $adb->pquery($query, $params);
     $id = $adb->getLastInsertID();
     $result = array();
     $result['success'] = TRUE;
     $result['widgetId'] = $id;
     $response = new Vtiger_Response();
     $response->setResult($result);
     $response->emit();
 }
Exemplo n.º 20
0
 /**
  * Function to check whether the current field is read-only
  * @return <Boolean> - true/false
  */
 public function isReadOnly()
 {
     $currentUserModel = Users_Record_Model::getCurrentUserModel();
     if ($currentUserModel->isAdminUser() == false && $this->get('uitype') == 98 || $this->get('uitype') == 156 || $this->get('uitype') == 115) {
         return true;
     }
 }
Exemplo n.º 21
0
 public function process(Vtiger_Request $request)
 {
     $currentUser = Users_Record_Model::getCurrentUserModel();
     $viewer = $this->getViewer($request);
     $moduleName = $request->getModule();
     $linkId = $request->get('linkid');
     $moduleModel = Vtiger_Module_Model::getInstance($moduleName);
     $data = $moduleModel->getPotentialTotalAmountBySalesStage();
     $listViewUrl = $moduleModel->getListViewUrl();
     for ($i = 0; $i < count($data); $i++) {
         $data[$i]["links"] = $listViewUrl . $this->getSearchParams($data[$i][1]);
     }
     $widget = Vtiger_Widget_Model::getInstance($linkId, $currentUser->getId());
     $viewer->assign('WIDGET', $widget);
     $viewer->assign('MODULE_NAME', $moduleName);
     $viewer->assign('DATA', $data);
     $viewer->assign('STYLES', $this->getHeaderCss($request));
     $viewer->assign('CURRENTUSER', $currentUser);
     $content = $request->get('content');
     if (!empty($content)) {
         $viewer->view('dashboards/DashBoardWidgetContents.tpl', $moduleName);
     } else {
         $viewer->view('dashboards/FunnelAmount.tpl', $moduleName);
     }
 }
Exemplo n.º 22
0
 public function process(Vtiger_Request $request)
 {
     $viewer = $this->getViewer($request);
     $currentUserModel = Users_Record_Model::getCurrentUserModel();
     $viewer->assign('CURRENT_USER', $currentUserModel);
     $viewer->view('SharedCalendarView.tpl', $request->getModule());
 }
Exemplo n.º 23
0
 public function preProcess(Vtiger_Request $request)
 {
     parent::preProcess($request);
     $viewer = $this->getViewer($request);
     $record = $request->get('record');
     $moduleName = $request->getModule();
     $reportModel = Reports_Record_Model::getCleanInstance($record);
     $primaryModule = $reportModel->getPrimaryModule();
     $primaryModuleModel = Vtiger_Module_Model::getInstance($primaryModule);
     if ($primaryModuleModel) {
         $currentUser = Users_Record_Model::getCurrentUserModel();
         $userPrivilegesModel = Users_Privileges_Model::getInstanceById($currentUser->getId());
         $permission = $userPrivilegesModel->hasModulePermission($primaryModuleModel->getId());
         if (!$permission) {
             $viewer->assign('MODULE', $primaryModule);
             $viewer->assign('MESSAGE', 'LBL_PERMISSION_DENIED');
             $viewer->view('OperationNotPermitted.tpl', $primaryModule);
             exit;
         }
     }
     $viewer->assign('REPORT_MODEL', $reportModel);
     $viewer->assign('RECORD_ID', $record);
     $viewer->assign('MODULE', $moduleName);
     $viewer->assign('VIEW', 'ChartEdit');
     $viewer->assign('RECORD_MODE', $request->getMode());
     $viewer->view('EditChartHeader.tpl', $request->getModule());
 }
 public function process(Vtiger_Request $request)
 {
     $currentUser = Users_Record_Model::getCurrentUserModel();
     $viewer = $this->getViewer($request);
     $moduleName = $request->getModule();
     $page = $request->get('page');
     $linkId = $request->get('linkid');
     $widget = Vtiger_Widget_Model::getInstance($linkId, $currentUser->getId());
     if (!$request->has('owner')) {
         $owner = Settings_WidgetsManagement_Module_Model::getDefaultUserId($widget);
     } else {
         $owner = $request->get('owner');
     }
     $pagingModel = new Vtiger_Paging_Model();
     $pagingModel->set('page', $page);
     $pagingModel->set('limit', (int) $widget->get('limit'));
     $moduleModel = Vtiger_Module_Model::getInstance($moduleName);
     $projectsTasks = $owner === false ? array() : $moduleModel->getAssignedProjectsTasks('upcoming', $pagingModel, $owner);
     $viewer->assign('WIDGET', $widget);
     $viewer->assign('MODULE_NAME', $moduleName);
     $viewer->assign('PROJECTSTASKS', $projectsTasks);
     $viewer->assign('PAGING', $pagingModel);
     $viewer->assign('CURRENTUSER', $currentUser);
     global $title_max_length, $href_max_length;
     $viewer->assign('NAMELENGHT', $title_max_length);
     $viewer->assign('HREFNAMELENGHT', $href_max_length);
     $viewer->assign('NODATAMSGLABLE', 'LBL_NO_OVERDUE_ACTIVITIES');
     $content = $request->get('content');
     if (!empty($content)) {
         $viewer->view('dashboards/AssignedProjectsTasksContents.tpl', $moduleName);
     } else {
         $viewer->view('dashboards/AssignedProjectsTasks.tpl', $moduleName);
     }
 }
Exemplo n.º 25
0
 public function process(Vtiger_Request $request)
 {
     $currentUser = Users_Record_Model::getCurrentUserModel();
     $viewer = $this->getViewer($request);
     $moduleName = $request->getModule();
     $number = $request->get('number');
     $page = $request->get('page');
     $linkId = $request->get('linkid');
     $widget = Vtiger_Widget_Model::getInstance($linkId, $currentUser->getId());
     $limit = (int) $widget->get('limit');
     if (empty($limit)) {
         $limit = 10;
     }
     if (empty($page)) {
         $page = 1;
     }
     $pagingModel = new Vtiger_Paging_Model();
     $pagingModel->set('page', $page);
     $pagingModel->set('limit', $limit);
     $columnList = array('LBL_NAME' => 'label', 'LBL_MODULE_NAME' => 'setype', 'Last Modified By' => 'modifiedtime', 'LBL_OWNER' => 'smownerid');
     $recordList = ListUpdatedRecord::getListRecord(NULL, $columnList);
     $viewer->assign('COLUMN_LIST', $columnList);
     $viewer->assign('WIDGET', $widget);
     $viewer->assign('MODULE_NAME', $moduleName);
     $viewer->assign('LIST', $recordList);
     $viewer->assign('PAGE', $page);
     $viewer->assign('NEXTPAGE', count($recordList) < $limit ? 0 : $page + 1);
     $content = $request->get('content');
     if (!empty($content)) {
         $viewer->view('dashboards/ListUpdatedRecordContents.tpl', $moduleName);
     } else {
         $viewer->view('dashboards/ListUpdatedRecord.tpl', $moduleName);
     }
 }
Exemplo n.º 26
0
 public function process(Vtiger_Request $request)
 {
     $currentUser = Users_Record_Model::getCurrentUserModel();
     $viewer = $this->getViewer($request);
     $moduleName = $request->getModule();
     $linkId = $request->get('linkid');
     $createdTime = $request->get('createdtime');
     $owner = $request->get('owner');
     //Date conversion from user to database format
     if (!empty($createdTime)) {
         $dates['start'] = Vtiger_Date_UIType::getDBInsertedValue($createdTime['start']);
         $dates['end'] = Vtiger_Date_UIType::getDBInsertedValue($createdTime['end']);
     }
     $moduleModel = Vtiger_Module_Model::getInstance($moduleName);
     $data = $moduleModel->getLeadsCreated($owner, $dates);
     $widget = Vtiger_Widget_Model::getInstance($linkId, $currentUser->getId());
     //Include special script and css needed for this widget
     $viewer->assign('SCRIPTS', $this->getHeaderScripts($request));
     $viewer->assign('WIDGET', $widget);
     $viewer->assign('MODULE_NAME', $moduleName);
     $viewer->assign('DATA', $data);
     $viewer->assign('CURRENTUSER', $currentUser);
     $accessibleUsers = $currentUser->getAccessibleUsersForModule('Leads');
     $viewer->assign('ACCESSIBLE_USERS', $accessibleUsers);
     $content = $request->get('content');
     if (!empty($content)) {
         $viewer->view('dashboards/DashBoardWidgetContents.tpl', $moduleName);
     } else {
         $viewer->view('dashboards/LeadsCreated.tpl', $moduleName);
     }
 }
Exemplo n.º 27
0
 function getAccountsList($user = false, $onlyMy = false, $password = false)
 {
     $adb = PearDatabase::getInstance();
     $currentUserModel = Users_Record_Model::getCurrentUserModel();
     $param = $users = [];
     $sql = "SELECT * FROM roundcube_users";
     $where = false;
     if ($password) {
         $where .= " AND password <> ''";
     }
     if ($user) {
         $where .= " AND user_id = ?";
         $param[] = $user;
     }
     if ($onlyMy) {
         $where .= " AND crm_user_id = ?";
         $param[] = $currentUserModel->getId();
     }
     if ($where) {
         $sql .= ' WHERE' . substr($where, 4);
     }
     $result = $adb->pquery($sql, $param);
     $num = $adb->num_rows($result);
     if ($num == 0) {
         return false;
     } else {
         while ($row = $adb->fetch_array($result)) {
             $users[] = $row;
         }
         return $users;
     }
 }
Exemplo n.º 28
0
 public function process(Vtiger_Request $request)
 {
     $moduleName = $request->getModule();
     $recordId = $request->get('record');
     $currencyName = $request->get('currency');
     if (!empty($recordId)) {
         $recordModel = Vtiger_Record_Model::getInstanceById($recordId, $moduleName);
         $priceDetails = $recordModel->getPriceDetails();
     } else {
         $recordModel = Vtiger_Record_Model::getCleanInstance($moduleName);
         $priceDetails = $recordModel->getPriceDetails();
         foreach ($priceDetails as $key => $currencyDetails) {
             if ($currencyDetails['curname'] === $currencyName) {
                 $baseCurrencyConversionRate = $currencyDetails['conversionrate'];
                 break;
             }
         }
         foreach ($priceDetails as $key => $currencyDetails) {
             if ($currencyDetails['curname'] === $currencyName) {
                 $currencyDetails['conversionrate'] = 1;
                 $currencyDetails['is_basecurrency'] = 1;
             } else {
                 $currencyDetails['conversionrate'] = $currencyDetails['conversionrate'] / $baseCurrencyConversionRate;
                 $currencyDetails['is_basecurrency'] = 0;
             }
             $priceDetails[$key] = $currencyDetails;
         }
     }
     $viewer = $this->getViewer($request);
     $viewer->assign('MODULE', $moduleName);
     $viewer->assign('PRICE_DETAILS', $priceDetails);
     $viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());
     $viewer->view('MoreCurrenciesList.tpl', 'Products');
 }
Exemplo n.º 29
0
 public function checkPermission(Vtiger_Request $request)
 {
     $currentUserModel = Users_Record_Model::getCurrentUserModel();
     if (!$currentUserModel->isAdminUser()) {
         throw new NoPermittedForAdminException('LBL_PERMISSION_DENIED');
     }
 }
Exemplo n.º 30
0
	public function process(Vtiger_Request $request) {
		$currentUser = Users_Record_Model::getCurrentUserModel();
		$viewer = $this->getViewer($request);
		$moduleName = $request->getModule();

		$linkId = $request->get('linkid');

		$moduleModel = Vtiger_Module_Model::getInstance($moduleName);
		$data = $moduleModel->getPotentialsCountBySalesPerson();

		$widget = Vtiger_Widget_Model::getInstance($linkId, $currentUser->getId());

		$viewer->assign('WIDGET', $widget);
		$viewer->assign('MODULE_NAME', $moduleName);
		$viewer->assign('DATA', $data);

		//Include special script and css needed for this widget
		$viewer->assign('SCRIPTS',$this->getHeaderScripts($request));
		$viewer->assign('STYLES',$this->getHeaderCss($request));
		$viewer->assign('CURRENTUSER', $currentUser);

		$content = $request->get('content');
		if(!empty($content)) {
			$viewer->view('dashboards/DashBoardWidgetContents.tpl', $moduleName);
		} else {
			$viewer->view('dashboards/GroupBySalesPerson.tpl', $moduleName);
		}
	}