本文整理汇总了PHP中Vtiger_Record_Model类的典型用法代码示例。如果您正苦于以下问题:PHP Vtiger_Record_Model类的具体用法?PHP Vtiger_Record_Model怎么用?PHP Vtiger_Record_Model使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Vtiger_Record_Model类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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');
$mailFilter = $request->get('mailFilter');
$recordModel = Vtiger_Record_Model::getCleanInstance($moduleName);
$recordModel_OSSMailScanner = Vtiger_Record_Model::getCleanInstance('OSSMailScanner');
$config = $recordModel_OSSMailScanner->getConfig('email_list');
if ($request->has('limit')) {
$config['widget_limit'] = $request->get('limit');
}
$viewer = $this->getViewer($request);
$viewer->assign('RECOLDLIST', $recordModel->{$mode}($srecord, $smodule, $config, $type, $mailFilter));
$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');
}
示例2: initializeListViewContents
public function initializeListViewContents(Vtiger_Request $request, Vtiger_Viewer $viewer)
{
$moduleName = $this->getModule($request);
$sourceModule = $request->get('src_module');
$sourceRecord = $request->get('src_record');
//list of records is narrowed to contacts related to help desks account, only in Help Desk Contacts relation view
if ($moduleName == 'Contacts' && $sourceModule == 'HelpDesk' && isRecordExists($sourceRecord) && strpos($_SERVER['QUERY_STRING'], 'module=Contacts&src_module=HelpDesk') === 0) {
$request->set('related_parent_module', 'Accounts');
$helpDeskRecord = Vtiger_Record_Model::getInstanceById($sourceRecord, 'HelpDesk');
$request->set('related_parent_id', $helpDeskRecord->get('parent_id'));
$viewer->assign('SWITCH', true);
}
if ($moduleName == 'Contacts' && $sourceModule == 'SSalesProcesses' && isRecordExists($sourceRecord) && strpos($_SERVER['QUERY_STRING'], 'module=Contacts&src_module=SSalesProcesses') === 0) {
$request->set('related_parent_module', 'Accounts');
$moduleRecord = Vtiger_Record_Model::getInstanceById($sourceRecord, 'SSalesProcesses');
$request->set('related_parent_id', $moduleRecord->get('related_to'));
$viewer->assign('SWITCH', true);
}
if ($moduleName == 'Contacts' && $sourceModule == 'Project' && isRecordExists($sourceRecord) && strpos($_SERVER['QUERY_STRING'], 'module=Contacts&src_module=Project') === 0) {
$request->set('related_parent_module', 'Accounts');
$moduleRecord = Vtiger_Record_Model::getInstanceById($sourceRecord, 'Project');
$request->set('related_parent_id', $moduleRecord->get('linktoaccountscontacts'));
$viewer->assign('SWITCH', true);
}
parent::initializeListViewContents($request, $viewer);
}
示例3: postpone
function postpone(Vtiger_Request $request)
{
$recordId = $request->get('record');
$module = $request->getModule();
$recordModel = Vtiger_Record_Model::getInstanceById($recordId, $module);
$recordModel->updateReminderStatus(0);
}
示例4: process
/**
* Function that saves SMS records
* @param Vtiger_Request $request
*/
public function process(Vtiger_Request $request)
{
$moduleName = $request->getModule();
$currentUserModel = Users_Record_Model::getCurrentUserModel();
$recordIds = $this->getRecordsListFromRequest($request);
$phoneFieldList = $request->get('fields');
$message = $request->get('message');
foreach ($recordIds as $recordId) {
$recordModel = Vtiger_Record_Model::getInstanceById($recordId);
$numberSelected = false;
foreach ($phoneFieldList as $fieldname) {
$fieldValue = $recordModel->get($fieldname);
if (!empty($fieldValue)) {
$toNumbers[] = $fieldValue;
$numberSelected = true;
}
}
if ($numberSelected) {
$recordIds[] = $recordId;
}
}
$response = new Vtiger_Response();
if (!empty($toNumbers)) {
SMSNotifier_Record_Model::SendSMS($message, $toNumbers, $currentUserModel->getId(), $recordIds, $moduleName);
$response->setResult(true);
} else {
$response->setResult(false);
}
return $response;
}
示例5: 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);
}
示例6: process
public function process(Vtiger_Request $request)
{
$moduleName = $request->getModule();
$moduleModel = Vtiger_Module_Model::getInstance($moduleName);
if ($request->get('selected_ids') == 'all' && $request->get('mode') == 'FindDuplicates') {
$recordIds = Vtiger_FindDuplicate_Model::getMassDeleteRecords($request);
} else {
$recordIds = $this->getRecordsListFromRequest($request);
}
foreach ($recordIds as $recordId) {
if (Users_Privileges_Model::isPermitted($moduleName, 'Delete', $recordId)) {
$recordModel = Vtiger_Record_Model::getInstanceById($recordId, $moduleModel);
$recordModel->delete();
} else {
$permission = 'No';
}
}
if ($permission === 'No') {
throw new AppException(vtranslate('LBL_PERMISSION_DENIED'));
}
$cvId = $request->get('viewname');
$response = new Vtiger_Response();
$response->setResult(array('viewname' => $cvId, 'module' => $moduleName));
$response->emit();
}
示例7: process
public function process(Vtiger_Request $request)
{
$moduleName = $request->getModule();
$documentIdsList = $this->getRecordsListFromRequest($request);
$folderId = $request->get('folderid');
if (!empty($documentIdsList)) {
foreach ($documentIdsList as $documentId) {
$documentModel = Vtiger_Record_Model::getInstanceById($documentId, $moduleName);
if (Users_Privileges_Model::isPermitted($moduleName, 'EditView', $documentId)) {
$documentModel->set('folderid', $folderId);
$documentModel->set('mode', 'edit');
$documentModel->save();
} else {
$documentsMoveDenied[] = $documentModel->getName();
}
}
}
if (empty($documentsMoveDenied)) {
$result = array('success' => true, 'message' => vtranslate('LBL_DOCUMENTS_MOVED_SUCCESSFULLY', $moduleName));
} else {
$result = array('success' => false, 'message' => vtranslate('LBL_DENIED_DOCUMENTS', $moduleName), 'LBL_RECORDS_LIST' => $documentsMoveDenied);
}
$response = new Vtiger_Response();
$response->setResult($result);
$response->emit();
}
示例8: 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;
}
示例9: updateEvent
public function updateEvent(Vtiger_Request $request)
{
$moduleName = $request->getModule();
$recordId = $request->get('id');
$date_start = date('Y-m-d', strtotime($request->get('start')));
$time_start = date('H:i:s', strtotime($request->get('start')));
$due_date = date('Y-m-d', strtotime($request->get('end')));
$time_end = date('H:i:s', strtotime($request->get('end')));
$succes = false;
if (!empty($recordId)) {
try {
$recordModel = Vtiger_Record_Model::getInstanceById($recordId, $moduleName);
$recordModel->set('id', $recordId);
$recordModel->set('mode', 'edit');
$recordModel->set('date_start', $date_start);
$recordModel->set('time_start', $time_start);
$recordModel->set('due_date', $due_date);
$recordModel->set('time_end', $time_end);
$recordModel->save();
$succes = true;
} catch (Exception $e) {
$succes = false;
}
}
$response = new Vtiger_Response();
$response->setResult($succes);
$response->emit();
}
示例10: UpdateInvoice
function UpdateInvoice($salesId)
{
$adb = PearDatabase::getInstance();
$moduleBalance = 'Invoice';
$StatusBalance = 'Paid';
if ($salesId == 0 || $salesId == '' || Vtiger_Functions::getCRMRecordType($salesId) != $moduleBalance) {
return false;
}
$sql = 'SELECT SUM(`paymentsvalue`) as suma FROM `vtiger_paymentsin` WHERE `salesid` = ? AND `paymentsin_status` = ?;';
$result = $adb->pquery($sql, array($salesId, $StatusBalance), false);
$paymentsIn = $adb->query_result($result, 0, 'suma');
$sql = 'SELECT SUM(`paymentsvalue`) as suma FROM `vtiger_paymentsout` WHERE `salesid` = ? AND `paymentsout_status` = ?;';
$result = $adb->pquery($sql, array($salesId, $StatusBalance), false);
$paymentsOut = $adb->query_result($result, 0, 'suma');
$sum = $paymentsIn - $paymentsOut;
$model = Vtiger_Record_Model::getInstanceById($salesId, $moduleBalance);
$hdnGrandTotal = $model->get('hdnGrandTotal');
$balance = $hdnGrandTotal - $sum;
$sql = 'UPDATE `vtiger_invoice` SET `payment_balance` = ? WHERE `invoiceid` = ? LIMIT 1;';
$params = array($balance, $salesId);
$adb->pquery($sql, $params, true);
$accountId = $model->get('account_id');
$potentialId = $model->get('potentialid');
UpdateAccounts($accountId);
UpdatePotential($potentialId);
}
示例11: loadRecord
public function loadRecord($id)
{
$recordModel = Vtiger_Record_Model::getInstanceById($id);
$this->moduleName = $recordModel->getModuleName();
$this->focus = $recordModel->getEntity();
$this->buildRecordTemplateModel();
}
示例12: process
function process(Vtiger_Request $request)
{
$currentUserPriviligeModel = Users_Privileges_Model::getCurrentUserPrivilegesModel();
$viewer = $this->getViewer($request);
$recordId = $request->get('record');
$moduleName = $request->getModule();
$recordModel = Vtiger_Record_Model::getInstanceById($recordId);
$moduleModel = $recordModel->getModule();
$viewer->assign('MODULE', $moduleName);
$viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());
$viewer->assign('CURRENT_USER_PRIVILEGE', $currentUserPriviligeModel);
$viewer->assign('RECORD', $recordModel);
$viewer->assign('CONVERT_LEAD_FIELDS', $recordModel->getConvertLeadFields());
$assignedToFieldModel = $moduleModel->getField('assigned_user_id');
$assignedToFieldModel->set('fieldvalue', $recordModel->get('assigned_user_id'));
$viewer->assign('ASSIGN_TO', $assignedToFieldModel);
$potentialModuleModel = Vtiger_Module_Model::getInstance('Potentials');
$accountField = Vtiger_Field_Model::getInstance('related_to', $potentialModuleModel);
$contactField = Vtiger_Field_Model::getInstance('contact_id', $potentialModuleModel);
$viewer->assign('ACCOUNT_FIELD_MODEL', $accountField);
$viewer->assign('CONTACT_FIELD_MODEL', $contactField);
$contactsModuleModel = Vtiger_Module_Model::getInstance('Contacts');
$accountField = Vtiger_Field_Model::getInstance('parent_id', $contactsModuleModel);
$viewer->assign('CONTACT_ACCOUNT_FIELD_MODEL', $accountField);
$state = Settings_Leads_ConvertToAccount_Model::getState();
$viewer->assign('STATE', $state);
$viewer->view('ConvertLead.tpl', $moduleName);
}
示例13: updateEvent
public function updateEvent(Vtiger_Request $request)
{
$moduleName = $request->getModule();
$recordId = $request->get('id');
$date_start = date('Y-m-d', strtotime($request->get('start')));
$time_start = date('H:i:s', strtotime($request->get('start')));
$succes = false;
if (isPermitted($moduleName, 'EditView', $recordId) === 'no') {
$succes = false;
} else {
if (!empty($recordId)) {
try {
$delta = $request->get('delta');
$recordModel = Vtiger_Record_Model::getInstanceById($recordId, $moduleName);
$recordData = $recordModel->entity->column_fields;
$end = self::changeDateTime($recordData['due_date'] . ' ' . $recordData['time_end'], $delta);
$due_date = $end['date'];
$time_end = $end['time'];
$recordModel->set('id', $recordId);
$recordModel->set('mode', 'edit');
$recordModel->set('date_start', $date_start);
$recordModel->set('time_start', $time_start);
$recordModel->set('due_date', $due_date);
$recordModel->set('time_end', $time_end);
$recordModel->save();
$succes = true;
} catch (Exception $e) {
$succes = false;
}
}
}
$response = new Vtiger_Response();
$response->setResult($succes);
$response->emit();
}
示例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
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();
}