Passed
Push — scrutinizer-code-quality ( 09f5a1...c4c5fb )
by Adam
56:05 queued 14:08
created

ViewDetail   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 59
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 93.33%

Importance

Changes 1
Bugs 1 Features 1
Metric Value
c 1
b 1
f 1
dl 0
loc 59
ccs 14
cts 15
cp 0.9333
rs 10
wmc 6
lcom 1
cbo 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A ViewDetail() 0 10 2
A preDisplay() 0 7 1
A display() 0 8 2
1
<?php
2
/*********************************************************************************
3
 * SugarCRM Community Edition is a customer relationship management program developed by
4
 * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
5
6
 * SuiteCRM is an extension to SugarCRM Community Edition developed by Salesagility Ltd.
7
 * Copyright (C) 2011 - 2014 Salesagility Ltd.
8
 *
9
 * This program is free software; you can redistribute it and/or modify it under
10
 * the terms of the GNU Affero General Public License version 3 as published by the
11
 * Free Software Foundation with the addition of the following permission added
12
 * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
13
 * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
14
 * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
15
 *
16
 * This program is distributed in the hope that it will be useful, but WITHOUT
17
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18
 * FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more
19
 * details.
20
 *
21
 * You should have received a copy of the GNU Affero General Public License along with
22
 * this program; if not, see http://www.gnu.org/licenses or write to the Free
23
 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
24
 * 02110-1301 USA.
25
 *
26
 * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
27
 * SW2-130, Cupertino, CA 95014, USA. or at email address [email protected].
28
 *
29
 * The interactive user interfaces in modified source and object code versions
30
 * of this program must display Appropriate Legal Notices, as required under
31
 * Section 5 of the GNU Affero General Public License version 3.
32
 *
33
 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
34
 * these Appropriate Legal Notices must retain the display of the "Powered by
35
 * SugarCRM" logo and "Supercharged by SuiteCRM" logo. If the display of the logos is not
36
 * reasonably feasible for  technical reasons, the Appropriate Legal Notices must
37
 * display the words  "Powered by SugarCRM" and "Supercharged by SuiteCRM".
38
 ********************************************************************************/
39
40 1
require_once('include/DetailView/DetailView2.php');
41
42
/**
43
 * Default view class for handling DetailViews
44
 *
45
 * @package MVC
46
 * @category Views
47
 */
48
class ViewDetail extends SugarView
49
{
50
    /**
51
     * @see SugarView::$type
52
     */
53
    public $type = 'detail';
54
55
    /**
56
     * @var DetailView2 object
57
     */
58
    public $dv;
59
60
    /**
61
     * Constructor
62
     *
63
     * @see SugarView::SugarView()
64
     */
65 8
    public function __construct()
66
    {
67 8
        parent::__construct();
68 8
    }
69
70
    /**
71
     * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead
72
     */
73
    function ViewDetail(){
74
        $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code';
75
        if(isset($GLOBALS['log'])) {
76
            $GLOBALS['log']->deprecated($deprecatedMessage);
77
        }
78
        else {
79
            trigger_error($deprecatedMessage, E_USER_DEPRECATED);
80
        }
81
        self::__construct();
82
    }
83
84
    /**
85
     * @see SugarView::preDisplay()
86
     */
87 2
    public function preDisplay()
88
    {
89 2
 	    $metadataFile = $this->getMetaDataFile();
90 2
 	    $this->dv = new DetailView2();
0 ignored issues
show
Bug introduced by
The call to DetailView2::__construct() misses some required arguments starting with $module.
Loading history...
91 2
 	    $this->dv->ss =&  $this->ss;
92 2
 	    $this->dv->setup($this->module, $this->bean, $metadataFile, get_custom_file_if_exists('include/DetailView/DetailView.tpl'));
93 2
    }
94
95
    /**
96
     * @see SugarView::display()
97
     */
98 1
    public function display()
99
    {
100 1
        if(empty($this->bean->id)){
101
            sugar_die($GLOBALS['app_strings']['ERROR_NO_RECORD']);
102
        }
103 1
        $this->dv->process();
104 1
        echo $this->dv->display();
105 1
    }
106
}
107