Example #1
0
 function process(Vtiger_Request $request)
 {
     $currentUserModel = Users_Record_Model::getCurrentUserModel();
     $baseUserId = $currentUserModel->getId();
     $userId = $request->get('id');
     $user = new Users();
     $currentUser = $user->retrieveCurrentUserInfoFromFile($userId);
     $name = $currentUserModel->getName();
     $userName = $currentUser->column_fields['user_name'];
     Vtiger_Session::set('AUTHUSERID', $userId);
     Vtiger_Session::set('authenticated_user_id', $userId);
     Vtiger_Session::set('user_name', $userName);
     Vtiger_Session::set('full_user_name', $name);
     $status = 'Switched';
     if (Vtiger_Session::get('baseUserId') == '') {
         Vtiger_Session::set('baseUserId', $baseUserId);
         $status = 'Signed in';
     } elseif ($userId == Vtiger_Session::get('baseUserId')) {
         $baseUserId = $userId;
         Vtiger_Session::set('baseUserId', '');
         $status = 'Signed out';
     } else {
         $baseUserId = Vtiger_Session::get('baseUserId');
     }
     $dbLog = PearDatabase::getInstance('log');
     $dbLog->insert('l_yf_switch_users', ['baseid' => $baseUserId, 'destid' => $userId, 'busername' => $currentUserModel->getName(), 'dusername' => $name, 'date' => date('Y-m-d H:i:s'), 'ip' => Vtiger_Functions::getRemoteIP(), 'agent' => $_SERVER['HTTP_USER_AGENT'], 'status' => $status]);
     header('Location: index.php');
 }
 /**
  * Creates a new file in the directory
  *
  * Data will either be supplied as a stream resource, or in certain cases
  * as a string. Keep in mind that you may have to support either.
  *
  * After successful creation of the file, you may choose to return the ETag
  * of the new file here.
  *
  * The returned ETag must be surrounded by double-quotes (The quotes should
  * be part of the actual string).
  *
  * If you cannot accurately determine the ETag, you should not return it.
  * If you don't store the file exactly as-is (you're transforming it
  * somehow) you should also not return an ETag.
  *
  * This means that if a subsequent GET to this new file does not exactly
  * return the same contents of what was submitted here, you are strongly
  * recommended to omit the ETag.
  *
  * @param string $name Name of the file
  * @param resource|string $data Initial payload
  * @return null|string
  */
 function createFile($name, $data = null)
 {
     include_once 'include/main/WebUI.php';
     global $log, $adb, $current_user;
     $adb = \PearDatabase::getInstance();
     $log = \LoggerManager::getLogger('DavToCRM');
     $user = new \Users();
     $current_user = $user->retrieveCurrentUserInfoFromFile($this->exData->crmUserId);
     $path = trim($this->path, 'files') . '/' . $name;
     $hash = sha1($path);
     $pathParts = pathinfo($path);
     $localPath = $this->localPath . $name;
     $stmt = $this->exData->pdo->prepare('SELECT crmid, smownerid, deleted FROM vtiger_files INNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid = vtiger_files.filesid WHERE vtiger_files.hash = ?;');
     $stmt->execute([$hash]);
     $rows = $stmt->fetch(\PDO::FETCH_ASSOC);
     if ($rows != false && ($rows['smownerid'] != $this->exData->crmUserId || $rows['deleted'] == 1)) {
         throw new DAV\Exception\Conflict('File with name ' . $file . ' could not be located');
     }
     file_put_contents($this->exData->localStorageDir . $localPath, $data);
     if ($rows) {
         $rekord = \Vtiger_Record_Model::getInstanceById($rows['crmid'], 'Files');
         $rekord->set('mode', 'edit');
     } else {
         $rekord = \Vtiger_Record_Model::getCleanInstance('Files');
         $rekord->set('assigned_user_id', $this->exData->crmUserId);
     }
     $rekord->set('title', $pathParts['filename']);
     $rekord->set('name', $pathParts['filename']);
     $rekord->set('path', $localPath);
     $rekord->save();
     $id = $rekord->getId();
     $stmt = $this->exData->pdo->prepare('UPDATE vtiger_files SET dirid=?,extension=?,size=?,hash=?,ctime=? WHERE filesid=?;');
     $stmt->execute([$this->dirid, $pathParts['extension'], filesize($this->exData->localStorageDir . $localPath), $hash, date('Y-m-d H:i:s'), $id]);
 }
/**
 * @param WebserviceId $id
 * @param String $oldPassword
 * @param String $newPassword
 * @param String $confirmPassword
 * @param Users $user 
 * 
 */
function vtws_changePassword($id, $oldPassword, $newPassword, $confirmPassword, $user)
{
    vtws_preserveGlobal('current_user', $user);
    $idComponents = vtws_getIdComponents($id);
    if ($idComponents[1] == $user->id || is_admin($user)) {
        $newUser = new Users();
        $newUser->retrieveCurrentUserInfoFromFile($idComponents[1]);
        if (!is_admin($user)) {
            if (empty($oldPassword)) {
                throw new WebServiceException(WebServiceErrorCode::$INVALIDOLDPASSWORD, vtws_getWebserviceTranslatedString('LBL_' . WebServiceErrorCode::$INVALIDOLDPASSWORD));
            }
            if (!$user->verifyPassword($oldPassword)) {
                throw new WebServiceException(WebServiceErrorCode::$INVALIDOLDPASSWORD, vtws_getWebserviceTranslatedString('LBL_' . WebServiceErrorCode::$INVALIDOLDPASSWORD));
            }
        }
        if (strcmp($newPassword, $confirmPassword) === 0) {
            $db = PearDatabase::getInstance();
            $db->dieOnError = true;
            $db->startTransaction();
            $success = $newUser->change_password($oldPassword, $newPassword, false);
            $error = $db->hasFailedTransaction();
            $db->completeTransaction();
            if ($error) {
                throw new WebServiceException(WebServiceErrorCode::$DATABASEQUERYERROR, vtws_getWebserviceTranslatedString('LBL_' . WebServiceErrorCode::$DATABASEQUERYERROR));
            }
            if (!$success) {
                throw new WebServiceException(WebServiceErrorCode::$CHANGEPASSWORDFAILURE, vtws_getWebserviceTranslatedString('LBL_' . WebServiceErrorCode::$CHANGEPASSWORDFAILURE));
            }
        } else {
            throw new WebServiceException(WebServiceErrorCode::$CHANGEPASSWORDFAILURE, vtws_getWebserviceTranslatedString('LBL_' . WebServiceErrorCode::$CHANGEPASSWORDFAILURE));
        }
        VTWS_PreserveGlobal::flush();
        return array('message' => 'Changed password successfully');
    }
}
 /**
  * Push the admin user on to the user stack
  * and make it the $current_user
  *
  */
 function adminUser()
 {
     $user = new Users();
     $user->retrieveCurrentUserInfoFromFile(1);
     global $current_user;
     array_push($this->userStack, $current_user);
     $current_user = $user;
     return $user;
 }
 function getAdmin()
 {
     $user = new Users();
     $user->retrieveCurrentUserInfoFromFile(1);
     global $current_user;
     $this->originalUser = $current_user;
     $current_user = $user;
     return $user;
 }
Example #6
0
 /**
  * Function to get the list of Header Links
  * @return <Array> - List of Vtiger_Link_Model instances
  */
 function getHeaderLinks()
 {
     $userModel = Users_Record_Model::getCurrentUserModel();
     $headerLinks = [];
     $userPersonalSettingsLinks = ['linktype' => 'HEADERLINK', 'linklabel' => $userModel->getDisplayName(), 'linkurl' => '', 'linkicon' => ''];
     if (SysSecurity::getBoolean('SHOW_MY_PREFERENCES')) {
         $userPersonalSettingsLinks['childlinks'][] = ['linktype' => 'HEADERLINK', 'linklabel' => 'LBL_MY_PREFERENCES', 'linkurl' => $userModel->getPreferenceDetailViewUrl(), 'linkicon' => ''];
     }
     $userPersonalSettingsLinks['childlinks'][] = ['linktype' => 'HEADERLINK', 'linklabel' => 'LBL_SIGN_OUT', 'linkurl' => '?module=Users&parent=Settings&action=Logout', 'linkicon' => ''];
     array_push($headerLinks, $userPersonalSettingsLinks);
     if ($userModel->isAdminUser()) {
         $crmSettingsLink = array('linktype' => 'HEADERLINK', 'linklabel' => 'LBL_SYSTEM_SETTINGS', 'linkurl' => '', 'linkicon' => 'setting.png', 'nocaret' => true, 'childlinks' => array(array('linktype' => 'HEADERLINK', 'linklabel' => 'LBL_SYSTEM_SETTINGS', 'linkurl' => '?module=Vtiger&parent=Settings&view=Index', 'linkicon' => ''), array('linktype' => 'HEADERLINK', 'linklabel' => 'LBL_MANAGE_USERS', 'linkurl' => '?module=Users&parent=Settings&view=List', 'linkicon' => '')));
         array_push($headerLinks, $crmSettingsLink);
     }
     require 'user_privileges/switchUsers.php';
     $baseUserId = $userModel->getId();
     if (Vtiger_Session::has('baseUserId') && Vtiger_Session::get('baseUserId') != '') {
         $baseUserId = Vtiger_Session::get('baseUserId');
     }
     if (key_exists($baseUserId, $switchUsers)) {
         $childlinks = [];
         if (Vtiger_Session::has('baseUserId') && Vtiger_Session::get('baseUserId') != '') {
             $user = new Users();
             $currentUser = $user->retrieveCurrentUserInfoFromFile($baseUserId);
             $userName = $currentUser->column_fields['first_name'] . ' ' . $currentUser->column_fields['last_name'];
             $childlinks[] = ['linktype' => 'HEADERLINK', 'linklabel' => $userName, 'linkurl' => '?module=Users&action=SwitchUsers&id=' . $baseUserId, 'linkicon' => ''];
             $childlinks[] = ['linktype' => 'HEADERLINK', 'linklabel' => NULL];
         }
         foreach ($switchUsers[$baseUserId] as $userid => $userName) {
             if ($userid != $baseUserId) {
                 $childlinks[] = ['linktype' => 'HEADERLINK', 'linklabel' => $userName, 'linkurl' => '?module=Users&action=SwitchUsers&id=' . $userid, 'linkicon' => ''];
             }
         }
         $customHeaderLinks = ['linktype' => 'HEADERLINK', 'linklabel' => 'SwitchUsers', 'linkurl' => '', 'linkicon' => 'glyphicon glyphicon-transfer', 'nocaret' => true, 'childlinks' => $childlinks];
         array_push($headerLinks, $customHeaderLinks);
     }
     $headerLinkInstances = [];
     $index = 0;
     foreach ($headerLinks as $headerLink) {
         $headerLinkInstance = Vtiger_Link_Model::getInstanceFromValues($headerLink);
         if (isset($headerLink['childlinks'])) {
             foreach ($headerLink['childlinks'] as $childLink) {
                 $headerLinkInstance->addChildLink(Vtiger_Link_Model::getInstanceFromValues($childLink));
             }
         }
         $headerLinkInstances[$index++] = $headerLinkInstance;
     }
     $headerLinks = Vtiger_Link_Model::getAllByType(Vtiger_Link::IGNORE_MODULE, ['HEADERLINK']);
     foreach ($headerLinks as $headerType => $headerLinks) {
         foreach ($headerLinks as $headerLink) {
             $headerLinkInstances[$index++] = Vtiger_Link_Model::getInstanceFromLinkObject($headerLink);
         }
     }
     return $headerLinkInstances;
 }
 public function getRecordsList()
 {
     $moduleName = $this->api->getModuleName();
     $user = new Users();
     $currentUser = $user->retrieveCurrentUserInfoFromFile(Users::getActiveAdminId());
     vglobal('current_user', $currentUser);
     $listQuery = '';
     $queryGenerator = new QueryGenerator($moduleName, $currentUser);
     $queryGenerator->initForDefaultCustomView();
     $listQuery = $queryGenerator->getQuery();
     $db = PearDatabase::getInstance();
     $listResult = $db->query($listQuery);
     $records = [];
     while ($row = $db->fetch_array($listResult)) {
         $records[] = $row;
     }
     //$listQuery = getListQuery('OSSTimeControl', '');
     return ['headers' => $queryGenerator->getFields(), 'records' => $records, 'count' => 456];
 }
