Esempio n. 1
0
<?php

//including session
session_start();
$session_id = $_SESSION['session_id'];
//including classes
include '../classes/CafeMgmt.php';
include '../classes/CafeDetails.php';
include '../classes/SugarSoap.php';
//creating objects
$cafe_mgmt = new CafeMgmt();
$cafe_details = new CafeDetails();
$sugar_soap = new SugarSoap();
//getting values from post
$first_name = $_POST['first_name'];
$last_name = $_POST['last_name'];
$department = $_POST['department'];
$role_id = $_POST['role'];
$counttry = $_POST['country'];
$state = $_POST['state'];
$city = $_POST['city'];
$reports_to_id = $_SESSION['user_id'];
$name = $first_name . ' ' . $last_name;
if ($session_id) {
    if ($cafedb_result = $cafe_details->insertEmp($name, $city)) {
        $id = $cafe_details->getMaxEmployeeId();
        $user_id = generateUserId($city, $id);
        //calling function to enter values in sugar crm, using soap
        $sugar_result = $sugar_soap->insertEmployee($session_id, $user_id, $first_name, $last_name, $department, $country, $state, $city, $phone_mobile, $reports_to_id);
    } else {
        echo 'can not insert in database';
<?php

//including session
session_start();
$session_id = $_SESSION['session_id'];
$assigned_id = $_SESSION['user_id'];
//echo $session_id;
//including classes
include '../classes/CafeMgmt.php';
include '../classes/CafeDetails.php';
include '../classes/SugarSoap.php';
//creating objects
$sugar_soap = new SugarSoap();
//getting items from the form
$first_name = $_POST['element_1_1'];
$last_name = $_POST['element_1_2'];
$company_name = $_POST['element_2'];
$opportunity_amount = $_POST['element_3'];
$expected_date = $_POST['element_4_1'] . '/' . $_POST['element_4_2'] . '/' . $_POST['element_4_3'];
$office_phone = $_POST['element_5'];
$email = $_POST['element_6'];
$address = $_POST['element_7_1'] . ',' . $_POST['element_7_2'];
$city = $_POST['element_7_3'];
$state = $_POST['element_7_4'];
$postal_code = $_POST['element_7_5'];
$country = $_POST['element_7_6'];
$comments = $_POST['element_8'];
$assign_to = '647786cd-4b7f-5f50-d557-4bd584191b8b';
//creating an array and saving files in an array
$contact = array('first_name' => $first_name, 'last_name' => $last_name, 'company_name' => $company_name, 'opportunity_amount' => $opportunity_amount, 'expected_date' => $expected_date, 'office_phone' => $office_phone, 'email' => $email, 'address' => $address, 'city' => $city, 'state' => $state, 'postal_code' => $postal_code, 'country' => $country, 'comments' => $comments, 'session_id' => $session_id, 'assign_to' => $assign_to);
if ($session_id) {
Esempio n. 3
0
    $ldap_enc_key = substr(md5($r['value']), 0, 24);
    $sugarSoapCredential = bin2hex(mcrypt_cbc(MCRYPT_3DES, $ldap_enc_key, $sugar_config['asterisk_soappass'], MCRYPT_ENCRYPT, 'password'));
}
// Added this while loop to keep retrying the soap login b/c I found when I started it through daemon script...
// despite specifying apache as a dependency... it was failing to connect... (this will keep retrying login until it's successful).
// Probably should have this script reload the SOAP config from config.php. Wasn't sure how to do that since it's already been
// included at top of file in require_once.
$successfullyLoggedInThroughSoap = false;
while (!$successfullyLoggedInThroughSoap) {
    //
    // And finally open a SOAP connection to SugarCRM
    //
    logLine("[SOAP Connection]\n");
    logLine(" Trying SOAP login endpoint=[{$sugarSoapEndpoint}] user=[{$sugarSoapUser}] password=[{$sugarSoapCredential}]\n");
    $auth_array = array('user_auth' => array('user_name' => $sugarSoapUser, 'password' => $sugarSoapCredential));
    $soapClient = new SugarSoap($sugarSoapEndpoint . '?wsdl', true, $auth_array);
    // This method logs in also
    $soapSessionId = $soapClient->sessionid;
    $userGUID = $soapClient->call('get_user_id', array($soapSessionId));
    if (is_array($userGUID) && array_key_exists("error", $userGUID) && $userGUID['error']['number'] != 0) {
        logLine(" **WARNING Unable to make initial SOAP Call " . $userGUID['error']['number'] . " " . $userGUID['error']['name'] . " // " . $userGUID['error']['description'] . "**\n");
        logLine(" Retrying in 5 seconds...\n\n");
        sleep(5);
    } else {
        if (empty($userGUID) || empty($soapSessionId) || $userGUID == -1) {
            logLine(" __FATAL: SOAP login failed, something didn't get set by login... check your site_url, and make sure sugarcrm is running. SessionID:" . $soapSessionId . " user="******" GUID=" . $userGUID . "__\n");
            logLine(" Sleeping for 5 seconds then retrying...\n\n");
            sleep(5);
        } else {
            logLine(" Successfully logged into Sugar via SOAP! SessionId=" . $soapSessionId . " user="******" GUID=" . $userGUID . "\n");
            $successfullyLoggedInThroughSoap = true;
$cafe_id = $_POST['cafe_id'];
$pay = $_POST['pay'];
//including all the relevant classes
include '../classes/CafeDetails.php';
include '../classes/CafeActivation.php';
include '../classes/CafeMgmt.php';
include '../classes/CafeTrac.php';
include '../classes/SugarSoap.php';
//creating object of class cafe details
$cafe_details = new CafeDetails();
//creating object of class Cafe Activation
$cafe_activate = new CafeActivation();
//creating objects of cafe Magmt
$cafe_mgmt = new CafeMgmt();
$cafe_trac = new CafeTrac();
$sugar = new SugarSoap();
//getting post values in the variables
$salutation = $_POST['salutation'];
$first_name = $_POST['first_name'];
$last_name = $_POST['last_name'];
$office_phone = $_POST['office_phone'];
$cafe_name = $_POST['cafe_name'];
$mobile = $_POST['mobile'];
$email = $_POST['email'];
$address = $_POST['address'];
$state = $_POST['state'];
$city = $_POST['city'];
$country = $_POST['country'];
$postal_code = $_POST['postal_code'];
$area = $_POST['area1'];
$terminals = $_POST['terminals'];