Passed
Push — developer ( 6b5868...bed0f9 )
by Radosław
22:42 queued 03:39
created

Leads_LeadsCreated_Dashboard::process()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 19
Code Lines 16

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 16
c 1
b 0
f 0
dl 0
loc 19
ccs 0
cts 16
cp 0
rs 9.7333
cc 2
nc 2
nop 1
crap 6
1
<?php
2
/* +***********************************************************************************
3
 * The contents of this file are subject to the vtiger CRM Public License Version 1.0
4
 * ("License"); You may not use this file except in compliance with the License
5
 * The Original Code is:  vtiger CRM Open Source
6
 * The Initial Developer of the Original Code is vtiger.
7
 * Portions created by vtiger are Copyright (C) vtiger.
8
 * All Rights Reserved.
9
 * *********************************************************************************** */
10
11
class Leads_LeadsCreated_Dashboard extends Vtiger_IndexAjax_View
12
{
13
	public function process(App\Request $request)
14
	{
15
		$currentUserId = \App\User::getCurrentUserId();
16
		$viewer = $this->getViewer($request);
17
		$moduleName = $request->getModule();
18
		$owner = $request->getByType('owner', 2);
19
		$data = Vtiger_Module_Model::getInstance($moduleName)->getLeadsCreated($owner, $request->getDateRange('createdtime'));
0 ignored issues
show
Bug introduced by
The method getLeadsCreated() does not exist on Vtiger_Module_Model. It seems like you code against a sub-type of Vtiger_Module_Model such as Leads_Module_Model. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

19
		$data = Vtiger_Module_Model::getInstance($moduleName)->/** @scrutinizer ignore-call */ getLeadsCreated($owner, $request->getDateRange('createdtime'));
Loading history...
20
		$widget = Vtiger_Widget_Model::getInstance($request->getInteger('linkid'), $currentUserId);
21
		//Include special script and css needed for this widget
22
		$viewer->assign('SCRIPTS', $this->getHeaderScripts($request));
23
		$viewer->assign('WIDGET', $widget);
24
		$viewer->assign('MODULE_NAME', $moduleName);
25
		$viewer->assign('CURRENTUSERID', $currentUserId);
26
		$viewer->assign('DATA', $data);
27
		$viewer->assign('ACCESSIBLE_USERS', \App\Fields\Owner::getInstance('Leads', $currentUserId)->getAccessibleUsersForModule());
28
		if ($request->has('content')) {
29
			$viewer->view('dashboards/DashBoardWidgetContents.tpl', $moduleName);
30
		} else {
31
			$viewer->view('dashboards/LeadsCreated.tpl', $moduleName);
32
		}
33
	}
34
}
35