public function close()
 {
     parent::close();
     if ($this->isCurrentSessionExceeded()) {
         $this->log->error(sprintf("[SessionLock] Session lock was held for %s seconds which is longer than the maximum of %s seconds. Request details: \n                SERVER_NAME     | %s \n                SERVER_ADDR     | %s \n                SCRIPT_FILENAME | %s \n                REQUEST_METHOD  | %s \n                SCRIPT_NAME     | %s \n                REQUEST_URI     | %s \n                QUERY_STRING    | %s ", $this->session_time, $this->max_session_time, $_SERVER['SERVER_NAME'], $_SERVER['SERVER_ADDR'], $_SERVER['SCRIPT_FILENAME'], $_SERVER['REQUEST_METHOD'], $_SERVER['SCRIPT_NAME'], $_SERVER['REQUEST_URI'], $_SERVER['QUERY_STRING']));
     }
 }
Exemple #2
0
function DelExclusiveLead()
{
    $log =& LoggerManager::getLogger('ClickATell');
    $log->debug('Update exclusive counts start.');
    $tablePrefix = 'vtiger_';
    $assigned_user_id = trim($_REQUEST['assigned_user_id']);
    $record = trim($_REQUEST['record']);
    $userid = $assigned_user_id ? $assigned_user_id : $_SESSION['authenticated_user_id'];
    $leadid = $record ? $record : '';
    $result = array('success' => false, 'message' => '');
    if (!empty($userid)) {
        $adb = PearDatabase::getInstance();
        $leadCfSQL = "UPDATE vtiger_leadscf ";
        $leadCfSQL .= "LEFT JOIN " . $tablePrefix . "lead_exclusives ON vtiger_leadscf.leadid=" . $tablePrefix . "lead_exclusives.leadid ";
        $leadCfSQL .= "SET vtiger_leadscf.cf_833='未独占' ";
        $leadCfSQL .= "WHERE userid=" . $userid . " AND datediff(NOW(), " . $tablePrefix . "lead_exclusives.created) >=" . MAX_TTME;
        $resultLeadCf = $adb->query($leadCfSQL);
        if ($resultLeadCf) {
            $log->debug('Update vtiger_leadscf status success.' . $leadCfSQL);
            $sql = "DELETE FROM " . $tablePrefix . "lead_exclusives WHERE userid=" . $userid . " AND leadid=" . $leadid;
            $result = $adb->query($sql);
            if ($result) {
                $log->debug('Update exclusive counts success .' . json_encode($result));
            }
            $counts = GetExclusiveCounts($userid);
            $result = array('success' => true, 'message' => $counts);
        } else {
            $log->debug('Update vtiger_leadscf status failed.' . $leadCfSQL);
            $counts = GetExclusiveCounts($userid);
            $result = array('success' => false, 'message' => $counts);
        }
    }
    $log->debug('Update exclusive counts end. SQL:' . $sql);
    return $result;
}
function DelExclusiveLeadByTime()
{
    $log =& LoggerManager::getLogger('ClickATell');
    $log->debug('update exclusive status start.');
    $tablePrefix = 'vtiger_';
    $result = array('success' => false, 'message' => '', 'tip' => '');
    $adb = PearDatabase::getInstance();
    $leadExclusivesTable = $tablePrefix . 'lead_exclusives';
    $leadCfSQL = "UPDATE vtiger_leadscf ";
    $leadCfSQL .= "LEFT JOIN {$leadExclusivesTable} ON {$leadExclusivesTable}.leadid = vtiger_leadscf.leadid ";
    $leadCfSQL .= "SET vtiger_leadscf.cf_833='未独占' ";
    $leadCfSQL .= "WHERE datediff(NOW(), {$leadExclusivesTable}.created) >=" . MAX_TTME;
    $resultLeadCf = $adb->query($leadCfSQL);
    if ($resultLeadCf) {
        $result = array('success' => true, 'message' => $leadCfSQL);
        $log->debug('Update vtiger_leadscf status success. SQL:' . $leadCfSQL);
        $delSQL = "DELETE FROM {$leadExclusivesTable} WHERE datediff(NOW(), created) >=" . MAX_TTME;
        $resultDelSQL = $adb->query($delSQL);
        if ($resultDelSQL) {
            $result = array('success' => true, 'tip' => $delSQL);
            $log->debug('DEL exclusive counts success.');
        } else {
            $log->debug('DEL exclusive failed.SQL:' . $delSQL);
        }
    } else {
        $log->debug('Update vtiger_leadscf status failed.SQL:' . $leadCfSQL);
    }
    $log->debug('update exclusive status end.');
    return $result;
}
 /**
  * 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]);
 }
 static function getInstance()
 {
     if (self::$loggerCache) {
         return self::$loggerCache;
     }
     return LoggerManager::getLogger();
 }
Exemple #6
0
 /**
  * コンストラクタ
  *
  */
 public function __construct()
 {
     $this->log = LoggerManager::getLogger(get_class($this));
     $request = array_merge($_POST, $_GET);
     if (get_magic_quotes_gpc()) {
         $request = $this->_stripSlashesDeep($request);
     }
     if (!ini_get("mbstring.encoding_translation") && INPUT_CODE != INTERNAL_CODE) {
         mb_convert_variables(INTERNAL_CODE, INPUT_CODE, $request);
     }
     // action:~ではじまるパラメータがあればactionMethodをセットする
     $methodName = "execute";
     $key = NULL;
     foreach ($request as $k => $val) {
         if (preg_match('/^action:(.+)$/', $k, $m)) {
             $methodName = $m[1];
             $this->log->debug("actionMethodが指定されました。 {$methodName}");
             $key = $k;
             break;
         }
     }
     $this->actionMethod = $methodName;
     if ($key != NULL) {
         unset($request[$key]);
     }
     $this->_params = $request;
     return;
 }
 public function __construct(MappedClassLoader $mappedClassLoader, SerializationPolicyProvider $serializationPolicyProvider)
 {
     $this->mappedClassLoader = $mappedClassLoader;
     $this->serializationPolicyProvider = $serializationPolicyProvider;
     $this->serializationPolicy = RPC::getDefaultSerializationPolicy();
     $this->logger = LoggerManager::getLogger('gwtphp.rpc.impl.ServerSerializationStreamReader');
 }
