Пример #1
0
 public function updateEvent(Vtiger_Request $request)
 {
     $moduleName = $request->getModule();
     $recordId = $request->get('id');
     $date_start = date('Y-m-d', strtotime($request->get('start')));
     $time_start = date('H:i:s', strtotime($request->get('start')));
     $succes = false;
     if (isPermitted($moduleName, 'EditView', $recordId) === 'no') {
         $succes = false;
     } else {
         if (!empty($recordId)) {
             try {
                 $delta = $request->get('delta');
                 $recordModel = Vtiger_Record_Model::getInstanceById($recordId, $moduleName);
                 $recordData = $recordModel->entity->column_fields;
                 $end = self::changeDateTime($recordData['due_date'] . ' ' . $recordData['time_end'], $delta);
                 $due_date = $end['date'];
                 $time_end = $end['time'];
                 $recordModel->set('id', $recordId);
                 $recordModel->set('mode', 'edit');
                 $recordModel->set('date_start', $date_start);
                 $recordModel->set('time_start', $time_start);
                 $recordModel->set('due_date', $due_date);
                 $recordModel->set('time_end', $time_end);
                 $recordModel->save();
                 $succes = true;
             } catch (Exception $e) {
                 $succes = false;
             }
         }
     }
     $response = new Vtiger_Response();
     $response->setResult($succes);
     $response->emit();
 }
Пример #2
0
 /**
  * Get widget instance by name
  */
 static function getWidget($name)
 {
     if ($name == 'DetailViewBlockCommentWidget' && isPermitted('ModComments', 'DetailView') == 'yes') {
         require_once dirname(__FILE__) . '/widgets/DetailViewBlockComment.php';
         return new ModComments_DetailViewBlockCommentWidget();
     }
     return false;
 }
Пример #3
0
 function isModuleActive($module)
 {
     include_once 'include/utils/VtlibUtils.php';
     if (vtlib_isModuleActive($module) && isPermitted($module, 'EditView') == 'yes') {
         return true;
     }
     return false;
 }
Пример #4
0
 function getModulesList()
 {
     foreach ($this->module_list as $key => $value) {
         if (isPermitted($key, 'index') == "yes") {
             $modules[$key] = vtranslate($key, $key);
         }
     }
     asort($modules);
     return $modules;
 }
Пример #5
0
	function isViewPermitted() {
		global $current_user;
		if (isset($current_user) && is_admin($current_user))
			return true;
		// Does current user has access to view the record that was tracked?
		if ($this->module == 'Events') {
			$moduleName = 'Calendar';
		} else {
			$moduleName = $this->module;
		}
		return (isPermitted($moduleName, 'DetailView', $this->crmid) == "yes");
	}
Пример #6
0
 /**
  * Function to get the detail view links (links and widgets)
  * @param <array> $linkParams - parameters which will be used to calicaulate the params
  * @return <array> - array of link models in the format as below
  *                   array('linktype'=>list of link models);
  */
 public function getDetailViewLinks($linkParams)
 {
     $currentUserModel = Users_Privileges_Model::getCurrentUserPrivilegesModel();
     $linkModelList = parent::getDetailViewLinks($linkParams);
     $recordModel = $this->getRecord();
     $moduleName = $recordModel->getModuleName();
     $recordId = $recordModel->getId();
     $status = $recordModel->get('activitystatus');
     $statusActivity = Calendar_Module_Model::getComponentActivityStateLabel('current');
     $lockEdit = Users_Privileges_Model::checkLockEdit($moduleName, $recordId);
     if (Users_Privileges_Model::isPermitted($moduleName, 'EditView', $recordId) && $currentUserModel->hasModuleActionPermission($this->getModule()->getId(), 'DetailView') && !$lockEdit && isPermitted($moduleName, 'ActivityComplete', $recordId) == 'yes' && isPermitted($moduleName, 'ActivityCancel', $recordId) == 'yes' && isPermitted($moduleName, 'ActivityPostponed', $recordId) == 'yes' && in_array($status, $statusActivity)) {
         $basicActionLink = ['linktype' => 'DETAILVIEW', 'linklabel' => 'LBL_SET_RECORD_STATUS', 'linkurl' => '#', 'linkdata' => ['url' => $recordModel->getActivityStateModalUrl()], 'linkicon' => 'glyphicon glyphicon-ok', 'linkclass' => 'showModal closeCalendarRekord'];
         $linkModelList['DETAILVIEW'][] = Vtiger_Link_Model::getInstanceFromValues($basicActionLink);
     }
     return $linkModelList;
 }
Пример #7
0
 public function updateEvent(Vtiger_Request $request)
 {
     $moduleName = $request->getModule();
     $recordId = $request->get('id');
     $actionname = 'EditView';
     if (isPermitted($moduleName, $actionname, $recordId) === 'no') {
         $succes = false;
     } else {
         $delta = $request->get('delta');
         $start = DateTimeField::convertToDBTimeZone($request->get('start'));
         $date_start = $start->format('Y-m-d');
         $time_start = $start->format('H:i:s');
         $succes = false;
         if (!empty($recordId)) {
             try {
                 $recordModel = Vtiger_Record_Model::getInstanceById($recordId, $moduleName);
                 $recordData = $recordModel->entity->column_fields;
                 $end = self::changeDateTime($recordData['due_date'] . ' ' . $recordData['time_end'], $delta);
                 $due_date = $end['date'];
                 $time_end = $end['time'];
                 $recordModel->set('id', $recordId);
                 $recordModel->set('mode', 'edit');
                 $recordModel->set('date_start', $date_start);
                 $recordModel->set('due_date', $due_date);
                 if ($request->get('allDay') == 'true') {
                     $recordModel->set('allday', 1);
                     $start = self::changeDateTime($recordData['date_start'] . ' ' . $recordData['time_start'], $delta);
                     $recordModel->set('date_start', $start['date']);
                 } else {
                     $recordModel->set('time_start', $time_start);
                     $recordModel->set('time_end', $time_end);
                     $recordModel->set('allday', 0);
                 }
                 $recordModel->save();
                 $succes = true;
             } catch (Exception $e) {
                 $succes = false;
             }
         }
     }
     $response = new Vtiger_Response();
     $response->setResult($succes);
     $response->emit();
 }
Пример #8
0
 /**
  * Function returns List of User's selected Dashboard Widgets
  * @return <Array of Vtiger_Widget_Model>
  */
 public function getDashboards($action = 1)
 {
     $db = PearDatabase::getInstance();
     $currentUser = Users_Record_Model::getCurrentUserModel();
     $moduleModel = $this->getModule();
     if ($action == 'Header') {
         $action = 0;
     }
     $sql = " SELECT vtiger_links.*, mdw.userid, mdw.data, mdw.active,  mdw.title, mdw.filterid, mdw.id as widgetid, mdw.position as position, vtiger_links.linkid as id \n\t\t\tFROM vtiger_links \n\t\t\tINNER JOIN vtiger_module_dashboard_widgets mdw ON vtiger_links.linkid = mdw.linkid\n\t\t\tWHERE mdw.userid = ? AND linktype = ? AND tabid = ? AND `active` = ?";
     $params = array($currentUser->getId(), 'DASHBOARDWIDGET', $moduleModel->getId(), $action);
     $result = $db->pquery($sql, $params);
     $widgets = array();
     for ($i = 0, $len = $db->num_rows($result); $i < $len; $i++) {
         $row = $db->query_result_rowdata($result, $i);
         $row['linkid'] = $row['id'];
         if ($row['linklabel'] == 'Mini List') {
             $minilistWidget = Vtiger_Widget_Model::getInstanceFromValues($row);
             $minilistWidgetModel = new Vtiger_MiniList_Model();
             $minilistWidgetModel->setWidgetModel($minilistWidget);
             $minilistWidget->set('title', $minilistWidgetModel->getTitle());
             $widgets[] = $minilistWidget;
         } else {
             $widgets[] = Vtiger_Widget_Model::getInstanceFromValues($row);
         }
     }
     foreach ($widgets as $index => $widget) {
         $label = $widget->get('linklabel');
         $url = $widget->get('linkurl');
         $redex = '/module=(.+?)&+/';
         preg_match($redex, $url, $match);
         if (isPermitted($match[1], 'Index') == 'no') {
             unset($widgets[$index]);
         }
         if ($label == 'Tag Cloud') {
             $isTagCloudExists = getTagCloudView($currentUser->getId());
             if ($isTagCloudExists === 'false') {
                 unset($widgets[$index]);
             }
         }
     }
     return $widgets;
 }
