function find_beans_with_phone_number($session, $phone_number, $module_order, $stop_on_find)
 {
     $GLOBALS['log']->info('Begin: SugarWebServiceImplv4_1_custom->example_method');
     $error = new SoapError();
     $retVal = array();
     //authenticate
     if (!self::$helperObject->checkSessionAndModuleAccess($session, 'invalid_session', '', '', '', $error)) {
         $GLOBALS['log']->info('End: SugarWebServiceImplv4_1_custom->example_method.');
         //$retVal['status'] = "ERROR: Invalid Session ID";
         //$retVal['data'] = '';
     } else {
         $retVal = find_beans($phone_number, $module_order, $stop_on_find, $GLOBALS['current_user']);
     }
     return $retVal;
     //$session . " oid: " . $oid;
 }
Exemple #2
0
<?php

/**
 * File: queryTests.php
 * Project: yaai
 * User: blake, http://www.blakerobertson.com
 * Date: 5/13/13
 * Time: 3:58 PM
 */
require_once "custom/modules/Asterisk/include/callinize_db.php";
//$result = find_beans_db_query("contacts", "phone_work,phone_home,phone_mobile,phone_other,assistant_phone", "4102152497", null, $GLOBALS['current_user'] );
//$beans = convert_bean_to_simple_array("contacts", $result,  $GLOBALS['current_user']);
//
//echo "BEANS:\n" . print_r($beans,true);
//
//echo "CONTACTS:\n" . print_r($contacts,true);
$beans = find_beans("4102152497", "accounts,contacts,leads", $GLOBALS['current_user']);
echo "BEANS:\n" . print_r($beans, true);
$beans = find_beans("4102152497", "accounts,contacts,leads", $GLOBALS['current_user']);
echo "BEANS:\n" . print_r($beans, true);
echo "ALL DONE";
Exemple #3
0
/**
 * Build the item list
 *
 * @param array $result_set Array of calls from database
 * @param object $current_user SugarCRM current_user object allows DB access
 * @param array $mod_strings SugarCRM module strings
 * @return array
 */
function build_getCalls_item_list($result_set, $current_user, $mod_strings)
{
    global $sugar_config;
    $response = array();
    $index = 0;
    $numCalls = $current_user->db->getRowCount($result_set);
    $maxCalls = $sugar_config['asterisk_max_popups'];
    while ($row = $current_user->db->fetchByAssoc($result_set)) {
        // If we have too many calls, we nuke the extra from beginning of result_set since they're the oldest.
        if ($numCalls > $maxCalls && $index++ < $numCalls - $maxCalls) {
            updateUIState("Closed", $row['call_record_id'], $row['asterisk_id']);
            //logLine("Too many active popups, closing {$row['asterisk_id']}");
        } else {
            $state = get_call_state($row, $mod_strings);
            $phone_number = get_callerid($row);
            $call_direction = get_call_direction($row, $mod_strings);
            $contacts = array();
            // Dont fetch contacts if it's already known this is already been related to another module.
            if (!empty($row['bean_module']) && !empty($row['bean_id'])) {
                $beans = make_bean_array_from_call_row($row);
            } else {
                // @@@@ BEGIN CALLINIZE COMMUNITY ONLY @@@@
                $module_list = "accounts,contacts";
                // @@@@ END CALLINIZE COMMUNITY ONLY @@@@
                $beans = find_beans($phone_number, $module_list, false, $current_user);
            }
            // When only one matching number, save the result in call record.
            if (count($beans) == 1) {
                setBeanID($row['call_record_id'], $beans[0]['bean_module'], $beans[0]['bean_id']);
            }
            $call = array('id' => $row['id'], 'asterisk_id' => $row['asterisk_id'], 'state' => $state, 'is_hangup' => $state == $mod_strings['YAAI']['HANGUP'], 'call_record_id' => $row['call_record_id'], 'phone_number' => $phone_number, 'timestamp_call' => $row['timestamp_call'], 'title' => get_title($beans, $phone_number, $state, $mod_strings), 'beans' => $beans, 'call_type' => $call_direction['call_type'], 'direction' => $call_direction['direction'], 'duration' => get_duration($row), 'mod_strings' => $mod_strings['YAAI']);
            $response[] = $call;
        }
    }
    return $response;
}