function dashboardDisplayCall($type, $Chart_Type, $from_page)
{
    global $app_strings;
    global $app_list_strings;
    global $mod_strings;
    global $currentModule;
    global $theme;
    $theme_path = "themes/" . $theme . "/";
    $image_path = $theme_path . "images/";
    require_once $theme_path . 'layout_utils.php';
    require_once 'include/logging.php';
    $graph_array = array("leadsource" => $mod_strings['leadsource'], "leadstatus" => $mod_strings['leadstatus'], "leadindustry" => $mod_strings['leadindustry'], "salesbyleadsource" => $mod_strings['salesbyleadsource'], "salesbyaccount" => $mod_strings['salesbyaccount'], "salesbyuser" => $mod_strings['salesbyuser'], "salesbyteam" => $mod_strings['salesbyteam'], "accountindustry" => $mod_strings['accountindustry'], "productcategory" => $mod_strings['productcategory'], "productbyqtyinstock" => $mod_strings['productbyqtyinstock'], "productbypo" => $mod_strings['productbypo'], "productbyquotes" => $mod_strings['productbyquotes'], "productbyinvoice" => $mod_strings['productbyinvoice'], "sobyaccounts" => $mod_strings['sobyaccounts'], "sobystatus" => $mod_strings['sobystatus'], "pobystatus" => $mod_strings['pobystatus'], "quotesbyaccounts" => $mod_strings['quotesbyaccounts'], "quotesbystage" => $mod_strings['quotesbystage'], "invoicebyacnts" => $mod_strings['invoicebyacnts'], "invoicebystatus" => $mod_strings['invoicebystatus'], "ticketsbystatus" => $mod_strings['ticketsbystatus'], "ticketsbypriority" => $mod_strings['ticketsbypriority'], "ticketsbycategory" => $mod_strings['ticketsbycategory'], "ticketsbyuser" => $mod_strings['ticketsbyuser'], "ticketsbyteam" => $mod_strings['ticketsbyteam'], "ticketsbyproduct" => $mod_strings['ticketsbyproduct'], "contactbycampaign" => $mod_strings['contactbycampaign'], "ticketsbyaccount" => $mod_strings['ticketsbyaccount'], "ticketsbycontact" => $mod_strings['ticketsbycontact']);
    $log = LoggerManager::getLogger('dashboard');
    if (isset($type) && $type != '') {
        $dashboard_type = $type;
    } else {
        $dashboard_type = 'DashboardHome';
    }
    if (!isset($type)) {
    } else {
        require_once 'modules/Dashboard/display_charts.php';
        $_REQUEST['type'] = $type;
        $_REQUEST['Chart_Type'] = $Chart_Type;
        $_REQUEST['from_page'] = 'HomePage';
        $dashval = dashBoardDisplayChart();
        return $dashval;
    }
}
Exemple #9
0
function getTopAccounts($maxval, $calCnt)
{
    $log = LoggerManager::getLogger('top accounts_list');
    $log->debug("Entering getTopAccounts() method ...");
    require_once "data/Tracker.php";
    require_once 'modules/Potentials/Potentials.php';
    require_once 'include/logging.php';
    require_once 'include/ListView/ListView.php';
    global $app_strings;
    global $adb;
    global $current_language;
    global $current_user;
    $current_module_strings = return_module_language($current_language, "Accounts");
    require 'user_privileges/user_privileges_' . $current_user->id . '.php';
    require 'user_privileges/sharing_privileges_' . $current_user->id . '.php';
    $list_query = "select vtiger_account.accountid, vtiger_account.accountname, vtiger_account.tickersymbol, sum(vtiger_potential.amount) as amount from vtiger_potential inner join vtiger_crmentity on (vtiger_potential.potentialid=vtiger_crmentity.crmid) left join vtiger_account on (vtiger_potential.related_to=vtiger_account.accountid) left join vtiger_groups on (vtiger_groups.groupid = vtiger_crmentity.smownerid) where vtiger_crmentity.deleted=0 AND vtiger_crmentity.smownerid='" . $current_user->id . "' and vtiger_potential.sales_stage not in ('Closed Won', 'Closed Lost','" . $app_strings['LBL_CLOSE_WON'] . "','" . $app_strings['LBL_CLOSE_LOST'] . "')";
    if ($is_admin == false && $profileGlobalPermission[1] == 1 && $profileGlobalPermission[2] == 1 && $defaultOrgSharingPermission[6] == 3) {
        $sec_parameter = getListViewSecurityParameter('Accounts');
        $list_query .= $sec_parameter;
    }
    $list_query .= " group by vtiger_account.accountid, vtiger_account.accountname, vtiger_account.tickersymbol order by amount desc";
    $list_query .= " LIMIT 0," . $adb->sql_escape_string($maxval);
    if ($calCnt == 'calculateCnt') {
        $list_result_rows = $adb->query(mkCountQuery($list_query));
        return $adb->query_result($list_result_rows, 0, 'count');
    }
    $list_result = $adb->query($list_query);
    $open_accounts_list = array();
    $noofrows = $adb->num_rows($list_result);
    if ($noofrows) {
        for ($i = 0; $i < $noofrows; $i++) {
            $open_accounts_list[] = array('accountid' => $adb->query_result($list_result, $i, 'accountid'), 'accountname' => $adb->query_result($list_result, $i, 'accountname'), 'amount' => $adb->query_result($list_result, $i, 'amount'), 'tickersymbol' => $adb->query_result($list_result, $i, 'tickersymbol'));
        }
    }
    $title = array();
    $title[] = 'myTopAccounts.gif';
    $title[] = $current_module_strings['LBL_TOP_ACCOUNTS'];
    $title[] = 'home_myaccount';
    $header = array();
    $header[] = $current_module_strings['LBL_LIST_ACCOUNT_NAME'];
    $currencyid = fetchCurrency($current_user->id);
    $rate_symbol = getCurrencySymbolandCRate($currencyid);
    $rate = $rate_symbol['rate'];
    $curr_symbol = $rate_symbol['symbol'];
    $header[] = $current_module_strings['LBL_LIST_AMOUNT'] . '(' . $curr_symbol . ')';
    $entries = array();
    foreach ($open_accounts_list as $account) {
        $value = array();
        $account_fields = array('ACCOUNT_ID' => $account['accountid'], 'ACCOUNT_NAME' => $account['accountname'], 'AMOUNT' => $account['amount']);
        $Top_Accounts = strlen($account['accountname']) > 20 ? substr($account['accountname'], 0, 20) . '...' : $account['accountname'];
        $value[] = '<a href="index.php?action=DetailView&module=Accounts&record=' . $account['accountid'] . '">' . $Top_Accounts . '</a>';
        $value[] = convertFromDollar($account['amount'], $rate);
        $entries[$account['accountid']] = $value;
    }
    $values = array('ModuleName' => 'Accounts', 'Title' => $title, 'Header' => $header, 'Entries' => $entries);
    $log->debug("Exiting getTopAccounts method ...");
    if ($display_empty_home_blocks && count($entries) == 0 || count($entries) > 0) {
        return $values;
    }
}
Exemple #10
0
 function Tracker()
 {
     $this->log = LoggerManager::getLogger('Tracker');
     // $this->db = PearDatabase::getInstance();
     $adb = PearDatabase::getInstance();
     $this->db = $adb;
 }
 /**
  * Constructor. 
  *
  * @param templateFile Complete path to the template file we are going to render
  */
 function Template($templateFile)
 {
     // initialize logging
     $this->log =& LoggerManager::getLogger("default");
     // create the Smarty object and set the security values
     $this->Smarty();
     $this->caching = false;
     //$this->cache_lifetime =  $cacheLifetime;
     $config =& Config::getConfig();
     $this->cache_dir = $config->getValue('temp_folder');
     $this->_templateFile = $templateFile;
     // enable the security settings
     $this->php_handling = false;
     // code is not allowed in the templates by default, unless specified otherwise
     /*if( $config->getValue( 'allow_php_code_in_templates', false ))
       	$this->security = true;
       else
       	$this->security = false;*/
     $this->security = (bool) (!$config->getValue('allow_php_code_in_templates', false));
     //$this->security = true;
     $this->secure_dir = array("./templates/admin", "./templates/");
     // default folders
     $this->compile_dir = $config->getValue('temp_folder');
     $this->template_dir = $config->getValue('template_folder');
     $this->compile_check = $config->getValue('template_compile_check', true);
     // this helps if php is running in 'safe_mode'
     $this->use_sub_dirs = false;
     // register dynamic block for every template instance
     $this->register_block('dynamic', 'smarty_block_dynamic', false);
 }
 function Webmails($mbox = '', $mailid = '')
 {
     $this->db = PearDatabase::getInstance();
     $this->db->println("Entering Webmail({$mbox},{$mailid})");
     $this->log =& LoggerManager::getLogger('WEBMAILS');
     $this->mbox = $mbox;
     $this->mailid = $mailid;
     $this->headers = $this->load_headers();
     $this->to = $this->headers["theader"]["to"];
     $this->to_name = $this->headers["theader"]["to_name"];
     $this->db->println("Webmail TO:");
     $this->db->println($this->to);
     $this->from = $this->headers["theader"]["from"];
     $this->fromname = $this->headers["theader"]["from_name"];
     $this->fromaddr = $this->headers["theader"]["fromaddr"];
     $this->reply_to = $this->headers["theader"]["reply_to"];
     $this->reply_to_name = $this->headers["theader"]["reply_to_name"];
     $this->cc_list = $this->headers["cc_list"];
     $this->cc_list_name = $this->headers["cc_list_name"];
     $this->subject = $this->headers["theader"]["subject"];
     $this->date = $this->headers["theader"]["date"];
     $this->has_attachments = $this->get_attachments();
     $this->db->println("Exiting Webmail({$mbox},{$mailid})");
     $this->relationship = $this->find_relationships();
     // Added by Puneeth for 5231
 }
 protected function reportException($message, $e)
 {
     $this->logger->fatal("{$message}: " . get_class($e));
     if ($this->logger->wouldLog('error')) {
         $this->logger->error($e->getMessage());
     }
 }