<?php if ($_valid && !is_callable('content_56059e5cd6c07')) {function content_56059e5cd6c07($_smarty_tpl) {?>
<?php $_smarty_tpl->tpl_vars['MODULE_NAME'] = new Smarty_variable("Calendar", null, 0);?><div  class="summaryWidgetContainer"><div class="widget_header row-fluid"><span class="span8"><h4 class="textOverflowEllipsis"><?php echo vtranslate('LBL_ACTIVITIES',$_smarty_tpl->tpl_vars['MODULE_NAME']->value);?>
</h4></span><span class="span4"><button class="btn pull-right addButton createActivity" data-url="sourceModule=<?php echo $_smarty_tpl->tpl_vars['RECORD']->value->getModuleName();?>
&sourceRecord=<?php echo $_smarty_tpl->tpl_vars['RECORD']->value->getId();?>
&relationOperation=true" type="button"><strong><?php echo vtranslate('LBL_ADD',$_smarty_tpl->tpl_vars['MODULE_NAME']->value);?>
</strong></button></span></div><div class="widget_contents"><?php if (count($_smarty_tpl->tpl_vars['ACTIVITIES']->value)!='0'){?><?php  $_smarty_tpl->tpl_vars['RECORD'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['RECORD']->_loop = false;
 $_smarty_tpl->tpl_vars['KEY'] = new Smarty_Variable;
 $_from = $_smarty_tpl->tpl_vars['ACTIVITIES']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['RECORD']->key => $_smarty_tpl->tpl_vars['RECORD']->value){
$_smarty_tpl->tpl_vars['RECORD']->_loop = true;
 $_smarty_tpl->tpl_vars['KEY']->value = $_smarty_tpl->tpl_vars['RECORD']->key;
?><?php $_smarty_tpl->tpl_vars['START_DATE'] = new Smarty_variable($_smarty_tpl->tpl_vars['RECORD']->value->get('date_start'), null, 0);?><?php $_smarty_tpl->tpl_vars['START_TIME'] = new Smarty_variable($_smarty_tpl->tpl_vars['RECORD']->value->get('time_start'), null, 0);?><?php $_smarty_tpl->tpl_vars['EDITVIEW_PERMITTED'] = new Smarty_variable(isPermitted('Calendar','EditView',$_smarty_tpl->tpl_vars['RECORD']->value->get('crmid')), null, 0);?><?php $_smarty_tpl->tpl_vars['DETAILVIEW_PERMITTED'] = new Smarty_variable(isPermitted('Calendar','DetailView',$_smarty_tpl->tpl_vars['RECORD']->value->get('crmid')), null, 0);?><div class="activityEntries"><input type="hidden" class="activityId" value="<?php echo $_smarty_tpl->tpl_vars['RECORD']->value->get('activityid');?>
"/><div class="row-fluid"><span class="span6"><strong title="<?php echo Vtiger_Util_Helper::formatDateTimeIntoDayString(($_smarty_tpl->tpl_vars['START_DATE']->value)." ".($_smarty_tpl->tpl_vars['START_TIME']->value));?>
"><?php echo Vtiger_Util_Helper::formatDateIntoStrings($_smarty_tpl->tpl_vars['START_DATE']->value,$_smarty_tpl->tpl_vars['START_TIME']->value);?>
</strong></span><div class="activityStatus span6"><?php if ($_smarty_tpl->tpl_vars['RECORD']->value->get('activitytype')=='Task'){?><?php $_smarty_tpl->tpl_vars['MODULE_NAME'] = new Smarty_variable($_smarty_tpl->tpl_vars['RECORD']->value->getModuleName(), null, 0);?><input type="hidden" class="activityModule" value="<?php echo $_smarty_tpl->tpl_vars['RECORD']->value->getModuleName();?>
"/><input type="hidden" class="activityType" value="<?php echo $_smarty_tpl->tpl_vars['RECORD']->value->get('activitytype');?>
"/><div class="pull-right"><strong><span class="value"><?php echo vtranslate($_smarty_tpl->tpl_vars['RECORD']->value->get('status'),$_smarty_tpl->tpl_vars['MODULE_NAME']->value);?>
</span></strong>&nbsp&nbsp;<span class="editStatus cursorPointer"><i class="icon-pencil" title="<?php echo vtranslate('LBL_EDIT',$_smarty_tpl->tpl_vars['MODULE_NAME']->value);?>
"></i></span><span class="edit hide"><?php $_smarty_tpl->tpl_vars['FIELD_MODEL'] = new Smarty_variable($_smarty_tpl->tpl_vars['RECORD']->value->getModule()->getField('taskstatus'), null, 0);?><?php $_smarty_tpl->tpl_vars['FIELD_VALUE'] = new Smarty_variable($_smarty_tpl->tpl_vars['FIELD_MODEL']->value->set('fieldvalue',$_smarty_tpl->tpl_vars['RECORD']->value->get('status')), null, 0);?><?php echo $_smarty_tpl->getSubTemplate (vtemplate_path($_smarty_tpl->tpl_vars['FIELD_MODEL']->value->getUITypeModel()->getTemplateName(),$_smarty_tpl->tpl_vars['MODULE_NAME']->value), $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null, array('FIELD_MODEL'=>$_smarty_tpl->tpl_vars['FIELD_MODEL']->value,'USER_MODEL'=>$_smarty_tpl->tpl_vars['USER_MODEL']->value,'MODULE'=>$_smarty_tpl->tpl_vars['MODULE_NAME']->value,'OCCUPY_COMPLETE_WIDTH'=>'true'), 0);?>
<input type="hidden" class="fieldname" value='<?php echo $_smarty_tpl->tpl_vars['FIELD_MODEL']->value->get('name');?>
' data-prev-value='<?php echo $_smarty_tpl->tpl_vars['FIELD_MODEL']->value->get('fieldvalue');?>
' /></span></div></div><?php }else{ ?><?php $_smarty_tpl->tpl_vars['MODULE_NAME'] = new Smarty_variable("Events", null, 0);?><input type="hidden" class="activityModule" value="Events"/><input type="hidden" class="activityType" value="<?php echo $_smarty_tpl->tpl_vars['RECORD']->value->get('activitytype');?>
"/><?php if ($_smarty_tpl->tpl_vars['EDITVIEW_PERMITTED']->value=='yes'){?><div class="pull-right"><strong><span class="value"><?php echo vtranslate($_smarty_tpl->tpl_vars['RECORD']->value->get('eventstatus'),$_smarty_tpl->tpl_vars['MODULE_NAME']->value);?>
</span></strong>&nbsp&nbsp;<span class="editStatus cursorPointer"><i class="icon-pencil" title="<?php echo vtranslate('LBL_EDIT',$_smarty_tpl->tpl_vars['MODULE_NAME']->value);?>
"></i></span><span class="edit hide"><?php $_smarty_tpl->tpl_vars['FIELD_MODEL'] = new Smarty_variable($_smarty_tpl->tpl_vars['RECORD']->value->getModule()->getField('eventstatus'), null, 0);?><?php $_smarty_tpl->tpl_vars['FIELD_VALUE'] = new Smarty_variable($_smarty_tpl->tpl_vars['FIELD_MODEL']->value->set('fieldvalue',$_smarty_tpl->tpl_vars['RECORD']->value->get('eventstatus')), null, 0);?><?php echo $_smarty_tpl->getSubTemplate (vtemplate_path($_smarty_tpl->tpl_vars['FIELD_MODEL']->value->getUITypeModel()->getTemplateName(),$_smarty_tpl->tpl_vars['MODULE_NAME']->value), $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null, array('FIELD_MODEL'=>$_smarty_tpl->tpl_vars['FIELD_MODEL']->value,'USER_MODEL'=>$_smarty_tpl->tpl_vars['USER_MODEL']->value,'MODULE'=>$_smarty_tpl->tpl_vars['MODULE_NAME']->value,'OCCUPY_COMPLETE_WIDTH'=>'true'), 0);?>
<?php if ($_smarty_tpl->tpl_vars['FIELD_MODEL']->value->getFieldDataType()=='multipicklist'){?><input type="hidden" class="fieldname" value='<?php echo $_smarty_tpl->tpl_vars['FIELD_MODEL']->value->get('name');?>
[]' data-prev-value='<?php echo $_smarty_tpl->tpl_vars['FIELD_MODEL']->value->getDisplayValue($_smarty_tpl->tpl_vars['FIELD_MODEL']->value->get('fieldvalue'));?>
' /><?php }else{ ?><input type="hidden" class="fieldname" value='<?php echo $_smarty_tpl->tpl_vars['FIELD_MODEL']->value->get('name');?>
' data-prev-value='<?php echo $_smarty_tpl->tpl_vars['FIELD_MODEL']->value->getDisplayValue($_smarty_tpl->tpl_vars['FIELD_MODEL']->value->get('fieldvalue'));?>
' /><?php }?></span></div><?php }?></div><?php }?></div><div class="summaryViewEntries"><?php echo vtranslate($_smarty_tpl->tpl_vars['RECORD']->value->get('activitytype'),$_smarty_tpl->tpl_vars['MODULE_NAME']->value);?>
&nbsp;-&nbsp;<?php if ($_smarty_tpl->tpl_vars['DETAILVIEW_PERMITTED']->value=='yes'){?><a href="<?php echo $_smarty_tpl->tpl_vars['RECORD']->value->getDetailViewUrl();?>
" ><?php echo $_smarty_tpl->tpl_vars['RECORD']->value->get('subject');?>
</a><?php }else{ ?><?php echo $_smarty_tpl->tpl_vars['RECORD']->value->get('subject');?>
<?php }?>&nbsp;<?php if ($_smarty_tpl->tpl_vars['EDITVIEW_PERMITTED']->value=='yes'){?><a href="<?php echo $_smarty_tpl->tpl_vars['RECORD']->value->getEditViewUrl();?>
" class="fieldValue"><i class="icon-pencil summaryViewEdit" title="<?php echo vtranslate('LBL_EDIT',$_smarty_tpl->tpl_vars['MODULE_NAME']->value);?>
"></i></a><?php }?></div></div><hr><?php } ?><?php }else{ ?><div class="summaryWidgetContainer"><p class="textAlignCenter"><?php echo vtranslate('LBL_NO_PENDING_ACTIVITIES',$_smarty_tpl->tpl_vars['MODULE_NAME']->value);?>
</p></div><?php }?><?php if ($_smarty_tpl->tpl_vars['PAGING_MODEL']->value->isNextPageExists()){?><div class="row-fluid"><div class="pull-right"><a href="javascript:void(0)" class="moreRecentActivities"><?php echo vtranslate('LBL_MORE',$_smarty_tpl->tpl_vars['MODULE_NAME']->value);?>
..</a></div></div><?php }?></div></div>
<?php }} ?>
Пример #10
0
 public function updateDeltaOnDrop(Vtiger_Request $request)
 {
     $moduleName = $request->getModule();
     $activityType = $request->get('activitytype');
     $recordId = $request->get('id');
     $dayDelta = $request->get('dayDelta');
     $minuteDelta = $request->get('minuteDelta');
     $actionname = 'EditView';
     $response = new Vtiger_Response();
     if (isPermitted($moduleName, $actionname, $recordId) === 'no') {
         $result = array('ispermitted' => false);
         $response->setResult($result);
         $response->emit();
     } else {
         $result = array('ispermitted' => true);
         $record = Vtiger_Record_Model::getInstanceById($recordId, $moduleName);
         $record->set('mode', 'edit');
         $oldStartDateTime[] = $record->get('date_start');
         $oldStartDateTime[] = $record->get('time_start');
         $oldStartDateTime = implode(' ', $oldStartDateTime);
         $resultDateTime = $this->changeDateTime($oldStartDateTime, $dayDelta, $minuteDelta);
         $parts = explode(' ', $resultDateTime);
         $record->set('date_start', $parts[0]);
         $record->set('time_start', $parts[1]);
         $oldEndDateTime[] = $record->get('due_date');
         $oldEndDateTime[] = $record->get('time_end');
         $oldEndDateTime = implode(' ', $oldEndDateTime);
         $resultDateTime = $this->changeDateTime($oldEndDateTime, $dayDelta, $minuteDelta);
         $parts = explode(' ', $resultDateTime);
         $record->set('due_date', $parts[0]);
         if (activitytype != 'Task') {
             $record->set('time_end', $parts[1]);
         }
         $record->save();
         $response->setResult($result);
         $response->emit();
     }
 }
 public function process(Vtiger_Request $request)
 {
     $moduleName = $request->getModule();
     $recordId = $request->get('record');
     $recordModel = Vtiger_Record_Model::getInstanceById($recordId);
     $moduleModel = $recordModel->getModule();
     $actionname = "EditView";
     if (isPermitted($moduleName, $actionname, $recordId) === 'yes') {
         //Start date Field required for validation
         $startDateFieldModel = $moduleModel->getField("date_start");
         $startDateTime = $recordModel->getDisplayValue('date_start');
         $startDate = explode(" ", $startDateTime);
         $startDate = $startDate[0];
         $viewer = $this->getViewer($request);
         $viewer->assign('STARTDATEFIELDMODEL', $startDateFieldModel);
         $viewer->assign('STARTDATE', $startDate);
         $viewer->assign('CURRENTDATE', date('Y-n-j'));
         $viewer->assign('MODULE', $moduleName);
         $viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());
         $viewer->assign('RECORD_MODEL', $recordModel);
         $viewer->view('QuickCreateFollowup.tpl', $moduleName);
     }
 }
<?php if ($_valid && !is_callable('content_56059e5eb6b1a')) {function content_56059e5eb6b1a($_smarty_tpl) {?>
<div class="recentActivitiesContainer" id="updates"><input type="hidden" id="updatesCurrentPage" value="<?php echo $_smarty_tpl->tpl_vars['PAGING_MODEL']->value->get('page');?>
" /><div><?php if (!empty($_smarty_tpl->tpl_vars['RECENT_ACTIVITIES']->value)){?><ul class="unstyled"><?php  $_smarty_tpl->tpl_vars['RECENT_ACTIVITY'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['RECENT_ACTIVITY']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['RECENT_ACTIVITIES']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['RECENT_ACTIVITY']->key => $_smarty_tpl->tpl_vars['RECENT_ACTIVITY']->value){
$_smarty_tpl->tpl_vars['RECENT_ACTIVITY']->_loop = true;
?><?php $_smarty_tpl->tpl_vars['PROCEED'] = new Smarty_variable(true, null, 0);?><?php if (($_smarty_tpl->tpl_vars['RECENT_ACTIVITY']->value->isRelationLink())||($_smarty_tpl->tpl_vars['RECENT_ACTIVITY']->value->isRelationUnLink())){?><?php $_smarty_tpl->tpl_vars['RELATION'] = new Smarty_variable($_smarty_tpl->tpl_vars['RECENT_ACTIVITY']->value->getRelationInstance(), null, 0);?><?php if (!($_smarty_tpl->tpl_vars['RELATION']->value->getLinkedRecord())){?><?php $_smarty_tpl->tpl_vars['PROCEED'] = new Smarty_variable(false, null, 0);?><?php }?><?php }?><?php if ($_smarty_tpl->tpl_vars['PROCEED']->value){?><?php if ($_smarty_tpl->tpl_vars['RECENT_ACTIVITY']->value->isCreate()){?><li><div><span><strong><?php echo $_smarty_tpl->tpl_vars['RECENT_ACTIVITY']->value->getModifiedBy()->getName();?>
</strong> <?php echo vtranslate('LBL_CREATED',$_smarty_tpl->tpl_vars['MODULE_NAME']->value);?>
</span><span class="pull-right"><p class="muted"><small title="<?php echo Vtiger_Util_Helper::formatDateTimeIntoDayString($_smarty_tpl->tpl_vars['RECENT_ACTIVITY']->value->getParent()->get('createdtime'));?>
"><?php echo Vtiger_Util_Helper::formatDateDiffInStrings($_smarty_tpl->tpl_vars['RECENT_ACTIVITY']->value->getParent()->get('createdtime'));?>
</small></p></span></div></li><?php }elseif($_smarty_tpl->tpl_vars['RECENT_ACTIVITY']->value->isUpdate()){?><li><div><span><strong><?php echo $_smarty_tpl->tpl_vars['RECENT_ACTIVITY']->value->getModifiedBy()->getDisplayName();?>
</strong> <?php echo vtranslate('LBL_UPDATED',$_smarty_tpl->tpl_vars['MODULE_NAME']->value);?>
</span><span class="pull-right"><p class="muted"><small title="<?php echo Vtiger_Util_Helper::formatDateTimeIntoDayString($_smarty_tpl->tpl_vars['RECENT_ACTIVITY']->value->getActivityTime());?>
"><?php echo Vtiger_Util_Helper::formatDateDiffInStrings($_smarty_tpl->tpl_vars['RECENT_ACTIVITY']->value->getActivityTime());?>
</small></p></span></div><?php  $_smarty_tpl->tpl_vars['FIELDMODEL'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['FIELDMODEL']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['RECENT_ACTIVITY']->value->getFieldInstances(); if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['FIELDMODEL']->key => $_smarty_tpl->tpl_vars['FIELDMODEL']->value){
$_smarty_tpl->tpl_vars['FIELDMODEL']->_loop = true;
?><?php if ($_smarty_tpl->tpl_vars['FIELDMODEL']->value&&$_smarty_tpl->tpl_vars['FIELDMODEL']->value->getFieldInstance()&&$_smarty_tpl->tpl_vars['FIELDMODEL']->value->getFieldInstance()->isViewable()&&$_smarty_tpl->tpl_vars['FIELDMODEL']->value->getFieldInstance()->getDisplayType()!='5'){?><div class='font-x-small updateInfoContainer'><i><?php echo vtranslate($_smarty_tpl->tpl_vars['FIELDMODEL']->value->getName(),$_smarty_tpl->tpl_vars['MODULE_NAME']->value);?>
</i> :&nbsp;<?php if ($_smarty_tpl->tpl_vars['FIELDMODEL']->value->get('prevalue')!=''&&$_smarty_tpl->tpl_vars['FIELDMODEL']->value->get('postvalue')!=''&&!($_smarty_tpl->tpl_vars['FIELDMODEL']->value->getFieldInstance()->getFieldDataType()=='reference'&&($_smarty_tpl->tpl_vars['FIELDMODEL']->value->get('postvalue')=='0'||$_smarty_tpl->tpl_vars['FIELDMODEL']->value->get('prevalue')=='0'))){?>&nbsp;<?php echo vtranslate('LBL_FROM');?>
 <b style="white-space:pre;"><?php echo Vtiger_Util_Helper::toVtiger6SafeHTML($_smarty_tpl->tpl_vars['FIELDMODEL']->value->getDisplayValue(decode_html($_smarty_tpl->tpl_vars['FIELDMODEL']->value->get('prevalue'))));?>
</b><?php }elseif($_smarty_tpl->tpl_vars['FIELDMODEL']->value->get('postvalue')==''||($_smarty_tpl->tpl_vars['FIELDMODEL']->value->getFieldInstance()->getFieldDataType()=='reference'&&$_smarty_tpl->tpl_vars['FIELDMODEL']->value->get('postvalue')=='0')){?>&nbsp; <b> <?php echo vtranslate('LBL_DELETED');?>
 </b> ( <del><?php echo Vtiger_Util_Helper::toVtiger6SafeHTML($_smarty_tpl->tpl_vars['FIELDMODEL']->value->getDisplayValue(decode_html($_smarty_tpl->tpl_vars['FIELDMODEL']->value->get('prevalue'))));?>
</del> )<?php }else{ ?>&nbsp;<?php echo vtranslate('LBL_CHANGED');?>
<?php }?><?php if ($_smarty_tpl->tpl_vars['FIELDMODEL']->value->get('postvalue')!=''&&!($_smarty_tpl->tpl_vars['FIELDMODEL']->value->getFieldInstance()->getFieldDataType()=='reference'&&$_smarty_tpl->tpl_vars['FIELDMODEL']->value->get('postvalue')=='0')){?>&nbsp;<?php echo vtranslate('LBL_TO');?>
&nbsp;<b style="white-space:pre;"><?php echo Vtiger_Util_Helper::toVtiger6SafeHTML($_smarty_tpl->tpl_vars['FIELDMODEL']->value->getDisplayValue(decode_html($_smarty_tpl->tpl_vars['FIELDMODEL']->value->get('postvalue'))));?>
</b><?php }?></div><?php }?><?php } ?></li><?php }elseif(($_smarty_tpl->tpl_vars['RECENT_ACTIVITY']->value->isRelationLink()||$_smarty_tpl->tpl_vars['RECENT_ACTIVITY']->value->isRelationUnLink())){?><li><div class="row-fluid"><?php $_smarty_tpl->tpl_vars['RELATION'] = new Smarty_variable($_smarty_tpl->tpl_vars['RECENT_ACTIVITY']->value->getRelationInstance(), null, 0);?><span><?php echo vtranslate($_smarty_tpl->tpl_vars['RELATION']->value->getLinkedRecord()->getModuleName(),$_smarty_tpl->tpl_vars['RELATION']->value->getLinkedRecord()->getModuleName());?>
</span> <span><?php if ($_smarty_tpl->tpl_vars['RECENT_ACTIVITY']->value->isRelationLink()){?><?php echo vtranslate('LBL_ADDED',$_smarty_tpl->tpl_vars['MODULE_NAME']->value);?>
<?php }else{ ?><?php echo vtranslate('LBL_REMOVED',$_smarty_tpl->tpl_vars['MODULE_NAME']->value);?>
<?php }?> </span><span><?php if ($_smarty_tpl->tpl_vars['RELATION']->value->getLinkedRecord()->getModuleName()=='Calendar'){?><?php if (isPermitted('Calendar','DetailView',$_smarty_tpl->tpl_vars['RELATION']->value->getLinkedRecord()->getId())=='yes'){?> <strong><?php echo $_smarty_tpl->tpl_vars['RELATION']->value->getLinkedRecord()->getName();?>
</strong> <?php }else{ ?> <?php }?><?php }else{ ?> <strong><?php echo $_smarty_tpl->tpl_vars['RELATION']->value->getLinkedRecord()->getName();?>
</strong> <?php }?></span><span class="pull-right"><p class="muted"><small title="<?php echo Vtiger_Util_Helper::formatDateTimeIntoDayString($_smarty_tpl->tpl_vars['RELATION']->value->get('changedon'));?>
"><?php echo Vtiger_Util_Helper::formatDateDiffInStrings($_smarty_tpl->tpl_vars['RELATION']->value->get('changedon'));?>
</small></p></span></div></li><?php }elseif($_smarty_tpl->tpl_vars['RECENT_ACTIVITY']->value->isRestore()){?><li></li><?php }?><?php }?><?php } ?></ul><?php }else{ ?><div class="summaryWidgetContainer"><p class="textAlignCenter"><?php echo vtranslate('LBL_NO_RECENT_UPDATES');?>
</p></div><?php }?></div><div class="row-fluid" id="moreLink"><?php if ($_smarty_tpl->tpl_vars['PAGING_MODEL']->value->isNextPageExists()){?><div class="pull-right"><a href="javascript:void(0)" class="moreRecentUpdates"><?php echo vtranslate('LBL_MORE',$_smarty_tpl->tpl_vars['MODULE_NAME']->value);?>
..</a></div><?php }?></div><span class="clearfix"></span></div><?php }} ?>
Пример #13
0
require_once 'modules/PickList/PickListUtils.php';
// Set the current language and the language strings, if not already set.
setCurrentLanguage();
global $allow_exports, $app_strings;
session_start();
$current_user = new Users();
if (isset($_SESSION['authenticated_user_id'])) {
    $result = $current_user->retrieveCurrentUserInfoFromFile($_SESSION['authenticated_user_id'], "Users");
    if ($result == null) {
        session_destroy();
        header("Location: index.php?action=Login&module=Users");
        exit;
    }
}
//Security Check
if (isPermitted($_REQUEST['module'], "Export") == "no") {
    $allow_exports = "none";
}
if ($allow_exports == 'none' || $allow_exports == 'admin' && !is_admin($current_user)) {
    ?>
	<script type='text/javascript'>
		alert("<?php 
    echo $app_strings['NOT_PERMITTED_TO_EXPORT'];
    ?>
");
		window.location="index.php?module=<?php 
    echo vtlib_purify($_REQUEST['module']);
    ?>
&action=index";
	</script>
	
Пример #14
0
 function get_project_mail($id, $cur_tab_id, $rel_tab_id, $actions = false)
 {
     global $currentModule, $app_strings, $singlepane_view;
     $this_module = $currentModule;
     $related_module = vtlib_getModuleNameById($rel_tab_id);
     $other = CRMEntity::getInstance($related_module);
     vtlib_setup_modulevars($related_module, $other);
     $singular_modname = vtlib_toSingular($related_module);
     $button = '';
     if ($actions) {
         if (is_string($actions)) {
             $actions = explode(',', strtoupper($actions));
         }
         if (in_array('SELECT', $actions) && isPermitted($related_module, 4, '') == 'yes') {
             $button .= "<input title='" . getTranslatedString('LBL_SELECT') . " " . getTranslatedString($related_module) . "' class='crmbutton small edit' type='button' onclick=\"return window.open('index.php?module={$related_module}&return_module={$currentModule}&action=Popup&popuptype=detailview&select=enable&form=EditView&form_submit=false&recordid={$id}','test','width=640,height=602,resizable=0,scrollbars=0');\" value='" . getTranslatedString('LBL_SELECT') . " " . getTranslatedString($related_module) . "'>&nbsp;";
         }
         if (in_array('ADD', $actions) && isPermitted($related_module, 1, '') == 'yes') {
             $button .= "<input type='hidden' name='createmode' id='createmode' value='link' />" . "<input title='" . getTranslatedString('LBL_ADD_NEW') . " " . getTranslatedString($singular_modname) . "' class='crmbutton small create'" . " onclick='this.form.action.value=\"EditView\";this.form.module.value=\"{$related_module}\"' type='submit' name='button'" . " value='" . getTranslatedString('LBL_ADD_NEW') . " " . getTranslatedString($singular_modname) . "'>&nbsp;";
         }
     }
     if ($singlepane_view == 'true') {
         $returnset = "&return_module={$this_module}&return_action=DetailView&return_id={$id}";
     } else {
         $returnset = "&return_module={$this_module}&return_action=CallRelatedList&return_id={$id}";
     }
     $userNameSql = getSqlForNameInDisplayFormat(array('first_name' => 'vtiger_users.first_name', 'last_name' => 'vtiger_users.last_name'), 'Users');
     $query = "SELECT case when (vtiger_users.user_name not like '') then {$userNameSql} else vtiger_groups.groupname end as user_name,\n\t\t\t\tvtiger_crmentity.*, vtiger_project.*, vtiger_projectcf.*\n\t\t\t\tFROM vtiger_project\n\t\t\t\tINNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid = vtiger_project.projectid\n\t\t\t\tLEFT JOIN vtiger_projectcf ON vtiger_projectcf.projectid = vtiger_project.projectid\n\t\t\t\tLEFT JOIN vtiger_ossmailview_project ON vtiger_ossmailview_project.crmid = vtiger_project.projectid\n\t\t\t\tLEFT JOIN vtiger_users ON vtiger_users.id = vtiger_crmentity.smownerid\n\t\t\t\tLEFT JOIN vtiger_groups ON vtiger_groups.groupid = vtiger_crmentity.smownerid\n\t\t\t\tWHERE vtiger_crmentity.deleted = 0 AND vtiger_ossmailview_project.ossmailviewid = '{$id}'";
     $return_value = GetRelatedList($this_module, $related_module, $other, $query, $button, $returnset);
     if ($return_value == null) {
         $return_value = array();
     }
     $return_value['CUSTOM_BUTTON'] = $button;
     return $return_value;
 }
Пример #15
0
function com_vtGetModules($adb)
{
    $sql = "select distinct vtiger_field.tabid, name\n\t\tfrom vtiger_field\n\t\tinner join vtiger_tab\n\t\t\ton vtiger_field.tabid=vtiger_tab.tabid\n\t\twhere vtiger_field.tabid not in(9,10,16,15,29) and vtiger_tab.presence = 0 and vtiger_tab.isentitytype=1";
    $it = new SqlResultIterator($adb, $adb->query($sql));
    $modules = array();
    foreach ($it as $row) {
        if (isPermitted($row->name, 'index') == "yes") {
            $modules[$row->name] = getTranslatedString($row->name);
        }
    }
    return $modules;
}
Пример #16
0
if (isPermitted($module, "EditView", $_REQUEST['record']) == 'yes') {
    $smarty->assign("EDIT", "permitted");
    $smarty->assign("EDIT_PERMISSION", "yes");
} else {
    $smarty->assign("EDIT_PERMISSION", "no");
}
$check_button = Button_Check($module);
$smarty->assign("CHECK", $check_button);
if (isPermitted($module, "Create", $_REQUEST['record']) == 'yes') {
    $smarty->assign("EDIT_DUPLICATE", "permitted");
}
if (isPermitted($module, "Delete", $_REQUEST['record']) == 'yes') {
    $smarty->assign("DELETE", "permitted");
}
if ((!isset($is_disable_approve) || isset($is_disable_approve) && !$is_disable_approve) && (isset($module_enable_approve) && $module_enable_approve)) {
    if (isPermitted($module, "Approve") == 'yes') {
        $smarty->assign("APPROVE", "permitted");
    }
    $smarty->assign("APPROVE_STATUS", $focus->column_fields['approved']);
    if ($focus->column_fields['approved'] == 1) {
        $smarty->assign("ANTI_RECORD_STATUS", "");
        $smarty->assign("APPROVE_RECORD_STATUS", "disabled");
        if (is_admin($current_user)) {
            $smarty->assign("APPROVE", "permitted");
        }
    } else {
        $smarty->assign("APPROVE_RECORD_STATUS", "");
        $smarty->assign("ANTI_RECORD_STATUS", "disabled");
    }
} else {
    //$smarty->assign("APPROVE_STATUS",0);
Пример #17
0
function CheckLeadViewPerm($user_name)
{
    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("Leads", "EditView") == "yes") {
        return "allowed";
    } else {
        return "denied";
    }
}
Пример #18
0
 /**
  * param $user_id - The id of the user to retrive the history for
  * param $module_name - Filter the history to only return records from the specified module.  If not specified all records are returned
  * return - return the array of result set rows from the query.  All of the vtiger_table vtiger_fields are included
  * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
  * All Rights Reserved.
  * Contributor(s): ______________________________________..
  */
 function get_recently_viewed($user_id, $module_name = "")
 {
     if (empty($user_id)) {
         return;
     }
     //        $query = "SELECT * from $this->table_name WHERE user_id='$user_id' ORDER BY id DESC";
     $query = "SELECT * from {$this->table_name} inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_tracker.item_id WHERE user_id=? and vtiger_crmentity.deleted=0 ORDER BY id DESC";
     $this->log->debug("About to retrieve list: {$query}");
     $result = $this->db->pquery($query, array($user_id), true);
     $list = array();
     while ($row = $this->db->fetchByAssoc($result, -1, false)) {
         //echo "while loppp";
         //echo '<BR>';
         // If the module was not specified or the module matches the module of the row, add the row to the list
         if ($module_name == "" || $row[module_name] == $module_name) {
             //Adding Security check
             require_once 'include/utils/utils.php';
             require_once 'include/utils/UserInfoUtil.php';
             $entity_id = $row['item_id'];
             $module = $row['module_name'];
             //echo "module is ".$module."  id is      ".$entity_id;
             //echo '<BR>';
             if ($module == "Users") {
                 $current_user = vglobal('current_user');
                 if (is_admin($current_user)) {
                     $per = 'yes';
                 }
             } else {
                 $per = isPermitted($module, 'DetailView', $entity_id);
             }
             if ($per == 'yes') {
                 $list[] = $row;
             }
         }
     }
     return $list;
 }
Пример #19
0
        if ($status_row["is_default"] == "1") {
            $is_default = '<img src="themes/images/yes.gif" alt="yes" />';
            $defaultButton = $mod_strings["LBL_UNSETASDEFAULT"];
        } else {
            $is_default = '<img src="themes/images/no.gif" alt="no" />';
            $defaultButton = $mod_strings["LBL_SETASDEFAULT"];
        }
    } else {
        $is_active = $app_strings["Active"];
        $is_default = '<img src="themes/images/no.gif" alt="no" />';
        $activateButton = $mod_strings["LBL_SETASINACTIVE"];
        $defaultButton = $mod_strings["LBL_SETASDEFAULT"];
    }
    $smarty->assign("IS_ACTIVE", $is_active);
    $smarty->assign("IS_DEFAULT", $is_default);
    $smarty->assign("ACTIVATE_BUTTON", $activateButton);
    $smarty->assign("DEFAULT_BUTTON", $defaultButton);
}
//PDF MARGIN SETTINGS
$Margins = array("top" => $pdftemplateResult["margin_top"], "bottom" => $pdftemplateResult["margin_bottom"], "left" => $pdftemplateResult["margin_left"], "right" => $pdftemplateResult["margin_right"]);
$smarty->assign("MARGINS", $Margins);
include_once "version.php";
$smarty->assign("VERSION", $version);
if (isPermitted($currentModule, "EditView") == 'yes') {
    $smarty->assign("EDIT", "permitted");
    $smarty->assign("EXPORT", "yes");
    $smarty->assign("IMPORT", "yes");
}
$category = getParentTab();
$smarty->assign("CATEGORY", $category);
$smarty->display("modules/PDFMaker/DetailViewPDFTemplate.tpl");
Пример #20
0
 /**
  *
  */
 private function getDefaultDetails($dfid, $calCnt)
 {
     global $adb;
     $qry = "select * from vtiger_homedefault where stuffid=?";
     $result = $adb->pquery($qry, array($dfid));
     $maxval = $adb->query_result($result, 0, "maxentries");
     $hometype = $adb->query_result($result, 0, "hometype");
     if ($hometype == "ALVT" && vtlib_isModuleActive("Accounts")) {
         include_once "modules/Accounts/ListViewTop.php";
         $home_values = getTopAccounts($maxval, $calCnt);
     } elseif ($hometype == "PLVT" && vtlib_isModuleActive("Potentials")) {
         if (isPermitted('Potentials', 'index') == "yes") {
             include_once "modules/Potentials/ListViewTop.php";
             $home_values = getTopPotentials($maxval, $calCnt);
         }
     } elseif ($hometype == "QLTQ" && vtlib_isModuleActive("Quotes")) {
         if (isPermitted('Quotes', 'index') == "yes") {
             require_once 'modules/Quotes/ListTopQuotes.php';
             $home_values = getTopQuotes($maxval, $calCnt);
         }
     } elseif ($hometype == "HLT" && vtlib_isModuleActive("HelpDesk")) {
         if (isPermitted('HelpDesk', 'index') == "yes") {
             require_once 'modules/HelpDesk/ListTickets.php';
             $home_values = getMyTickets($maxval, $calCnt);
         }
     } elseif ($hometype == "GRT") {
         $home_values = getGroupTaskLists($maxval, $calCnt);
     } elseif ($hometype == "OLTSO" && vtlib_isModuleActive("SalesOrder")) {
         if (isPermitted('SalesOrder', 'index') == "yes") {
             require_once 'modules/SalesOrder/ListTopSalesOrder.php';
             $home_values = getTopSalesOrder($maxval, $calCnt);
         }
     } elseif ($hometype == "ILTI" && vtlib_isModuleActive("Invoice")) {
         if (isPermitted('Invoice', 'index') == "yes") {
             require_once 'modules/Invoice/ListTopInvoice.php';
             $home_values = getTopInvoice($maxval, $calCnt);
         }
     } elseif ($hometype == "MNL" && vtlib_isModuleActive("Leads")) {
         if (isPermitted('Leads', 'index') == "yes") {
             include_once "modules/Leads/ListViewTop.php";
             $home_values = getNewLeads($maxval, $calCnt);
         }
     } elseif ($hometype == "OLTPO" && vtlib_isModuleActive("PurchaseOrder")) {
         if (isPermitted('PurchaseOrder', 'index') == "yes") {
             require_once 'modules/PurchaseOrder/ListTopPurchaseOrder.php';
             $home_values = getTopPurchaseOrder($maxval, $calCnt);
         }
     } elseif ($hometype == "LTFAQ" && vtlib_isModuleActive("Faq")) {
         if (isPermitted('Faq', 'index') == "yes") {
             require_once 'modules/Faq/ListFaq.php';
             $home_values = getMyFaq($maxval, $calCnt);
         }
     } elseif ($hometype == "CVLVT") {
         include_once "modules/CustomView/ListViewTop.php";
         $home_values = getKeyMetrics($maxval, $calCnt);
     } elseif ($hometype == 'UA' && vtlib_isModuleActive("Calendar")) {
         require_once "modules/Home/HomeUtils.php";
         $home_values = homepage_getUpcomingActivities($maxval, $calCnt);
     } elseif ($hometype == 'PA' && vtlib_isModuleActive("Calendar")) {
         require_once "modules/Home/HomeUtils.php";
         $home_values = homepage_getPendingActivities($maxval, $calCnt);
     }
     if ($calCnt == 'calculateCnt') {
         return $home_values;
     }
     $return_value = array();
     if (count($home_values) > 0) {
         $return_value = array('Maxentries' => $maxval, 'Details' => $home_values);
     }
     return $return_value;
 }
Пример #21
0
 /**	function used to get the list of activities which are related to the Quotes
  *	@param int $id - quote id
  *	@return array - return an array which will be returned from the function GetRelatedList
  */
 function get_activities($id, $cur_tab_id, $rel_tab_id, $actions = false)
 {
     global $log, $singlepane_view, $currentModule, $current_user;
     $log->debug("Entering get_activities(" . $id . ") method ...");
     $this_module = $currentModule;
     $related_module = vtlib_getModuleNameById($rel_tab_id);
     require_once "modules/{$related_module}/Activity.php";
     $other = new Activity();
     vtlib_setup_modulevars($related_module, $other);
     $singular_modname = vtlib_toSingular($related_module);
     $parenttab = getParentTab();
     if ($singlepane_view == 'true') {
         $returnset = '&return_module=' . $this_module . '&return_action=DetailView&return_id=' . $id;
     } else {
         $returnset = '&return_module=' . $this_module . '&return_action=CallRelatedList&return_id=' . $id;
     }
     $button = '';
     $button .= '<input type="hidden" name="activity_mode">';
     if ($actions) {
         if (is_string($actions)) {
             $actions = explode(',', strtoupper($actions));
         }
         if (in_array('ADD', $actions) && isPermitted($related_module, 1, '') == 'yes') {
             $button .= "<input title='" . getTranslatedString('LBL_NEW') . " " . getTranslatedString('LBL_TODO', $related_module) . "' class='crmbutton small create'" . " onclick='this.form.action.value=\"EditView\";this.form.module.value=\"{$related_module}\";this.form.return_module.value=\"{$this_module}\";this.form.activity_mode.value=\"Task\";' type='submit' name='button'" . " value='" . getTranslatedString('LBL_ADD_NEW') . " " . getTranslatedString('LBL_TODO', $related_module) . "'>&nbsp;";
         }
     }
     $query = "SELECT case when (vtiger_users.user_name not like '') then vtiger_users.user_name else vtiger_groups.groupname end as user_name, vtiger_contactdetails.contactid, vtiger_contactdetails.lastname, vtiger_contactdetails.firstname, vtiger_activity.*,vtiger_seactivityrel.*,vtiger_crmentity.crmid, vtiger_crmentity.smownerid, vtiger_crmentity.modifiedtime,vtiger_recurringevents.recurringtype from vtiger_activity inner join vtiger_seactivityrel on vtiger_seactivityrel.activityid=vtiger_activity.activityid inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_activity.activityid left join vtiger_cntactivityrel on vtiger_cntactivityrel.activityid= vtiger_activity.activityid left join vtiger_contactdetails on vtiger_contactdetails.contactid = vtiger_cntactivityrel.contactid left join vtiger_users on vtiger_users.id=vtiger_crmentity.smownerid left outer join vtiger_recurringevents on vtiger_recurringevents.activityid=vtiger_activity.activityid left join vtiger_groups on vtiger_groups.groupid=vtiger_crmentity.smownerid where vtiger_seactivityrel.crmid=" . $id . " and vtiger_crmentity.deleted=0 and activitytype='Task' and (vtiger_activity.status is not NULL and vtiger_activity.status != 'Completed') and (vtiger_activity.status is not NULL and vtiger_activity.status != 'Deferred')";
     $return_value = GetRelatedList($this_module, $related_module, $other, $query, $button, $returnset);
     if ($return_value == null) {
         $return_value = array();
     }
     $return_value['CUSTOM_BUTTON'] = $button;
     $log->debug("Exiting get_activities method ...");
     return $return_value;
 }
Пример #22
0
 /**	Function to display the Services which are related to the PriceBook
  *	@param string $query - query to get the list of products which are related to the current PriceBook
  *	@param object $focus - PriceBook object which contains all the information of the current PriceBook
  *	@param string $returnset - return_module, return_action and return_id which are sequenced with & to pass to the URL which is optional
  *	return array $return_data which will be formed like array('header'=>$header,'entries'=>$entries_list) where as $header contains all the header columns and $entries_list will contain all the Service entries
  */
 function getPriceBookRelatedServices($query, $focus, $returnset = '')
 {
     global $log;
     $log->debug("Entering getPriceBookRelatedServices(" . $query . "," . get_class($focus) . "," . $returnset . ") method ...");
     global $adb;
     global $app_strings;
     global $current_language, $current_user;
     $current_module_strings = return_module_language($current_language, 'Services');
     global $list_max_entries_per_page;
     global $urlPrefix;
     global $theme;
     $pricebook_id = $_REQUEST['record'];
     $theme_path = "themes/" . $theme . "/";
     $image_path = $theme_path . "images/";
     $computeCount = $_REQUEST['withCount'];
     if (PerformancePrefs::getBoolean('LISTVIEW_COMPUTE_PAGE_COUNT', false) === true || (bool) $computeCount == true) {
         $noofrows = $adb->query_result($adb->query(mkCountQuery($query)), 0, 'count');
     } else {
         $noofrows = null;
     }
     $module = 'PriceBooks';
     $relatedmodule = 'Services';
     if (!$_SESSION['rlvs'][$module][$relatedmodule]) {
         $modObj = new ListViewSession();
         $modObj->sortby = $focus->default_order_by;
         $modObj->sorder = $focus->default_sort_order;
         $_SESSION['rlvs'][$module][$relatedmodule] = get_object_vars($modObj);
     }
     if (isset($_REQUEST['relmodule']) && $_REQUEST['relmodule'] != '' && $_REQUEST['relmodule'] == $relatedmodule) {
         $relmodule = vtlib_purify($_REQUEST['relmodule']);
         if ($_SESSION['rlvs'][$module][$relmodule]) {
             setSessionVar($_SESSION['rlvs'][$module][$relmodule], $noofrows, $list_max_entries_per_page, $module, $relmodule);
         }
     }
     global $relationId;
     $start = RelatedListViewSession::getRequestCurrentPage($relationId, $query);
     $navigation_array = VT_getSimpleNavigationValues($start, $list_max_entries_per_page, $noofrows);
     $limit_start_rec = ($start - 1) * $list_max_entries_per_page;
     if ($adb->dbType == "pgsql") {
         $list_result = $adb->pquery($query . " OFFSET {$limit_start_rec} LIMIT {$list_max_entries_per_page}", array());
     } else {
         $list_result = $adb->pquery($query . " LIMIT {$limit_start_rec}, {$list_max_entries_per_page}", array());
     }
     $header = array();
     $header[] = $current_module_strings['LBL_LIST_SERVICE_NAME'];
     if (getFieldVisibilityPermission('Services', $current_user->id, 'unit_price') == '0') {
         $header[] = $current_module_strings['LBL_SERVICE_UNIT_PRICE'];
     }
     $header[] = $current_module_strings['LBL_PB_LIST_PRICE'];
     if (isPermitted("PriceBooks", "EditView", "") == 'yes' || isPermitted("PriceBooks", "Delete", "") == 'yes') {
         $header[] = $app_strings['LBL_ACTION'];
     }
     $currency_id = $focus->column_fields['currency_id'];
     $numRows = $adb->num_rows($list_result);
     for ($i = 0; $i < $numRows; $i++) {
         $entity_id = $adb->query_result($list_result, $i, "crmid");
         $unit_price = $adb->query_result($list_result, $i, "unit_price");
         if ($currency_id != null) {
             $prod_prices = getPricesForProducts($currency_id, array($entity_id), 'Services');
             $unit_price = $prod_prices[$entity_id];
         }
         $listprice = $adb->query_result($list_result, $i, "listprice");
         $field_name = $entity_id . "_listprice";
         $entries = array();
         $entries[] = textlength_check($adb->query_result($list_result, $i, "servicename"));
         if (getFieldVisibilityPermission('Services', $current_user->id, 'unit_price') == '0') {
             $entries[] = CurrencyField::convertToUserFormat($unit_price, null, true);
         }
         $entries[] = CurrencyField::convertToUserFormat($listprice, null, true);
         $action = "";
         if (isPermitted("PriceBooks", "EditView", "") == 'yes' && isPermitted('Services', 'EditView', $entity_id) == 'yes') {
             $action .= '<img style="cursor:pointer;" src="themes/images/editfield.gif" border="0" onClick="fnvshobj(this,\'editlistprice\'),editProductListPrice(\'' . $entity_id . '\',\'' . $pricebook_id . '\',\'' . $listprice . '\')" alt="' . $app_strings["LBL_EDIT_BUTTON"] . '" title="' . $app_strings["LBL_EDIT_BUTTON"] . '"/>';
         } else {
             $action .= '<img src="' . vtiger_imageurl('blank.gif', $theme) . '" border="0" />';
         }
         if (isPermitted("PriceBooks", "Delete", "") == 'yes' && isPermitted('Services', 'Delete', $entity_id) == 'yes') {
             if ($action != "") {
                 $action .= '&nbsp;|&nbsp;';
             }
             $action .= '<img src="themes/images/delete.gif" onclick="if(confirm(\'' . $app_strings['ARE_YOU_SURE'] . '\')) deletePriceBookProductRel(' . $entity_id . ',' . $pricebook_id . ');" alt="' . $app_strings["LBL_DELETE"] . '" title="' . $app_strings["LBL_DELETE"] . '" style="cursor:pointer;" border="0">';
         }
         if ($action != "") {
             $entries[] = $action;
         }
         $entries_list[] = $entries;
     }
     $navigationOutput[] = getRecordRangeMessage($list_result, $limit_start_rec, $noofrows);
     $navigationOutput[] = getRelatedTableHeaderNavigation($navigation_array, '', $module, $relatedmodule, $focus->id);
     $return_data = array('header' => $header, 'entries' => $entries_list, 'navigation' => $navigationOutput);
     $log->debug("Exiting getPriceBookRelatedServices method ...");
     return $return_data;
 }
Пример #23
0
}
$smarty->assign("MODULE", $currentModule);
$smarty->assign("CONVERTMODE", 'sotoinvoice');
//Get the associated Products and then display above Terms and Conditions
$smarty->assign("ASSOCIATED_PRODUCTS", getDetailAssociatedProducts('SalesOrder', $focus));
$tabid = getTabid("SalesOrder");
$validationData = getDBValidationData($focus->tab_name, $tabid);
$data = split_validationdataArray($validationData);
$smarty->assign("VALIDATION_DATA_FIELDNAME", $data['fieldname']);
$smarty->assign("VALIDATION_DATA_FIELDDATATYPE", $data['datatype']);
$smarty->assign("VALIDATION_DATA_FIELDLABEL", $data['fieldlabel']);
$smarty->assign("TODO_PERMISSION", CheckFieldPermission('parent_id', 'Calendar'));
$smarty->assign("EVENT_PERMISSION", CheckFieldPermission('parent_id', 'Events'));
$check_button = Button_Check($module);
$smarty->assign("CHECK", $check_button);
$smarty->assign("EDIT_PERMISSION", isPermitted($currentModule, 'EditView', $_REQUEST['record']));
$smarty->assign("IS_REL_LIST", isPresentRelatedLists($currentModule));
if ($singlepane_view == 'true') {
    $related_array = getRelatedLists($currentModule, $focus);
    $smarty->assign("RELATEDLISTS", $related_array);
    require_once 'include/ListView/RelatedListViewSession.php';
    if (!empty($_REQUEST['selected_header']) && !empty($_REQUEST['relation_id'])) {
        RelatedListViewSession::addRelatedModuleToSession(vtlib_purify($_REQUEST['relation_id']), vtlib_purify($_REQUEST['selected_header']));
    }
    $open_related_modules = RelatedListViewSession::getRelatedModulesFromSession();
    $smarty->assign("SELECTEDHEADERS", $open_related_modules);
}
$smarty->assign("SinglePane_View", $singlepane_view);
if (PerformancePrefs::getBoolean('DETAILVIEW_RECORD_NAVIGATION', true) && isset($_SESSION[$currentModule . '_listquery'])) {
    $recordNavigationInfo = ListViewSession::getListViewNavigation($focus->id);
    VT_detailViewNavigation($smarty, $recordNavigationInfo, $focus->id);
    $entity_id = $new_prod_array[$i];
    $list_body .= '<tr class="lvtColData" onmouseover="this.className=\'lvtColDataHover\'" onmouseout="this.className=\'lvtColData\'" bgcolor="white">';
    $unit_price = $prod_price_list[$entity_id];
    $field_name = $entity_id . "_listprice";
    $unit_price_array[] = '"' . CurrencyField::convertToUserFormat($unit_price, null, true) . '"';
    $field_name_array[] = "'" . $field_name . "'";
    $list_body .= '<td><INPUT type=checkbox NAME="selected_id" id="check_' . $entity_id . '" value= ' . $entity_id . ' onClick=\'toggleSelectAll(this.name,"selectall");updateListPriceForField("' . $field_name . '",this)\'></td>';
    $list_body .= '<td>' . $adb->query_result($list_result, $entity_id_array[$entity_id], "productname") . '</td>';
    if (getFieldVisibilityPermission('Products', $current_user->id, 'productcode') == '0') {
        $list_body .= '<td>' . $adb->query_result($list_result, $entity_id_array[$entity_id], "productcode") . '</td>';
    }
    if (getFieldVisibilityPermission('Products', $current_user->id, 'unit_price') == '0') {
        $list_body .= '<td>' . CurrencyField::convertToUserFormat($unit_price, null, true) . '</td>';
    }
    $list_body .= '<td>';
    if (isPermitted("PriceBooks", "EditView", "") == 'yes') {
        $list_body .= '<input type="text" name="' . $field_name . '" style="visibility:hidden;" id="' . $field_name . '">';
    } else {
        $list_body .= '<input type="text" name="' . $field_name . '" style="visibility:hidden;" readonly id="' . $field_name . '">';
    }
    $list_body .= '</td></tr>';
}
$smarty->assign("UNIT_PRICE_ARRAY", implode(",", $unit_price_array));
$smarty->assign("FIELD_NAME_ARRAY", implode(",", $field_name_array));
if ($order_by != '') {
    $url_string .= "&order_by=" . $order_by;
}
if ($sorder != '') {
    $url_string .= "&sorder=" . $sorder;
}
$smarty->assign("LISTENTITY", $list_body);
Пример #25
0
//Added to handle approving or denying status-public by the admin in CustomView
$statusdetails = $oCustomView->isPermittedChangeStatus($viewnamedesc['status']);
$smarty->assign("CUSTOMVIEW_PERMISSION", $statusdetails);
//To check if a user is able to edit/delete a customview
$edit_permit = $oCustomView->isPermittedCustomView($viewid, 'EditView', $currentModule);
$delete_permit = $oCustomView->isPermittedCustomView($viewid, 'Delete', $currentModule);
$smarty->assign("CV_EDIT_PERMIT", $edit_permit);
$smarty->assign("CV_DELETE_PERMIT", $delete_permit);
//<<<<<customview>>>>>
$smarty->assign("CHANGE_OWNER", getUserslist());
$smarty->assign("CHANGE_GROUP_OWNER", getGroupslist());
// Buttons and View options
if (isPermitted('SalesOrder', 'Delete', '') == 'yes') {
    $other_text['del'] = $app_strings[LBL_MASS_DELETE];
}
if (isPermitted('SalesOrder', 'EditView', '') == 'yes') {
    $other_text['mass_edit'] = $app_strings[LBL_MASS_EDIT];
    $other_text['c_owner'] = $app_strings[LBL_CHANGE_OWNER];
}
if ($viewnamedesc['viewname'] == 'All') {
    $smarty->assign("ALL", 'All');
}
//<<<<<<<<<customview>>>>>>>>>
if ($viewid != "0") {
    $listquery = getListQuery("SalesOrder");
    $list_query = $oCustomView->getModifiedCvListQuery($viewid, $listquery, "SalesOrder");
} else {
    $list_query = getListQuery("SalesOrder");
}
//<<<<<<<<customview>>>>>>>>>
if (isset($where) && $where != '') {
Пример #26
0
 function get_emails($id, $cur_tab_id, $rel_tab_id, $actions = false)
 {
     $log = vglobal('log');
     $current_user = vglobal('current_user');
     $singlepane_view = vglobal('singlepane_view');
     $currentModule = vglobal('currentModule');
     $log->debug("Entering get_emails(" . $id . ") method ...");
     $this_module = $currentModule;
     $related_module = vtlib_getModuleNameById($rel_tab_id);
     require_once "modules/{$related_module}/{$related_module}.php";
     $other = new $related_module();
     vtlib_setup_modulevars($related_module, $other);
     $singular_modname = vtlib_toSingular($related_module);
     if ($singlepane_view == 'true') {
         $returnset = '&return_module=' . $this_module . '&return_action=DetailView&return_id=' . $id;
     } else {
         $returnset = '&return_module=' . $this_module . '&return_action=CallRelatedList&return_id=' . $id;
     }
     $button = '';
     $button .= '<input type="hidden" name="email_directing_module"><input type="hidden" name="record">';
     if ($actions) {
         if (is_string($actions)) {
             $actions = explode(',', strtoupper($actions));
         }
         if (in_array('SELECT', $actions) && isPermitted($related_module, 4, '') == 'yes') {
             $button .= "<input title='" . getTranslatedString('LBL_SELECT') . " " . getTranslatedString($related_module) . "' class='crmbutton small edit' type='button' onclick=\"return window.open('index.php?module={$related_module}&return_module={$currentModule}&action=Popup&popuptype=detailview&select=enable&form=EditView&form_submit=false&recordid={$id}','test','width=640,height=602,resizable=0,scrollbars=0');\" value='" . getTranslatedString('LBL_SELECT') . " " . getTranslatedString($related_module) . "'>&nbsp;";
         }
         if (in_array('ADD', $actions) && isPermitted($related_module, 1, '') == 'yes') {
             $button .= "<input title='" . getTranslatedString('LBL_ADD_NEW') . " " . getTranslatedString($singular_modname) . "' accessyKey='F' class='crmbutton small create' onclick='fnvshobj(this,\"sendmail_cont\");sendmail(\"{$this_module}\",{$id});' type='button' name='button' value='" . getTranslatedString('LBL_ADD_NEW') . " " . getTranslatedString($singular_modname) . "'></td>";
         }
     }
     $userNameSql = getSqlForNameInDisplayFormat(array('first_name' => 'vtiger_users.first_name', 'last_name' => 'vtiger_users.last_name'), 'Users');
     $query = "SELECT vtiger_ossmailview.*, vtiger_crmentity.modifiedtime, vtiger_crmentity.crmid, vtiger_crmentity.smownerid, case when (vtiger_users.user_name not like '') then {$userNameSql} else vtiger_groups.groupname end as user_name FROM vtiger_ossmailview \n\t\t\tINNER JOIN vtiger_ossmailview_relation ON vtiger_ossmailview_relation.ossmailviewid = vtiger_ossmailview.ossmailviewid\n\t\t\tINNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid = vtiger_ossmailview.ossmailviewid \n\t\t\tLEFT JOIN vtiger_groups ON vtiger_groups.groupid=vtiger_crmentity.smownerid \n\t\t\tLEFT JOIN vtiger_users ON vtiger_crmentity.smownerid = vtiger_users.id\n\t\t\tWHERE vtiger_crmentity.deleted = 0 AND vtiger_ossmailview_relation.crmid = " . $id . " ";
     $return_value = GetRelatedList($this_module, $related_module, $other, $query, $button, $returnset);
     if ($return_value == null) {
         $return_value = array();
     }
     $return_value['CUSTOM_BUTTON'] = $button;
     $log->debug("Exiting get_emails method ...");
     return $return_value;
 }
Пример #27
0
 /**
  * Function to get Activity related Contacts
  * @param  integer   $id      - activityid
  * returns related Contacts record in array format
  */
 function get_contacts($id, $cur_tab_id, $rel_tab_id, $actions = false)
 {
     global $log, $singlepane_view, $currentModule, $current_user;
     $log->debug("Entering get_contacts(" . $id . ") method ...");
     $this_module = $currentModule;
     $related_module = vtlib_getModuleNameById($rel_tab_id);
     require_once "modules/{$related_module}/{$related_module}.php";
     $other = new $related_module();
     vtlib_setup_modulevars($related_module, $other);
     $singular_modname = vtlib_toSingular($related_module);
     $parenttab = getParentTab();
     $returnset = '&return_module=' . $this_module . '&return_action=DetailView&activity_mode=Events&return_id=' . $id;
     $search_string = '';
     $button = '';
     if ($actions) {
         if (is_string($actions)) {
             $actions = explode(',', strtoupper($actions));
         }
         if (in_array('SELECT', $actions) && isPermitted($related_module, 4, '') == 'yes') {
             $button .= "<input title='" . getTranslatedString('LBL_SELECT') . " " . getTranslatedString($related_module) . "' class='crmbutton small edit' type='button' onclick=\"return window.open('index.php?module={$related_module}&return_module={$currentModule}&action=Popup&popuptype=detailview&select=enable&form=EditView&form_submit=false&recordid={$id}&parenttab={$parenttab}{$search_string}','test','width=640,height=602,resizable=0,scrollbars=0');\" value='" . getTranslatedString('LBL_SELECT') . " " . getTranslatedString($related_module) . "'>&nbsp;";
         }
     }
     $query = 'select vtiger_users.user_name,vtiger_contactdetails.accountid,vtiger_contactdetails.contactid, vtiger_contactdetails.firstname,vtiger_contactdetails.lastname, vtiger_contactdetails.department, vtiger_contactdetails.title, vtiger_contactdetails.email, vtiger_contactdetails.phone, vtiger_crmentity.crmid, vtiger_crmentity.smownerid, vtiger_crmentity.modifiedtime from vtiger_contactdetails inner join vtiger_cntactivityrel on vtiger_cntactivityrel.contactid=vtiger_contactdetails.contactid inner join vtiger_crmentity on vtiger_crmentity.crmid = vtiger_contactdetails.contactid left join vtiger_users on vtiger_users.id = vtiger_crmentity.smownerid left join vtiger_groups on vtiger_groups.groupid = vtiger_crmentity.smownerid where vtiger_cntactivityrel.activityid=' . $id . ' and vtiger_crmentity.deleted=0';
     $return_value = GetRelatedList($this_module, $related_module, $other, $query, $button, $returnset);
     if ($return_value == null) {
         $return_value = array();
     }
     $return_value['CUSTOM_BUTTON'] = $button;
     $log->debug("Exiting get_contacts method ...");
     return $return_value;
 }
    function content_56755f20e4998($_smarty_tpl)
    {
        ?>

<div style='padding:5px;'>
<?php 
        if ($_smarty_tpl->tpl_vars['HISTORIES']->value != false) {
            ?>
	<?php 
            $_smarty_tpl->tpl_vars['HISTORY'] = new Smarty_Variable();
            $_smarty_tpl->tpl_vars['HISTORY']->_loop = false;
            $_smarty_tpl->tpl_vars[$_smarty_tpl->tpl_vars['index']->value] = new Smarty_Variable();
            $_from = $_smarty_tpl->tpl_vars['HISTORIES']->value;
            if (!is_array($_from) && !is_object($_from)) {
                settype($_from, 'array');
            }
            foreach ($_from as $_smarty_tpl->tpl_vars['HISTORY']->key => $_smarty_tpl->tpl_vars['HISTORY']->value) {
                $_smarty_tpl->tpl_vars['HISTORY']->_loop = true;
                $_smarty_tpl->tpl_vars[$_smarty_tpl->tpl_vars['index']->value]->value = $_smarty_tpl->tpl_vars['HISTORY']->key;
                ?>
		<?php 
                $_smarty_tpl->tpl_vars['MODELNAME'] = new Smarty_variable(get_class($_smarty_tpl->tpl_vars['HISTORY']->value), null, 0);
                ?>
		<?php 
                if ($_smarty_tpl->tpl_vars['MODELNAME']->value == 'ModTracker_Record_Model') {
                    ?>
			<?php 
                    $_smarty_tpl->tpl_vars['USER'] = new Smarty_variable($_smarty_tpl->tpl_vars['HISTORY']->value->getModifiedBy(), null, 0);
                    ?>
			<?php 
                    $_smarty_tpl->tpl_vars['TIME'] = new Smarty_variable($_smarty_tpl->tpl_vars['HISTORY']->value->getActivityTime(), null, 0);
                    ?>
			<?php 
                    $_smarty_tpl->tpl_vars['PARENT'] = new Smarty_variable($_smarty_tpl->tpl_vars['HISTORY']->value->getParent(), null, 0);
                    ?>
			<?php 
                    $_smarty_tpl->tpl_vars['MOD_NAME'] = new Smarty_variable($_smarty_tpl->tpl_vars['HISTORY']->value->getParent()->getModule()->getName(), null, 0);
                    ?>
			<?php 
                    $_smarty_tpl->tpl_vars['SINGLE_MODULE_NAME'] = new Smarty_variable('SINGLE_' . $_smarty_tpl->tpl_vars['MOD_NAME']->value, null, 0);
                    ?>
			<?php 
                    $_smarty_tpl->tpl_vars['TRANSLATED_MODULE_NAME'] = new Smarty_variable(vtranslate($_smarty_tpl->tpl_vars['SINGLE_MODULE_NAME']->value, $_smarty_tpl->tpl_vars['MOD_NAME']->value), null, 0);
                    ?>
			<?php 
                    $_smarty_tpl->tpl_vars['PROCEED'] = new Smarty_variable(true, null, 0);
                    ?>
			<?php 
                    if ($_smarty_tpl->tpl_vars['HISTORY']->value->isRelationLink() || $_smarty_tpl->tpl_vars['HISTORY']->value->isRelationUnLink()) {
                        ?>
				<?php 
                        $_smarty_tpl->tpl_vars['RELATION'] = new Smarty_variable($_smarty_tpl->tpl_vars['HISTORY']->value->getRelationInstance(), null, 0);
                        ?>
				<?php 
                        if (!$_smarty_tpl->tpl_vars['RELATION']->value->getLinkedRecord()) {
                            ?>
					<?php 
                            $_smarty_tpl->tpl_vars['PROCEED'] = new Smarty_variable(false, null, 0);
                            ?>
				<?php 
                        }
                        ?>
			<?php 
                    }
                    ?>
			<?php 
                    if ($_smarty_tpl->tpl_vars['PROCEED']->value) {
                        ?>
				<div class="row-fluid">
					<div class='span1'>
						<img width='24px' src="<?php 
                        echo vimage_path($_smarty_tpl->tpl_vars['MOD_NAME']->value . '.png');
                        ?>
" alt="<?php 
                        echo $_smarty_tpl->tpl_vars['TRANSLATED_MODULE_NAME']->value;
                        ?>
" title="<?php 
                        echo $_smarty_tpl->tpl_vars['TRANSLATED_MODULE_NAME']->value;
                        ?>
" />&nbsp;&nbsp;
					</div>
					<div class="span11">
					<p class="pull-right muted" style="padding-right:5px;"><small title="<?php 
                        echo Vtiger_Util_Helper::formatDateTimeIntoDayString($_smarty_tpl->tpl_vars['TIME']->value);
                        ?>
"><?php 
                        echo Vtiger_Util_Helper::formatDateDiffInStrings($_smarty_tpl->tpl_vars['TIME']->value);
                        ?>
</small></p>
					<?php 
                        $_smarty_tpl->tpl_vars['DETAILVIEW_URL'] = new Smarty_variable($_smarty_tpl->tpl_vars['PARENT']->value->getDetailViewUrl(), null, 0);
                        ?>
					<?php 
                        if ($_smarty_tpl->tpl_vars['HISTORY']->value->isUpdate()) {
                            ?>
						<?php 
                            $_smarty_tpl->tpl_vars['FIELDS'] = new Smarty_variable($_smarty_tpl->tpl_vars['HISTORY']->value->getFieldInstances(), null, 0);
                            ?>
						<div class="">
							<div><b><?php 
                            echo $_smarty_tpl->tpl_vars['USER']->value->getName();
                            ?>
</b> <?php 
                            echo vtranslate('LBL_UPDATED');
                            ?>
 <a class="cursorPointer" <?php 
                            if (stripos($_smarty_tpl->tpl_vars['DETAILVIEW_URL']->value, 'javascript:') === 0) {
                                ?>
								onclick='<?php 
                                echo substr($_smarty_tpl->tpl_vars['DETAILVIEW_URL']->value, strlen("javascript:"));
                                ?>
' <?php 
                            } else {
                                ?>
 onclick='window.location.href="<?php 
                                echo $_smarty_tpl->tpl_vars['DETAILVIEW_URL']->value;
                                ?>
"' <?php 
                            }
                            ?>
>
								<?php 
                            echo $_smarty_tpl->tpl_vars['PARENT']->value->getName();
                            ?>
</a>
							</div>
							<?php 
                            $_smarty_tpl->tpl_vars['FIELD'] = new Smarty_Variable();
                            $_smarty_tpl->tpl_vars['FIELD']->_loop = false;
                            $_smarty_tpl->tpl_vars['INDEX'] = new Smarty_Variable();
                            $_from = $_smarty_tpl->tpl_vars['FIELDS']->value;
                            if (!is_array($_from) && !is_object($_from)) {
                                settype($_from, 'array');
                            }
                            foreach ($_from as $_smarty_tpl->tpl_vars['FIELD']->key => $_smarty_tpl->tpl_vars['FIELD']->value) {
                                $_smarty_tpl->tpl_vars['FIELD']->_loop = true;
                                $_smarty_tpl->tpl_vars['INDEX']->value = $_smarty_tpl->tpl_vars['FIELD']->key;
                                ?>
							<?php 
                                if ($_smarty_tpl->tpl_vars['INDEX']->value < 2) {
                                    ?>
								<?php 
                                    if ($_smarty_tpl->tpl_vars['FIELD']->value && $_smarty_tpl->tpl_vars['FIELD']->value->getFieldInstance() && $_smarty_tpl->tpl_vars['FIELD']->value->getFieldInstance()->isViewableInDetailView()) {
                                        ?>
								<div class='font-x-small'>
									<i><?php 
                                        echo vtranslate($_smarty_tpl->tpl_vars['FIELD']->value->getName(), $_smarty_tpl->tpl_vars['FIELD']->value->getModuleName());
                                        ?>
</i>
									<?php 
                                        if ($_smarty_tpl->tpl_vars['FIELD']->value->get('prevalue') != '' && $_smarty_tpl->tpl_vars['FIELD']->value->get('postvalue') != '' && !($_smarty_tpl->tpl_vars['FIELD']->value->getFieldInstance()->getFieldDataType() == 'reference' && ($_smarty_tpl->tpl_vars['FIELD']->value->get('postvalue') == '0' || $_smarty_tpl->tpl_vars['FIELD']->value->get('prevalue') == '0'))) {
                                            ?>
										&nbsp;<?php 
                                            echo vtranslate('LBL_FROM');
                                            ?>
 <b><?php 
                                            echo Vtiger_Util_Helper::toVtiger6SafeHTML($_smarty_tpl->tpl_vars['FIELD']->value->getDisplayValue(decode_html($_smarty_tpl->tpl_vars['FIELD']->value->get('prevalue'))));
                                            ?>
</b>
									<?php 
                                        } elseif ($_smarty_tpl->tpl_vars['FIELD']->value->get('postvalue') == '' || $_smarty_tpl->tpl_vars['FIELD']->value->getFieldInstance()->getFieldDataType() == 'reference' && $_smarty_tpl->tpl_vars['FIELD']->value->get('postvalue') == '0') {
                                            ?>
	                                    &nbsp; <b> <?php 
                                            echo vtranslate('LBL_DELETED');
                                            ?>
 </b> ( <del><?php 
                                            echo Vtiger_Util_Helper::toVtiger6SafeHTML($_smarty_tpl->tpl_vars['FIELD']->value->getDisplayValue(decode_html($_smarty_tpl->tpl_vars['FIELD']->value->get('prevalue'))));
                                            ?>
</del> )
	                                <?php 
                                        } else {
                                            ?>
										&nbsp;<?php 
                                            echo vtranslate('LBL_CHANGED');
                                            ?>

									<?php 
                                        }
                                        ?>
	                                <?php 
                                        if ($_smarty_tpl->tpl_vars['FIELD']->value->get('postvalue') != '' && !($_smarty_tpl->tpl_vars['FIELD']->value->getFieldInstance()->getFieldDataType() == 'reference' && $_smarty_tpl->tpl_vars['FIELD']->value->get('postvalue') == '0')) {
                                            ?>
										<?php 
                                            echo vtranslate('LBL_TO');
                                            ?>
 <b><?php 
                                            echo Vtiger_Util_Helper::toVtiger6SafeHTML($_smarty_tpl->tpl_vars['FIELD']->value->getDisplayValue(decode_html($_smarty_tpl->tpl_vars['FIELD']->value->get('postvalue'))));
                                            ?>
</b>
	                                <?php 
                                        }
                                        ?>
    
								</div>
								<?php 
                                    }
                                    ?>
							<?php 
                                } else {
                                    ?>
								<a href="<?php 
                                    echo $_smarty_tpl->tpl_vars['PARENT']->value->getUpdatesUrl();
                                    ?>
"><?php 
                                    echo vtranslate('LBL_MORE');
                                    ?>
</a>
								<?php 
                                    break 1;
                                    ?>
							<?php 
                                }
                                ?>
							<?php 
                            }
                            ?>
						</div>
					<?php 
                        } elseif ($_smarty_tpl->tpl_vars['HISTORY']->value->isCreate()) {
                            ?>
						<div class=''  style='margin-top:5px'>
							<b><?php 
                            echo $_smarty_tpl->tpl_vars['USER']->value->getName();
                            ?>
</b> <?php 
                            echo vtranslate('LBL_ADDED');
                            ?>
 <a class="cursorPointer" <?php 
                            if (stripos($_smarty_tpl->tpl_vars['DETAILVIEW_URL']->value, 'javascript:') === 0) {
                                ?>
								onclick='<?php 
                                echo substr($_smarty_tpl->tpl_vars['DETAILVIEW_URL']->value, strlen("javascript:"));
                                ?>
' <?php 
                            } else {
                                ?>
 onclick='window.location.href="<?php 
                                echo $_smarty_tpl->tpl_vars['DETAILVIEW_URL']->value;
                                ?>
"' <?php 
                            }
                            ?>
>
								<?php 
                            echo $_smarty_tpl->tpl_vars['PARENT']->value->getName();
                            ?>
</a>
						</div>
					<?php 
                        } elseif ($_smarty_tpl->tpl_vars['HISTORY']->value->isRelationLink() || $_smarty_tpl->tpl_vars['HISTORY']->value->isRelationUnLink()) {
                            ?>
	
	
	
	
	
	
	
	
	
	
	
	
						<?php 
                            $_smarty_tpl->tpl_vars['RELATION'] = new Smarty_variable($_smarty_tpl->tpl_vars['HISTORY']->value->getRelationInstance(), null, 0);
                            ?>
						<?php 
                            $_smarty_tpl->tpl_vars['LINKED_RECORD_DETAIL_URL'] = new Smarty_variable($_smarty_tpl->tpl_vars['RELATION']->value->getLinkedRecord()->getDetailViewUrl(), null, 0);
                            ?>
						<?php 
                            $_smarty_tpl->tpl_vars['PARENT_DETAIL_URL'] = new Smarty_variable($_smarty_tpl->tpl_vars['RELATION']->value->getParent()->getParent()->getDetailViewUrl(), null, 0);
                            ?>
						<div class='' style='margin-top:5px'>
							<b><?php 
                            echo $_smarty_tpl->tpl_vars['USER']->value->getName();
                            ?>
</b>
								<?php 
                            if ($_smarty_tpl->tpl_vars['HISTORY']->value->isRelationLink()) {
                                ?>
									<?php 
                                echo vtranslate('LBL_ADDED', $_smarty_tpl->tpl_vars['MODULE_NAME']->value);
                                ?>

								<?php 
                            } else {
                                ?>
									<?php 
                                echo vtranslate('LBL_REMOVED', $_smarty_tpl->tpl_vars['MODULE_NAME']->value);
                                ?>

								<?php 
                            }
                            ?>
								<?php 
                            if ($_smarty_tpl->tpl_vars['RELATION']->value->getLinkedRecord()->getModuleName() == 'Calendar') {
                                ?>
									<?php 
                                if (isPermitted('Calendar', 'DetailView', $_smarty_tpl->tpl_vars['RELATION']->value->getLinkedRecord()->getId()) == 'yes') {
                                    ?>
										<a class="cursorPointer" <?php 
                                    if (stripos($_smarty_tpl->tpl_vars['LINKED_RECORD_DETAIL_URL']->value, 'javascript:') === 0) {
                                        ?>
 onclick='<?php 
                                        echo substr($_smarty_tpl->tpl_vars['LINKED_RECORD_DETAIL_URL']->value, strlen("javascript:"));
                                        ?>
'
											<?php 
                                    } else {
                                        ?>
 onclick='window.location.href="<?php 
                                        echo $_smarty_tpl->tpl_vars['LINKED_RECORD_DETAIL_URL']->value;
                                        ?>
"' <?php 
                                    }
                                    ?>
><?php 
                                    echo $_smarty_tpl->tpl_vars['RELATION']->value->getLinkedRecord()->getName();
                                    ?>
</a>
									<?php 
                                } else {
                                    ?>
										<?php 
                                    echo vtranslate($_smarty_tpl->tpl_vars['RELATION']->value->getLinkedRecord()->getModuleName(), $_smarty_tpl->tpl_vars['RELATION']->value->getLinkedRecord()->getModuleName());
                                    ?>

									<?php 
                                }
                                ?>
								<?php 
                            } else {
                                ?>
								 <a class="cursorPointer" <?php 
                                if (stripos($_smarty_tpl->tpl_vars['LINKED_RECORD_DETAIL_URL']->value, 'javascript:') === 0) {
                                    ?>
 onclick='<?php 
                                    echo substr($_smarty_tpl->tpl_vars['LINKED_RECORD_DETAIL_URL']->value, strlen("javascript:"));
                                    ?>
'
									<?php 
                                } else {
                                    ?>
 onclick='window.location.href="<?php 
                                    echo $_smarty_tpl->tpl_vars['LINKED_RECORD_DETAIL_URL']->value;
                                    ?>
"' <?php 
                                }
                                ?>
><?php 
                                echo $_smarty_tpl->tpl_vars['RELATION']->value->getLinkedRecord()->getName();
                                ?>
</a>
								<?php 
                            }
                            echo vtranslate('LBL_FOR');
                            ?>
 <a class="cursorPointer" <?php 
                            if (stripos($_smarty_tpl->tpl_vars['PARENT_DETAIL_URL']->value, 'javascript:') === 0) {
                                ?>
								onclick='<?php 
                                echo substr($_smarty_tpl->tpl_vars['PARENT_DETAIL_URL']->value, strlen("javascript:"));
                                ?>
' <?php 
                            } else {
                                ?>
 onclick='window.location.href="<?php 
                                echo $_smarty_tpl->tpl_vars['PARENT_DETAIL_URL']->value;
                                ?>
"' <?php 
                            }
                            ?>
>
								<?php 
                            echo $_smarty_tpl->tpl_vars['RELATION']->value->getParent()->getParent()->getName();
                            ?>
</a>
						</div>
					<?php 
                        } elseif ($_smarty_tpl->tpl_vars['HISTORY']->value->isRestore()) {
                            ?>
						<div class=''  style='margin-top:5px'>
							<b><?php 
                            echo $_smarty_tpl->tpl_vars['USER']->value->getName();
                            ?>
</b> <?php 
                            echo vtranslate('LBL_RESTORED');
                            ?>
 <a class="cursorPointer" <?php 
                            if (stripos($_smarty_tpl->tpl_vars['DETAILVIEW_URL']->value, 'javascript:') === 0) {
                                ?>
								onclick='<?php 
                                echo substr($_smarty_tpl->tpl_vars['DETAILVIEW_URL']->value, strlen("javascript:"));
                                ?>
' <?php 
                            } else {
                                ?>
 onclick='window.location.href="<?php 
                                echo $_smarty_tpl->tpl_vars['DETAILVIEW_URL']->value;
                                ?>
"' <?php 
                            }
                            ?>
>
								<?php 
                            echo $_smarty_tpl->tpl_vars['PARENT']->value->getName();
                            ?>
</a>
						</div>
					<?php 
                        } elseif ($_smarty_tpl->tpl_vars['HISTORY']->value->isDelete()) {
                            ?>
						<div class=''  style='margin-top:5px'>
							<b><?php 
                            echo $_smarty_tpl->tpl_vars['USER']->value->getName();
                            ?>
</b> <?php 
                            echo vtranslate('LBL_DELETED');
                            ?>
 <a class="cursorPointer" <?php 
                            if (stripos($_smarty_tpl->tpl_vars['DETAILVIEW_URL']->value, 'javascript:') === 0) {
                                ?>
								onclick='<?php 
                                echo substr($_smarty_tpl->tpl_vars['DETAILVIEW_URL']->value, strlen("javascript:"));
                                ?>
' <?php 
                            } else {
                                ?>
 onclick='window.location.href="<?php 
                                echo $_smarty_tpl->tpl_vars['DETAILVIEW_URL']->value;
                                ?>
"' <?php 
                            }
                            ?>
>
								<?php 
                            echo $_smarty_tpl->tpl_vars['PARENT']->value->getName();
                            ?>
</a>
						</div>
					<?php 
                        }
                        ?>
					</div>
				</div>
			<?php 
                    }
                    ?>
			<?php 
                } elseif ($_smarty_tpl->tpl_vars['MODELNAME']->value == 'ModComments_Record_Model') {
                    ?>
			<div class="row-fluid">
				<div class="span1">
					<image width='24px' src="<?php 
                    echo vimage_path('Comments.png');
                    ?>
"/>&nbsp;&nbsp;
				</div>
				<div class="span11">
					<?php 
                    $_smarty_tpl->tpl_vars['COMMENT_TIME'] = new Smarty_variable($_smarty_tpl->tpl_vars['HISTORY']->value->getCommentedTime(), null, 0);
                    ?>
					<p class="pull-right muted" style="padding-right:5px;"><small title="<?php 
                    echo Vtiger_Util_Helper::formatDateTimeIntoDayString($_smarty_tpl->tpl_vars['COMMENT_TIME']->value);
                    ?>
"><?php 
                    echo Vtiger_Util_Helper::formatDateDiffInStrings($_smarty_tpl->tpl_vars['COMMENT_TIME']->value);
                    ?>
</small></p>
					<div>
						<b><?php 
                    echo $_smarty_tpl->tpl_vars['HISTORY']->value->getCommentedByModel()->getName();
                    ?>
</b> <?php 
                    echo vtranslate('LBL_COMMENTED');
                    ?>
 <?php 
                    echo vtranslate('LBL_ON');
                    ?>
 <a class="textOverflowEllipsis" href="<?php 
                    echo $_smarty_tpl->tpl_vars['HISTORY']->value->getParentRecordModel()->getDetailViewUrl();
                    ?>
"><?php 
                    echo $_smarty_tpl->tpl_vars['HISTORY']->value->getParentRecordModel()->getName();
                    ?>
</a>
					</div>
					<div class='font-x-small'><i>"<?php 
                    echo nl2br($_smarty_tpl->tpl_vars['HISTORY']->value->get('commentcontent'));
                    ?>
"</i></div>
				</div>
			</div>
		<?php 
                }
                ?>
	<?php 
            }
            ?>

	<?php 
            if ($_smarty_tpl->tpl_vars['NEXTPAGE']->value) {
                ?>
	<div class="row-fluid">
		<div class="span12">
			<a href="javascript:;" class="load-more" data-page="<?php 
                echo $_smarty_tpl->tpl_vars['PAGE']->value;
                ?>
" data-nextpage="<?php 
                echo $_smarty_tpl->tpl_vars['NEXTPAGE']->value;
                ?>
"><?php 
                echo vtranslate('LBL_MORE');
                ?>
...</a>
		</div>
	</div>
	<?php 
            }
            ?>

<?php 
        } else {
            ?>
	<span class="noDataMsg">
		<?php 
            echo vtranslate('LBL_NO_UPDATES_OR_COMMENTS', $_smarty_tpl->tpl_vars['MODULE_NAME']->value);
            ?>

	</span>
<?php 
        }
        ?>
</div>
<?php 
    }
Пример #29
0
 /**
  * Function to calculate number of reports in this folder
  * @return <Integer>
  */
 public function getReportsCount()
 {
     $db = PearDatabase::getInstance();
     $params = array();
     // To get the report ids which are permitted for the user
     $query = "SELECT reportmodulesid, primarymodule from vtiger_reportmodules";
     $result = $db->pquery($query, array());
     $noOfRows = $db->num_rows($result);
     $allowedReportIds = array();
     for ($i = 0; $i < $noOfRows; $i++) {
         $primaryModule = $db->query_result($result, $i, 'primarymodule');
         $reportid = $db->query_result($result, $i, 'reportmodulesid');
         if (isPermitted($primaryModule, 'index') == "yes") {
             $allowedReportIds[] = $reportid;
         }
     }
     //End
     $sql = "SELECT count(*) AS count FROM vtiger_report\n\t\t\t\tINNER JOIN vtiger_reportfolder ON vtiger_reportfolder.folderid = vtiger_report.folderid AND \n                vtiger_report.reportid in (" . implode(',', $allowedReportIds) . ")";
     $fldrId = $this->getId();
     if ($fldrId == 'All') {
         $fldrId = false;
     }
     // If information is required only for specific report folder?
     if ($fldrId !== false) {
         $sql .= " WHERE vtiger_reportfolder.folderid=?";
         array_push($params, $fldrId);
     }
     $currentUserModel = Users_Privileges_Model::getCurrentUserPrivilegesModel();
     if (!$currentUserModel->isAdminUser()) {
         $currentUserId = $currentUserModel->getId();
         $groupId = implode(',', $currentUserModel->get('groups'));
         if ($groupId) {
             $groupQuery = "(SELECT reportid from vtiger_reportsharing WHERE shareid IN ({$groupId}) AND setype = 'groups') OR ";
         }
         $sql .= " AND (vtiger_report.reportid IN (SELECT reportid from vtiger_reportsharing WHERE {$groupQuery} shareid = ? AND setype = 'users')\n\t\t\t\t\t\tOR vtiger_report.sharingtype = 'Public'\n\t\t\t\t\t\tOR vtiger_report.owner = ?\n\t\t\t\t\t\tOR vtiger_report.owner IN (SELECT vtiger_user2role.userid FROM vtiger_user2role\n\t\t\t\t\t\t\t\t\t\t\t\t\tINNER JOIN vtiger_users ON vtiger_users.id = vtiger_user2role.userid\n\t\t\t\t\t\t\t\t\t\t\t\t\tINNER JOIN vtiger_role ON vtiger_role.roleid = vtiger_user2role.roleid\n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE vtiger_role.parentrole LIKE ?))";
         $parentRoleSeq = $currentUserModel->get('parent_role_seq') . '::%';
         array_push($params, $currentUserId, $currentUserId, $parentRoleSeq);
     }
     $result = $db->pquery($sql, $params);
     return $db->query_result($result, 0, 'count');
 }
Пример #30
0
 /**
  * Invoked when special actions are performed on the module.
  * @param String Module name
  * @param String Event Type (module.postinstall, module.disabled, module.enabled, module.preuninstall)
  */
 function get_osstimecontrol($id, $cur_tab_id, $rel_tab_id, $actions = false)
 {
     global $log, $singlepane_view, $currentModule, $current_user;
     $log->debug("Entering get_osstimecontrol(" . $id . ") method ...");
     $this_module = $currentModule;
     $related_module = vtlib_getModuleNameById($rel_tab_id);
     require_once "modules/{$related_module}/{$related_module}.php";
     $other = new $related_module();
     vtlib_setup_modulevars($related_module, $other);
     $singular_modname = vtlib_toSingular($related_module);
     $record = Vtiger_Record_Model::getInstanceById($id);
     $userId = $record->get('assigned_user_id');
     if ($singlepane_view == 'true') {
         $returnset = '&return_module=' . $this_module . '&return_action=DetailView&return_id=' . $id;
     } else {
         $returnset = '&return_module=' . $this_module . '&return_action=CallRelatedList&return_id=' . $id;
     }
     $button = '';
     if ($actions && getFieldVisibilityPermission($related_module, $current_user->id, 'parent_id', 'readwrite') == '0') {
         if (is_string($actions)) {
             $actions = explode(',', strtoupper($actions));
         }
         if (in_array('SELECT', $actions) && isPermitted($related_module, 4, '') == 'yes') {
             $button .= "<input title='" . getTranslatedString('LBL_SELECT') . " " . getTranslatedString($related_module) . "' class='crmbutton small edit' type='button' onclick=\"return window.open('index.php?module={$related_module}&return_module={$currentModule}&action=Popup&popuptype=detailview&select=enable&form=EditView&form_submit=false&recordid={$id}','test','width=640,height=602,resizable=0,scrollbars=0');\" value='" . getTranslatedString('LBL_SELECT') . " " . getTranslatedString($related_module) . "'>&nbsp;";
         }
         if (in_array('ADD', $actions) && isPermitted($related_module, 1, '') == 'yes') {
             $button .= "<input title='" . getTranslatedString('LBL_ADD_NEW') . " " . getTranslatedString($singular_modname) . "' class='crmbutton small create'" . " onclick='this.form.action.value=\"EditView\";this.form.module.value=\"{$related_module}\"' type='submit' name='button'" . " value='" . getTranslatedString('LBL_ADD_NEW') . " " . getTranslatedString($singular_modname) . "'>&nbsp;";
         }
     }
     $userNameSql = getSqlForNameInDisplayFormat(array('first_name' => 'vtiger_users.first_name', 'last_name' => 'vtiger_users.last_name'), 'Users');
     $query = "SELECT case when (vtiger_users.user_name not like '') then {$userNameSql} else vtiger_groups.groupname end as user_name, vtiger_users.id,\n\t\t\t\tvtiger_osstimecontrol.name, vtiger_osstimecontrol.osstimecontrolid as crmid, vtiger_osstimecontrol.osstimecontrol_status, vtiger_osstimecontrol.payment,\n\t\t\t\tvtiger_osstimecontrol.osstimecontrol_no, vtiger_osstimecontrol.date_start, vtiger_osstimecontrol.due_date, vtiger_osstimecontrol.time_end, vtiger_osstimecontrol.sum_time, vtiger_crmentity.smownerid, vtiger_crmentity.modifiedtime\n\t\t\t\tFROM vtiger_osstimecontrol\n\t\t\t\tINNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid = vtiger_osstimecontrol.osstimecontrolid\n\t\t\t\tLEFT JOIN vtiger_users ON vtiger_users.id=vtiger_crmentity.smownerid\n\t\t\t\tLEFT JOIN vtiger_groups ON vtiger_groups.groupid = vtiger_crmentity.smownerid\n\t\t\t\tWHERE  vtiger_crmentity.deleted = 0 AND vtiger_crmentity.`smownerid`= " . $userId;
     $return_value = GetRelatedList($this_module, $related_module, $other, $query, $button, $returnset);
     if ($return_value == null) {
         $return_value = array();
     }
     $return_value['CUSTOM_BUTTON'] = $button;
     $log->debug("Exiting get_osstimecontrol method ...");
     return $return_value;
 }