Example #8
0
 function addCallLogs($data)
 {
     $adb = PearDatabase::getInstance();
     $log = vglobal('log');
     include_once 'include/main/WebUI.php';
     $log->info("Start HistoryCall::addCallLogs | user id: " . $this->userID);
     $resultData = array('status' => 2);
     $user = new Users();
     $count = 0;
     $current_user = $user->retrieveCurrentUserInfoFromFile(Users::getActiveAdminId());
     $data = json_decode($data);
     foreach ($data->callLogs as $call) {
         $to_number = $call->to_number;
         $from_number = $data->phoneNumber;
         $destination = $this->findPhoneNumber($to_number);
         $CallHistory = CRMEntity::getInstance('CallHistory');
         $CallHistory->column_fields['assigned_user_id'] = $this->userID;
         $CallHistory->column_fields['callhistorytype'] = $this->getType($call->type, $call->duration);
         $CallHistory->column_fields['country'] = $call->country_iso;
         $CallHistory->column_fields['to_number'] = $to_number;
         $CallHistory->column_fields['from_number'] = $from_number;
         $CallHistory->column_fields['location'] = $call->location;
         $CallHistory->column_fields['phonecallid'] = $call->callid;
         $CallHistory->column_fields['start_time'] = $this->getDate($call->start_time);
         $CallHistory->column_fields['end_time'] = $this->getDate($call->end_time);
         $CallHistory->column_fields['duration'] = $call->duration;
         $CallHistory->column_fields['imei'] = $data->imei;
         $CallHistory->column_fields['ipAddress'] = $data->ipAddress;
         $CallHistory->column_fields['simSerial'] = $data->simSerial;
         $CallHistory->column_fields['subscriberId'] = $data->subscriberId;
         if ($destination) {
             $CallHistory->column_fields['destination'] = $destination;
         }
         $CallHistory->save('CallHistory');
         $count++;
     }
     $resultData = array('status' => 1, 'count' => $count);
     $log->info("End HistoryCall::addCallLogs | return: " . print_r($resultData, true));
     return $resultData;
 }
 public function getRecordDetail($record)
 {
     $moduleName = $this->api->getModuleName();
     $user = new Users();
     $currentUser = $user->retrieveCurrentUserInfoFromFile(Users::getActiveAdminId());
     vglobal('current_user', $currentUser);
     $recordModel = Vtiger_Record_Model::getInstanceById($record, $moduleName);
     $rawData = $recordModel->getData();
     $moduleModel = $recordModel->getModule();
     $fields = [];
     $moduleBlockFields = Vtiger_Field_Model::getAllForModule($moduleModel);
     foreach ($moduleBlockFields as $moduleFields) {
         foreach ($moduleFields as $moduleField) {
             $block = $moduleField->get('block');
             $fields[$block->label][$moduleField->get('name')] = $rawData[$moduleField->get('name')];
             if (empty($block)) {
                 continue;
             }
         }
     }
     return ['rawData' => $rawData, 'data' => $fields];
 }
Example #10
0
function get_service_list_values($id, $modulename, $sessionid, $only_mine = 'true')
{
    require_once 'modules/Services/Services.php';
    require_once 'include/utils/UserInfoUtil.php';
    $adb = PearDatabase::getInstance();
    $log = vglobal('log');
    $log->debug("Entering customer portal Function get_service_list_values");
    $check = checkModuleActive($modulename);
    if ($check == false) {
        return array("#MODULE INACTIVE#");
    }
    $user = new Users();
    $userid = getPortalUserid();
    $current_user = $user->retrieveCurrentUserInfoFromFile($userid);
    //To avoid SQL injection we are type casting as well as bound the id variable
    $id = (int) vtlib_purify($id);
    $entity_ids_list = array();
    $show_all = show_all($modulename);
    if (!validateSession($id, $sessionid)) {
        return null;
    }
    if ($only_mine == 'true' || $show_all == 'false') {
        array_push($entity_ids_list, $id);
    } else {
        $contactquery = "SELECT contactid, parentid FROM vtiger_contactdetails " . " INNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid = vtiger_contactdetails.contactid" . " AND vtiger_crmentity.deleted = 0 " . " WHERE (parentid = (SELECT parentid FROM vtiger_contactdetails WHERE contactid = ?)  AND parentid != 0) OR contactid = ?";
        $contactres = $adb->pquery($contactquery, array($id, $id));
        $no_of_cont = $adb->num_rows($contactres);
        for ($i = 0; $i < $no_of_cont; $i++) {
            $cont_id = $adb->query_result($contactres, $i, 'contactid');
            $acc_id = $adb->query_result($contactres, $i, 'parentid');
            if (!in_array($cont_id, $entity_ids_list)) {
                $entity_ids_list[] = $cont_id;
            }
            if (!in_array($acc_id, $entity_ids_list) && $acc_id != '0') {
                $entity_ids_list[] = $acc_id;
            }
        }
    }
    $focus = new Services();
    $focus->filterInactiveFields('Services');
    foreach ($focus->list_fields as $fieldlabel => $values) {
        foreach ($values as $table => $fieldname) {
            $fields_list[$fieldlabel] = $fieldname;
        }
    }
    $fields_list['Related To'] = 'entityid';
    $query = array();
    $params = array();
    $query[] = "select vtiger_service.*," . "case when vtiger_crmentityrel.crmid != vtiger_service.serviceid then vtiger_crmentityrel.crmid else vtiger_crmentityrel.relcrmid end as entityid, " . "'' as setype from vtiger_service " . "inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_service.serviceid " . "left join vtiger_crmentityrel on (vtiger_crmentityrel.relcrmid=vtiger_service.serviceid or vtiger_crmentityrel.crmid=vtiger_service.serviceid) " . "where vtiger_crmentity.deleted = 0 and " . "( vtiger_crmentityrel.crmid in (" . generateQuestionMarks($entity_ids_list) . ") OR " . "(vtiger_crmentityrel.relcrmid in (" . generateQuestionMarks($entity_ids_list) . ") AND vtiger_crmentityrel.module = 'Services')" . ")";
    $params[] = array($entity_ids_list, $entity_ids_list);
    $checkQuotes = checkModuleActive('Quotes');
    if ($checkQuotes == true) {
        $query[] = "select distinct vtiger_service.*,\n\t\t\tvtiger_quotes.accountid as entityid,\n\t\t\t'Accounts' as setype\n\t\t\tfrom vtiger_quotes INNER join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_quotes.quoteid\n\t\t\tleft join vtiger_inventoryproductrel on vtiger_inventoryproductrel.id=vtiger_quotes.quoteid\n\t\t\tleft join vtiger_service on vtiger_service.serviceid = vtiger_inventoryproductrel.productid\n\t\t\twhere vtiger_inventoryproductrel.productid = vtiger_service.serviceid AND vtiger_crmentity.deleted=0 and accountid in  (" . generateQuestionMarks($entity_ids_list) . ")";
        $params[] = array($entity_ids_list);
    }
    $checkInvoices = checkModuleActive('Invoice');
    if ($checkInvoices == true) {
        $query[] = "select distinct vtiger_service.*, vtiger_invoice.accountid as entityid, 'Accounts' as setype\n\t\t\tfrom vtiger_invoice\n\t\t\tINNER join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_invoice.invoiceid\n\t\t\tleft join vtiger_inventoryproductrel on vtiger_inventoryproductrel.id=vtiger_invoice.invoiceid\n\t\t\tleft join vtiger_service on vtiger_service.serviceid = vtiger_inventoryproductrel.productid\n\t\t\twhere vtiger_inventoryproductrel.productid = vtiger_service.serviceid AND vtiger_crmentity.deleted=0 and accountid in (" . generateQuestionMarks($entity_ids_list) . ")";
        $params[] = array($entity_ids_list, $entity_ids_list);
    }
    $ServicesfieldVisibilityPermissions = array();
    foreach ($fields_list as $fieldlabel => $fieldname) {
        $ServicesfieldVisibilityPermissions[$fieldname] = getFieldVisibilityPermission('Services', $current_user->id, $fieldname);
    }
    $fieldValuesToRound = array('unit_price', 'commissionrate');
    for ($k = 0; $k < count($query); $k++) {
        $res[$k] = $adb->pquery($query[$k], $params[$k]);
        $noofdata[$k] = $adb->num_rows($res[$k]);
        if ($noofdata[$k] == 0) {
            $output[$k][$modulename]['data'] = '';
        }
        for ($j = 0; $j < $noofdata[$k]; $j++) {
            $i = 0;
            foreach ($fields_list as $fieldlabel => $fieldname) {
                $fieldper = $ServicesfieldVisibilityPermissions[$fieldname];
                if ($fieldper == '1' && $fieldname != 'entityid') {
                    continue;
                }
                $output[$k][$modulename]['head'][0][$i]['fielddata'] = Vtiger_Language_Handler::getTranslatedString($fieldlabel, 'Services', vglobal('default_language'));
                $fieldvalue = $adb->query_result($res[$k], $j, $fieldname);
                $fieldid = $adb->query_result($res[$k], $j, 'serviceid');
                if (in_array($fieldname, $fieldValuesToRound)) {
                    $fieldvalue = round($fieldvalue, 2);
                }
                if ($fieldname == 'entityid') {
                    $crmid = $fieldvalue;
                    $module = $adb->query_result($res[$k], $j, 'setype');
                    if ($module == '') {
                        $module = $adb->query_result($adb->pquery("SELECT setype FROM vtiger_crmentity WHERE crmid = ?", array($crmid)), 0, 'setype');
                    }
                    if ($crmid != '' && $module != '') {
                        $fieldvalues = getEntityName($module, array($crmid));
                        if ($module == 'Contacts') {
                            $fieldvalue = '<a href="index.php?module=Contacts&action=index&id=' . $crmid . '">' . $fieldvalues[$crmid] . '</a>';
                        } elseif ($module == 'Accounts') {
                            $fieldvalue = '<a href="index.php?module=Accounts&action=index&id=' . $crmid . '">' . $fieldvalues[$crmid] . '</a>';
                        }
                    } else {
                        $fieldvalue = '';
                    }
                }
                if ($fieldname == 'servicename') {
                    $fieldvalue = '<a href="index.php?module=Services&action=index&id=' . $fieldid . '">' . $fieldvalue . '</a>';
                }
                if ($fieldname == 'unit_price') {
                    $sym = getCurrencySymbol($res[$k], $j, 'currency_id');
                    $fieldvalue = $sym . $fieldvalue;
                }
                $output[$k][$modulename]['data'][$j][$i]['fielddata'] = $fieldvalue;
                $i++;
            }
        }
    }
    $log->debug("Exiting customerportal function get_product_list_values.....");
    return $output;
}
Example #11
0
 /**
  * Function to get the active admin user object
  * @return Users - Active Admin User Instance
  */
 public static function getActiveAdminUser()
 {
     $adminId = self::getActiveAdminId();
     $user = new Users();
     $user->retrieveCurrentUserInfoFromFile($adminId);
     return $user;
 }
Example #12
0
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style type="text/css">@import url("themes/softed/style.css");br { display: block; margin: 2px; }</style>
</head><body class=small style="font-size: 12px; margin: 2px; padding: 2px; background-color:#f7fff3; ">
<table width="100%" border=0><tr><td><span style='color:red;float:right;margin-right:30px;'><h2>Proud member of the <a href='http://corebos.org'>coreBOS</a> family!</h2></span></td></tr></table>
<hr style="height: 1px">
<?php 
// Turn on debugging level
$Vtiger_Utils_Log = true;
require_once 'include/utils/utils.php';
include_once 'vtlib/Vtiger/Module.php';
require 'modules/com_vtiger_workflow/VTEntityMethodManager.inc';
global $current_user, $adb;
set_time_limit(0);
ini_set('memory_limit', '1024M');
$current_user = new Users();
$current_user->retrieveCurrentUserInfoFromFile(Users::getActiveAdminId());
if (isset($_SESSION['authenticated_user_language']) && $_SESSION['authenticated_user_language'] != '') {
    $current_language = $_SESSION['authenticated_user_language'];
} else {
    if (!empty($current_user->language)) {
        $current_language = $current_user->language;
    } else {
        $current_language = $default_language;
    }
}
$app_strings = return_application_language($current_language);
$query_count = 0;
$success_query_count = 0;
$failure_query_count = 0;
$success_query_array = array();
$failure_query_array = array();
Example #13
0
 public function getReports4YouOwnerUser($user_id = "")
 {
     global $current_user;
     if ($user_id != "") {
         $user = new Users();
         $user->retrieveCurrentUserInfoFromFile($user_id);
     } else {
         $user = Users::getActiveAdminUser();
     }
     $current_user = $user;
     return $user;
 }