Exemple #14
0
 function Tracker()
 {
     $this->log = LoggerManager::getLogger('Tracker');
     //$this->db = & getSingleDBInstance();
     global $adb;
     $this->db = $adb;
 }
 /**
  * Constructor
  * @ignore 
  */
 function __construct()
 {
     $this->Logger = LoggerManager::getLogger('SignalHandler');
     if (!function_exists("pcntl_signal")) {
         self::RaiseError("Function pcntl_signal() not found. PCNTL must be enabled in PHP.", E_ERROR);
     }
 }
function getTopPotentials($maxval, $calCnt)
{
    $log = LoggerManager::getLogger('top opportunity_list');
    $log->debug("Entering getTopPotentials() method ...");
    require_once "data/Tracker.php";
    require_once 'modules/Potentials/Potentials.php';
    require_once 'include/logging.php';
    require_once 'include/ListView/ListView.php';
    global $app_strings;
    global $adb;
    global $current_language;
    global $current_user;
    $current_module_strings = return_module_language($current_language, "Potentials");
    $title = array();
    $title[] = 'myTopOpenPotentials.gif';
    $title[] = $current_module_strings['LBL_TOP_OPPORTUNITIES'];
    $title[] = 'home_mypot';
    $where = "AND vtiger_potential.potentialid > 0 AND vtiger_potential.sales_stage not in ('Closed Won','Closed Lost','" . $current_module_strings['Closed Won'] . "','" . $current_module_strings['Closed Lost'] . "') AND vtiger_crmentity.smownerid='" . $current_user->id . "' AND vtiger_potential.amount > 0";
    $header = array();
    $header[] = $current_module_strings['LBL_LIST_OPPORTUNITY_NAME'];
    //$header[]=$current_module_strings['LBL_LIST_ACCOUNT_NAME'];
    $currencyid = fetchCurrency($current_user->id);
    $rate_symbol = getCurrencySymbolandCRate($currencyid);
    $rate = $rate_symbol['rate'];
    $curr_symbol = $rate_symbol['symbol'];
    $header[] = $current_module_strings['LBL_LIST_AMOUNT'] . '(' . $curr_symbol . ')';
    $list_query = "SELECT vtiger_crmentity.crmid, vtiger_potential.potentialname,\n\t\t\tvtiger_potential.amount, potentialid\n\t\t\tFROM vtiger_potential\n\t\t\tIGNORE INDEX(PRIMARY) INNER JOIN vtiger_crmentity\n\t\t\t\tON vtiger_crmentity.crmid = vtiger_potential.potentialid";
    $list_query .= getNonAdminAccessControlQuery('Potentials', $current_user);
    $list_query .= "WHERE vtiger_crmentity.deleted = 0 " . $where;
    $list_query .= " ORDER BY amount DESC";
    $list_query .= " LIMIT " . $adb->sql_escape_string($maxval);
    if ($calCnt == 'calculateCnt') {
        $list_result_rows = $adb->query(mkCountQuery($list_query));
        return $adb->query_result($list_result_rows, 0, 'count');
    }
    $list_result = $adb->query($list_query);
    $open_potentials_list = array();
    $noofrows = $adb->num_rows($list_result);
    $entries = array();
    if ($noofrows) {
        for ($i = 0; $i < $noofrows; $i++) {
            $open_potentials_list[] = array('name' => $adb->query_result($list_result, $i, 'potentialname'), 'id' => $adb->query_result($list_result, $i, 'potentialid'), 'amount' => $adb->query_result($list_result, $i, 'amount'));
            $potentialid = $adb->query_result($list_result, $i, 'potentialid');
            $potentialname = $adb->query_result($list_result, $i, 'potentialname');
            $Top_Potential = strlen($potentialname) > 20 ? substr($potentialname, 0, 20) . '...' : $potentialname;
            $value = array();
            $value[] = '<a href="index.php?action=DetailView&module=Potentials&record=' . $potentialid . '">' . $Top_Potential . '</a>';
            $value[] = CurrencyField::convertToUserFormat($adb->query_result($list_result, $i, 'amount'));
            $entries[$potentialid] = $value;
        }
    }
    $advft_criteria_groups = array('1' => array('groupcondition' => null));
    $advft_criteria = array(array('groupid' => 1, 'columnname' => 'vtiger_potential:sales_stage:sales_stage:Potentials_Sales_Stage:V', 'comparator' => 'k', 'value' => 'closed', 'columncondition' => 'and'), array('groupid' => 1, 'columnname' => 'vtiger_potential:amount:amount:Potentials_Amount:N', 'comparator' => 'g', 'value' => '0', 'columncondition' => 'and'), array('groupid' => 1, 'columnname' => 'vtiger_crmentity:smownerid:assigned_user_id:Leads_Assigned_To:V', 'comparator' => 'e', 'value' => getFullNameFromArray('Users', $current_user->column_fields), 'columncondition' => null));
    $search_qry = '&advft_criteria=' . Zend_Json::encode($advft_criteria) . '&advft_criteria_groups=' . Zend_Json::encode($advft_criteria_groups) . '&searchtype=advance&query=true';
    $values = array('ModuleName' => 'Potentials', 'Title' => $title, 'Header' => $header, 'Entries' => $entries, 'search_qry' => $search_qry);
    if (count($open_potentials_list) == 0 || count($open_potentials_list) > 0) {
        $log->debug("Exiting getTopPotentials method ...");
        return $values;
    }
}
Exemple #17
0
 /** constructor function for the main user class
             instantiates the Logger class and PearDatabase Class	
   	  *
  	*/
 function Users()
 {
     $this->log = LoggerManager::getLogger('user');
     $this->log->debug("Entering Users() method ...");
     $this->db =& getSingleDBInstance();
     $this->log->debug("Exiting Users() method ...");
 }
