Files
crm.clientright.ru/post.php

72 lines
2.5 KiB
PHP
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
/////////////////////////////////////////////////////////////////////////////
// SalesPlatform Vtiger CRM Community http://community.salesplatform.ru
//
// Примеры создания новой сущности
// Проверено для версии SalesPlatform Vtiger CRM 6.5.0-201611 SP1
// Скрипт выполнять из корня Vtiger: $ php script.php или через веб-сервер:
// http://localhost/vtiger650/script.php
//
/////////////////////////////////////////////////////////////////////////////
include_once 'modules/Users/Users.php';
require_once 'include/Webservices/Create.php';
require_once 'includes/Loader.php';
vimport ('includes.runtime.Globals');
vimport ('includes.runtime.BaseModel');
vimport ('includes.runtime.LanguageHandler');
/*if(isset($_POST["name"])){
$name = $_POST["name"];
}
if(isset($_POST["age"])){
$age = $_POST["age"];
}
*/
#$name = 'коробков';
#$cf_1187 = $_POST['cf_1187'];//Направление обращения
$projectname = $_POST['projectname']; //телефон
#$lastname = $_POST['lastname'];//фамилия
#$firstname = $_POST['firstname'];// имя
#$cf_1157 = $_POST['cf_1157']; // отчество
#$email = $_POST['email']; //электронная почта
$user = Users::getActiveAdminUser();
// Первый способ: через API веб-сервисов
$user = Users::getActiveAdminUser();
try {
$data = array (
# 'cf_1187' => $cf_1187,
'projectname' => $projectname,
# 'firstname' => $firstname,
#'lastname' => $lastname,
# 'cf_1157' => $cf_1157,
# 'email' => $email,
'projecttype' => 'Претензионно - исковая работа',
'assigned_user_id' => vtws_getWebserviceEntityId('Users', $user->id),
);
$lead1 = vtws_create('Project', $data, $user);
} catch (WebServiceException $ex) {
echo $ex->getMessage();
}
// Второй способ: через модель
/*
$lead2 = Vtiger_Record_Model::getCleanInstance('Contacts');
$lead2->set('cf_1187', $cf_1187); // направление обращения
$lead2->set('mobile', $mobile); // телефон
$lead2->set('firstname', $firstname); //имя
$lead2->set('lastname', $lastname); //фамилия
$lead2->set('cf_1157', $cf_1157); // отчество
$lead2->set('email', $email); //электронная почта
$lead2->set('leadsource', 'Веб-сайт'); //
$lead2->set('assigned_user_id', $user->id);
$lead2->save();
*/
?>