Example #14
0
function Soap_generatePDF($userid)
{
    $adb = PearDatabase::getInstance();
    $current_user = vglobal('current_user');
    $_SESSION['type'] = "single";
    $user = new Users();
    $current_user = $user->retrieveCurrentUserInfoFromFile($userid);
    require_once "modules/OSSPdf/Print.php";
    require_once 'modules/OSSPdf/ModulesQueries.php';
    $module = $_REQUEST['usingmodule'];
    $id = $_REQUEST['recordid'];
    if (isset($_REQUEST['fromdetailview']) && $_REQUEST['fromdetailview'] == 'yes') {
        $document_list = array();
        if ($_REQUEST['return_name'] == "yes" || isset($_REQUEST['pdfajax'])) {
            $_REQUEST['template'] = explode(';', trim($_REQUEST['template'], ';'));
        }
        /* ----------------------------- */
        ##############
        ### PRZETWANIA ZMIENNYCH POCZATKOWYCH
        foreach ($_REQUEST['template'] as $templateid) {
            $_SESSION['template_to_perfom'] = $_REQUEST['template_to_perfom'] = $templateid;
            $pobierzdane = $adb->query("select osspdf_pdf_format,osspdf_pdf_orientation, filename, left_margin, right_margin, top_margin, bottom_margin from vtiger_osspdf where osspdfid = '{$templateid}'", true);
            $_REQUEST['pdf_format'] = $adb->query_result($pobierzdane, 0, "osspdf_pdf_format");
            $pdf_orientation_result = $adb->query_result($pobierzdane, 0, "osspdf_pdf_orientation");
            $_REQUEST['file_name'] = $adb->query_result($pobierzdane, 0, "filename");
            $_REQUEST['left'] = $adb->query_result($pobierzdane, 0, "left_margin");
            $_REQUEST['right'] = $adb->query_result($pobierzdane, 0, "right_margin");
            $_REQUEST['top'] = $adb->query_result($pobierzdane, 0, "top_margin");
            $_REQUEST['bottom'] = $adb->query_result($pobierzdane, 0, "bottom_margin");
            $_SESSION['top'] = $_REQUEST['top'];
            if ($pdf_orientation_result == 'Portrait') {
                $pdf_orientation = "P";
            } elseif ($pdf_orientation_result == 'Landscape') {
                $pdf_orientation = "L";
            }
            /* ----------------------------- */
            ##############
            ### INICJOWANIE PDFA, POBIERANIE DANYCH ETC
            $pdf = new Printer();
            $pdf->setPageFormat($_REQUEST['pdf_format'], $pdf_orientation);
            //$pdf->setPrintHeader(false);
            //$pdf->setPrintFooter(false);
            //	$pdf->SetHeaderData( '','','asd','' );
            $pdf->SetCompression(true);
            //$pdf->SetMargins( $left,$top, $right = -1,$keepmargins = false );
            if (isset($_REQUEST['left']) && $_REQUEST['left'] != '' && $_REQUEST['left'] != 0) {
                $pdf->SetLeftMargin($_REQUEST['left']);
            }
            if (isset($_REQUEST['right']) && $_REQUEST['right'] != '' && $_REQUEST['right'] != 0) {
                $pdf->SetRightMargin($_REQUEST['right']);
            }
            /*
                        if (isset($_REQUEST['top']) && $_REQUEST['top'] != '' && $_REQUEST['top'] != 0) {
                            $pdf->SetTopMargin($_REQUEST['top']);
                        }
            
                        if (isset($_REQUEST['bottom']) && $_REQUEST['bottom'] != '' && $_REQUEST['bottom'] != 0) {
                            $pdf->SetAutoPageBreak(true, $_REQUEST['bottom']);
                        }*/
            /* ----------------------------- */
            ################
            $date_var = $adb->formatDate(date('Y-m-d H:i:s'), true);
            $query = "insert into vtiger_audit_trial values(?,?,?,?,?,?)";
            $qparams = array($adb->getUniqueID('vtiger_audit_trial'), $current_user->id, $module, 'Generate PDF', $id, $date_var);
            $adb->pquery($query, $qparams, true);
            TakeContent($pdf, $module, $id, $site_URL);
            $filepath = $_REQUEST['file_name'] . '_' . $id . $templateid . '_' . date("YmdHis") . '.pdf';
            $pdf->Output($filepath, 'F');
            ###
            $pobierz = $adb->query("select * from vtiger_osspdf_config where conf_id = 'GENERALCONFIGURATION'", true);
            ###
            $data = array();
            for ($i = 0; $i < $adb->num_rows($pobierz); $i++) {
                $data[$adb->query_result($pobierz, $i, "name")] = $adb->query_result($pobierz, $i, "value");
            }
            $docid = 0;
            if ($data['ifsave'] == 'yes') {
                $document_id = CreateDocument($filepath, $data['ifattach'], $id, $module, $docid);
                $nr = $document_id + 1;
                $document_list[] = $nr . '_' . $filepath;
                $storage_path = decideFilePath();
                $pelnasciezka = $storage_path . $nr . '_' . $filepath;
            } else {
                $document_list[] = $filepath;
                $storage_path = decideFilePath();
                $pelnasciezka = $storage_path . $filepath;
            }
            chmod('storage', 0777);
            if ($_REQUEST['return_name'] != "yes" || $_REQUEST['return_name'] == "") {
                rename($filepath, $pelnasciezka);
            } else {
                $sciezka = "storage/" . $filepath;
                rename($filepath, $sciezka);
            }
            if ($data['ifattach'] == 'yes') {
                $sql = "INSERT INTO vtiger_senotesrel (`crmid`,`notesid`) VALUES ('{$id}','{$docid}')";
                $wykonaj = $adb->query($sql, true);
            }
        }
        if ($_REQUEST['return_name'] != "yes" || $_REQUEST['return_name'] == "") {
            $storage_path = decideFilePath();
        } else {
            $storage_path = "storage/";
        }
        $zip = getTranslatedString($_REQUEST['usingmodule']) . '_' . date("YmdHis") . '.zip';
        $zipname = 'storage/' . $zip;
        $zipname = file_exist_fn($zipname, 0);
        if (count($document_list) > 1) {
            zipFilesAndDownload($document_list, $zipname, $storage_path, $zip);
        } else {
            if ($_REQUEST['return_name'] != "yes") {
                header("Content-type: application/pdf");
                header("Content-Disposition: attachment; filename=" . $document_list[0]);
                header("Pragma: no-cache");
                header("Expires: 0");
                readfile($storage_path . "/" . $document_list[0]);
                exit;
            } elseif ($_REQUEST['return_name'] == "yes") {
                return $document_list[0];
            }
        }
    }
}
Example #15
0
$queryGenerator = new QueryGenerator($moduleName, $current_user);
$queryGenerator->setFields(array('id'));
$query = $queryGenerator->getQuery();
echo "{$query}<br>";
testquery($query);
echo "<h2>Query with custom field</h2>";
$queryGenerator = new QueryGenerator($moduleName, $current_user);
$queryGenerator->setFields(array('id', 'cf_681'));
$query = $queryGenerator->getQuery();
echo "{$query}<br>";
testquery($query);
echo "<h2>Query with invalid and non-accessible fields</h2>";
echo "<b>The invalid fields and fields the current user does not have permission to access are eliminated</b><br>";
$hold_user = $current_user;
$user = new Users();
$user->retrieveCurrentUserInfoFromFile(5);
// 5 is a normal user that does not have access to cf_681
$queryGenerator = new QueryGenerator($moduleName, $user);
$queryGenerator->setFields(array('id', 'cf_681', 'acname'));
$query = $queryGenerator->getQuery();
echo "{$query}<br>";
testquery($query);
$current_user = $hold_user;
echo "<h2>Query as individual parts</h2>";
echo "<b>We can get the different parts of the query individually so we can construct specific queries easily</b><br>";
$queryGenerator = new QueryGenerator($moduleName, $current_user);
$queryGenerator->setFields(array('id', 'cf_681', 'accountname'));
echo "<b>Full query:</b><br>";
$query = $queryGenerator->getQuery();
echo "{$query}<br>";
echo "<b>SELECT:</b><br>";
Example #16
0
function VT520_queryGeneratorMigration()
{
    $db = PearDatabase::getInstance();
    $sql = "delete from vtiger_cvadvfilter where columnname IS NULL or columnname='';";
    $db->pquery($sql, array());
    $sql = "select id from vtiger_users where is_admin='On' and status='Active' limit 1";
    $result = $db->pquery($sql, array());
    $adminId = 1;
    $it = new SqlResultIterator($db, $result);
    foreach ($it as $row) {
        $adminId = $row->id;
    }
    $user = new Users();
    $current_user = $user->retrieveCurrentUserInfoFromFile($adminId);
    $user = $current_user;
    $sql = "select vtiger_customview.cvid,columnindex,entitytype from vtiger_customview inner join " . "vtiger_cvcolumnlist on vtiger_customview.cvid=vtiger_cvcolumnlist.cvid where entitytype !=" . "'Accounts' and columnname like 'vtiger_account:accountname:accountname%';";
    VT520_migrateCustomview($sql, 'Accounts', $user, VT520_updateCVColumnList);
    $sql = "select vtiger_customview.cvid,columnindex,entitytype from vtiger_customview inner join " . "vtiger_cvcolumnlist on vtiger_customview.cvid=vtiger_cvcolumnlist.cvid where entitytype !=" . "'Contacts' and columnname like 'vtiger_contactdetails:lastname:lastname:%';";
    VT520_migrateCustomview($sql, 'Contacts', $user, VT520_updateCVColumnList);
    $sql = "select vtiger_customview.cvid,columnindex,entitytype from vtiger_customview inner join " . "vtiger_cvcolumnlist on vtiger_customview.cvid=vtiger_cvcolumnlist.cvid where entitytype not in " . "('Products','HelpDesk','Faq') and columnname like 'vtiger_products:productname:productname%';";
    VT520_migrateCustomview($sql, 'Products', $user, VT520_updateCVColumnList);
    $sql = "select vtiger_customview.cvid,columnindex,entitytype from vtiger_customview inner join " . "vtiger_cvcolumnlist on vtiger_customview.cvid=vtiger_cvcolumnlist.cvid where entitytype not in " . "('Products','HelpDesk','Faq') and columnname like 'vtiger_quotes:quoteid:quote_id%';";
    VT520_migrateCustomview($sql, 'SalesOrder', $user, VT520_updateCVColumnList);
    $sql = "select vtiger_customview.cvid,columnindex,entitytype from vtiger_customview inner join " . "vtiger_cvadvfilter on vtiger_customview.cvid=vtiger_cvadvfilter.cvid where entitytype !=" . "'Accounts' and columnname like 'vtiger_account:accountname:accountname%';";
    VT520_migrateCustomview($sql, 'Accounts', $user, VT520_updateADVColumnList);
    $sql = "select vtiger_customview.cvid,columnindex,entitytype from vtiger_customview inner join " . "vtiger_cvadvfilter on vtiger_customview.cvid=vtiger_cvadvfilter.cvid where entitytype !=" . "'Contacts' and columnname like 'vtiger_contactdetails:lastname:lastname:%';";
    VT520_migrateCustomview($sql, 'Contacts', $user, VT520_updateADVColumnList);
    $sql = "select vtiger_customview.cvid,columnindex,entitytype from vtiger_customview inner join " . "vtiger_cvadvfilter on vtiger_customview.cvid=vtiger_cvadvfilter.cvid where entitytype not in " . "('Products','HelpDesk','Faq') and columnname like 'vtiger_products:productname:productname%';";
    VT520_migrateCustomview($sql, 'Products', $user, VT520_updateADVColumnList);
    $sql = "select vtiger_customview.cvid,columnindex,entitytype from vtiger_customview inner join " . "vtiger_cvcolumnlist on vtiger_customview.cvid=vtiger_cvcolumnlist.cvid where entitytype not in " . "('Products','HelpDesk','Faq') and columnname like 'vtiger_quotes:quoteid:quote_id%';";
    VT520_migrateCustomview($sql, 'SalesOrder', $user, VT520_updateADVColumnList);
    $tabId = getTabid('Contacts');
    $sql = "select fieldid from vtiger_field where tabid=? and fieldname='birthday';";
    $params = array($tabId);
    $result = $db->pquery($sql, $params);
    $it = new SqlResultIterator($db, $result);
    $fieldId = null;
    foreach ($it as $row) {
        $fieldId = $row->fieldid;
    }
    if (!empty($fieldId)) {
        $sql = "update vtiger_field set typeofdata = 'D~O' where fieldid=?;";
        $params = array($fieldId);
        $result = $db->pquery($sql, $params);
    } else {
        echo '
			<tr width="100%">
				<td width="25%">Failure</td>
				<td width="5%"><font color="red"> F </font></td>
				<td width="70%">Failed to change typeofdata of birthday field</td>
			</tr>';
    }
    $tabId = getTabid('Documents');
    $sql = "select fieldid from vtiger_field where tabid=? and fieldname='filesize';";
    $params = array($tabId);
    $result = $db->pquery($sql, $params);
    $it = new SqlResultIterator($db, $result);
    $fieldId = null;
    foreach ($it as $row) {
        $fieldId = $row->fieldid;
    }
    if (!empty($fieldId)) {
        $sql = "update vtiger_field set typeofdata = 'I~O' where fieldid=?;";
        $params = array($fieldId);
        $result = $db->pquery($sql, $params);
    } else {
        echo '
			<tr width="100%">
				<td width="25%">Failure</td>
				<td width="5%"><font color="red"> F </font></td>
				<td width="70%">Failed to change typeofdata of filesize field</td>
			</tr>';
    }
}
Example #17
0
            return;
        }
    }
    $sid = $sessionManager->startSession($sessionId, $adoptSession);
    if (!$sessionId && !$operationManager->isPreLoginOperation()) {
        writeErrorOutput($operationManager, new WebServiceException(WebServiceErrorCode::$AUTHREQUIRED, "Authentication required"));
        return;
    }
    if (!$sid) {
        writeErrorOutput($operationManager, $sessionManager->getError());
        return;
    }
    $userid = $sessionManager->get("authenticatedUserId");
    if ($userid) {
        $seed_user = new Users();
        $current_user = $seed_user->retrieveCurrentUserInfoFromFile($userid);
    } else {
        $current_user = null;
    }
    $operationInput = $operationManager->sanitizeOperation($input);
    $includes = $operationManager->getOperationIncludes();
    foreach ($includes as $ind => $path) {
        checkFileAccessForInclusion($path);
        require_once $path;
    }
    cbEventHandler::do_action('corebos.audit.action', array(isset($current_user) ? $current_user->id : 0, 'Webservice', $operation, 0, date('Y-m-d H:i:s')));
    $rawOutput = $operationManager->runOperation($operationInput, $current_user);
    writeOutput($operationManager, $rawOutput);
} catch (WebServiceException $e) {
    writeErrorOutput($operationManager, $e);
} catch (Exception $e) {
Example #18
0
    public function addRecords()
    {
        global $log, $adb;
        $log->debug("Entering VT620_to_YT::addRecords() method ...");
        //include('config/config.inc.php');
        global $dbconfig;
        $assigned_user_id = $this->adminId;
        $user = new Users();
        $current_user = $user->retrieveCurrentUserInfoFromFile($assigned_user_id);
        $moduleName = 'OSSMailTemplates';
        vimport('~~modules/' . $moduleName . '/' . $moduleName . '.php');
        $records = array();
        $records[] = array(35, 'Notify Owner On Ticket Change', 'HelpDesk', '#t#LBL_NOTICE_MODIFICATION#tEnd# #a#155#aEnd#: #a#169#aEnd#', '<div>
<h3>#t#LBL_NOTICE_WELCOME#tEnd# <strong>YetiForce Sp. z o.o.</strong></h3>
#t#SINGLE_HelpDesk#tEnd# #a#155#aEnd# #t#LBL_NOTICE_UPDATED#tEnd# #a#168#aEnd#). #s#ChangesList#sEnd#

<hr /><h1><a href="%23s%23LinkToCRMRecord%23sEnd%23">#t#LBL_NOTICE_MODIFICATION#tEnd# #a#155#aEnd#: #a#169#aEnd#</a></h1>

<ul><li>#b#161#bEnd#: #a#161#aEnd#</li>
	<li>#b#158#bEnd#: #a#158#aEnd#</li>
	<li>#b#156#bEnd#: #a#156#aEnd#</li>
	<li>#b#157#bEnd#: #a#157#aEnd#</li>
	<li>#b#718#bEnd#: #a#718#aEnd#</li>
</ul><hr /> #b#170#bEnd#: #a#170#aEnd#
<hr /> #b#171#bEnd#: #a#171#aEnd#
<hr /><span><em>#t#LBL_NOTICE_FOOTER#tEnd#</em></span></div>', 'PLL_RECORD');
        $records[] = array(36, 'Notify Account On Ticket Change', 'HelpDesk', '#t#LBL_NOTICE_MODIFICATION#tEnd# #a#155#aEnd#: #a#169#aEnd#', '<div>
<h3><span>#t#LBL_NOTICE_WELCOME#tEnd# <strong>YetiForce Sp. z o.o.</strong></span></h3>
#t#SINGLE_HelpDesk#tEnd# #a#155#aEnd# #t#LBL_NOTICE_UPDATED#tEnd# #a#168#aEnd#). #s#ChangesList#sEnd#

<hr /><h1><a href="%23s%23LinkToPortalRecord%23sEnd%23">#t#LBL_NOTICE_MODIFICATION#tEnd# #a#155#aEnd#: #a#169#aEnd#</a></h1>

<ul><li>#b#161#bEnd#: #a#161#aEnd#</li>
	<li>#b#158#bEnd#: #a#158#aEnd#</li>
	<li>#b#156#bEnd#: #a#156#aEnd#</li>
	<li>#b#157#bEnd#: #a#157#aEnd#</li>
	<li>#b#718#bEnd#: #a#718#aEnd#</li>
</ul><hr /> #b#170#bEnd#: #a#170#aEnd#
<hr /> #b#171#bEnd#: #a#171#aEnd#
<hr /><span><em>#t#LBL_NOTICE_FOOTER#tEnd#</em></span></div>', 'PLL_RECORD');
        $records[] = array(37, 'Notify Contact On Ticket Closed', 'HelpDesk', '#t#LBL_NOTICE_CLOSE#tEnd# #a#155#aEnd#: #a#169#aEnd#', '<div>
<h3>#t#LBL_NOTICE_WELCOME#tEnd# <strong>YetiForce Sp. z o.o.</strong></h3>
#t#SINGLE_HelpDesk#tEnd# #a#155#aEnd# #t#LBL_NOTICE_CLOSED#tEnd# #a#168#aEnd#). #s#ChangesList#sEnd#

<hr /><h1><a href="%23s%23LinkToPortalRecord%23sEnd%23">#t#LBL_NOTICE_CLOSE#tEnd# #a#155#aEnd#: #a#169#aEnd#</a></h1>

<ul><li>#b#161#bEnd#: #a#161#aEnd#</li>
	<li>#b#158#bEnd#: #a#158#aEnd#</li>
	<li>#b#156#bEnd#: #a#156#aEnd#</li>
	<li>#b#157#bEnd#: #a#157#aEnd#</li>
	<li>#b#718#bEnd#: #a#718#aEnd#</li>
</ul><hr /> #b#170#bEnd#: #a#170#aEnd#
<hr /> #b#171#bEnd#: #a#171#aEnd#
<hr /><span><em>#t#LBL_NOTICE_FOOTER#tEnd#</em></span></div>', 'PLL_RECORD');
        $records[] = array(38, 'Notify Account On Ticket Closed', 'HelpDesk', '#t#LBL_NOTICE_CLOSE#tEnd# #a#155#aEnd#: #a#169#aEnd#', '<div>
<h3>#t#LBL_NOTICE_WELCOME#tEnd# <strong>YetiForce Sp. z o.o.</strong></h3>
#t#SINGLE_HelpDesk#tEnd# #a#155#aEnd# #t#LBL_NOTICE_CLOSED#tEnd# #a#168#aEnd#). #s#ChangesList#sEnd#

<hr /><h1><a href="%23s%23LinkToPortalRecord%23sEnd%23">#t#LBL_NOTICE_CLOSE#tEnd# #a#155#aEnd#: #a#169#aEnd#</a></h1>

<ul><li>#b#161#bEnd#: #a#161#aEnd#</li>
	<li>#b#158#bEnd#: #a#158#aEnd#</li>
	<li>#b#156#bEnd#: #a#156#aEnd#</li>
	<li>#b#157#bEnd#: #a#157#aEnd#</li>
	<li>#b#718#bEnd#: #a#718#aEnd#</li>
</ul><hr /> #b#170#bEnd#: #a#170#aEnd#
<hr /> #b#171#bEnd#: #a#171#aEnd#
<hr /><span><em>#t#LBL_NOTICE_FOOTER#tEnd#</em></span></div>', 'PLL_RECORD');
        $records[] = array(39, 'Notify Contact On Ticket Create', 'HelpDesk', '#t#LBL_NOTICE_CREATE#tEnd# #a#155#aEnd#: #a#169#aEnd#', '<div>
<h3>#t#LBL_NOTICE_WELCOME#tEnd# <strong>YetiForce Sp. z o.o.</strong></h3>
#t#SINGLE_HelpDesk#tEnd# #a#155#aEnd# #t#LBL_NOTICE_CREATED#tEnd# #a#168#aEnd#).

<hr /><h1><a href="%23s%23LinkToPortalRecord%23sEnd%23">#t#LBL_NOTICE_CREATE#tEnd# #a#155#aEnd#: #a#169#aEnd#</a></h1>

<ul><li>#b#161#bEnd#: #a#161#aEnd#</li>
	<li>#b#158#bEnd#: #a#158#aEnd#</li>
	<li>#b#156#bEnd#: #a#156#aEnd#</li>
	<li>#b#157#bEnd#: #a#157#aEnd#</li>
	<li>#b#718#bEnd#: #a#718#aEnd#</li>
</ul><hr /> #b#170#bEnd#: #a#170#aEnd#
<hr /><span><em>#t#LBL_NOTICE_FOOTER#tEnd#</em></span></div>', 'PLL_RECORD');
        $records[] = array(40, 'Notify Account On Ticket Create', 'HelpDesk', '#t#LBL_NOTICE_CREATE#tEnd# #a#155#aEnd#: #a#169#aEnd#', '<div>
<h3>#t#LBL_NOTICE_WELCOME#tEnd# <strong>YetiForce Sp. z o.o.</strong></h3>
#t#SINGLE_HelpDesk#tEnd# #a#155#aEnd# #t#LBL_NOTICE_CREATED#tEnd# #a#168#aEnd#).

<hr /><h1><a href="%23s%23LinkToPortalRecord%23sEnd%23">#t#LBL_NOTICE_CREATE#tEnd# #a#155#aEnd#: #a#169#aEnd#</a></h1>

<ul><li>#b#161#bEnd#: #a#161#aEnd#</li>
	<li>#b#158#bEnd#: #a#158#aEnd#</li>
	<li>#b#156#bEnd#: #a#156#aEnd#</li>
	<li>#b#157#bEnd#: #a#157#aEnd#</li>
	<li>#b#718#bEnd#: #a#718#aEnd#</li>
</ul><hr /> #b#170#bEnd#: #a#170#aEnd#
<hr /><span><em>#t#LBL_NOTICE_FOOTER#tEnd#</em></span></div>', 'PLL_RECORD');
        $records[] = array(41, 'Notify Contact On Ticket Change', 'HelpDesk', '#t#LBL_NOTICE_MODIFICATION#tEnd# #a#155#aEnd#: #a#169#aEnd#', '<div>
<h3><span>#t#LBL_NOTICE_WELCOME#tEnd# <strong>YetiForce Sp. z o.o.</strong></span></h3>
#t#SINGLE_HelpDesk#tEnd# #a#155#aEnd# #t#LBL_NOTICE_UPDATED#tEnd# #a#168#aEnd#). #s#ChangesList#sEnd#

<hr /><h1><a href="%23s%23LinkToPortalRecord%23sEnd%23">#t#LBL_NOTICE_MODIFICATION#tEnd# #a#155#aEnd#: #a#169#aEnd#</a></h1>

<ul><li>#b#161#bEnd#: #a#161#aEnd#</li>
	<li>#b#158#bEnd#: #a#158#aEnd#</li>
	<li>#b#156#bEnd#: #a#156#aEnd#</li>
	<li>#b#157#bEnd#: #a#157#aEnd#</li>
	<li>#b#718#bEnd#: #a#718#aEnd#</li>
</ul><hr /> #b#170#bEnd#: #a#170#aEnd#
<hr /> #b#171#bEnd#: #a#171#aEnd#
<hr /><span><em>#t#LBL_NOTICE_FOOTER#tEnd#</em></span></div>', 'PLL_RECORD');
        $records[] = array(42, 'Notify Owner On Ticket Closed', 'HelpDesk', '#t#LBL_NOTICE_CLOSE#tEnd# #a#155#aEnd#: #a#169#aEnd#', '<div>
<h3><span>#t#LBL_NOTICE_WELCOME#tEnd# <strong>YetiForce Sp. z o.o.</strong></span></h3>
#t#SINGLE_HelpDesk#tEnd# #a#155#aEnd# #t#LBL_NOTICE_CLOSED#tEnd# #a#168#aEnd#). #s#ChangesList#sEnd#

<hr /><h1><a href="%23s%23LinkToCRMRecord%23sEnd%23">#t#LBL_NOTICE_CLOSE#tEnd# #a#155#aEnd#: #a#169#aEnd#</a></h1>

<ul><li>#b#161#bEnd#: #a#161#aEnd#</li>
	<li>#b#158#bEnd#: #a#158#aEnd#</li>
	<li>#b#156#bEnd#: #a#156#aEnd#</li>
	<li>#b#157#bEnd#: #a#157#aEnd#</li>
	<li>#b#718#bEnd#: #a#718#aEnd#</li>
</ul><hr /> #b#170#bEnd#: #a#170#aEnd#
<hr /> #b#171#bEnd#: #a#171#aEnd#
<hr /><span><em>#t#LBL_NOTICE_FOOTER#tEnd#</em></span></div>', 'PLL_RECORD');
        $records[] = array(43, 'Notify Owner On Ticket Create', 'HelpDesk', '#t#LBL_NOTICE_CREATE#tEnd# #a#155#aEnd#: #a#169#aEnd#', '<div>
<h3>#t#LBL_NOTICE_WELCOME#tEnd# <strong>YetiForce Sp. z o.o.</strong></h3>
#t#SINGLE_HelpDesk#tEnd# #a#155#aEnd# #t#LBL_NOTICE_CREATED#tEnd# #a#168#aEnd#).

<hr /><h1><a href="%23s%23LinkToCRMRecord%23sEnd%23">#t#LBL_NOTICE_CREATE#tEnd# #a#155#aEnd#: #a#169#aEnd#</a></h1>

<ul><li>#b#161#bEnd#: #a#161#aEnd#</li>
	<li>#b#158#bEnd#: #a#158#aEnd#</li>
	<li>#b#156#bEnd#: #a#156#aEnd#</li>
	<li>#b#157#bEnd#: #a#157#aEnd#</li>
	<li>#b#718#bEnd#: #a#718#aEnd#</li>
</ul><hr /> #b#170#bEnd#: #a#170#aEnd#
<hr /><span><em>#t#LBL_NOTICE_FOOTER#tEnd#</em></span></div>', 'PLL_RECORD');
        $records[] = array(44, 'Customer Portal Login Details', 'Contacts', 'Customer Portal Login Details', '<p>#s#LogoImage#sEnd# </p><p>Dear #a#67#aEnd#  #a#70#aEnd#</p><p>Created for your account in the customer portal, below sending data access.</p><p>Login: #a#80#aEnd#<br />Password: #s#ContactsPortalPass#sEnd#</p><p>Regards</p>', 'PLL_RECORD');
        $records[] = array(45, 'Send invitations', 'Events', '#a#267#aEnd#:  #a#255#aEnd#', '<table border="0" cellpadding="8" cellspacing="0" style="width:100%;font-family:Arial, \'Sans-serif\';border:1px solid #ccc;border-width:1px 2px 2px 1px;background-color:#fff;" summary=""><tbody><tr><td style="background-color:#f6f6f6;color:#888;border-bottom:1px solid #ccc;font-family:Arial, \'Sans-serif\';font-size:11px;">
			<h3 style="padding:0 0 6px 0;margin:0;font-family:Arial, \'Sans-serif\';font-size:16px;font-weight:bold;color:#222;"><span>#a#255#aEnd#</span></h3>
			</td>
		</tr><tr><td>
			<div style="padding:2px;">
			<table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="padding:0 1em 10px 0;font-family:Arial,\'Sans-serif\';font-size:13px;color:#888;white-space:nowrap;" valign="top">
						<div><i style="font-style:normal;">#b#257#bEnd#</i></div>
						</td>
						<td style="padding-bottom:10px;font-family:Arial, \'Sans-serif\';font-size:13px;color:#222;" valign="top">#a#257#aEnd# #a#258#aEnd#</td>
					</tr><tr><td style="padding:0 1em 10px 0;font-family:Arial, \'Sans-serif\';font-size:13px;color:#888;white-space:nowrap;" valign="top">
						<div><i style="font-style:normal;">#b#259#bEnd#</i></div>
						</td>
						<td style="padding-bottom:10px;font-family:Arial, \'Sans-serif\';font-size:13px;color:#222;" valign="top">#a#259#aEnd# #a#260#aEnd#</td>
					</tr><tr><td style="padding:0 1em 10px 0;font-family:Arial, \'Sans-serif\';font-size:13px;color:#888;white-space:nowrap;" valign="top">
						<div><i style="font-style:normal;">#b#264#bEnd#</i></div>
						</td>
						<td style="padding-bottom:10px;font-family:Arial, \'Sans-serif\';font-size:13px;color:#222;" valign="top">#a#264#aEnd#</td>
					</tr><tr><td style="padding:0 1em 10px 0;font-family:Arial, \'Sans-serif\';font-size:13px;color:#888;white-space:nowrap;" valign="top">
						<div><i style="font-style:normal;">#b#277#bEnd#</i></div>
						</td>
						<td style="padding-bottom:10px;font-family:Arial, \'Sans-serif\';font-size:13px;color:#222;" valign="top">#a#277#aEnd#</td>
					</tr><tr><td style="padding:0 1em 10px 0;font-family:Arial, \'Sans-serif\';font-size:13px;color:#888;white-space:nowrap;" valign="top">
						<div><i style="font-style:normal;">#b#267#bEnd#</i></div>
						</td>
						<td style="padding-bottom:10px;font-family:Arial, \'Sans-serif\';font-size:13px;color:#222;" valign="top">#a#267#aEnd#</td>
					</tr><tr><td style="padding:0 1em 10px 0;font-family:Arial, \'Sans-serif\';font-size:13px;color:#888;white-space:nowrap;" valign="top">
						<div><i style="font-style:normal;">#b#271#bEnd#</i></div>
						</td>
						<td style="padding-bottom:10px;font-family:Arial, \'Sans-serif\';font-size:13px;color:#222;" valign="top">#a#271#aEnd#</td>
					</tr><tr><td style="padding:0 1em 10px 0;font-family:Arial, \'Sans-serif\';font-size:13px;color:#888;white-space:nowrap;" valign="top">
						<div><i style="font-style:normal;">#b#268#bEnd#</i></div>
						</td>
						<td style="padding-bottom:10px;font-family:Arial, \'Sans-serif\';font-size:13px;color:#222;" valign="top"><span><span>#a#268#aEnd#</span><span dir="ltr"> (<a href="https://maps.google.pl/maps?q=%23a%23268%23aEnd%23" style="color:#20c;white-space:nowrap;">mapa</a>)</span></span></td>
					</tr><tr><td style="padding:0 1em 10px 0;font-family:Arial, \'Sans-serif\';font-size:13px;color:#888;white-space:nowrap;" valign="top">
						<div><i style="font-style:normal;">#b#265#bEnd#</i></div>
						</td>
						<td style="padding-bottom:10px;font-family:Arial, \'Sans-serif\';font-size:13px;color:#222;" valign="top">#a#265#aEnd#</td>
					</tr><tr><td style="padding:0 1em 10px 0;font-family:Arial, \'Sans-serif\';font-size:13px;color:#888;white-space:nowrap;" valign="top">
						<div><i style="font-style:normal;">#b#275#bEnd#</i></div>
						</td>
						<td style="padding-bottom:10px;font-family:Arial, \'Sans-serif\';font-size:13px;color:#222;" valign="top">#a#275#aEnd#</td>
					</tr><tr><td style="padding:0 1em 10px 0;font-family:Arial, \'Sans-serif\';font-size:13px;color:#888;white-space:nowrap;" valign="top">
						<div><i style="font-style:normal;">#b#256#bEnd#</i></div>
						</td>
						<td style="padding-bottom:10px;font-family:Arial, \'Sans-serif\';font-size:13px;color:#222;" valign="top">#a#256#aEnd#</td>
					</tr></tbody></table></div>
			</td>
		</tr><tr><td style="background-color:#f6f6f6;color:#888;border-top:1px solid #ccc;font-family:Arial, \'Sans-serif\';font-size:11px;">
			<p>YetiForce CRM - Notification activities on the calendar</p>
			</td>
		</tr></tbody></table>', 'PLL_RECORD');
        $records[] = array(46, 'Send Notification Email to Record Owner', 'Calendar', 'Task :  #a#231#aEnd#', '#a#232#aEnd#<br /><br />Activity Notification Details:<br />Subject : #a#231#aEnd#<br />Start date and time : #a#233#aEnd# #a#234#aEnd#<br />End date and time : #a#235#aEnd# #a#236#aEnd#<br />Status : #a#239#aEnd#<br />Priority : #a#241#aEnd#<br />Related To : #a#237#aEnd#<br />Contacts List : #a#238#aEnd#<br />Location : #a#250#aEnd#<br />Description : #a#247#aEnd#', 'PLL_RECORD');
        $records[] = array(93, 'Activity Reminder Notification', 'Calendar', 'Reminder:  #a#231#aEnd#', 'This is a reminder notification for the Activity:<br />Subject: #a#231#aEnd#<br />Date & Time: #a#233#aEnd# #a#234#aEnd#<br /><span style=\\"color:rgb(43,43,43);font-family:\'Helvetica Neue\', Helvetica, Arial, sans-serif;line-height:20.7999992370605px;\\">Contact Name: </span>#a#238#aEnd#<br style=\\"color:rgb(43,43,43);font-family:\'Helvetica Neue\', Helvetica, Arial, sans-serif;line-height:20.7999992370605px;\\" /><span style=\\"color:rgb(43,43,43);font-family:\'Helvetica Neue\', Helvetica, Arial, sans-serif;line-height:20.7999992370605px;\\">Related To: </span>#a#237#aEnd#<br style=\\"color:rgb(43,43,43);font-family:\'Helvetica Neue\', Helvetica, Arial, sans-serif;line-height:20.7999992370605px;\\" /><span style=\\"color:rgb(43,43,43);font-family:\'Helvetica Neue\', Helvetica, Arial, sans-serif;line-height:20.7999992370605px;\\">Description: </span>#a#247#aEnd#', 'PLL_RECORD');
        $records[] = array(94, 'Activity Reminder Notification', 'Events', 'Reminder: #a#255#aEnd#', '<span style=\\"line-height:20.7999992370605px;\\">This is a reminder notification for the Activity:</span><br style=\\"line-height:20.7999992370605px;\\" /><span style=\\"line-height:20.7999992370605px;\\">Subject:</span>#a#255#aEnd#<br style=\\"line-height:20.7999992370605px;\\" /><span style=\\"line-height:20.7999992370605px;\\">Date & Time: </span>#a#257#aEnd# #a#258#aEnd#<br style=\\"line-height:20.7999992370605px;\\" /><span style=\\"line-height:20.7999992370605px;color:rgb(43,43,43);font-family:\'Helvetica Neue\', Helvetica, Arial, sans-serif;\\">Contact Name: </span>#a#277#aEnd#<br style=\\"line-height:20.7999992370605px;color:rgb(43,43,43);font-family:\'Helvetica Neue\', Helvetica, Arial, sans-serif;\\" /><span style=\\"line-height:20.7999992370605px;color:rgb(43,43,43);font-family:\'Helvetica Neue\', Helvetica, Arial, sans-serif;\\">Related To: </span>#a#264#aEnd#<br style=\\"line-height:20.7999992370605px;color:rgb(43,43,43);font-family:\'Helvetica Neue\', Helvetica, Arial, sans-serif;\\" /><span style=\\"line-height:20.7999992370605px;color:rgb(43,43,43);font-family:\'Helvetica Neue\', Helvetica, Arial, sans-serif;\\">Description: </span>#a#275#aEnd#', 'PLL_RECORD');
        $records[] = array(95, 'Test mail about the mail server configuration.', 'Users', 'Test mail about the mail server configuration.', '<span style=\\"color:rgb(0,0,0);font-family:arial, sans-serif;line-height:normal;\\">Dear </span>#a#478#aEnd# #a#479#aEnd#<span style=\\"color:rgb(0,0,0);font-family:arial, sans-serif;line-height:normal;\\">, </span><br style=\\"color:rgb(0,0,0);font-family:arial, sans-serif;line-height:normal;\\" /><br style=\\"color:rgb(0,0,0);font-family:arial, sans-serif;line-height:normal;\\" /><b style=\\"color:rgb(0,0,0);font-family:arial, sans-serif;line-height:normal;\\">This is a test mail sent to confirm if a mail is actually being sent through the smtp server that you have configured. </b><br style=\\"color:rgb(0,0,0);font-family:arial, sans-serif;line-height:normal;\\" /><span style=\\"color:rgb(0,0,0);font-family:arial, sans-serif;line-height:normal;\\">Feel free to delete this mail. </span><br style=\\"color:rgb(0,0,0);font-family:arial, sans-serif;line-height:normal;\\" /><br style=\\"color:rgb(0,0,0);font-family:arial, sans-serif;line-height:normal;\\" /><span style=\\"color:rgb(0,0,0);font-family:arial, sans-serif;line-height:normal;\\">Thanks and Regards,</span><br style=\\"color:rgb(0,0,0);font-family:arial, sans-serif;line-height:normal;\\" /><span style=\\"color:rgb(0,0,0);font-family:arial, sans-serif;line-height:normal;\\">Team YetiForce</span>', 'PLL_RECORD');
        $records[] = array(103, 'ForgotPassword', 'Users', 'Request: ForgotPassword', 'Dear user,<br /><br />\\r\\nYou recently requested a password reset for your YetiForce CRM.<br />\\r\\nTo create a new password, click on the link #s#LinkToForgotPassword#sEnd#.<br /><br />\\r\\nThis request was made on #s#CurrentDateTime#sEnd# and will expire in next 24 hours.<br /><br />\\r\\nRegards,<br />\\r\\nYetiForce CRM Support Team.', 'PLL_RECORD');
        $records[] = array(104, 'Customer Portal - ForgotPassword', 'Contacts', 'Request: ForgotPassword', 'Dear #a#67#aEnd# #a#70#aEnd#,<br /><br />
You recently requested a reminder of your access data for the YetiForce Portal.<br /><br />
You can login by entering the following data:<br /><br />
Your username: #a#80#aEnd#<br />
Your password: #s#ContactsPortalPass#sEnd#<br /><br /><br />
Regards,<br />
YetiForce CRM Support Team.', 'PLL_RECORD');
        $records[] = array(105, 'New comment added to ticket from portal', 'ModComments', 'New comment added to ticket from portal', 'Dear User,<br />
A new comment has been added to the ticket.<br />
#b#597#bEnd# #a#597#aEnd#<br /><br />
 ', 'PLL_RECORD');
        $records[] = array(106, 'New comment added to ticket', 'ModComments', 'New comment added to ticket', '<span class="value">Dear User,<br />
A new comment has been added to the ticket.<br />
#b#597#bEnd# #a#597#aEnd#</span>', 'PLL_RECORD');
        $records[] = array(107, 'Security risk has been detected - Brute Force', 'Contacts', 'Security risk has been detected', '<span class="value">Dear user,<br />
Failed login attempts have been detected. </span>', 'PLL_MODULE');
        $records[] = array(108, 'Backup has been made', 'Contacts', 'Backup has been made notification', 'Dear User,<br />
Backup has been made.', 'PLL_MODULE');
        foreach ($records as $record) {
            try {
                $instance = new $moduleName();
                $instance->column_fields['assigned_user_id'] = $assigned_user_id;
                $instance->column_fields['name'] = $record[1];
                $instance->column_fields['oss_module_list'] = $record[2];
                $instance->column_fields['subject'] = $record[3];
                $instance->column_fields['content'] = $record[4];
                $instance->column_fields['ossmailtemplates_type'] = $record[5];
                $save = $instance->save($moduleName);
                if ($record[1] == 'Test mail about the mail server configuration.') {
                    self::changeOutgoingServerFile($instance->id);
                }
                if ($record[1] == 'ForgotPassword') {
                    self::updateForgotPassword($instance->id);
                }
            } catch (Exception $e) {
                Install_InitSchema_Model::addMigrationLog('addRecords ' . $e->getMessage(), 'error');
            }
        }
        //vtiger_osspdf
        $moduleName = 'OSSPdf';
        vimport('~~modules/' . $moduleName . '/' . $moduleName . '.php');
        $records = array();
        $records[] = array('Quotes PDF', '20', 'A4', 'Portrait', '<title></title>
<title></title>
<table align="left" border="0" cellpadding="1" cellspacing="1" style="width: 100%;">
	<tbody>
		<tr>
			<td><span style="font-size:9px;"><span style="font-family: tahoma,geneva,sans-serif;"><strong>#company_organizationname#</strong><br />
			#company_address#<br />
			#company_code# #company_city#<br />
			#company_country#<br />
			tel.: #company_phone#<br />
			fax: #company_fax#<br />
			WWW: <a href="#company_website#"> #company_website#</a><br />
			VAT: #company_vatid#</span></span></td>
			<td>&nbsp;</td>
			<td>
			<div style="text-align: right;"><span style="font-size:9px;"><span style="font-family: tahoma,geneva,sans-serif;">#company_city#, #special_function#CurrentDate#end_special_function#</span></span></div>
			</td>
		</tr>
		<tr>
			<td>&nbsp;</td>
			<td>&nbsp;</td>
			<td><span style="font-size:9px;"><span style="font-family: tahoma,geneva,sans-serif;">#Contacts_firstname# #Contacts_lastname#<br />
			tel: #Contacts_phone#<br />
			email: #Contacts_email#<br />
			<br />
			<strong>#Accounts_accountname#</strong><br />
			#addresslevel8a# #buildingnumbera# #localnumbera#<br />
			#addresslevel7a# #addresslevel5a#<br />
			#Accounts_label_vat_id#: #Accounts_vat_id#</span></span></td>
		</tr>
	</tbody>
</table>

<p style="text-align: center;"><br />
<span style="font-size:14px;"><span style="font-family: tahoma,geneva,sans-serif;"><strong>Offer #quote_no#</strong></span></span></p>
<span style="font-size:9px;"><span style="font-family: tahoma,geneva,sans-serif;">#description#</span></span><br />
<span>#special_function#replaceProductTable#end_special_function#</span><br />
<br />
<span style="font-size:9px;"><span style="font-family: tahoma,geneva,sans-serif;"><strong>#label_attention#: </strong>#attention#<br />
<strong>#label_currency_id#: </strong>#currency_id#<br />
<strong>#label_validtill#: </strong>#validtill#<br />
<strong>#label_shipping#: </strong>#shipping#<br />
<strong>#label_form_payment#: </strong>#form_payment#<br />
<strong>#label_terms_conditions#:</strong>#terms_conditions#</span></span><br />
<br />
<span style="font-size:9px;"><span style="font-family: tahoma,geneva,sans-serif;">#Users_first_name# #Users_last_name#<br />
email: <a href="mailto:#Users_email1#">#Users_email1#</a><br />
<br />
<strong>#company_organizationname#</strong><br />
tel.: #company_phone#<br />
fax: #company_fax#<br />
WWW: <a href="#company_website#"> #company_website#</a></span></span>', '', '', '10', '10', '10', '10', 'No', 'No', '', '', 'No', '1', '1', '1', 'Lista |##| PodglÄ…d');
        $records[] = array('Sales Order PDF', '22', 'A4', 'Portrait', '<title></title>
<title></title>
<table align="left" border="0" cellpadding="1" cellspacing="1" style="width: 100%;">
	<tbody>
		<tr>
			<td><span style="font-size:9px;"><span style="font-family: tahoma,geneva,sans-serif;"><strong>#company_organizationname#</strong><br />
			#company_address#<br />
			#company_code# #company_city#<br />
			#company_country#<br />
			tel.: #company_phone#<br />
			fax: #company_fax#<br />
			WWW: <a href="#company_website#"> #company_website#</a><br />
			VAT: #company_vatid#</span></span></td>
			<td>&nbsp;</td>
			<td>
			<div style="text-align: right;"><span style="font-size:9px;"><span style="font-family: tahoma,geneva,sans-serif;">#company_city#, #special_function#CurrentDate#end_special_function#
			</span></span></div>
			</td>
		</tr>
		<tr>
			<td>&nbsp;</td>
			<td>&nbsp;</td>
			<td><span style="font-size:9px;"><span style="font-family: tahoma,geneva,sans-serif;">#Contacts_firstname# #Contacts_lastname#<br />
			tel: #Contacts_phone#<br />
			email: #Contacts_email#<br />
			<br />
			<strong>#Accounts_accountname#</strong><br />
			#addresslevel8a# #buildingnumbera# #localnumbera#<br />
			#addresslevel7a# #addresslevel5a#<br />
			#Accounts_label_vat_id#: #Accounts_vat_id#</span></span></td>
		</tr>
	</tbody>
</table>

<p style="text-align: center;"><br />
<span style="font-size:14px;"><span style="font-family: tahoma,geneva,sans-serif;"><strong>Sales Order #salesorder_no#</strong></span></span></p>
<span style="font-size:9px;"><span style="font-family: tahoma,geneva,sans-serif;">#description#</span></span><br />
<span>#special_function#replaceProductTable#end_special_function#</span><br />
<br />
<span style="font-size:9px;"><span style="font-family: tahoma,geneva,sans-serif;"><strong>#label_attention#: </strong>#attention#<br />
<strong>#label_currency_id#: </strong>#currency_id#<br />
<strong>#label_duedate#: </strong>#duedate#<br />
<strong>#label_form_payment#: </strong>#form_payment#<br />
<strong>#Quotes_label_quote_no#: </strong>#Quotes_quote_no#<br />
<strong>#label_terms_conditions#:</strong>#terms_conditions#</span></span><br />
<br />
<span style="font-size:9px;"><span style="font-family: tahoma,geneva,sans-serif;">#Users_first_name# #Users_last_name#<br />
email: <a href="mailto:#Users_email1#">#Users_email1#</a><br />
<br />
<strong>#company_organizationname#</strong><br />
tel.: #company_phone#<br />
fax: #company_fax#<br />
WWW: <a href="#company_website#"> #company_website#</a></span></span>', '', '', '10', '10', '10', '10', 'No', 'No', '', '', 'No', '1', '1', '1', 'Lista |##| PodglÄ…d');
        $records[] = array('Invoice PDF', '23', 'A4', 'Portrait', '<title></title>
<title></title>
<table align="left" border="0" cellpadding="1" cellspacing="1" style="width: 100%;">
	<tbody>
		<tr>
			<td><span style="font-size:9px;"><span style="font-family: tahoma,geneva,sans-serif;"><strong>#company_organizationname#</strong><br />
			#company_address#<br />
			#company_code# #company_city#<br />
			#company_country#<br />
			tel.: #company_phone#<br />
			fax: #company_fax#<br />
			WWW: <a href="#company_website#"> #company_website#</a><br />
			VAT: #company_vatid#</span></span></td>
			<td>&nbsp;</td>
			<td>
			<div style="text-align: right;"><span style="font-size:9px;"><span style="font-family: tahoma,geneva,sans-serif;">#label_invoicedate#: #invoicedate#
			</span></span></div>
			</td>
		</tr>
		<tr>
			<td>&nbsp;</td>
			<td>&nbsp;</td>
			<td><span style="font-size:9px;"><span style="font-family: tahoma,geneva,sans-serif;">#Contacts_firstname# #Contacts_lastname#<br />
			tel: #Contacts_phone#<br />
			email: #Contacts_email#<br />
			<br />
			<strong>#Accounts_accountname#</strong><br />
			#addresslevel8a# #buildingnumbera# #localnumbera#<br />
			#addresslevel7a# #addresslevel5a#<br />
			#Accounts_label_vat_id#: #Accounts_vat_id#</span></span></td>
		</tr>
	</tbody>
</table>

<p style="text-align: center;"><br />
<span style="font-size:14px;"><span style="font-family: tahoma,geneva,sans-serif;"><strong>Invoice #invoice_no#</strong></span></span></p>
<span style="font-size:9px;"><span style="font-family: tahoma,geneva,sans-serif;">#description#</span></span><br />
<span>#special_function#replaceProductTable#end_special_function#</span><br />
<br />
<span style="font-size:9px;"><span style="font-family: tahoma,geneva,sans-serif;"><strong>#label_attention#: </strong>#attention#<br />
<strong>#label_currency_id#: </strong>#currency_id#<br />
<strong>#label_invoicedate#: </strong>#invoicedate#<br />
<strong>#label_duedate#: </strong>#duedate#<br />
<strong>#label_form_payment#: </strong>#form_payment#<br />
<strong>Sales Order: </strong>#SalesOrder_salesorder_no#<br />
<strong>#label_terms_conditions#:</strong>#terms_conditions#</span></span><br />
<br />
<span style="font-size:9px;"><span style="font-family: tahoma,geneva,sans-serif;">#Users_first_name# #Users_last_name#<br />
email: <a href="mailto:#Users_email1#">#Users_email1#</a><br />
<br />
<strong>#company_organizationname#</strong><br />
tel.: #company_phone#<br />
fax: #company_fax#<br />
WWW: <a href="#company_website#"> #company_website#</a></span></span>', '', '', '10', '10', '10', '10', 'No', 'No', '', '', 'No', '1', '1', '1', 'Lista |##| PodglÄ…d');
        $records[] = array('Purchase Order PDF', '21', 'A4', 'Portrait', '<title></title>
<title></title>
<table align="left" border="0" cellpadding="1" cellspacing="1" style="width: 100%;">
	<tbody>
		<tr>
			<td><span style="font-size:9px;"><span style="font-family: tahoma,geneva,sans-serif;"><strong>#company_organizationname#</strong><br />
			#company_address#<br />
			#company_code# #company_city#<br />
			#company_country#<br />
			tel.: #company_phone#<br />
			fax: #company_fax#<br />
			WWW: <a href="#company_website#"> #company_website#</a><br />
			VAT: #company_vatid#</span></span></td>
			<td>&nbsp;</td>
			<td>
			<div style="text-align: right;"><span style="font-size:9px;"><span style="font-family: tahoma,geneva,sans-serif;">#company_city#, #special_function#CurrentDate#end_special_function# </span></span></div>
			</td>
		</tr>
		<tr>
			<td>&nbsp;</td>
			<td>&nbsp;</td>
			<td><span style="font-size:9px;"><span style="font-family: tahoma,geneva,sans-serif;">#Contacts_firstname# #Contacts_lastname#<br />
			tel: #Contacts_phone#<br />
			email: #Contacts_email#<br />
			<br />
			<strong>#Vendors_vendorname#</strong><br />
			#addresslevel8a# #buildingnumbera# #localnumbera#<br />
			#addresslevel7a# #addresslevel5a#<br />
			#Vendors_label_vat_id#: #Vendors_vat_id#</span></span></td>
		</tr>
	</tbody>
</table>

<p style="text-align: center;"><br />
<span style="font-size:14px;"><span style="font-family: tahoma,geneva,sans-serif;"><strong>Order confirmation #purchaseorder_no#</strong></span></span></p>
<span style="font-size:9px;"><span style="font-family: tahoma,geneva,sans-serif;">Thank you for your order. Herewith we are pleased to confirm it as follows.<br />
#description#</span></span><br />
<span>#special_function#replaceProductTable#end_special_function#</span><br />
<br />
<span style="font-size:9px;"><span style="font-family: tahoma,geneva,sans-serif;"><strong>#label_attention#: </strong>#attention#<br />
<strong>#label_currency_id#: </strong>#currency_id#<br />
<strong>#label_duedate#: </strong>#duedate#<br />
<strong>#label_terms_conditions#:</strong>#terms_conditions#</span></span><br />
<br />
<span style="font-size:9px;"><span style="font-family: tahoma,geneva,sans-serif;">#Users_first_name# #Users_last_name#<br />
email: <a href="mailto:#Users_email1#">#Users_email1#</a><br />
<br />
<strong>#company_organizationname#</strong><br />
tel.: #company_phone#<br />
fax: #company_fax#<br />
WWW: <a href="#company_website#"> #company_website#</a></span></span>', '', '', '10', '10', '10', '10', 'No', 'No', '', '', 'No', '1', '1', '1', 'Lista |##| PodglÄ…d');
        $records[] = array('Calculation PDF', '70', 'A4', 'Portrait', '', '', '', '10', '10', '10', '10', 'No', 'No', '', '<title></title>
<table width="537px">
	<tbody>
		<tr>
			<td colspan="6" rowspan="2"><img src="#special_function#siteUrl#end_special_function#storage/Logo/logo_yetiforce.png" style="width: 200px;" width="200" /></td>
			<td colspan="4"><span style="font-size:6px;">#company_organizationname# #company_address# #company_code# #company_city#. VAT:#company_vatid#</span></td>
		</tr>
		<tr>
			<td colspan="5">
			<table border="1">
				<tbody>
					<tr>
						<td>
						<table cellpadding="1">
							<tbody>
								<tr>
									<td style="text-align: center;"><span style="font-size:9px;">Calculation confirmation: <strong>#calculations_no#</strong></span></td>
								</tr>
							</tbody>
						</table>
						</td>
					</tr>
					<tr>
						<td>
						<table cellpadding="1">
							<tbody>
								<tr>
									<td style="text-align: center;"><span style="font-size:9px;">Date: #special_function#CreatedDateTime#end_special_function#</span></td>
								</tr>
							</tbody>
						</table>
						</td>
					</tr>
				</tbody>
			</table>
			</td>
		</tr>
		<tr>
			<td colspan="7">&nbsp;</td>
			<td colspan="5" rowspan="2">
			<table border="1">
				<tbody>
					<tr>
						<td>
						<table cellpadding="5">
							<tbody>
								<tr>
									<td>
									<table cellpadding="0" style="font-size:8px;">
										<tbody>
											<tr>
												<td colspan="2">Issued by:</td>
												<td colspan="3">#Users_first_name# #Users_last_name#</td>
											</tr>
											<tr>
												<td colspan="2">Email:</td>
												<td colspan="3">#Users_email1#</td>
											</tr>
										</tbody>
									</table>
									</td>
								</tr>
							</tbody>
						</table>
						</td>
					</tr>
				</tbody>
			</table>
			</td>
		</tr>
		<tr>
			<td colspan="3">
			<table>
				<tbody>
					<tr>
						<td><span style="font-size:10px;">&nbsp;<span style="font-size:8px;">#Accounts_account_no#</span></span></td>
					</tr>
					<tr>
						<td>
						<table>
							<tbody>
								<tr>
									<td>
									<p><span style="font-size:10px;">#Accounts_accountname#<br />
									<span style="font-size:8px;">#Accounts_addresslevel8b# #Accounts_buildingnumberb# #Accounts_localnumberb#<br />
									#Accounts_addresslevel7b#, #Accounts_addresslevel5b#<br />
									<span style="font-size:10px;">#Accounts_addresslevel1b#</span><br />
									#Accounts_vat_id#<br />
									#Contacts_email#</span></span></p>
									</td>
								</tr>
							</tbody>
						</table>
						</td>
					</tr>
				</tbody>
			</table>
			</td>
			<td colspan="3">&nbsp;</td>
		</tr>
	</tbody>
</table>
&nbsp;

<table>
	<tbody>
		<tr>
			<td>&nbsp;</td>
		</tr>
		<tr>
			<td>#special_function#replaceProductTable#end_special_function#</td>
		</tr>
	</tbody>
</table>', 'No', '1', '1', '0', 'Lista |##| PodglÄ…d');
        foreach ($records as $record) {
            try {
                $instance = new $moduleName();
                $instance->column_fields['assigned_user_id'] = $assigned_user_id;
                $instance->column_fields['title'] = $record[0];
                $instance->column_fields['moduleid'] = $record[1];
                $instance->column_fields['osspdf_pdf_format'] = $record[2];
                $instance->column_fields['osspdf_pdf_orientation'] = $record[3];
                $instance->column_fields['content'] = $record[4];
                $instance->column_fields['constraints'] = $record[5];
                $instance->column_fields['filename'] = $record[6];
                $instance->column_fields['left_margin'] = $record[7];
                $instance->column_fields['right_margin'] = $record[8];
                $instance->column_fields['top_margin'] = $record[9];
                $instance->column_fields['bottom_margin'] = $record[10];
                $instance->column_fields['osspdf_enable_footer'] = $record[11];
                $instance->column_fields['osspdf_enable_header'] = $record[12];
                $instance->column_fields['header_content'] = $record[13];
                $instance->column_fields['footer_content'] = $record[14];
                $instance->column_fields['osspdf_enable_numbering'] = $record[15];
                $instance->column_fields['height_header'] = $record[16];
                $instance->column_fields['height_footer'] = $record[17];
                $instance->column_fields['selected'] = $record[18];
                $instance->column_fields['osspdf_view'] = $record[19];
                $saved = $instance->save($moduleName);
            } catch (Exception $e) {
                Install_InitSchema_Model::addMigrationLog('addRecords ' . $e->getMessage(), 'error');
            }
        }
        // vtiger_picklist_dependency
        $sql = "SELECT * FROM `vtiger_picklist_dependency_seq`;";
        $result = $adb->query($sql);
        $num = $adb->num_rows($result);
        if (!$num) {
            $adb->pquery('insert  into `vtiger_picklist_dependency_seq`(`id`) values (?);', array(0));
        }
        $moduleName = 'Leads';
        $dependencyMap['sourcefield'] = 'industry';
        $dependencyMap['targetfield'] = 'subindustry';
        $targetvalues = '["Ministry","Chancellery","Voivodeship Office","Marshal Office","Poviat","City\\/Township\\/District","Social Welfare Centre","Water and Sewerage Company","Voivodeship Job Centre","Poviat Job Centre","Court of justice","Attorney General\'s Office","Other"]';
        $targetvalues = Zend_Json::decode($targetvalues);
        $dependencyMap['valuemapping'][] = array('sourcevalue' => 'Administration', 'targetvalues' => $targetvalues);
        $targetvalues = '["Other","Deweloperzy","Real Estate"]';
        $targetvalues = Zend_Json::decode($targetvalues);
        $dependencyMap['valuemapping'][] = array('sourcevalue' => 'Construction Industry', 'targetvalues' => $targetvalues);
        $targetvalues = '["Other","Primary Schools","High Schools"]';
        $targetvalues = Zend_Json::decode($targetvalues);
        $dependencyMap['valuemapping'][] = array('sourcevalue' => 'Education', 'targetvalues' => $targetvalues);
        $targetvalues = '[""]';
        $targetvalues = Zend_Json::decode($targetvalues);
        $dependencyMap['valuemapping'][] = array('sourcevalue' => 'Power Industry', 'targetvalues' => $targetvalues);
        $targetvalues = '["Other","Banking","Capital Market","Financial Services","Investments","Insurance"]';
        $targetvalues = Zend_Json::decode($targetvalues);
        $dependencyMap['valuemapping'][] = array('sourcevalue' => 'Finance', 'targetvalues' => $targetvalues);
        $targetvalues = '["Other","Retail","Wholesale","Resale"]';
        $targetvalues = Zend_Json::decode($targetvalues);
        $dependencyMap['valuemapping'][] = array('sourcevalue' => 'Trade', 'targetvalues' => $targetvalues);
        $targetvalues = '[""]';
        $targetvalues = Zend_Json::decode($targetvalues);
        $dependencyMap['valuemapping'][] = array('sourcevalue' => 'Hotels and Restaurants', 'targetvalues' => $targetvalues);
        $targetvalues = '[""]';
        $targetvalues = Zend_Json::decode($targetvalues);
        $dependencyMap['valuemapping'][] = array('sourcevalue' => 'Health Care', 'targetvalues' => $targetvalues);
        $targetvalues = '["Other","Automotive","Plastics","Chamical","Raw material","Fuel","Wood and paper","Electromechanical","Pharmaceutical","Building Materials","Metal","Light","Food industry","Recycling"]';
        $targetvalues = Zend_Json::decode($targetvalues);
        $dependencyMap['valuemapping'][] = array('sourcevalue' => 'Industry / Manufacturing', 'targetvalues' => $targetvalues);
        $targetvalues = '["Army","Police"]';
        $targetvalues = Zend_Json::decode($targetvalues);
        $dependencyMap['valuemapping'][] = array('sourcevalue' => 'Uniformed Services', 'targetvalues' => $targetvalues);
        $targetvalues = '[""]';
        $targetvalues = Zend_Json::decode($targetvalues);
        $dependencyMap['valuemapping'][] = array('sourcevalue' => 'Transport & Logistics', 'targetvalues' => $targetvalues);
        $targetvalues = '["Other","Information Technology","Telecommunication","Media"]';
        $targetvalues = Zend_Json::decode($targetvalues);
        $dependencyMap['valuemapping'][] = array('sourcevalue' => 'Technologies', 'targetvalues' => $targetvalues);
        Vtiger_DependencyPicklist::savePickListDependencies($moduleName, $dependencyMap);
        //info on migration
        $adb->pquery("INSERT INTO yetiforce_updates (`time`, `user`, `name`, `from_version`, `to_version`, `result`) VALUES  (?, ?, ?, ?, ?, ?)", array(date('Y-m-d H:i:s'), $this->adminId, 'migration', $this->name, 'Yetiforce CRM 1.0.0', 1));
        $log->debug("Exiting VT620_to_YT::addRecords() method ...");
    }
 /**
  * Update the value for relation
  * @param string $sourceModule Source module name
  * @param int $sourceRecord Source record
  */
 public function reloadValue($sourceModule, $sourceRecord)
 {
     $currentUser = vglobal('current_user');
     $user = new Users();
     vglobal('current_user', $user->retrieveCurrentUserInfoFromFile(Users::getActiveAdminId()));
     vglobal('currentModule', $sourceModule);
     $db = PearDatabase::getInstance();
     $params = $this->get('field')->getFieldParams();
     $sourceRecordModel = Vtiger_Record_Model::getInstanceById($sourceRecord, $sourceModule);
     $targetModel = Vtiger_RelationListView_Model::getInstance($sourceRecordModel, $params['module']);
     $fieldInfo = Vtiger_Functions::getModuleFieldInfoWithId($params['field']);
     $query = $targetModel->getRelationQuery();
     $explodedQuery = explode('FROM', $query, 2);
     $relationQuery = 'SELECT DISTINCT ' . $fieldInfo['columnname'] . ' FROM' . $explodedQuery[1] . ' AND ' . $fieldInfo['columnname'] . " <> ''";
     vglobal('current_user', $currentUser);
     $result = $db->query($relationQuery);
     $currentValue = self::COMMA;
     while ($value = $db->getSingleValue($result)) {
         $currentValue .= $value . self::COMMA;
     }
     $db->update($this->get('field')->get('table'), [$this->get('field')->get('column') => $currentValue], $sourceRecordModel->getEntity()->tab_name_index[$this->get('field')->get('table')] . ' = ?', [$sourceRecord]);
 }
Example #20
0
/**
 * Get PriceBook list
 * 
 * @param array $input_array    input data
 * @return array                resulted data
 */
function get_pricebooks_list($input_array)
{
    require_once 'modules/PriceBooks/PriceBooks.php';
    require_once 'include/utils/UserInfoUtil.php';
    global $adb, $log;
    global $current_user;
    require_once 'modules/Users/Users.php';
    $log->debug("Entering customer portal function get_pricebooks_list");
    $user = new Users();
    $userid = getPortalUserid();
    $show_all = show_all('PriceBooks');
    $current_user = $user->retrieveCurrentUserInfoFromFile($userid);
    $id = $input_array['id'];
    $only_mine = $input_array['onlymine'];
    $only_base = $input_array['onlybase'];
    $sessionid = $input_array['sessionid'];
    if (!validateSession($id, $sessionid)) {
        return null;
    }
    $entity_ids_list = array();
    if ($only_mine == 'true') {
        array_push($entity_ids_list, $id);
    } else {
        // TODO
    }
    $focus = new PriceBooks();
    $focus->filterInactiveFields('PriceBooks');
    foreach ($focus->list_fields as $fieldlabel => $values) {
        foreach ($values as $table => $fieldname) {
            $fields_list[$fieldlabel] = $fieldname;
        }
    }
    $FieldVisibilityByColumn = array();
    foreach ($fields_list as $fieldlabel => $fieldname) {
        $FieldVisibilityByColumn[$fieldname] = getColumnVisibilityPermission($current_user->id, $fieldname, 'PriceBooks');
    }
    // PriceBooks items selection
    $query = "SELECT * FROM vtiger_pricebook " . "INNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid = vtiger_pricebook.pricebookid AND vtiger_crmentity.deleted = 0 " . "WHERE active = 1 ";
    if (count($entity_ids_list) > 0) {
        $query .= "AND owner_id IN (" . generateQuestionMarks($entity_ids_list) . ")";
    }
    $params = array($entity_ids_list);
    $res = $adb->pquery($query, $params);
    $noofdata = $adb->num_rows($res);
    for ($j = 0; $j < $noofdata; $j++) {
        $i = 0;
        foreach ($fields_list as $fieldlabel => $fieldname) {
            if (strcmp($fieldname, 'active') == 0) {
                continue;
            }
            $fieldper = $FieldVisibilityByColumn[$fieldname];
            if ($fieldper == '1') {
                continue;
            }
            $output[0]['head'][0][$i]['fielddata'] = $fieldlabel;
            $fieldvalue = $adb->query_result($res, $j, $fieldname);
            $pricebookid = $adb->query_result($res, $j, 'pricebookid');
            if ($fieldname == 'bookname') {
                $fieldvalue = '<a href="index.php?module=PriceBooks&action=index&fun=detail&pricebookid=' . $pricebookid . '">' . $fieldvalue . '</a>';
            }
            if ($fieldname == 'owner_id') {
                // TODO
            }
            $output[1]['data'][$j][$i]['fielddata'] = $fieldvalue;
            $i++;
        }
    }
    $log->debug("Exiting customer portal function get_pricebooks_list");
    return $output;
}
Example #21
0
	public function getUserName($id)
	{
		if (key_exists($id, self::$users)) {
			return self::$users[$id];
		}
		$entityData = Vtiger_Functions::getEntityModuleInfo('Users');
		$user = new Users();
		$currentUser = $user->retrieveCurrentUserInfoFromFile($id);
		$colums = [];
		foreach (explode(',', $entityData['fieldname']) as &$fieldname) {
			$colums[] = $currentUser->column_fields[$fieldname];
		}
		$name = implode(' ', $colums);
		self::$users[$id] = $name;
		return $name;
	}
Example #22
0
/**
 * Function to get the vtiger_activity details for mail body
 * @param   string   $description       - activity description
 * @param   string   $from              - to differenciate from notification to invitation.
 * return   string   $list              - HTML in string format
 */
function getActivityDetails($description, $user_id, $from = '')
{
    global $log, $current_user, $current_language, $adb;
    require_once 'include/utils/utils.php';
    $mod_strings = return_module_language($current_language, 'Calendar');
    $log->debug("Entering getActivityDetails(" . $description . ") method ...");
    $updated = $mod_strings['LBL_UPDATED'];
    $created = $mod_strings['LBL_CREATED'];
    $reply = $description['mode'] == 'edit' ? "{$updated}" : "{$created}";
    if ($description['activity_mode'] == "Events") {
        $end_date_lable = $mod_strings['End date and time'];
    } else {
        $end_date_lable = $mod_strings['Due Date'];
    }
    $name = getUserFullName($user_id);
    $inviteuser = new Users();
    $inviteuser->retrieveCurrentUserInfoFromFile($user_id);
    $stdatetime = new DateTimeField($description['st_date_time']);
    $etdatetime = new DateTimeField($description['end_date_time']);
    if ($from == "invite") {
        $msg = getTranslatedString($mod_strings['LBL_ACTIVITY_INVITATION']);
    } else {
        $msg = getTranslatedString($mod_strings['LBL_ACTIVITY_NOTIFICATION']);
    }
    $current_username = getUserFullName($current_user->id);
    $status = getTranslatedString($description['status'], 'Calendar');
    $list = $name . ',';
    $list .= '<br><br>' . $msg . ' ' . $reply . '.<br> ' . $mod_strings['LBL_DETAILS_STRING'] . ':<br>';
    $list .= '<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . $mod_strings["LBL_SUBJECT"] . ' : ' . $description['subject'];
    $list .= '<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . $mod_strings["Start date and time"] . ' : ' . $stdatetime->getDisplayDateTimeValue($inviteuser) . ' ' . $inviteuser->column_fields['time_zone'];
    $list .= '<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . $end_date_lable . ' : ' . $etdatetime->getDisplayDateTimeValue($inviteuser) . ' ' . $inviteuser->column_fields['time_zone'];
    $list .= '<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . $mod_strings["LBL_STATUS"] . ': ' . $status;
    $list .= '<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . $mod_strings["Priority"] . ': ' . getTranslatedString($description['taskpriority']);
    $list .= '<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . $mod_strings["Related To"] . ': ' . getTranslatedString($description['relatedto']);
    if (!empty($description['contact_name'])) {
        $list .= '<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . $mod_strings["LBL_CONTACT_LIST"] . ' ' . $description['contact_name'];
    } else {
        $list .= '<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . $mod_strings["Location"] . ' : ' . $description['location'];
    }
    $list .= '<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . $mod_strings["LBL_APP_DESCRIPTION"] . ': ' . $description['description'];
    $list .= '<br><br>' . $mod_strings["LBL_REGARDS_STRING"] . ' ,';
    $list .= '<br>' . $current_username . '.';
    $log->debug("Exiting getActivityDetails method ...");
    return $list;
}
Example #23
0
 /**
  * Function to get the list of Header Links
  * @return <Array> - List of Vtiger_Link_Model instances
  */
 public function getHeaderLinks(Vtiger_Request $request)
 {
     $userModel = Users_Record_Model::getCurrentUserModel();
     $headerLinks = [];
     if ($userModel->isAdminUser()) {
         if ($request->get('parent') != 'Settings') {
             $headerLinks[] = ['linktype' => 'HEADERLINK', 'linklabel' => 'LBL_SYSTEM_SETTINGS', 'linkurl' => 'index.php?module=Vtiger&parent=Settings&view=Index', 'glyphicon' => 'glyphicon glyphicon-cog'];
         } else {
             $headerLinks[] = ['linktype' => 'HEADERLINK', 'linklabel' => 'LBL_USER_PANEL', 'linkurl' => 'index.php', 'glyphicon' => 'glyphicon glyphicon-user'];
         }
     }
     //TODO To remove in the future
     if (SysSecurity::getBoolean('SHOW_MY_PREFERENCES')) {
         $headerLinks[] = ['linktype' => 'HEADERLINK', 'linklabel' => 'LBL_MY_PREFERENCES', 'linkurl' => $userModel->getPreferenceDetailViewUrl(), 'glyphicon' => 'glyphicon glyphicon-tasks'];
     }
     $headerLinks[] = ['linktype' => 'HEADERLINK', 'linklabel' => 'LBL_SIGN_OUT', 'linkurl' => 'index.php?module=Users&parent=Settings&action=Logout', 'glyphicon' => 'glyphicon glyphicon-off'];
     require 'user_privileges/switchUsers.php';
     $baseUserId = $userModel->getId();
     if (Vtiger_Session::has('baseUserId') && Vtiger_Session::get('baseUserId') != '') {
         $baseUserId = Vtiger_Session::get('baseUserId');
     }
     if (key_exists($baseUserId, $switchUsers)) {
         $childlinks = [];
         if (Vtiger_Session::has('baseUserId') && Vtiger_Session::get('baseUserId') != '') {
             $entityData = Vtiger_Functions::getEntityModuleInfo('Users');
             $user = new Users();
             $currentUser = $user->retrieveCurrentUserInfoFromFile($baseUserId);
             $colums = [];
             foreach (explode(',', $entityData['fieldname']) as $fieldname) {
                 $colums[] = $currentUser->column_fields[$fieldname];
             }
             $userName = implode(' ', $colums);
             $childlinks[] = ['linktype' => 'HEADERLINK', 'linklabel' => $userName, 'linkurl' => '?module=Users&action=SwitchUsers&id=' . $baseUserId, 'linkicon' => ''];
             $childlinks[] = ['linktype' => 'HEADERLINK', 'linklabel' => NULL];
         }
         foreach ($switchUsers[$baseUserId] as $userid => $userName) {
             if ($userid != $baseUserId) {
                 $childlinks[] = ['linktype' => 'HEADERLINK', 'linklabel' => $userName, 'linkurl' => '?module=Users&action=SwitchUsers&id=' . $userid, 'linkicon' => ''];
             }
         }
         $customHeaderLinks = ['linktype' => 'HEADERLINK', 'linklabel' => 'SwitchUsers', 'linkurl' => '', 'glyphicon' => 'glyphicon glyphicon-transfer', 'nocaret' => true, 'childlinks' => $childlinks];
         if (count($childlinks)) {
             array_push($headerLinks, $customHeaderLinks);
         }
     }
     $headerLinkInstances = [];
     foreach ($headerLinks as $headerLink) {
         $headerLinkInstance = Vtiger_Link_Model::getInstanceFromValues($headerLink);
         if (isset($headerLink['childlinks'])) {
             foreach ($headerLink['childlinks'] as $childLink) {
                 $headerLinkInstance->addChildLink(Vtiger_Link_Model::getInstanceFromValues($childLink));
             }
         }
         $headerLinkInstances[] = $headerLinkInstance;
     }
     $headerLinks = Vtiger_Link_Model::getAllByType(Vtiger_Link::IGNORE_MODULE, ['HEADERLINK']);
     foreach ($headerLinks as $headerType => $headerLinks) {
         foreach ($headerLinks as $headerLink) {
             $headerLinkInstances[] = Vtiger_Link_Model::getInstanceFromLinkObject($headerLink);
         }
     }
     return $headerLinkInstances;
 }
Example #24
0
 public function getUserName($id)
 {
     if (key_exists($id, self::$users)) {
         return self::$users[$id];
     }
     $user = new Users();
     $currentUser = $user->retrieveCurrentUserInfoFromFile($id);
     $name = $currentUser->column_fields['first_name'] . ' ' . $currentUser->column_fields['last_name'];
     self::$users[$id] = $name;
     return $name;
 }
Example #25
0
require_once 'modules/Documents/Documents.php';
require_once 'modules/Potentials/Potentials.php';
require_once 'modules/Users/Users.php';
require_once 'modules/Products/Products.php';
require_once 'modules/HelpDesk/HelpDesk.php';
require_once 'modules/Vendors/Vendors.php';
require_once 'include/utils/UserInfoUtil.php';
require_once 'modules/CustomView/CustomView.php';
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'];
function HeldDeskNewCommentOwner($entityData)
{
    $log = vglobal('log');
    $log->debug('Entering HeldDeskNewCommentAccount');
    $db = PearDatabase::getInstance();
    $wsId = $entityData->getId();
    $parts = explode('x', $wsId);
    $entityId = $parts[1];
    $data = $entityData->getData();
    $relatedToWSId = $data['related_to'];
    $relatedToId = explode('x', $relatedToWSId);
    $mails = [];
    $sql = 'SELECT smownerid FROM vtiger_crmentity WHERE deleted = 0 AND crmid = ? ';
    $result = $db->pquery($sql, [$relatedToId[1]]);
    if ($result->rowCount() > 0) {
        $smownerid = $db->getSingleValue($result);
        $ownerType = vtws_getOwnerType($smownerid);
        if ($ownerType == 'Users') {
            $user = new Users();
            $currentUser = $user->retrieveCurrentUserInfoFromFile($smownerid);
            if ($currentUser->column_fields['emailoptout'] == '1') {
                $mails[] = $currentUser->column_fields['email1'];
            }
        } else {
            require_once 'include/utils/GetGroupUsers.php';
            $ggu = new GetGroupUsers();
            $ggu->getAllUsersInGroup($smownerid);
            foreach ($ggu->group_users as $userId) {
                $user = new Users();
                $currentUser = $user->retrieveCurrentUserInfoFromFile($userId);
                if ($currentUser->column_fields['emailoptout'] == '1') {
                    $mails[] = $currentUser->column_fields['email1'];
                }
            }
        }
    }
    if (count($mails) > 0) {
        $mails = implode(',', $mails);
        $data = ['sysname' => 'NewCommentAddedToTicketOwner', 'to_email' => $mails, 'module' => 'ModComments', 'record' => $entityId];
        $recordModel = Vtiger_Record_Model::getCleanInstance('OSSMailTemplates');
        if ($recordModel->sendMailFromTemplate($data)) {
            $log->debug('HeldDeskNewCommentAccount');
            return true;
        }
    }
    $log->debug('HeldDeskNewCommentAccount');
    return false;
}
Example #27
0
*************************************************************************************************/
// Turn on debugging level
$Vtiger_Utils_Log = true;
require_once 'include/utils/utils.php';
include_once 'vtlib/Vtiger/Module.php';
require_once 'vtlib/Vtiger/Package.php';
include_once 'modules/cbupdater/cbupdater.php';
require_once "modules/com_vtiger_workflow/include.inc";
require_once "modules/com_vtiger_workflow/tasks/VTEntityMethodTask.inc";
require_once "modules/com_vtiger_workflow/VTEntityMethodManager.inc";
global $current_user, $adb, $app_strings;
set_time_limit(0);
ini_set('memory_limit', '1024M');
if (empty($current_user) or $current_user->id != 1) {
    $current_user = new Users();
    $current_user->retrieveCurrentUserInfoFromFile(1);
    // admin
}
if (empty($current_language)) {
    if (isset($_SESSION['authenticated_user_language']) && $_SESSION['authenticated_user_language'] != '') {
        $current_language = $_SESSION['authenticated_user_language'];
    } else {
        if (!empty($current_user->language)) {
            $current_language = $current_user->language;
        } else {
            $current_language = $default_language;
        }
    }
}
if (empty($app_strings)) {
    $app_strings = return_application_language($current_language);
Example #28
0
<?php

/* {[The file is published on the basis of YetiForce Public License that can be found in the following directory: licenses/License.html]} */
require_once 'include/main/WebUI.php';
$user = new Users();
$current_user = $user->retrieveCurrentUserInfoFromFile("1");
$adb = PearDatabase::getInstance();
$statusActivity = Calendar_Module_Model::getComponentActivityStateLabel();
$query = 'SELECT vtiger_activity.`activityid`, vtiger_activity.`due_date`,vtiger_activity.`time_end`,vtiger_activity.`date_start`,vtiger_activity.`time_start`,vtiger_activity.`state` FROM vtiger_activity INNER JOIN vtiger_crmentity AS crm ON crm.crmid = vtiger_activity.`activityid` WHERE vtiger_activity.`status` IN (?,?) AND crm.`deleted` = ?';
$result = $adb->pquery($query, [$statusActivity['not_started'], $statusActivity['in_realization'], 0]);
while ($row = $adb->fetch_array($result)) {
    $state = Calendar_Module_Model::getCalendarState($row);
    if ($state) {
        $recordModel = Vtiger_Record_Model::getInstanceById($row['activityid']);
        $recordModel->set('id', $row['activityid']);
        $recordModel->set('activitystatus', $state);
        $recordModel->set('mode', 'edit');
        $recordModel->save();
    }
}