Exemple #18
0
 /**
  * Construction of a DBO object
  * @param String table name of the Dbo
  * @param array the initial row value of the Dbo
  */
 public function __construct()
 {
     $this->logger =& LoggerManager::getLogger(get_class($this));
     $this->dbHandler = CalemFactory::getDbHandler();
     $this->conn = $this->dbHandler->getCalemConnection();
     $this->resourceMgr = CalemFactory::getResourceManager();
 }
 public function __construct()
 {
     $this->logger =& LoggerManager::getLogger("CalemSchedulerJobBo");
     $this->dbo = CalemFactory::getDbo('scheduler_job');
     $this->dboRun = CalemFactory::getDbo('scheduler_job_log');
     $this->taskDbo = CalemFactory::getDbo('scheduler_task');
 }
Exemple #20
0
/** to get the details of a KeyMetrics on Home page 
 * @returns  $customviewlist Array in the following format
 * $values = Array('Title'=>Array(0=>'image name',
 *				 1=>'Key Metrics',
 *			 	 2=>'home_metrics'
 *			 	),
 *		  'Header'=>Array(0=>'Metrics',
 *	  			  1=>'Count'
 *			  	),
 *		  'Entries'=>Array($cvid=>Array(
 *			  			0=>$customview name,
 *						1=>$no of records for the view
 *					       ),
 *				   $cvid=>Array(
 *                                               0=>$customview name,
 *                                               1=>$no of records for the view
 *                                              ),
 *					|
 *					|
 *				   $cvid=>Array(
 *                                               0=>$customview name,
 *                                               1=>$no of records for the view
 *                                              )	
 *				  )
 *
 */
