本文整理汇总了PHP中Vtiger_Record_Model::getCleanInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP Vtiger_Record_Model::getCleanInstance方法的具体用法?PHP Vtiger_Record_Model::getCleanInstance怎么用?PHP Vtiger_Record_Model::getCleanInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vtiger_Record_Model
的用法示例。
在下文中一共展示了Vtiger_Record_Model::getCleanInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process
public function process(Vtiger_Request $request)
{
$viewer = $this->getViewer($request);
$moduleName = $request->getModule();
$record = $request->get('record');
if (!empty($record) && $request->get('isDuplicate') == true) {
$recordModel = Vtiger_Record_Model::getInstanceById($record, $moduleName);
$viewer->assign('MODE', '');
} else {
if (!empty($record)) {
$recordModel = Vtiger_Record_Model::getInstanceById($record, $moduleName);
$viewer->assign('RECORD_ID', $record);
$viewer->assign('MODE', 'edit');
} else {
$recordModel = Vtiger_Record_Model::getCleanInstance($moduleName);
$viewer->assign('MODE', '');
$parentId = $request->get('parentId');
$parentModule = $request->get('parentModule');
if ($parentId && $parentModule === 'HelpDesk') {
$parentRecordModel = Vtiger_Record_Model::getInstanceById($parentId, $parentModule);
$recordModel = Faq_Record_Model::getInstanceFromHelpDesk($parentRecordModel);
}
}
}
$moduleModel = $recordModel->getModule();
$fieldList = $moduleModel->getFields();
$requestFieldList = array_intersect_key($request->getAll(), $fieldList);
foreach ($requestFieldList as $fieldName => $fieldValue) {
$fieldModel = $fieldList[$fieldName];
if ($fieldModel->isEditable()) {
$recordModel->set($fieldName, $fieldModel->getDBInsertValue($fieldValue));
}
}
$recordStructureInstance = Vtiger_RecordStructure_Model::getInstanceFromRecordModel($recordModel, Vtiger_RecordStructure_Model::RECORD_STRUCTURE_MODE_EDIT);
$viewMode = $request->get('view_mode');
if (!empty($viewMode)) {
$viewer->assign('VIEW_MODE', $viewMode);
}
$picklistDependencyDatasource = Vtiger_DependencyPicklist::getPicklistDependencyDatasource($moduleName);
$viewer->assign('PICKIST_DEPENDENCY_DATASOURCE', Zend_Json::encode($picklistDependencyDatasource));
$mappingRelatedField = $moduleModel->getMappingRelatedField($moduleName);
$viewer->assign('MAPPING_RELATED_FIELD', Zend_Json::encode($mappingRelatedField));
$viewer->assign('RECORD_STRUCTURE_MODEL', $recordStructureInstance);
$viewer->assign('RECORD_STRUCTURE', $recordStructureInstance->getStructure());
$viewer->assign('MODULE', $moduleName);
$viewer->assign('RECORD', $recordModel);
$viewer->assign('BLOCK_LIST', $moduleModel->getBlocks());
$viewer->assign('CURRENTDATE', date('Y-n-j'));
$viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());
$isRelationOperation = $request->get('relationOperation');
//if it is relation edit
$viewer->assign('IS_RELATION_OPERATION', $isRelationOperation);
if ($isRelationOperation) {
$viewer->assign('SOURCE_MODULE', $request->get('sourceModule'));
$viewer->assign('SOURCE_RECORD', $request->get('sourceRecord'));
}
$viewer->assign('MAX_UPLOAD_LIMIT_MB', Vtiger_Util_Helper::getMaxUploadSize());
$viewer->assign('MAX_UPLOAD_LIMIT', vglobal('upload_maxsize'));
$viewer->view('EditView.tpl', $moduleName);
}
示例2: process
public function process(Vtiger_Request $request)
{
$adb = PearDatabase::getInstance();
$metod = $request->get('metod');
$params = $request->get('params');
$params['folder'] = urldecode($params['folder']);
$return = false;
if (Vtiger_Functions::getModuleId('OSSMailView') && Vtiger_Functions::getModuleId('OSSMailScanner')) {
$return = 0;
$account = OSSMail_Record_Model::get_account_detail_by_name($params['username']);
$result = $adb->pquery("SELECT ossmailviewid FROM vtiger_ossmailview WHERE id = ? AND mbox = ? AND rc_user = ?", array($params['uid'], $params['folder'], $account[0]['user_id']), true);
if ($adb->num_rows($result) > 0) {
$return = $adb->query_result($result, 0, 'ossmailviewid');
} else {
$scannerModel = Vtiger_Record_Model::getCleanInstance('OSSMailScanner');
$params['actions'] = '0_created_Email';
$mail_Scan_mail = $scannerModel->manualScanMail($params);
if ($mail_Scan_mail['0_created_Email']) {
$return = $mail_Scan_mail['0_created_Email']['created_Email'];
}
}
}
$response = new Vtiger_Response();
$response->setResult($return);
$response->emit();
}
示例3: createFile
/**
* 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]);
}
示例4: process
public function process(Vtiger_Request $request)
{
$moduleName = $request->getModule();
$recordId = $request->get('record');
$recordModel = $this->record;
if (!$recordModel) {
if (!empty($recordId)) {
$recordModel = Vtiger_Record_Model::getInstanceById($recordId, $moduleName);
} else {
$recordModel = Vtiger_Record_Model::getCleanInstance($moduleName);
}
$this->record = $recordModel;
}
$viewer = $this->getViewer($request);
$viewer->assign('IMAGE_DETAILS', $recordModel->getImageDetails());
$salutationFieldModel = Vtiger_Field_Model::getInstance('salutationtype', $recordModel->getModule());
// Fix for http://trac.vtiger.com/cgi-bin/trac.cgi/ticket/7851
$salutationType = $request->get('salutationtype');
if (!empty($salutationType)) {
$salutationFieldModel->set('fieldvalue', $request->get('salutationtype'));
} else {
$salutationFieldModel->set('fieldvalue', $recordModel->get('salutationtype'));
}
$viewer->assign('SALUTATION_FIELD_MODEL', $salutationFieldModel);
parent::process($request);
}
示例5: getComposeUrlParam
function getComposeUrlParam($moduleName = false, $record = false, $view = false)
{
$url = '';
if (!empty($record) && isRecordExists($record)) {
$recordModel_OSSMailView = Vtiger_Record_Model::getCleanInstance('OSSMailView');
$email = $recordModel_OSSMailView->findEmail($record, $moduleName);
if ($email) {
$url = '&to=' . $email;
}
$recordModel = Vtiger_Record_Model::getInstanceById($record, $moduleName);
if ($moduleName == 'HelpDesk') {
$urldata = '&subject=' . $recordModel->get('ticket_no') . ' - ' . $recordModel->get('ticket_title');
} elseif ($moduleName == 'SSalesProcesses') {
$urldata = '&subject=' . $recordModel->get('ssalesprocesses_no') . ' - ' . $recordModel->get('subject');
} elseif ($moduleName == 'Project') {
$urldata = '&subject=' . $recordModel->get('project_no') . ' - ' . $recordModel->get('projectname');
}
$url .= $urldata;
}
if (!empty($moduleName)) {
$url .= '&crmmodule=' . $moduleName;
}
if (!empty($record)) {
$url .= '&crmrecord=' . $record;
}
if (!empty($view)) {
$url .= '&crmview=' . $view;
}
return $url;
}
示例6: requestForgotPassword
public function requestForgotPassword($request)
{
$request = new Vtiger_Request($request);
$adb = PearDatabase::getInstance();
$username = vtlib_purify($request->get('user_name'));
$result = $adb->pquery('select id,email1 from vtiger_users where user_name = ? ', array($username));
if ($adb->num_rows($result) > 0) {
$email = $adb->query_result($result, 0, 'email1');
}
if (strcasecmp($request->get('emailId'), $email) === 0) {
$userId = $adb->query_result($result, 0, 'id');
$time = time();
$options = array('handler_path' => 'modules/Users/handlers/ForgotPassword.php', 'handler_class' => 'Users_ForgotPassword_Handler', 'handler_function' => 'changePassword', 'handler_data' => array('username' => $username, 'email' => $email, 'time' => $time, 'hash' => md5($username . $time)));
$trackURL = Vtiger_ShortURL_Helper::generateURL($options);
$data = ['sysname' => 'UsersForgotPassword', 'to_email' => $email, 'module' => 'Users', 'record' => $userId, 'trackURL' => $trackURL];
$recordModel = Vtiger_Record_Model::getCleanInstance('OSSMailTemplates');
$status = $recordModel->sendMailFromTemplate($data);
$site_URL = vglobal('site_URL') . 'index.php?modules=Users&view=Login';
if ($status === 1) {
header('Location: ' . $site_URL . '&status=1');
} else {
header('Location: ' . $site_URL . '&statusError=1');
}
} else {
$site_URL = vglobal('site_URL') . 'index.php?modules=Users&view=Login';
header('Location: ' . $site_URL . '&fpError=1');
}
}
示例7: process
function process(Vtiger_Request $request)
{
$moduleName = $request->getModule();
$records = $request->get('records');
$template = $request->get('template');
$targetModuleName = $request->get('target');
$method = $request->get('method');
$success = [];
if (!empty($template)) {
$templateRecord = Vtiger_MappedFields_Model::getInstanceById($template);
foreach ($records as $recordId) {
if ($templateRecord->checkFiltersForRecord(intval($recordId))) {
if ($method == 0) {
$recordModel = Vtiger_Record_Model::getCleanInstance($targetModuleName);
$parentRecordModel = Vtiger_Record_Model::getInstanceById($recordId);
$recordModel->setRecordFieldValues($parentRecordModel);
if ($this->checkMandatoryFields($recordModel)) {
continue;
}
// TODO Add saving fields that exist in advanced module
$recordModel->save();
if (isRecordExists($recordModel->getId())) {
$success[] = $recordId;
}
} else {
$success[] = $recordId;
}
}
}
}
$output = ['all' => count($records), 'ok' => $success, 'fail' => array_diff($records, $success)];
$response = new Vtiger_Response();
$response->setResult($output);
$response->emit();
}
示例8: process
public function process(Vtiger_Request $request)
{
$moduleName = $request->getModule();
$srecord = $request->get('srecord');
$smodule = $request->get('smodule');
$type = $request->get('type');
$mode = $request->get('mode');
$record = $request->get('record');
$module = $request->get('module');
$currentUser = Users_Record_Model::getCurrentUserModel();
$recordModel = Vtiger_Record_Model::getCleanInstance($moduleName);
$recordModel_OSSMailScanner = Vtiger_Record_Model::getCleanInstance('OSSMailScanner');
$Config = $recordModel_OSSMailScanner->getConfig('email_list');
$emailModuleModel = Vtiger_Module_Model::getInstance('OSSMail');
$config = $emailModuleModel->getComposeParameters();
$urldata = $emailModuleModel->getComposeUrl($smodule, $srecord, 'Detail', $config['popup']);
$viewer = $this->getViewer($request);
$viewer->assign('RECOLDLIST', $recordModel->{$mode}($srecord, $smodule, $Config, $type));
$viewer->assign('SENDURLDDATA', $urldata);
$viewer->assign('MODULENAME', $moduleName);
$viewer->assign('SMODULENAME', $smodule);
$viewer->assign('RECORD', $record);
$viewer->assign('SRECORD', $srecord);
$viewer->assign('TYPE', $type);
$viewer->assign('POPUP', $config['popup']);
$viewer->view('widgets.tpl', 'OSSMailView');
}
示例9: process
public function process(Vtiger_Request $request)
{
$moduleSettingsName = $request->getModule(false);
$moduleName = $request->getModule();
$paymentsIn = array();
$record = Vtiger_Record_Model::getCleanInstance($moduleName);
$type = $request->get('type');
$bank = $request->get('bank');
$this->saveFile($_FILES);
$recordParse = $record->getSummary($type, $bank, $_FILES["file"]["name"]);
// only incomming records (C)
$i = 0;
$j = array();
foreach ($recordParse->operations as $transfers) {
foreach ($transfers as $key => $value) {
if ($key == 'indicator' && $value == 'C') {
$paymentsIn[] = $transfers;
}
if ($key == 'third_letter_currency_code') {
$j[] = $i;
}
}
$i++;
}
$json = json_encode($paymentsIn);
$viewer = $this->getViewer($request);
$viewer->assign('MODULENAME', $moduleName);
$viewer->assign('PAYMENTSIN', $paymentsIn);
$viewer->assign('COUNT', count($paymentsIn));
$viewer->assign('JSON', $json);
echo $viewer->view('step1.tpl', $moduleSettingsName, true);
}
示例10: process
public function process(Vtiger_Request $request)
{
$recordModel = Vtiger_Record_Model::getCleanInstance('OSSMailScanner');
$response = new Vtiger_Response();
$response->setResult($recordModel->executeCron(Users_Record_Model::getCurrentUserModel()->user_name));
$response->emit();
}
示例11: process
public function process(Vtiger_Request $request)
{
$moduleName = $request->getModule();
$relatedLoad = $request->get('relatedLoad');
$data = '';
if ($relatedLoad) {
$postData = $request->get('postData');
$relatedModuleName = $request->get('relatedModuleName');
$selected_ids = json_decode($postData['selected_ids'], true);
$OSSMailModel = Vtiger_Record_Model::getCleanInstance('OSSMail');
$data = $OSSMailModel->getEmailsFromModule($selected_ids, $relatedModuleName);
} else {
$selectedFields = $request->get('selectedFields');
$selected_ids = $request->get('selected_ids');
foreach ($selected_ids as $key => $value) {
$recordModel = Vtiger_Record_Model::getInstanceById($value);
if ($data == '') {
$data = $recordModel->get($selectedFields[$key]);
} else {
$data .= ',' . $recordModel->get($selectedFields[$key]);
}
}
}
$result = array('success' => true, 'data' => $data);
$response = new Vtiger_Response();
$response->setResult($result);
$response->emit();
}
示例12: handleEvent
function handleEvent($eventName, $entityData)
{
global $log, $adb, $current;
$moduleName = $entityData->getModuleName();
$currentUserModel = Users_Record_Model::getCurrentUserModel();
if ($moduleName == 'OSSPasswords') {
if ($eventName == 'vtiger.entity.aftersave.final') {
$recordModel = Vtiger_Record_Model::getCleanInstance($moduleName);
$conf = $recordModel->getConfiguration();
$sql = "SELECT basic.id FROM `vtiger_modtracker_basic` basic LEFT JOIN `vtiger_modtracker_detail` detail ON detail.`id` = basic.`id` \n WHERE basic.module = 'OSSPasswords' AND basic.`whodid` = '{$currentUserModel->id}' \n AND basic.changedon > CURDATE() AND detail.fieldname = 'password' ORDER BY basic.id DESC LIMIT 1;";
$result = $adb->query($sql, true);
$num = $adb->num_rows($result);
if ($num > 0) {
$toUpdate = array();
for ($i = 0; $i < $num; $i++) {
$toUpdate[] = (int) $adb->query_result($result, $i, 'id');
}
// register changes: show prevalue, hide postvalue
if ($conf['register_changes'] == 1) {
$sql = "UPDATE `vtiger_modtracker_detail` SET `postvalue` = '**********' WHERE `id` IN (" . implode(',', $toUpdate) . ") AND `fieldname` = 'password';";
} else {
$sql = "UPDATE `vtiger_modtracker_detail` SET `prevalue` = '**********', `postvalue` = '**********' WHERE `id` IN (" . implode(',', $toUpdate) . ") AND `fieldname` = 'password';";
}
$adb->query($sql, true);
}
}
}
}
示例13: getTimeEmployee
public function getTimeEmployee($id)
{
$db = PearDatabase::getInstance();
$moduleModel = Vtiger_Record_Model::getCleanInstance('OSSTimeControl');
$Ids = $moduleModel->getProjectRelatedIDS($id);
foreach ($Ids as $module) {
foreach ($module as $moduleId) {
$idArray .= $moduleId . ',';
}
}
$idArray = substr($idArray, 0, -1);
$addSql = '';
if ($idArray) {
$addSql = ' WHERE vtiger_osstimecontrol.osstimecontrolid IN (' . $idArray . ') ';
}
//TODO need to handle security
$result = $db->pquery('SELECT count(*) AS count, concat(vtiger_users.first_name, " " ,vtiger_users.last_name) as name, vtiger_users.id as id, SUM(vtiger_osstimecontrol.sum_time) as time FROM vtiger_osstimecontrol
INNER JOIN vtiger_crmentity ON vtiger_osstimecontrol.osstimecontrolid = vtiger_crmentity.crmid
INNER JOIN vtiger_users ON vtiger_users.id=vtiger_crmentity.smownerid AND vtiger_users.status="ACTIVE"
AND vtiger_crmentity.deleted = 0' . Users_Privileges_Model::getNonAdminAccessControlQuery($this->getName()) . $addSql . ' GROUP BY smownerid', array());
$data = array();
for ($i = 0; $i < $db->num_rows($result); $i++) {
$row = $db->query_result_rowdata($result, $i);
$data[] = $row;
}
return $data;
}
示例14: amount_in_words
function amount_in_words($module, $id, $templateid, $content, $tcpdf)
{
$db = PearDatabase::getInstance();
$current_language = Users_Record_Model::getCurrentUserModel()->get('language');
if (!file_exists("languages/" . $current_language . "/OSSPdf.php")) {
$current_language = "en_us";
}
$mod = $module;
$module = strtolower($module);
if ($module == 'quotes') {
$idcol = "quoteid";
} else {
$idcol = $module . "id";
}
$sql = "SELECT total FROM vtiger_{$module} WHERE {$idcol} = " . $id;
$result = $db->query($sql, true);
$grand_total = $db->query_result($result, 0, 'total');
$currfield = new CurrencyField($grand_total);
$grand_total = $currfield->getDBInsertedValue($grand_total);
require_once 'include/utils/utils.php';
require_once 'include/utils/CommonUtils.php';
require_once 'modules/' . $mod . '/' . $mod . '.php';
$focus = new $mod();
$focus->retrieve_entity_info($id, $mod);
$currency_id = $focus->column_fields['currency_id'];
$pobierz = $db->query("select currency_symbol, currency_code from vtiger_currency_info where id = '{$currency_id}'", true);
$kod_aktualnej_waluty = $db->query_result($pobierz, 0, "currency_code");
$recordModel = Vtiger_Record_Model::getCleanInstance('OSSPdf');
$kwota = $recordModel->slownie($grand_total, $kod_aktualnej_waluty);
return $kwota;
}
示例15: process
public function process(Vtiger_Request $request)
{
$moduleName = $request->getModule();
$recordId = $request->get('record');
$currencyName = $request->get('currency');
if (!empty($recordId)) {
$recordModel = Vtiger_Record_Model::getInstanceById($recordId, $moduleName);
$priceDetails = $recordModel->getPriceDetails();
} else {
$recordModel = Vtiger_Record_Model::getCleanInstance($moduleName);
$priceDetails = $recordModel->getPriceDetails();
foreach ($priceDetails as $key => $currencyDetails) {
if ($currencyDetails['curname'] === $currencyName) {
$baseCurrencyConversionRate = $currencyDetails['conversionrate'];
break;
}
}
foreach ($priceDetails as $key => $currencyDetails) {
if ($currencyDetails['curname'] === $currencyName) {
$currencyDetails['conversionrate'] = 1;
$currencyDetails['is_basecurrency'] = 1;
} else {
$currencyDetails['conversionrate'] = $currencyDetails['conversionrate'] / $baseCurrencyConversionRate;
$currencyDetails['is_basecurrency'] = 0;
}
$priceDetails[$key] = $currencyDetails;
}
}
$viewer = $this->getViewer($request);
$viewer->assign('MODULE', $moduleName);
$viewer->assign('PRICE_DETAILS', $priceDetails);
$viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());
$viewer->view('MoreCurrenciesList.tpl', 'Products');
}