function getKeyMetrics()
{
    require_once "data/Tracker.php";
    require_once 'modules/CustomView/CustomView.php';
    require_once 'include/logging.php';
    require_once 'include/ListView/ListView.php';
    global $app_strings;
    global $adb;
    global $log;
    global $current_language;
    $metricviewnames = "'Hot Leads'";
    $current_module_strings = return_module_language($current_language, "CustomView");
    $log = LoggerManager::getLogger('metrics');
    $metriclists = getMetricList();
    $log->info("Metrics :: Successfully got MetricList to be displayed");
    if (isset($metriclists)) {
        foreach ($metriclists as $key => $metriclist) {
            $listquery = getListQuery($metriclist['module']);
            if (empty($listquery)) {
                if (is_file("modules/" . $metriclist['module'] . "/" . $metriclist['module'] . ".php")) {
                    include_once "modules/" . $metriclist['module'] . "/" . $metriclist['module'] . ".php";
                    $metric_focus = new $metriclist['module']();
                    $listquery = $metric_focus->getListQuery('');
                }
            }
            $oCustomView = new CustomView($metriclist['module']);
            $metricsql = $oCustomView->getMetricsCvListQuery($metriclist['id'], $listquery, $metriclist['module']);
            $metricresult = $adb->query($metricsql);
            if ($metricresult) {
                $rowcount = $adb->fetch_array($metricresult);
                if (isset($rowcount)) {
                    $metriclists[$key]['count'] = $rowcount['count'];
                }
            }
        }
        $log->info("Metrics :: Successfully build the Metrics");
    }
    $title = array();
    $title[] = 'keyMetrics.gif';
    $title[] = $app_strings['LBL_HOME_KEY_METRICS'];
    $title[] = 'home_metrics';
    $header = array();
    $header[] = $app_strings['LBL_HOME_METRICS'];
    $header[] = $app_strings['LBL_HOME_COUNT'];
    $entries = array();
    if (isset($metriclists)) {
        $oddRow = true;
        foreach ($metriclists as $metriclist) {
            $value = array();
            $metric_fields = array('ID' => $metriclist['id'], 'NAME' => $metriclist['name'], 'COUNT' => $metriclist['count'], 'MODULE' => $metriclist['module']);
            $value[] = '<a href="index.php?action=index&module=' . $metriclist['module'] . '&viewname=' . $metriclist['id'] . '">' . $metriclist['name'] . '</a>';
            $value[] = '<a href="index.php?action=index&module=' . $metriclist['module'] . '&viewname=' . $metriclist['id'] . '">' . $metriclist['count'] . '</a>';
            $entries[$metriclist['id']] = $value;
        }
    }
    $values = array('Title' => $title, 'Header' => $header, 'Entries' => $entries);
    //if ( ($display_empty_home_blocks ) || (count($value)!= 0) )
    return $values;
}
 function listViewProcess()
 {
     $GLOBALS['log'] = LoggerManager::getLogger('SugarCRM');
     global $sugar_config;
     global $current_user;
     global $app_strings;
     global $timedate;
     $type = clean_string($_REQUEST['module']);
     $db = DBManagerFactory::getInstance();
     /* $query = $_REQUEST['query'];
        if($query){
            $ret_array = generateSearchWhere($type, $_REQUEST['current_post']);
            $w = $ret_array['where'];
            $where = "IN ( SELECT id from grouplists WHERE ".$w .")";  
        }
        else{
            $where = '';
        } */
     /*$ids = $_REQUEST['uid']; 
                 if($ids) {
                     $ids = explode(',', $ids);
                     $ids = "'" . implode("','", $ids) . "'";
                     $where = "in ($ids)";
                 } 
                 else if (isset($_REQUEST['all']) ){
                         $where = '';//get all
     
                     } else {
                         if(!empty($_REQUEST['current_post'])) {
                             $ret_array = generateSearchWhere($type, $_REQUEST['current_post']);
     
                             $w = $ret_array['where'];
                             $where = "IN ( SELECT id from grouplists WHERE ".$w .")";
     
                         } else {
                             $where = '';
                         }
                 }*/
     $focus = new GroupLists();
     // $query = $focus->create_new_list_query($order_by, $where,$filter=array(),$params=array(), $show_deleted = 0,$join_type='', $return_array = false, $parentbean=null, $singleSelect = false);
     $query = $focus->{$start_date} = $_REQUEST['start_date'];
     $end_date = $_REQUEST['end_date'];
     $template = file_get_contents('modules/GroupLists/tpls/report.tpl');
     $template = str_replace('{START}', $start_date, $template);
     $template = str_replace('{END}', $end_date, $template);
     $template = str_replace('{LIST_GIT}', $focus->get_GIT_to_report($where), $template);
     $template = str_replace('{LIST_FIT}', $focus->get_FIT_to_report($where), $template);
     $size = strlen($template);
     $filename = "DS KHACH DI TOUR TU " . $start_date . " DEN " . $end_date . ".doc";
     ob_end_clean();
     header("Cache-Control: private");
     header("Content-Type: application/force-download;");
     header("Content-Disposition:attachment; filename=\"{$filename}\"");
     header("Content-length:{$size}");
     echo $template;
     ob_flush();
     //    header("Location: index.php?module=GroupLists&action=index");
     sugar_cleanup(true);
 }
Exemple #22
0
 /**	Constructor which will set the column_fields in this object
  */
 function Vendors()
 {
     $this->log = LoggerManager::getLogger('vendor');
     $this->log->debug("Entering Vendors() method ...");
     $this->db = PearDatabase::getInstance();
     $this->column_fields = getColumnFields('Vendors');
     $this->log->debug("Exiting Vendor method ...");
 }
 /**
  * Constructor
  */
 function __construct($dbtype = '', $host = '', $dbname = '', $username = '', $passwd = '', $port = 3306)
 {
     $this->log = LoggerManager::getLogger('DB');
     $this->loadDBConfig($dbtype, $host, $dbname, $username, $passwd, $port);
     $this->isdb_default_utf8_charset = PerformancePrefs::getBoolean('DB_DEFAULT_CHARSET_UTF8');
     $this->setDieOnError(SysDebug::get('SQL_DIE_ON_ERROR'));
     $this->connect();
 }
 public function __construct()
 {
     $this->logger = LoggerManager::getLogger('CalemDataLoader');
     $this->dbHandler = CalemFactory::getDbHandler();
     $this->conn = $this->dbHandler->getCalemConnection();
     $this->stats = array();
     $this->resourceMgr = CalemFactory::getResourceManager();
 }
Exemple #25
0
 /**	Constructor which will set the column_fields in this object
  */
 function Invoice()
 {
     $this->log = LoggerManager::getLogger('Invoice');
     $this->log->debug("Entering Invoice() method ...");
     $this->db = PearDatabase::getInstance();
     $this->column_fields = getColumnFields('Invoice');
     $this->log->debug("Exiting Invoice method ...");
 }
Exemple #26
0
 function Maillists()
 {
     $this->log = LoggerManager::getLogger('maillists');
     $this->log->debug("Entering Maillists() method ...");
     $this->db =& getSingleDBInstance();
     $this->column_fields = getColumnFields('Maillists');
     $this->log->debug("Exiting Maillists method ...");
 }
Exemple #27
0
 /**	Constructor which will set the column_fields in this object
  */
 function HelpDesk()
 {
     $this->log = LoggerManager::getLogger('helpdesk');
     $this->log->debug("Entering HelpDesk() method ...");
     $this->db = PearDatabase::getInstance();
     $this->column_fields = getColumnFields('HelpDesk');
     $this->log->debug("Exiting HelpDesk method ...");
 }
Exemple #28
0
 function Leads()
 {
     $this->log = LoggerManager::getLogger('lead');
     $this->log->debug("Entering Leads() method ...");
     $this->db = PearDatabase::getInstance();
     $this->column_fields = getColumnFields('Leads');
     $this->log->debug("Exiting Lead method ...");
 }
Exemple #29
0
 function Relsettings()
 {
     $this->log = LoggerManager::getLogger('relsettings');
     $this->log->debug("Entering Relsettings() method ...");
     $this->db =& getSingleDBInstance();
     $this->column_fields = getColumnFields('Relsettings');
     $this->log->debug("Exiting Relsettings method ...");
 }
Exemple #30
0
 function Documents()
 {
     $this->log = LoggerManager::getLogger('notes');
     $this->log->debug("Entering Documents() method ...");
     $this->db = PearDatabase::getInstance();
     $this->column_fields = getColumnFields('Documents');
     $this->log->debug("Exiting Documents method ...");
 }