Passed
Push — scrutinizer-code-quality ( 27193c...09f5a1 )
by Adam
51:28
created
modules/SecurityGroups/SecurityGroupUserRelationship.php 3 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -32,14 +32,14 @@
 block discarded – undo
32 32
     
33 33
     var $additional_column_fields = Array();
34 34
         var $field_defs = array (
35
-       'id'=>array('name' =>'id', 'type' =>'char', 'len'=>'36', 'default'=>'')
36
-      , 'securitygroup_id'=>array('name' =>'securitygroup_id', 'type' =>'char', 'len'=>'36', )
37
-      , 'user_id'=>array('name' =>'user_id', 'type' =>'char', 'len'=>'36',)
38
-      , 'noninheritable'=>array('name' =>'noninheritable', 'type' =>'bool', 'len'=>'1')
39
-      , 'primary_group'=>array('name' =>'primary_group', 'type' =>'bool', 'len'=>'1')
40
-      , 'date_modified'=>array ('name' => 'date_modified','type' => 'datetime')
41
-      , 'deleted'=>array('name' =>'deleted', 'type' =>'bool', 'len'=>'1', 'default'=>'0', 'required'=>true)
42
-      );
35
+        'id'=>array('name' =>'id', 'type' =>'char', 'len'=>'36', 'default'=>'')
36
+        , 'securitygroup_id'=>array('name' =>'securitygroup_id', 'type' =>'char', 'len'=>'36', )
37
+        , 'user_id'=>array('name' =>'user_id', 'type' =>'char', 'len'=>'36',)
38
+        , 'noninheritable'=>array('name' =>'noninheritable', 'type' =>'bool', 'len'=>'1')
39
+        , 'primary_group'=>array('name' =>'primary_group', 'type' =>'bool', 'len'=>'1')
40
+        , 'date_modified'=>array ('name' => 'date_modified','type' => 'datetime')
41
+        , 'deleted'=>array('name' =>'deleted', 'type' =>'bool', 'len'=>'1', 'default'=>'0', 'required'=>true)
42
+        );
43 43
     function SecurityGroupUserRelationship() {
44 44
         $this->db = DBManagerFactory::getInstance();
45 45
         $this->dbManager = DBManagerFactory::getInstance();
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 
4 4
 
5 5
 require_once('data/SugarBean.php');
@@ -31,46 +31,46 @@  discard block
 block discarded – undo
31 31
     var $new_schema = true;
32 32
     
33 33
     var $additional_column_fields = Array();
34
-        var $field_defs = array (
34
+        var $field_defs = array(
35 35
        'id'=>array('name' =>'id', 'type' =>'char', 'len'=>'36', 'default'=>'')
36
-      , 'securitygroup_id'=>array('name' =>'securitygroup_id', 'type' =>'char', 'len'=>'36', )
36
+      , 'securitygroup_id'=>array('name' =>'securitygroup_id', 'type' =>'char', 'len'=>'36',)
37 37
       , 'user_id'=>array('name' =>'user_id', 'type' =>'char', 'len'=>'36',)
38 38
       , 'noninheritable'=>array('name' =>'noninheritable', 'type' =>'bool', 'len'=>'1')
39 39
       , 'primary_group'=>array('name' =>'primary_group', 'type' =>'bool', 'len'=>'1')
40
-      , 'date_modified'=>array ('name' => 'date_modified','type' => 'datetime')
40
+      , 'date_modified'=>array('name' => 'date_modified', 'type' => 'datetime')
41 41
       , 'deleted'=>array('name' =>'deleted', 'type' =>'bool', 'len'=>'1', 'default'=>'0', 'required'=>true)
42 42
       );
43 43
     function SecurityGroupUserRelationship() {
44 44
         $this->db = DBManagerFactory::getInstance();
45 45
         $this->dbManager = DBManagerFactory::getInstance();
46 46
 
47
-        $this->disable_row_level_security =true;
47
+        $this->disable_row_level_security = true;
48 48
 
49 49
         }
50 50
 
51 51
     function fill_in_additional_detail_fields()
52 52
     {
53
-        if(isset($this->securitygroup_id) && $this->securitygroup_id != "")
53
+        if (isset($this->securitygroup_id) && $this->securitygroup_id != "")
54 54
         {
55 55
             $query = "SELECT name from securitygroups where id='$this->securitygroup_id' AND deleted=0";
56
-            $result =$this->db->query($query,true," Error filling in additional detail fields: ");
56
+            $result = $this->db->query($query, true, " Error filling in additional detail fields: ");
57 57
             // Get the id and the name.
58 58
             $row = $this->db->fetchByAssoc($result);
59 59
 
60
-            if($row != null)
60
+            if ($row != null)
61 61
             {
62 62
                 $this->securitygroup_name = $row['name'];
63 63
             }
64 64
         }
65 65
 
66
-        if(isset($this->user_id) && $this->user_id != "")
66
+        if (isset($this->user_id) && $this->user_id != "")
67 67
         {
68 68
             $query = "SELECT user_name from users where id='$this->user_id' AND deleted=0";
69
-            $result =$this->db->query($query,true," Error filling in additional detail fields: ");
69
+            $result = $this->db->query($query, true, " Error filling in additional detail fields: ");
70 70
             // Get the id and the name.
71 71
             $row = $this->db->fetchByAssoc($result);
72 72
 
73
-            if($row != null)
73
+            if ($row != null)
74 74
             {
75 75
                 $this->user_name = $row['user_name'];
76 76
             }
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
         $query = "SELECT id, first_name, last_name, user_name FROM users ";
84 84
         $where_auto = "deleted=0";
85 85
 
86
-        if($where != "")
86
+        if ($where != "")
87 87
             $query .= "where $where AND ".$where_auto;
88 88
         else
89 89
             $query .= "where ".$where_auto;
Please login to merge, or discard this patch.
Braces   +8 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 
4 6
 
5 7
 require_once('data/SugarBean.php');
@@ -83,10 +85,11 @@  discard block
 block discarded – undo
83 85
         $query = "SELECT id, first_name, last_name, user_name FROM users ";
84 86
         $where_auto = "deleted=0";
85 87
 
86
-        if($where != "")
87
-            $query .= "where $where AND ".$where_auto;
88
-        else
89
-            $query .= "where ".$where_auto;
88
+        if($where != "") {
89
+                    $query .= "where $where AND ".$where_auto;
90
+        } else {
91
+                    $query .= "where ".$where_auto;
92
+        }
90 93
 
91 94
         $query .= " ORDER BY last_name, first_name";
92 95
 
Please login to merge, or discard this patch.
modules/SecurityGroups/SecurityGroupMessage.php 3 patches
Braces   +11 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?PHP
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 
4 6
 class SecurityGroupMessage extends Basic {
5 7
 	var $new_schema = true;
@@ -91,7 +93,10 @@  discard block
 block discarded – undo
91 93
 			$securitygroup_id = null; //6.4.0
92 94
 		}
93 95
 		$message = new SecurityGroupMessage();
94
-		if(empty($text)) return; // || !$feed->ACLAccess('save', true) )return;
96
+		if(empty($text)) {
97
+		    return;
98
+		}
99
+		// || !$feed->ACLAccess('save', true) )return;
95 100
 
96 101
 		$text = strip_tags($text);
97 102
 		$message->name = '';
@@ -120,18 +125,18 @@  discard block
 block discarded – undo
120 125
 		if($weeks == 1){
121 126
 			$result = translate('LBL_TIME_LAST_WEEK','SugarFeed').' ';
122 127
 			return $result;
123
-		}else if($weeks > 1){
128
+		} else if($weeks > 1){
124 129
 			$result .= $weeks . ' '.translate('LBL_TIME_WEEKS','SugarFeed').' ';
125 130
 			if($days > 0) { 
126 131
                 $result .= $days . ' '.translate('LBL_TIME_DAYS','SugarFeed').' ';
127 132
             }
128
-		}else{
133
+		} else{
129 134
 			if($days == 1){
130 135
 				$result = translate('LBL_TIME_YESTERDAY','SugarFeed').' ';
131 136
 				return $result;
132
-			}else if($days > 1){
137
+			} else if($days > 1){
133 138
 				$result .= $days . ' '. translate('LBL_TIME_DAYS','SugarFeed').' ';
134
-			}else{
139
+			} else{
135 140
 				if($hours == 1) {
136 141
                     $result .= $hours . ' '.translate('LBL_TIME_HOUR','SugarFeed').' ';
137 142
                 } else {
Please login to merge, or discard this patch.
Indentation   +138 added lines, -138 removed lines patch added patch discarded remove patch
@@ -2,169 +2,169 @@
 block discarded – undo
2 2
 if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 
4 4
 class SecurityGroupMessage extends Basic {
5
-	var $new_schema = true;
6
-	var $module_dir = 'SecurityGroups';
7
-	var $object_name = 'SecurityGroupMessage';
8
-	var $table_name = 'securitygroups_message';
9
-	var $importable = false;
10
-
11
-	var $id;
12
-	var $name;
13
-	var $date_entered;
14
-	var $date_modified;
15
-	var $modified_user_id;
16
-	var $modified_by_name;
17
-	var $created_by;
18
-	var $created_by_name;
19
-	var $description;
20
-	var $deleted;
21
-	var $created_by_link;
22
-	var $modified_user_link;
23
-
24
-
25
-	var $additional_column_fields = Array();
26
-	var $field_defs = array (
27
-       'id'=>array('name' =>'id', 'type' =>'char', 'len'=>'36', 'default'=>'')
28
-      , 'name'=>array('name' =>'name', 'type' =>'varchar', 'len'=>'255', )
29
-      , 'date_entered'=>array ('name' => 'date_entered','type' => 'datetime')
30
-      , 'date_modified'=>array ('name' => 'date_modified','type' => 'datetime')
31
-      , 'modified_user_id'=>array('name' =>'modified_user_id', 'type' =>'char', 'len'=>'36',)
32
-      , 'created_by'=>array('name' =>'created_by', 'type' =>'char', 'len'=>'36',)
33
-      , 'description'=>array('name' =>'description', 'type' =>'text', 'len'=>'',)
34
-      , 'deleted'=>array('name' =>'deleted', 'type' =>'bool', 'len'=>'1', 'default'=>'0', 'required'=>true)
35
-      , 'securitygroup_id'=>array('name' =>'securitygroup_id', 'type' =>'char', 'len'=>'36',)
5
+    var $new_schema = true;
6
+    var $module_dir = 'SecurityGroups';
7
+    var $object_name = 'SecurityGroupMessage';
8
+    var $table_name = 'securitygroups_message';
9
+    var $importable = false;
10
+
11
+    var $id;
12
+    var $name;
13
+    var $date_entered;
14
+    var $date_modified;
15
+    var $modified_user_id;
16
+    var $modified_by_name;
17
+    var $created_by;
18
+    var $created_by_name;
19
+    var $description;
20
+    var $deleted;
21
+    var $created_by_link;
22
+    var $modified_user_link;
23
+
24
+
25
+    var $additional_column_fields = Array();
26
+    var $field_defs = array (
27
+        'id'=>array('name' =>'id', 'type' =>'char', 'len'=>'36', 'default'=>'')
28
+        , 'name'=>array('name' =>'name', 'type' =>'varchar', 'len'=>'255', )
29
+        , 'date_entered'=>array ('name' => 'date_entered','type' => 'datetime')
30
+        , 'date_modified'=>array ('name' => 'date_modified','type' => 'datetime')
31
+        , 'modified_user_id'=>array('name' =>'modified_user_id', 'type' =>'char', 'len'=>'36',)
32
+        , 'created_by'=>array('name' =>'created_by', 'type' =>'char', 'len'=>'36',)
33
+        , 'description'=>array('name' =>'description', 'type' =>'text', 'len'=>'',)
34
+        , 'deleted'=>array('name' =>'deleted', 'type' =>'bool', 'len'=>'1', 'default'=>'0', 'required'=>true)
35
+        , 'securitygroup_id'=>array('name' =>'securitygroup_id', 'type' =>'char', 'len'=>'36',)
36 36
     );
37 37
 
38 38
 
39
-	function __construct(){
40
-		parent::__construct();
41
-	}
42
-
43
-
44
-	function get_list_view_data(){
45
-		$data = parent::get_list_view_data();
46
-		$delete = '';
47
-
48
-		$group_owner = false;
49
-		$securitygroup_name = "";
50
-		if(empty($data['SECURITYGROUP_ID'])) {
51
-			$securitygroup_name = "All";
52
-		} else {
53
-			require_once('modules/SecurityGroups/SecurityGroup.php');
54
-			$securitygroup = new SecurityGroup();
55
-			$securitygroup->retrieve($data['SECURITYGROUP_ID']);
56
-			$securitygroup_name = $securitygroup->name;
57
-
58
-			if($securitygroup->assigned_user_id == $GLOBALS['current_user']->id) {
59
-				$group_owner = true;
60
-			}
61
-		}
62
-
63
-		if(is_admin($GLOBALS['current_user']) || $data['CREATED_BY'] == $GLOBALS['current_user']->id || $group_owner) {
64
-			$delete = SugarThemeRegistry::current()->getImage( 'delete_inline', 'width="12" height="12" border="0" align="absmiddle" style="vertical-align: bottom;" onclick=\'Message.deleteMessage("'. $data['ID'] . '", "{this.id}")\'',null,null,'.gif','');
65
-		}
66
-
67
-		$username = "";
68
-		if(empty($data['CREATED_BY'])) {
69
-			$username = "Unknown";
70
-		} else {
71
-			require_once('modules/Users/User.php');
72
-			$user = new User();
73
-			$user->retrieve($data['CREATED_BY']);
74
-			$username = $user->user_name;
75
-		}
76
-
77
-		$data['NAME'] = $data['DESCRIPTION'];
78
-		$data['NAME'] =  '<div class="list view" style="padding:5px;border:none;">' . html_entity_decode($data['NAME']);
39
+    function __construct(){
40
+        parent::__construct();
41
+    }
42
+
43
+
44
+    function get_list_view_data(){
45
+        $data = parent::get_list_view_data();
46
+        $delete = '';
47
+
48
+        $group_owner = false;
49
+        $securitygroup_name = "";
50
+        if(empty($data['SECURITYGROUP_ID'])) {
51
+            $securitygroup_name = "All";
52
+        } else {
53
+            require_once('modules/SecurityGroups/SecurityGroup.php');
54
+            $securitygroup = new SecurityGroup();
55
+            $securitygroup->retrieve($data['SECURITYGROUP_ID']);
56
+            $securitygroup_name = $securitygroup->name;
57
+
58
+            if($securitygroup->assigned_user_id == $GLOBALS['current_user']->id) {
59
+                $group_owner = true;
60
+            }
61
+        }
62
+
63
+        if(is_admin($GLOBALS['current_user']) || $data['CREATED_BY'] == $GLOBALS['current_user']->id || $group_owner) {
64
+            $delete = SugarThemeRegistry::current()->getImage( 'delete_inline', 'width="12" height="12" border="0" align="absmiddle" style="vertical-align: bottom;" onclick=\'Message.deleteMessage("'. $data['ID'] . '", "{this.id}")\'',null,null,'.gif','');
65
+        }
66
+
67
+        $username = "";
68
+        if(empty($data['CREATED_BY'])) {
69
+            $username = "Unknown";
70
+        } else {
71
+            require_once('modules/Users/User.php');
72
+            $user = new User();
73
+            $user->retrieve($data['CREATED_BY']);
74
+            $username = $user->user_name;
75
+        }
76
+
77
+        $data['NAME'] = $data['DESCRIPTION'];
78
+        $data['NAME'] =  '<div class="list view" style="padding:5px;border:none;">' . html_entity_decode($data['NAME']);
79 79
         $data['NAME'] .= '<div class="byLineBox" style="padding-top: 2px"><span class="byLineLeft">'.$username.' ['.$securitygroup_name.']';
80
-		$data['NAME'] .= '&nbsp;</span><span style="cursor: pointer;" class="byLineRight"> '.  $this->getTimeLapse($data['DATE_ENTERED']) . ' &nbsp;' .$delete. '</span></div>';
81
-		return  $data ;
82
-	}
83
-
84
-
85
-	static function saveMessage($text, $securitygroup_id) {
86
-		//if no security group id then must be admin. Otherwise, make sure the user is a member of the group
87
-		global $current_user;
88
-		if(empty($securitygroup_id) && !is_admin($current_user)) {
89
-			return;
90
-		} else if(empty($securitygroup_id)) {
91
-			$securitygroup_id = null; //6.4.0
92
-		}
93
-		$message = new SecurityGroupMessage();
94
-		if(empty($text)) return; // || !$feed->ACLAccess('save', true) )return;
95
-
96
-		$text = strip_tags($text);
97
-		$message->name = '';
98
-		$message->description = $text;
99
-		$message->securitygroup_id = $securitygroup_id;
100
-		$message->save();
101
-	}
102
-
103
-	function getTimeLapse($startDate)
104
-	{
105
-		$startDate = $GLOBALS['timedate']->to_db($startDate);
106
-		$start = array();
107
-   		preg_match('/(\d+)\-(\d+)\-(\d+) (\d+)\:(\d+)\:(\d+)/', $startDate, $start);
108
-		$end = gmdate('Y-m-d H:i:s');
109
-    	$start_time = gmmktime($start[4],$start[5], $start[6], $start[2], $start[3], $start[1] );
110
-		$seconds = time()- $start_time;
111
-		$minutes =   $seconds/60;
112
-		$seconds = $seconds % 60;
113
-		$hours = floor( $minutes / 60);
114
-		$minutes = $minutes % 60;
115
-		$days = floor( $hours / 24);
116
-		$hours = $hours % 24;
117
-		$weeks = floor( $days / 7);
118
-		$days = $days % 7;
119
-		$result = '';
120
-		if($weeks == 1){
121
-			$result = translate('LBL_TIME_LAST_WEEK','SugarFeed').' ';
122
-			return $result;
123
-		}else if($weeks > 1){
124
-			$result .= $weeks . ' '.translate('LBL_TIME_WEEKS','SugarFeed').' ';
125
-			if($days > 0) {
80
+        $data['NAME'] .= '&nbsp;</span><span style="cursor: pointer;" class="byLineRight"> '.  $this->getTimeLapse($data['DATE_ENTERED']) . ' &nbsp;' .$delete. '</span></div>';
81
+        return  $data ;
82
+    }
83
+
84
+
85
+    static function saveMessage($text, $securitygroup_id) {
86
+        //if no security group id then must be admin. Otherwise, make sure the user is a member of the group
87
+        global $current_user;
88
+        if(empty($securitygroup_id) && !is_admin($current_user)) {
89
+            return;
90
+        } else if(empty($securitygroup_id)) {
91
+            $securitygroup_id = null; //6.4.0
92
+        }
93
+        $message = new SecurityGroupMessage();
94
+        if(empty($text)) return; // || !$feed->ACLAccess('save', true) )return;
95
+
96
+        $text = strip_tags($text);
97
+        $message->name = '';
98
+        $message->description = $text;
99
+        $message->securitygroup_id = $securitygroup_id;
100
+        $message->save();
101
+    }
102
+
103
+    function getTimeLapse($startDate)
104
+    {
105
+        $startDate = $GLOBALS['timedate']->to_db($startDate);
106
+        $start = array();
107
+            preg_match('/(\d+)\-(\d+)\-(\d+) (\d+)\:(\d+)\:(\d+)/', $startDate, $start);
108
+        $end = gmdate('Y-m-d H:i:s');
109
+        $start_time = gmmktime($start[4],$start[5], $start[6], $start[2], $start[3], $start[1] );
110
+        $seconds = time()- $start_time;
111
+        $minutes =   $seconds/60;
112
+        $seconds = $seconds % 60;
113
+        $hours = floor( $minutes / 60);
114
+        $minutes = $minutes % 60;
115
+        $days = floor( $hours / 24);
116
+        $hours = $hours % 24;
117
+        $weeks = floor( $days / 7);
118
+        $days = $days % 7;
119
+        $result = '';
120
+        if($weeks == 1){
121
+            $result = translate('LBL_TIME_LAST_WEEK','SugarFeed').' ';
122
+            return $result;
123
+        }else if($weeks > 1){
124
+            $result .= $weeks . ' '.translate('LBL_TIME_WEEKS','SugarFeed').' ';
125
+            if($days > 0) {
126 126
                 $result .= $days . ' '.translate('LBL_TIME_DAYS','SugarFeed').' ';
127 127
             }
128
-		}else{
129
-			if($days == 1){
130
-				$result = translate('LBL_TIME_YESTERDAY','SugarFeed').' ';
131
-				return $result;
132
-			}else if($days > 1){
133
-				$result .= $days . ' '. translate('LBL_TIME_DAYS','SugarFeed').' ';
134
-			}else{
135
-				if($hours == 1) {
128
+        }else{
129
+            if($days == 1){
130
+                $result = translate('LBL_TIME_YESTERDAY','SugarFeed').' ';
131
+                return $result;
132
+            }else if($days > 1){
133
+                $result .= $days . ' '. translate('LBL_TIME_DAYS','SugarFeed').' ';
134
+            }else{
135
+                if($hours == 1) {
136 136
                     $result .= $hours . ' '.translate('LBL_TIME_HOUR','SugarFeed').' ';
137 137
                 } else {
138 138
                     $result .= $hours . ' '.translate('LBL_TIME_HOURS','SugarFeed').' ';
139 139
                 }
140
-				if($hours < 6){
141
-					if($minutes == 1) {
140
+                if($hours < 6){
141
+                    if($minutes == 1) {
142 142
                         $result .= $minutes . ' ' . translate('LBL_TIME_MINUTE','SugarFeed'). ' ';
143 143
                     } else {
144 144
                         $result .= $minutes . ' ' . translate('LBL_TIME_MINUTES','SugarFeed'). ' ';
145 145
                     }
146
-				}
147
-				if($hours == 0 && $minutes == 0) {
146
+                }
147
+                if($hours == 0 && $minutes == 0) {
148 148
                     if($seconds == 1 ) {
149 149
                         $result = $seconds . ' ' . translate('LBL_TIME_SECOND','SugarFeed');
150 150
                     } else {
151 151
                         $result = $seconds . ' ' . translate('LBL_TIME_SECONDS','SugarFeed');
152 152
                     }
153 153
                 }
154
-			}
155
-		}
156
-		return $result . ' ' . translate('LBL_TIME_AGO','SugarFeed');
154
+            }
155
+        }
156
+        return $result . ' ' . translate('LBL_TIME_AGO','SugarFeed');
157 157
 
158 158
 
159 159
 
160 160
     }
161 161
 
162
-	function bean_implements($interface){
163
-		switch($interface){
164
-			case 'ACL':return false;
165
-		}
166
-		return false;
167
-	}
162
+    function bean_implements($interface){
163
+        switch($interface){
164
+            case 'ACL':return false;
165
+        }
166
+        return false;
167
+    }
168 168
 
169 169
 }
170 170
 ?>
171 171
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?PHP
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 
4 4
 class SecurityGroupMessage extends Basic {
5 5
 	var $new_schema = true;
@@ -23,11 +23,11 @@  discard block
 block discarded – undo
23 23
 
24 24
 
25 25
 	var $additional_column_fields = Array();
26
-	var $field_defs = array (
26
+	var $field_defs = array(
27 27
        'id'=>array('name' =>'id', 'type' =>'char', 'len'=>'36', 'default'=>'')
28
-      , 'name'=>array('name' =>'name', 'type' =>'varchar', 'len'=>'255', )
29
-      , 'date_entered'=>array ('name' => 'date_entered','type' => 'datetime')
30
-      , 'date_modified'=>array ('name' => 'date_modified','type' => 'datetime')
28
+      , 'name'=>array('name' =>'name', 'type' =>'varchar', 'len'=>'255',)
29
+      , 'date_entered'=>array('name' => 'date_entered', 'type' => 'datetime')
30
+      , 'date_modified'=>array('name' => 'date_modified', 'type' => 'datetime')
31 31
       , 'modified_user_id'=>array('name' =>'modified_user_id', 'type' =>'char', 'len'=>'36',)
32 32
       , 'created_by'=>array('name' =>'created_by', 'type' =>'char', 'len'=>'36',)
33 33
       , 'description'=>array('name' =>'description', 'type' =>'text', 'len'=>'',)
@@ -36,18 +36,18 @@  discard block
 block discarded – undo
36 36
     );
37 37
 
38 38
 
39
-	function __construct(){
39
+	function __construct() {
40 40
 		parent::__construct();
41 41
 	}
42 42
 
43 43
 
44
-	function get_list_view_data(){
44
+	function get_list_view_data() {
45 45
 		$data = parent::get_list_view_data();
46 46
 		$delete = '';
47 47
 
48 48
 		$group_owner = false;
49 49
 		$securitygroup_name = "";
50
-		if(empty($data['SECURITYGROUP_ID'])) {
50
+		if (empty($data['SECURITYGROUP_ID'])) {
51 51
 			$securitygroup_name = "All";
52 52
 		} else {
53 53
 			require_once('modules/SecurityGroups/SecurityGroup.php');
@@ -55,17 +55,17 @@  discard block
 block discarded – undo
55 55
 			$securitygroup->retrieve($data['SECURITYGROUP_ID']);
56 56
 			$securitygroup_name = $securitygroup->name;
57 57
 
58
-			if($securitygroup->assigned_user_id == $GLOBALS['current_user']->id) {
58
+			if ($securitygroup->assigned_user_id == $GLOBALS['current_user']->id) {
59 59
 				$group_owner = true;
60 60
 			}
61 61
 		}
62 62
 
63
-		if(is_admin($GLOBALS['current_user']) || $data['CREATED_BY'] == $GLOBALS['current_user']->id || $group_owner) {
64
-			$delete = SugarThemeRegistry::current()->getImage( 'delete_inline', 'width="12" height="12" border="0" align="absmiddle" style="vertical-align: bottom;" onclick=\'Message.deleteMessage("'. $data['ID'] . '", "{this.id}")\'',null,null,'.gif','');
63
+		if (is_admin($GLOBALS['current_user']) || $data['CREATED_BY'] == $GLOBALS['current_user']->id || $group_owner) {
64
+			$delete = SugarThemeRegistry::current()->getImage('delete_inline', 'width="12" height="12" border="0" align="absmiddle" style="vertical-align: bottom;" onclick=\'Message.deleteMessage("'.$data['ID'].'", "{this.id}")\'', null, null, '.gif', '');
65 65
 		}
66 66
 
67 67
 		$username = "";
68
-		if(empty($data['CREATED_BY'])) {
68
+		if (empty($data['CREATED_BY'])) {
69 69
 			$username = "Unknown";
70 70
 		} else {
71 71
 			require_once('modules/Users/User.php');
@@ -75,23 +75,23 @@  discard block
 block discarded – undo
75 75
 		}
76 76
 
77 77
 		$data['NAME'] = $data['DESCRIPTION'];
78
-		$data['NAME'] =  '<div class="list view" style="padding:5px;border:none;">' . html_entity_decode($data['NAME']);
78
+		$data['NAME'] = '<div class="list view" style="padding:5px;border:none;">'.html_entity_decode($data['NAME']);
79 79
         $data['NAME'] .= '<div class="byLineBox" style="padding-top: 2px"><span class="byLineLeft">'.$username.' ['.$securitygroup_name.']';
80
-		$data['NAME'] .= '&nbsp;</span><span style="cursor: pointer;" class="byLineRight"> '.  $this->getTimeLapse($data['DATE_ENTERED']) . ' &nbsp;' .$delete. '</span></div>';
81
-		return  $data ;
80
+		$data['NAME'] .= '&nbsp;</span><span style="cursor: pointer;" class="byLineRight"> '.$this->getTimeLapse($data['DATE_ENTERED']).' &nbsp;'.$delete.'</span></div>';
81
+		return  $data;
82 82
 	}
83 83
 
84 84
 
85 85
 	static function saveMessage($text, $securitygroup_id) {
86 86
 		//if no security group id then must be admin. Otherwise, make sure the user is a member of the group
87 87
 		global $current_user;
88
-		if(empty($securitygroup_id) && !is_admin($current_user)) {
88
+		if (empty($securitygroup_id) && !is_admin($current_user)) {
89 89
 			return;
90
-		} else if(empty($securitygroup_id)) {
90
+		} else if (empty($securitygroup_id)) {
91 91
 			$securitygroup_id = null; //6.4.0
92 92
 		}
93 93
 		$message = new SecurityGroupMessage();
94
-		if(empty($text)) return; // || !$feed->ACLAccess('save', true) )return;
94
+		if (empty($text)) return; // || !$feed->ACLAccess('save', true) )return;
95 95
 
96 96
 		$text = strip_tags($text);
97 97
 		$message->name = '';
@@ -106,61 +106,61 @@  discard block
 block discarded – undo
106 106
 		$start = array();
107 107
    		preg_match('/(\d+)\-(\d+)\-(\d+) (\d+)\:(\d+)\:(\d+)/', $startDate, $start);
108 108
 		$end = gmdate('Y-m-d H:i:s');
109
-    	$start_time = gmmktime($start[4],$start[5], $start[6], $start[2], $start[3], $start[1] );
110
-		$seconds = time()- $start_time;
111
-		$minutes =   $seconds/60;
109
+    	$start_time = gmmktime($start[4], $start[5], $start[6], $start[2], $start[3], $start[1]);
110
+		$seconds = time() - $start_time;
111
+		$minutes = $seconds / 60;
112 112
 		$seconds = $seconds % 60;
113
-		$hours = floor( $minutes / 60);
113
+		$hours = floor($minutes / 60);
114 114
 		$minutes = $minutes % 60;
115
-		$days = floor( $hours / 24);
115
+		$days = floor($hours / 24);
116 116
 		$hours = $hours % 24;
117
-		$weeks = floor( $days / 7);
117
+		$weeks = floor($days / 7);
118 118
 		$days = $days % 7;
119 119
 		$result = '';
120
-		if($weeks == 1){
121
-			$result = translate('LBL_TIME_LAST_WEEK','SugarFeed').' ';
120
+		if ($weeks == 1) {
121
+			$result = translate('LBL_TIME_LAST_WEEK', 'SugarFeed').' ';
122 122
 			return $result;
123
-		}else if($weeks > 1){
124
-			$result .= $weeks . ' '.translate('LBL_TIME_WEEKS','SugarFeed').' ';
125
-			if($days > 0) {
126
-                $result .= $days . ' '.translate('LBL_TIME_DAYS','SugarFeed').' ';
123
+		} else if ($weeks > 1) {
124
+			$result .= $weeks.' '.translate('LBL_TIME_WEEKS', 'SugarFeed').' ';
125
+			if ($days > 0) {
126
+                $result .= $days.' '.translate('LBL_TIME_DAYS', 'SugarFeed').' ';
127 127
             }
128
-		}else{
129
-			if($days == 1){
130
-				$result = translate('LBL_TIME_YESTERDAY','SugarFeed').' ';
128
+		} else {
129
+			if ($days == 1) {
130
+				$result = translate('LBL_TIME_YESTERDAY', 'SugarFeed').' ';
131 131
 				return $result;
132
-			}else if($days > 1){
133
-				$result .= $days . ' '. translate('LBL_TIME_DAYS','SugarFeed').' ';
134
-			}else{
135
-				if($hours == 1) {
136
-                    $result .= $hours . ' '.translate('LBL_TIME_HOUR','SugarFeed').' ';
132
+			} else if ($days > 1) {
133
+				$result .= $days.' '.translate('LBL_TIME_DAYS', 'SugarFeed').' ';
134
+			} else {
135
+				if ($hours == 1) {
136
+                    $result .= $hours.' '.translate('LBL_TIME_HOUR', 'SugarFeed').' ';
137 137
                 } else {
138
-                    $result .= $hours . ' '.translate('LBL_TIME_HOURS','SugarFeed').' ';
138
+                    $result .= $hours.' '.translate('LBL_TIME_HOURS', 'SugarFeed').' ';
139 139
                 }
140
-				if($hours < 6){
141
-					if($minutes == 1) {
142
-                        $result .= $minutes . ' ' . translate('LBL_TIME_MINUTE','SugarFeed'). ' ';
140
+				if ($hours < 6) {
141
+					if ($minutes == 1) {
142
+                        $result .= $minutes.' '.translate('LBL_TIME_MINUTE', 'SugarFeed').' ';
143 143
                     } else {
144
-                        $result .= $minutes . ' ' . translate('LBL_TIME_MINUTES','SugarFeed'). ' ';
144
+                        $result .= $minutes.' '.translate('LBL_TIME_MINUTES', 'SugarFeed').' ';
145 145
                     }
146 146
 				}
147
-				if($hours == 0 && $minutes == 0) {
148
-                    if($seconds == 1 ) {
149
-                        $result = $seconds . ' ' . translate('LBL_TIME_SECOND','SugarFeed');
147
+				if ($hours == 0 && $minutes == 0) {
148
+                    if ($seconds == 1) {
149
+                        $result = $seconds.' '.translate('LBL_TIME_SECOND', 'SugarFeed');
150 150
                     } else {
151
-                        $result = $seconds . ' ' . translate('LBL_TIME_SECONDS','SugarFeed');
151
+                        $result = $seconds.' '.translate('LBL_TIME_SECONDS', 'SugarFeed');
152 152
                     }
153 153
                 }
154 154
 			}
155 155
 		}
156
-		return $result . ' ' . translate('LBL_TIME_AGO','SugarFeed');
156
+		return $result.' '.translate('LBL_TIME_AGO', 'SugarFeed');
157 157
 
158 158
 
159 159
 
160 160
     }
161 161
 
162
-	function bean_implements($interface){
163
-		switch($interface){
162
+	function bean_implements($interface) {
163
+		switch ($interface) {
164 164
 			case 'ACL':return false;
165 165
 		}
166 166
 		return false;
Please login to merge, or discard this patch.
modules/SecurityGroups/SecurityGroupUserRelationshipEdit.php 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 
4 4
 require_once('XTemplate/xtpl.php');
5 5
 require_once('modules/SecurityGroups/SecurityGroupUserRelationship.php');
@@ -13,11 +13,11 @@  discard block
 block discarded – undo
13 13
 
14 14
 $focus = new SecurityGroupUserRelationship();
15 15
 
16
-if(isset($_REQUEST['record'])) {
16
+if (isset($_REQUEST['record'])) {
17 17
     $focus->retrieve($_REQUEST['record']);
18 18
 }
19 19
 
20
-if(isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') {
20
+if (isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') {
21 21
     $focus->id = "";
22 22
 }
23 23
 
@@ -30,8 +30,8 @@  discard block
 block discarded – undo
30 30
 safe_map('primary_group', $focus);
31 31
 
32 32
 
33
-$theme_path="themes/".$theme."/";
34
-$image_path=$theme_path."images/";
33
+$theme_path = "themes/".$theme."/";
34
+$image_path = $theme_path."images/";
35 35
 require_once($theme_path.'layout_utils.php');
36 36
 
37 37
 $GLOBALS['log']->info("SecurityGroup User relationship");
@@ -42,10 +42,10 @@  discard block
 block discarded – undo
42 42
 $sqs_objects = array('user_name' => $qsd->getQSParent());
43 43
 $sqs_objects['user_name']['populate_list'] = array('user_name', 'user_id');
44 44
 $quicksearch_js = $qsd->getQSScripts();
45
-$quicksearch_js .= '<script type="text/javascript" language="javascript">sqs_objects = ' . $json->encode($sqs_objects) . '</script>';
45
+$quicksearch_js .= '<script type="text/javascript" language="javascript">sqs_objects = '.$json->encode($sqs_objects).'</script>';
46 46
 echo $quicksearch_js;
47 47
 
48
-$xtpl=new XTemplate ('modules/SecurityGroups/SecurityGroupUserRelationshipEdit.html');
48
+$xtpl = new XTemplate('modules/SecurityGroups/SecurityGroupUserRelationshipEdit.html');
49 49
 $xtpl->assign("MOD", $mod_strings);
50 50
 $xtpl->assign("APP", $app_strings);
51 51
 
@@ -54,25 +54,25 @@  discard block
 block discarded – undo
54 54
 $xtpl->assign("RETURN_ACTION", $_REQUEST['return_action']);
55 55
 $xtpl->assign("RETURN_ID", $_REQUEST['return_id']);
56 56
 $xtpl->assign("THEME", $theme);
57
-$xtpl->assign("IMAGE_PATH", $image_path);$xtpl->assign("PRINT_URL", "index.php?".$GLOBALS['request_string']);
57
+$xtpl->assign("IMAGE_PATH", $image_path); $xtpl->assign("PRINT_URL", "index.php?".$GLOBALS['request_string']);
58 58
 $xtpl->assign("ID", $focus->id);
59
-$xtpl->assign("SECURITYGROUP",$securityGroup = Array("NAME" => $focus->securitygroup_name, "ID" => $focus->securitygroup_id));
60
-$xtpl->assign("USER",$user = Array("NAME" => $focus->user_name, "ID" => $focus->user_id));
59
+$xtpl->assign("SECURITYGROUP", $securityGroup = Array("NAME" => $focus->securitygroup_name, "ID" => $focus->securitygroup_id));
60
+$xtpl->assign("USER", $user = Array("NAME" => $focus->user_name, "ID" => $focus->user_id));
61 61
 
62 62
 echo "\n<p>\n";
63
-echo get_module_title($mod_strings['LBL_MODULE_NAME'], $mod_strings['LBL_SECURITYGROUP_USER_FORM_TITLE'].": ".$securityGroup['NAME'] . " - ". $user['NAME'], true);
63
+echo get_module_title($mod_strings['LBL_MODULE_NAME'], $mod_strings['LBL_SECURITYGROUP_USER_FORM_TITLE'].": ".$securityGroup['NAME']." - ".$user['NAME'], true);
64 64
 echo "\n</p>\n";
65 65
 
66 66
 // noninheritable
67 67
 $noninheritable = '';
68
-if(isset($focus->noninheritable) && $focus->noninheritable == true) {
68
+if (isset($focus->noninheritable) && $focus->noninheritable == true) {
69 69
     $noninheritable = 'CHECKED';
70 70
 } 
71 71
 $xtpl->assign('noninheritable', $noninheritable);
72 72
 
73 73
 // primary_group
74 74
 $primary_group = '';
75
-if(isset($focus->primary_group) && $focus->primary_group == true) {
75
+if (isset($focus->primary_group) && $focus->primary_group == true) {
76 76
     $primary_group = 'CHECKED';
77 77
 } 
78 78
 $xtpl->assign('primary_group', $primary_group);
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 $javascript = new javascript();
86 86
 $javascript->setFormName('EditView');
87 87
 $javascript->setSugarBean($focus);
88
-$javascript->addToValidateBinaryDependency('user_name', 'alpha', $app_strings['ERR_SQS_NO_MATCH_FIELD'] . $mod_strings['LBL_USER_NAME'], 'false', '', 'user_id');
88
+$javascript->addToValidateBinaryDependency('user_name', 'alpha', $app_strings['ERR_SQS_NO_MATCH_FIELD'].$mod_strings['LBL_USER_NAME'], 'false', '', 'user_id');
89 89
 echo $javascript->getScript();
90 90
 
91 91
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
Please login to merge, or discard this patch.
modules/SecurityGroups/AssignGroups.php 3 patches
Indentation   +112 added lines, -112 removed lines patch added patch discarded remove patch
@@ -6,113 +6,113 @@  discard block
 block discarded – undo
6 6
 
7 7
 function popup_select(&$bean, $event, $arguments)
8 8
 {
9
-	global $sugar_config;
10
-
11
-	//only process if action is Save (meaning a user has triggered this event and not the portal or automated process)
12
-	if(isset($_REQUEST['action']) && $_REQUEST['action'] == 'Save' 
13
-		&& isset($sugar_config['securitysuite_popup_select']) && $sugar_config['securitysuite_popup_select'] == true
14
-		&& empty($bean->fetched_row['id']) && $bean->module_dir != "Users" && $bean->module_dir != "SugarFeed") {		
15
-		//Upload an attachment to an Email Template and save. If user with multi groups - popup select option
16
-		//it will redirect to notes instead of EmailTemplate and relationship will fail...check below to avoid
17
-		if(!empty($_REQUEST['module']) && $_REQUEST['module'] != $bean->module_dir) return;
18
-
19
-		if(!empty($_REQUEST['securitygroup_list'])) {
20
-			require_once('modules/SecurityGroups/SecurityGroup.php');
21
-			$groupFocus = new SecurityGroup();
22
-			$security_modules = $groupFocus->getSecurityModules();
23
-			//sanity check
24
-			if(in_array($bean->module_dir,array_keys($security_modules))) {
25
-				//add each group in securitygroup_list to new record
26
-				$rel_name = $groupFocus->getLinkName($bean->module_dir,"SecurityGroups");
27
-
28
-				$bean->load_relationship($rel_name);
29
-				foreach($_REQUEST['securitygroup_list'] as $group_id) {
30
-					$bean->$rel_name->add($group_id);
31
-				}
32
-			}
33
-		} else if(!empty($_REQUEST['dup_checked'])) {
34
-			//well...ShowDuplicates doesn't pass through request vars unless they are defined in the module vardefs
35
-			//so we are screwed here...
36
-			global $current_language;
37
-			$ss_mod_strings = return_module_language($current_language, 'SecurityGroups');	
38
-			unset($_SESSION['securitysuite_error']); //to be safe
39
-			$_SESSION['securitysuite_error'] = $ss_mod_strings['LBL_ERROR_DUPLICATE'];
40
-		}
41
-	}
9
+    global $sugar_config;
10
+
11
+    //only process if action is Save (meaning a user has triggered this event and not the portal or automated process)
12
+    if(isset($_REQUEST['action']) && $_REQUEST['action'] == 'Save' 
13
+        && isset($sugar_config['securitysuite_popup_select']) && $sugar_config['securitysuite_popup_select'] == true
14
+        && empty($bean->fetched_row['id']) && $bean->module_dir != "Users" && $bean->module_dir != "SugarFeed") {		
15
+        //Upload an attachment to an Email Template and save. If user with multi groups - popup select option
16
+        //it will redirect to notes instead of EmailTemplate and relationship will fail...check below to avoid
17
+        if(!empty($_REQUEST['module']) && $_REQUEST['module'] != $bean->module_dir) return;
18
+
19
+        if(!empty($_REQUEST['securitygroup_list'])) {
20
+            require_once('modules/SecurityGroups/SecurityGroup.php');
21
+            $groupFocus = new SecurityGroup();
22
+            $security_modules = $groupFocus->getSecurityModules();
23
+            //sanity check
24
+            if(in_array($bean->module_dir,array_keys($security_modules))) {
25
+                //add each group in securitygroup_list to new record
26
+                $rel_name = $groupFocus->getLinkName($bean->module_dir,"SecurityGroups");
27
+
28
+                $bean->load_relationship($rel_name);
29
+                foreach($_REQUEST['securitygroup_list'] as $group_id) {
30
+                    $bean->$rel_name->add($group_id);
31
+                }
32
+            }
33
+        } else if(!empty($_REQUEST['dup_checked'])) {
34
+            //well...ShowDuplicates doesn't pass through request vars unless they are defined in the module vardefs
35
+            //so we are screwed here...
36
+            global $current_language;
37
+            $ss_mod_strings = return_module_language($current_language, 'SecurityGroups');	
38
+            unset($_SESSION['securitysuite_error']); //to be safe
39
+            $_SESSION['securitysuite_error'] = $ss_mod_strings['LBL_ERROR_DUPLICATE'];
40
+        }
41
+    }
42 42
 
43
-	else if(isset($sugar_config['securitysuite_user_popup']) && $sugar_config['securitysuite_user_popup'] == true
44
-		&& empty($bean->fetched_row['id']) && $bean->module_dir == "Users"
45
-		&& isset($_REQUEST['action']) && $_REQUEST['action'] != 'SaveSignature' ) { //Bug: 589
43
+    else if(isset($sugar_config['securitysuite_user_popup']) && $sugar_config['securitysuite_user_popup'] == true
44
+        && empty($bean->fetched_row['id']) && $bean->module_dir == "Users"
45
+        && isset($_REQUEST['action']) && $_REQUEST['action'] != 'SaveSignature' ) { //Bug: 589
46 46
 
47
-		//$_REQUEST['return_module'] = $bean->module_dir;
48
-		//$_REQUEST['return_action'] = "DetailView";
49
-		//$_REQUEST['return_id'] = $bean->id;
47
+        //$_REQUEST['return_module'] = $bean->module_dir;
48
+        //$_REQUEST['return_action'] = "DetailView";
49
+        //$_REQUEST['return_id'] = $bean->id;
50 50
 		
51
-		//$_SESSION['securitygroups_popup_'.$bean->module_dir] = $bean->id;
51
+        //$_SESSION['securitygroups_popup_'.$bean->module_dir] = $bean->id;
52 52
 		
53
-		if(!isset($_SESSION['securitygroups_popup'])) {
54
-			$_SESSION['securitygroups_popup'] = array();
55
-		}
56
-		$_SESSION['securitygroups_popup'][] = array(
57
-			'module' => $bean->module_dir,
58
-			'id' => $bean->id
59
-		);
60
-	}
53
+        if(!isset($_SESSION['securitygroups_popup'])) {
54
+            $_SESSION['securitygroups_popup'] = array();
55
+        }
56
+        $_SESSION['securitygroups_popup'][] = array(
57
+            'module' => $bean->module_dir,
58
+            'id' => $bean->id
59
+        );
60
+    }
61 61
 } 
62 62
 
63 63
 
64 64
 function popup_onload($event, $arguments)
65 65
 {
66
-	if(!empty($_REQUEST['to_pdf']) || !empty($_REQUEST['sugar_body_only'])) return;
66
+    if(!empty($_REQUEST['to_pdf']) || !empty($_REQUEST['sugar_body_only'])) return;
67 67
 
68 68
 /** //test user popup
69 69
 	//always have this loaded
70 70
 	echo '<script type="text/javascript" src="modules/SecurityGroups/javascript/popup_relate.js"></script>';
71 71
 */
72
-	global $sugar_config;
72
+    global $sugar_config;
73 73
 
74
-	$module = $_REQUEST['module'];
75
-	$action = $_REQUEST['action'];
74
+    $module = $_REQUEST['module'];
75
+    $action = $_REQUEST['action'];
76 76
 
77
-	if(isset($action) && ($action == "Save" || $action == "SetTimezone")) return;  
77
+    if(isset($action) && ($action == "Save" || $action == "SetTimezone")) return;  
78 78
 
79
-	if( (
80
-			//(isset($sugar_config['securitysuite_popup_select']) && $sugar_config['securitysuite_popup_select'] == true)
81
-			//|| 
82
-			($module == "Users" && isset($sugar_config['securitysuite_user_popup']) && $sugar_config['securitysuite_user_popup'] == true)
83
-		)
79
+    if( (
80
+            //(isset($sugar_config['securitysuite_popup_select']) && $sugar_config['securitysuite_popup_select'] == true)
81
+            //|| 
82
+            ($module == "Users" && isset($sugar_config['securitysuite_user_popup']) && $sugar_config['securitysuite_user_popup'] == true)
83
+        )
84 84
 	
85
-		//&& isset($_SESSION['securitygroups_popup_'.$module]) && !empty($_SESSION['securitygroups_popup_'.$module])
86
-		&& !empty($_SESSION['securitygroups_popup'])
87
-	) {	
88
-
89
-		foreach($_SESSION['securitygroups_popup'] as $popup_index => $popup) {
90
-			$record_id = $popup['id'];
91
-			$module = $popup['module'];
92
-			unset($_SESSION['securitygroups_popup'][$popup_index]);
85
+        //&& isset($_SESSION['securitygroups_popup_'.$module]) && !empty($_SESSION['securitygroups_popup_'.$module])
86
+        && !empty($_SESSION['securitygroups_popup'])
87
+    ) {	
88
+
89
+        foreach($_SESSION['securitygroups_popup'] as $popup_index => $popup) {
90
+            $record_id = $popup['id'];
91
+            $module = $popup['module'];
92
+            unset($_SESSION['securitygroups_popup'][$popup_index]);
93 93
 			
94
-			require_once('modules/SecurityGroups/SecurityGroup.php');
95
-			$groupFocus = new SecurityGroup();
96
-			if($module == 'Users') {
97
-				$rel_name = "SecurityGroups";
98
-			} else {
99
-				$rel_name = $groupFocus->getLinkName($module,"SecurityGroups");
100
-			}
101
-
102
-				//this only works if on the detail view of the record actually saved...
103
-				//so ajaxui breaks this as it stays on the parent
104
-				$auto_popup = <<<EOQ
94
+            require_once('modules/SecurityGroups/SecurityGroup.php');
95
+            $groupFocus = new SecurityGroup();
96
+            if($module == 'Users') {
97
+                $rel_name = "SecurityGroups";
98
+            } else {
99
+                $rel_name = $groupFocus->getLinkName($module,"SecurityGroups");
100
+            }
101
+
102
+                //this only works if on the detail view of the record actually saved...
103
+                //so ajaxui breaks this as it stays on the parent
104
+                $auto_popup = <<<EOQ
105 105
 <script type="text/javascript" language="javascript">
106 106
 	open_popup("SecurityGroups",600,400,"",true,true,{"call_back_function":"securitysuite_set_return_and_save_background","form_name":"DetailView","field_to_name_array":{"id":"subpanel_id"},"passthru_data":{"module":"$module","record":"$record_id","child_field":"$rel_name","return_url":"","link_field_name":"$rel_name","module_name":"$rel_name","refresh_page":"1"}},"MultiSelect",true);
107 107
 </script>
108 108
 EOQ;
109 109
 
110
-			echo $auto_popup;
110
+            echo $auto_popup;
111 111
 
112
-		}
113
-		unset($_SESSION['securitygroups_popup']);
112
+        }
113
+        unset($_SESSION['securitygroups_popup']);
114 114
 		
115
-	}
115
+    }
116 116
 
117 117
 }
118 118
 
@@ -121,37 +121,37 @@  discard block
 block discarded – undo
121 121
     $action = $_REQUEST['action'];
122 122
     $module = $_REQUEST['module'];
123 123
   
124
-  	$no_mass_assign_list = array("Emails"=>"Emails","ACLRoles"=>"ACLRoles"); //,"Users"=>"Users");
124
+        $no_mass_assign_list = array("Emails"=>"Emails","ACLRoles"=>"ACLRoles"); //,"Users"=>"Users");
125 125
     //check if security suite enabled
126 126
     $action = strtolower($action);
127 127
     if(isset($module) && ($action == "list" || $action == "index" || $action == "listview") 
128
-    	&& (!isset($_REQUEST['search_form_only']) || $_REQUEST['search_form_only'] != true)
129
-    	&& !array_key_exists($module,$no_mass_assign_list)
130
-    	) {
131
-   		global $current_user;
132
-   		if(is_admin($current_user) || ACLAction::getUserAccessLevel($current_user->id,"SecurityGroups", 'access') == ACL_ALLOW_ENABLED) {
128
+        && (!isset($_REQUEST['search_form_only']) || $_REQUEST['search_form_only'] != true)
129
+        && !array_key_exists($module,$no_mass_assign_list)
130
+        ) {
131
+            global $current_user;
132
+            if(is_admin($current_user) || ACLAction::getUserAccessLevel($current_user->id,"SecurityGroups", 'access') == ACL_ALLOW_ENABLED) {
133 133
 
134
-			require_once('modules/SecurityGroups/SecurityGroup.php');
135
-			$groupFocus = new SecurityGroup();
136
-			$security_modules = $groupFocus->getSecurityModules();
137
-			//if(in_array($module,$security_modules)) {
138
-			if(in_array($module,array_keys($security_modules))) {
134
+            require_once('modules/SecurityGroups/SecurityGroup.php');
135
+            $groupFocus = new SecurityGroup();
136
+            $security_modules = $groupFocus->getSecurityModules();
137
+            //if(in_array($module,$security_modules)) {
138
+            if(in_array($module,array_keys($security_modules))) {
139 139
 
140
-				global $app_strings;
140
+                global $app_strings;
141 141
 
142
-				global $current_language;
143
-				$current_module_strings = return_module_language($current_language, 'SecurityGroups');
142
+                global $current_language;
143
+                $current_module_strings = return_module_language($current_language, 'SecurityGroups');
144 144
 
145
-				$form_header = get_form_header($current_module_strings['LBL_MASS_ASSIGN'], '', false);
145
+                $form_header = get_form_header($current_module_strings['LBL_MASS_ASSIGN'], '', false);
146 146
 
147
-				$groups = $groupFocus->get_list("name","",0,-99,-99);
148
-				$options = array(""=>"");
149
-				foreach($groups['list'] as $group) {
150
-					$options[$group->id] = $group->name;
151
-				}
152
-				$group_options =  get_select_options_with_id($options, "");
147
+                $groups = $groupFocus->get_list("name","",0,-99,-99);
148
+                $options = array(""=>"");
149
+                foreach($groups['list'] as $group) {
150
+                    $options[$group->id] = $group->name;
151
+                }
152
+                $group_options =  get_select_options_with_id($options, "");
153 153
 
154
-				$mass_assign = <<<EOQ
154
+                $mass_assign = <<<EOQ
155 155
 
156 156
 <script type="text/javascript" language="javascript">
157 157
 function confirm_massassign(del,start_string, end_string) {
@@ -264,16 +264,16 @@  discard block
 block discarded – undo
264 264
 EOQ;
265 265
 
266 266
 
267
-				echo $mass_assign;
268
-			}
269
-		}
267
+                echo $mass_assign;
268
+            }
269
+        }
270 270
     }
271 271
 
272
-	//if after a save...
273
-	if(!empty($_SESSION['securitysuite_error'])) {
274
-		$lbl_securitysuite_error = $_SESSION['securitysuite_error'];
275
-		unset($_SESSION['securitysuite_error']);
276
-		echo <<<EOQ
272
+    //if after a save...
273
+    if(!empty($_SESSION['securitysuite_error'])) {
274
+        $lbl_securitysuite_error = $_SESSION['securitysuite_error'];
275
+        unset($_SESSION['securitysuite_error']);
276
+        echo <<<EOQ
277 277
 <script>
278 278
 				
279 279
 
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
 document.body.insertBefore(oNewP, beforeMe);
288 288
 </script>
289 289
 EOQ;
290
-	}
290
+    }
291 291
 }
292 292
 
293 293
 }
Please login to merge, or discard this patch.
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 
4 4
 
5 5
 class AssignGroups {
@@ -9,28 +9,28 @@  discard block
 block discarded – undo
9 9
 	global $sugar_config;
10 10
 
11 11
 	//only process if action is Save (meaning a user has triggered this event and not the portal or automated process)
12
-	if(isset($_REQUEST['action']) && $_REQUEST['action'] == 'Save' 
12
+	if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'Save' 
13 13
 		&& isset($sugar_config['securitysuite_popup_select']) && $sugar_config['securitysuite_popup_select'] == true
14 14
 		&& empty($bean->fetched_row['id']) && $bean->module_dir != "Users" && $bean->module_dir != "SugarFeed") {		
15 15
 		//Upload an attachment to an Email Template and save. If user with multi groups - popup select option
16 16
 		//it will redirect to notes instead of EmailTemplate and relationship will fail...check below to avoid
17
-		if(!empty($_REQUEST['module']) && $_REQUEST['module'] != $bean->module_dir) return;
17
+		if (!empty($_REQUEST['module']) && $_REQUEST['module'] != $bean->module_dir) return;
18 18
 
19
-		if(!empty($_REQUEST['securitygroup_list'])) {
19
+		if (!empty($_REQUEST['securitygroup_list'])) {
20 20
 			require_once('modules/SecurityGroups/SecurityGroup.php');
21 21
 			$groupFocus = new SecurityGroup();
22 22
 			$security_modules = $groupFocus->getSecurityModules();
23 23
 			//sanity check
24
-			if(in_array($bean->module_dir,array_keys($security_modules))) {
24
+			if (in_array($bean->module_dir, array_keys($security_modules))) {
25 25
 				//add each group in securitygroup_list to new record
26
-				$rel_name = $groupFocus->getLinkName($bean->module_dir,"SecurityGroups");
26
+				$rel_name = $groupFocus->getLinkName($bean->module_dir, "SecurityGroups");
27 27
 
28 28
 				$bean->load_relationship($rel_name);
29
-				foreach($_REQUEST['securitygroup_list'] as $group_id) {
29
+				foreach ($_REQUEST['securitygroup_list'] as $group_id) {
30 30
 					$bean->$rel_name->add($group_id);
31 31
 				}
32 32
 			}
33
-		} else if(!empty($_REQUEST['dup_checked'])) {
33
+		} else if (!empty($_REQUEST['dup_checked'])) {
34 34
 			//well...ShowDuplicates doesn't pass through request vars unless they are defined in the module vardefs
35 35
 			//so we are screwed here...
36 36
 			global $current_language;
@@ -40,9 +40,9 @@  discard block
 block discarded – undo
40 40
 		}
41 41
 	}
42 42
 
43
-	else if(isset($sugar_config['securitysuite_user_popup']) && $sugar_config['securitysuite_user_popup'] == true
43
+	else if (isset($sugar_config['securitysuite_user_popup']) && $sugar_config['securitysuite_user_popup'] == true
44 44
 		&& empty($bean->fetched_row['id']) && $bean->module_dir == "Users"
45
-		&& isset($_REQUEST['action']) && $_REQUEST['action'] != 'SaveSignature' ) { //Bug: 589
45
+		&& isset($_REQUEST['action']) && $_REQUEST['action'] != 'SaveSignature') { //Bug: 589
46 46
 
47 47
 		//$_REQUEST['return_module'] = $bean->module_dir;
48 48
 		//$_REQUEST['return_action'] = "DetailView";
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 		
51 51
 		//$_SESSION['securitygroups_popup_'.$bean->module_dir] = $bean->id;
52 52
 		
53
-		if(!isset($_SESSION['securitygroups_popup'])) {
53
+		if (!isset($_SESSION['securitygroups_popup'])) {
54 54
 			$_SESSION['securitygroups_popup'] = array();
55 55
 		}
56 56
 		$_SESSION['securitygroups_popup'][] = array(
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 
64 64
 function popup_onload($event, $arguments)
65 65
 {
66
-	if(!empty($_REQUEST['to_pdf']) || !empty($_REQUEST['sugar_body_only'])) return;
66
+	if (!empty($_REQUEST['to_pdf']) || !empty($_REQUEST['sugar_body_only'])) return;
67 67
 
68 68
 /** //test user popup
69 69
 	//always have this loaded
@@ -74,9 +74,9 @@  discard block
 block discarded – undo
74 74
 	$module = $_REQUEST['module'];
75 75
 	$action = $_REQUEST['action'];
76 76
 
77
-	if(isset($action) && ($action == "Save" || $action == "SetTimezone")) return;  
77
+	if (isset($action) && ($action == "Save" || $action == "SetTimezone")) return;  
78 78
 
79
-	if( (
79
+	if ((
80 80
 			//(isset($sugar_config['securitysuite_popup_select']) && $sugar_config['securitysuite_popup_select'] == true)
81 81
 			//|| 
82 82
 			($module == "Users" && isset($sugar_config['securitysuite_user_popup']) && $sugar_config['securitysuite_user_popup'] == true)
@@ -86,17 +86,17 @@  discard block
 block discarded – undo
86 86
 		&& !empty($_SESSION['securitygroups_popup'])
87 87
 	) {	
88 88
 
89
-		foreach($_SESSION['securitygroups_popup'] as $popup_index => $popup) {
89
+		foreach ($_SESSION['securitygroups_popup'] as $popup_index => $popup) {
90 90
 			$record_id = $popup['id'];
91 91
 			$module = $popup['module'];
92 92
 			unset($_SESSION['securitygroups_popup'][$popup_index]);
93 93
 			
94 94
 			require_once('modules/SecurityGroups/SecurityGroup.php');
95 95
 			$groupFocus = new SecurityGroup();
96
-			if($module == 'Users') {
96
+			if ($module == 'Users') {
97 97
 				$rel_name = "SecurityGroups";
98 98
 			} else {
99
-				$rel_name = $groupFocus->getLinkName($module,"SecurityGroups");
99
+				$rel_name = $groupFocus->getLinkName($module, "SecurityGroups");
100 100
 			}
101 101
 
102 102
 				//this only works if on the detail view of the record actually saved...
@@ -121,21 +121,21 @@  discard block
 block discarded – undo
121 121
     $action = $_REQUEST['action'];
122 122
     $module = $_REQUEST['module'];
123 123
   
124
-  	$no_mass_assign_list = array("Emails"=>"Emails","ACLRoles"=>"ACLRoles"); //,"Users"=>"Users");
124
+  	$no_mass_assign_list = array("Emails"=>"Emails", "ACLRoles"=>"ACLRoles"); //,"Users"=>"Users");
125 125
     //check if security suite enabled
126 126
     $action = strtolower($action);
127
-    if(isset($module) && ($action == "list" || $action == "index" || $action == "listview") 
127
+    if (isset($module) && ($action == "list" || $action == "index" || $action == "listview") 
128 128
     	&& (!isset($_REQUEST['search_form_only']) || $_REQUEST['search_form_only'] != true)
129
-    	&& !array_key_exists($module,$no_mass_assign_list)
129
+    	&& !array_key_exists($module, $no_mass_assign_list)
130 130
     	) {
131 131
    		global $current_user;
132
-   		if(is_admin($current_user) || ACLAction::getUserAccessLevel($current_user->id,"SecurityGroups", 'access') == ACL_ALLOW_ENABLED) {
132
+   		if (is_admin($current_user) || ACLAction::getUserAccessLevel($current_user->id, "SecurityGroups", 'access') == ACL_ALLOW_ENABLED) {
133 133
 
134 134
 			require_once('modules/SecurityGroups/SecurityGroup.php');
135 135
 			$groupFocus = new SecurityGroup();
136 136
 			$security_modules = $groupFocus->getSecurityModules();
137 137
 			//if(in_array($module,$security_modules)) {
138
-			if(in_array($module,array_keys($security_modules))) {
138
+			if (in_array($module, array_keys($security_modules))) {
139 139
 
140 140
 				global $app_strings;
141 141
 
@@ -144,12 +144,12 @@  discard block
 block discarded – undo
144 144
 
145 145
 				$form_header = get_form_header($current_module_strings['LBL_MASS_ASSIGN'], '', false);
146 146
 
147
-				$groups = $groupFocus->get_list("name","",0,-99,-99);
147
+				$groups = $groupFocus->get_list("name", "", 0, -99, -99);
148 148
 				$options = array(""=>"");
149
-				foreach($groups['list'] as $group) {
149
+				foreach ($groups['list'] as $group) {
150 150
 					$options[$group->id] = $group->name;
151 151
 				}
152
-				$group_options =  get_select_options_with_id($options, "");
152
+				$group_options = get_select_options_with_id($options, "");
153 153
 
154 154
 				$mass_assign = <<<EOQ
155 155
 
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
     }
271 271
 
272 272
 	//if after a save...
273
-	if(!empty($_SESSION['securitysuite_error'])) {
273
+	if (!empty($_SESSION['securitysuite_error'])) {
274 274
 		$lbl_securitysuite_error = $_SESSION['securitysuite_error'];
275 275
 		unset($_SESSION['securitysuite_error']);
276 276
 		echo <<<EOQ
Please login to merge, or discard this patch.
Braces   +13 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 
4 6
 
5 7
 class AssignGroups {
@@ -14,7 +16,9 @@  discard block
 block discarded – undo
14 16
 		&& empty($bean->fetched_row['id']) && $bean->module_dir != "Users" && $bean->module_dir != "SugarFeed") {		
15 17
 		//Upload an attachment to an Email Template and save. If user with multi groups - popup select option
16 18
 		//it will redirect to notes instead of EmailTemplate and relationship will fail...check below to avoid
17
-		if(!empty($_REQUEST['module']) && $_REQUEST['module'] != $bean->module_dir) return;
19
+		if(!empty($_REQUEST['module']) && $_REQUEST['module'] != $bean->module_dir) {
20
+		    return;
21
+		}
18 22
 
19 23
 		if(!empty($_REQUEST['securitygroup_list'])) {
20 24
 			require_once('modules/SecurityGroups/SecurityGroup.php');
@@ -38,9 +42,7 @@  discard block
 block discarded – undo
38 42
 			unset($_SESSION['securitysuite_error']); //to be safe
39 43
 			$_SESSION['securitysuite_error'] = $ss_mod_strings['LBL_ERROR_DUPLICATE'];
40 44
 		}
41
-	}
42
-
43
-	else if(isset($sugar_config['securitysuite_user_popup']) && $sugar_config['securitysuite_user_popup'] == true
45
+	} else if(isset($sugar_config['securitysuite_user_popup']) && $sugar_config['securitysuite_user_popup'] == true
44 46
 		&& empty($bean->fetched_row['id']) && $bean->module_dir == "Users"
45 47
 		&& isset($_REQUEST['action']) && $_REQUEST['action'] != 'SaveSignature' ) { //Bug: 589
46 48
 
@@ -63,7 +65,9 @@  discard block
 block discarded – undo
63 65
 
64 66
 function popup_onload($event, $arguments)
65 67
 {
66
-	if(!empty($_REQUEST['to_pdf']) || !empty($_REQUEST['sugar_body_only'])) return;
68
+	if(!empty($_REQUEST['to_pdf']) || !empty($_REQUEST['sugar_body_only'])) {
69
+	    return;
70
+	}
67 71
 
68 72
 /** //test user popup
69 73
 	//always have this loaded
@@ -74,7 +78,9 @@  discard block
 block discarded – undo
74 78
 	$module = $_REQUEST['module'];
75 79
 	$action = $_REQUEST['action'];
76 80
 
77
-	if(isset($action) && ($action == "Save" || $action == "SetTimezone")) return;  
81
+	if(isset($action) && ($action == "Save" || $action == "SetTimezone")) {
82
+	    return;
83
+	}
78 84
 
79 85
 	if( (
80 86
 			//(isset($sugar_config['securitysuite_popup_select']) && $sugar_config['securitysuite_popup_select'] == true)
Please login to merge, or discard this patch.
modules/Contacts/ContactsQuickCreate.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 /*********************************************************************************
4 4
  * SugarCRM Community Edition is a customer relationship management program developed by
5 5
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
   
56 56
         $this->ss->assign("SALUTATION_OPTIONS", get_select_options_with_id($app_list_strings['salutation_dom'], ''));
57 57
 
58
-        if($this->viaAJAX) { // override for ajax call
58
+        if ($this->viaAJAX) { // override for ajax call
59 59
             $this->ss->assign('saveOnclick', "onclick='if(check_form(\"contactsQuickCreate\")) return SUGAR.subpanelUtils.inlineSave(this.form.id, \"contacts\"); else return false;'");
60 60
             $this->ss->assign('cancelOnclick', "onclick='return SUGAR.subpanelUtils.cancelCreate(\"subpanel_contacts\")';");
61 61
         }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
Please login to merge, or discard this patch.
modules/Contacts/SaveContactOpportunityRelationship.php 3 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -57,12 +57,12 @@
 block discarded – undo
57 57
 
58 58
 foreach($focus->column_fields as $field)
59 59
 {
60
-	safe_map($field, $focus, true);
60
+    safe_map($field, $focus, true);
61 61
 }
62 62
 
63 63
 foreach($focus->additional_column_fields as $field)
64 64
 {
65
-	safe_map($field, $focus, true);
65
+    safe_map($field, $focus, true);
66 66
 }
67 67
 
68 68
 // send them to the edit screen.
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 /*********************************************************************************
4 4
  * SugarCRM Community Edition is a customer relationship management program developed by
5 5
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -55,18 +55,18 @@  discard block
 block discarded – undo
55 55
 
56 56
 $focus->retrieve($_REQUEST['record']);
57 57
 
58
-foreach($focus->column_fields as $field)
58
+foreach ($focus->column_fields as $field)
59 59
 {
60 60
 	safe_map($field, $focus, true);
61 61
 }
62 62
 
63
-foreach($focus->additional_column_fields as $field)
63
+foreach ($focus->additional_column_fields as $field)
64 64
 {
65 65
 	safe_map($field, $focus, true);
66 66
 }
67 67
 
68 68
 // send them to the edit screen.
69
-if(isset($_REQUEST['record']) && $_REQUEST['record'] != "")
69
+if (isset($_REQUEST['record']) && $_REQUEST['record'] != "")
70 70
 {
71 71
     $recordID = $_REQUEST['record'];
72 72
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
Please login to merge, or discard this patch.
modules/Contacts/disablePortalUser.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -21,9 +21,9 @@  discard block
 block discarded – undo
21 21
  *
22 22
  * @author Salesagility Ltd <[email protected]>
23 23
  */
24
-if(!defined('sugarEntry'))define('sugarEntry', true);
24
+if (!defined('sugarEntry'))define('sugarEntry', true);
25 25
 require_once 'modules/AOP_Case_Updates/util.php';
26
-if(!isAOPEnabled()){
26
+if (!isAOPEnabled()) {
27 27
     return;
28 28
 }
29 29
 global $sugar_config, $mod_strings;
@@ -33,19 +33,19 @@  discard block
 block discarded – undo
33 33
 $bean = new Contact();
34 34
 $bean->retrieve($_REQUEST['record']);
35 35
 
36
-if(array_key_exists("aop",$sugar_config) && array_key_exists("joomla_url",$sugar_config['aop'])){
36
+if (array_key_exists("aop", $sugar_config) && array_key_exists("joomla_url", $sugar_config['aop'])) {
37 37
     $portalURL = $sugar_config['aop']['joomla_url'];
38 38
     $wbsv = file_get_contents($portalURL.'/index.php?option=com_advancedopenportal&task=disable_user&sug='.$_REQUEST['record'].'&uid='.$bean->joomla_account_id);
39 39
     $res = json_decode($wbsv);
40
-    if(!$res->success){
40
+    if (!$res->success) {
41 41
         $msg = $res->error ? $res->error : $mod_strings['LBL_DISABLE_PORTAL_USER_FAILED'];
42 42
         SugarApplication::appendErrorMessage($msg);
43
-    }else{
43
+    } else {
44 44
         $bean->portal_account_disabled = 1;
45 45
         $bean->save(false);
46 46
         SugarApplication::appendErrorMessage($mod_strings['LBL_DISABLE_PORTAL_USER_SUCCESS']);
47 47
     }
48
-}else{
48
+} else {
49 49
     SugarApplication::appendErrorMessage($mod_strings['LBL_NO_JOOMLA_URL']);
50 50
 }
51 51
 
Please login to merge, or discard this patch.
Braces   +5 added lines, -3 removed lines patch added patch discarded remove patch
@@ -21,7 +21,9 @@  discard block
 block discarded – undo
21 21
  *
22 22
  * @author Salesagility Ltd <[email protected]>
23 23
  */
24
-if(!defined('sugarEntry'))define('sugarEntry', true);
24
+if(!defined('sugarEntry')) {
25
+    define('sugarEntry', true);
26
+}
25 27
 require_once 'modules/AOP_Case_Updates/util.php';
26 28
 if(!isAOPEnabled()){
27 29
     return;
@@ -40,12 +42,12 @@  discard block
 block discarded – undo
40 42
     if(!$res->success){
41 43
         $msg = $res->error ? $res->error : $mod_strings['LBL_DISABLE_PORTAL_USER_FAILED'];
42 44
         SugarApplication::appendErrorMessage($msg);
43
-    }else{
45
+    } else{
44 46
         $bean->portal_account_disabled = 1;
45 47
         $bean->save(false);
46 48
         SugarApplication::appendErrorMessage($mod_strings['LBL_DISABLE_PORTAL_USER_SUCCESS']);
47 49
     }
48
-}else{
50
+} else{
49 51
     SugarApplication::appendErrorMessage($mod_strings['LBL_NO_JOOMLA_URL']);
50 52
 }
51 53
 
Please login to merge, or discard this patch.
modules/Contacts/ContactOpportunityRelationship.php 3 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 /*********************************************************************************
4 4
  * SugarCRM Community Edition is a customer relationship management program developed by
5 5
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -74,46 +74,46 @@  discard block
 block discarded – undo
74 74
 	var $new_schema = true;
75 75
 	
76 76
 	var $additional_column_fields = Array();
77
-		var $field_defs = array (
77
+		var $field_defs = array(
78 78
        'id'=>array('name' =>'id', 'type' =>'char', 'len'=>'36', 'default'=>'')
79
-      , 'contact_id'=>array('name' =>'contact_id', 'type' =>'char', 'len'=>'36', )
79
+      , 'contact_id'=>array('name' =>'contact_id', 'type' =>'char', 'len'=>'36',)
80 80
       , 'opportunity_id'=>array('name' =>'opportunity_id', 'type' =>'char', 'len'=>'36',)
81 81
       , 'contact_role'=>array('name' =>'contact_role', 'type' =>'char', 'len'=>'50')
82
-      , 'date_modified'=>array ('name' => 'date_modified','type' => 'datetime')
82
+      , 'date_modified'=>array('name' => 'date_modified', 'type' => 'datetime')
83 83
       , 'deleted'=>array('name' =>'deleted', 'type' =>'bool', 'len'=>'1', 'default'=>'0', 'required'=>true)
84 84
       );
85 85
 	function ContactOpportunityRelationship() {
86 86
 		$this->db = DBManagerFactory::getInstance();
87 87
         $this->dbManager = DBManagerFactory::getInstance();
88 88
 
89
-		$this->disable_row_level_security =true;
89
+		$this->disable_row_level_security = true;
90 90
 
91 91
 		}
92 92
 
93 93
 	function fill_in_additional_detail_fields()
94 94
 	{
95 95
 		global $locale;
96
-		if(isset($this->contact_id) && $this->contact_id != "")
96
+		if (isset($this->contact_id) && $this->contact_id != "")
97 97
 		{
98 98
 			$query = "SELECT first_name, last_name from contacts where id='$this->contact_id' AND deleted=0";
99
-			$result =$this->db->query($query,true," Error filling in additional detail fields: ");
99
+			$result = $this->db->query($query, true, " Error filling in additional detail fields: ");
100 100
 			// Get the id and the name.
101 101
 			$row = $this->db->fetchByAssoc($result);
102 102
 
103
-			if($row != null)
103
+			if ($row != null)
104 104
 			{
105 105
 				$this->contact_name = $locale->getLocaleFormattedName($row['first_name'], $row['last_name']);
106 106
 			}
107 107
 		}
108 108
 
109
-		if(isset($this->opportunity_id) && $this->opportunity_id != "")
109
+		if (isset($this->opportunity_id) && $this->opportunity_id != "")
110 110
 		{
111 111
 			$query = "SELECT name from opportunities where id='$this->opportunity_id' AND deleted=0";
112
-			$result =$this->db->query($query,true," Error filling in additional detail fields: ");
112
+			$result = $this->db->query($query, true, " Error filling in additional detail fields: ");
113 113
 			// Get the id and the name.
114 114
 			$row = $this->db->fetchByAssoc($result);
115 115
 
116
-			if($row != null)
116
+			if ($row != null)
117 117
 			{
118 118
 				$this->opportunity_name = $row['name'];
119 119
 			}
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
Please login to merge, or discard this patch.
Indentation   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -52,75 +52,75 @@
 block discarded – undo
52 52
 
53 53
 // Contact is used to store customer information.
54 54
 class ContactOpportunityRelationship extends SugarBean {
55
-	// Stored fields
56
-	var $id;
57
-	var $contact_id;
58
-	var $contact_role;
59
-	var $opportunity_id;
60
-
61
-	// Related fields
62
-	var $contact_name;
63
-	var $opportunity_name;
64
-
65
-	var $table_name = "opportunities_contacts";
66
-	var $object_name = "ContactOpportunityRelationship";
67
-	var $column_fields = Array("id"
68
-		,"contact_id"
69
-		,"opportunity_id"
70
-		,"contact_role"
71
-		,'date_modified'
72
-		);
73
-
74
-	var $new_schema = true;
75
-
76
-	var $additional_column_fields = Array();
77
-		var $field_defs = array (
78
-       'id'=>array('name' =>'id', 'type' =>'char', 'len'=>'36', 'default'=>'')
79
-      , 'contact_id'=>array('name' =>'contact_id', 'type' =>'char', 'len'=>'36', )
80
-      , 'opportunity_id'=>array('name' =>'opportunity_id', 'type' =>'char', 'len'=>'36',)
81
-      , 'contact_role'=>array('name' =>'contact_role', 'type' =>'char', 'len'=>'50')
82
-      , 'date_modified'=>array ('name' => 'date_modified','type' => 'datetime')
83
-      , 'deleted'=>array('name' =>'deleted', 'type' =>'bool', 'len'=>'1', 'default'=>'0', 'required'=>true)
84
-      );
85
-	function __construct() {
55
+    // Stored fields
56
+    var $id;
57
+    var $contact_id;
58
+    var $contact_role;
59
+    var $opportunity_id;
60
+
61
+    // Related fields
62
+    var $contact_name;
63
+    var $opportunity_name;
64
+
65
+    var $table_name = "opportunities_contacts";
66
+    var $object_name = "ContactOpportunityRelationship";
67
+    var $column_fields = Array("id"
68
+        ,"contact_id"
69
+        ,"opportunity_id"
70
+        ,"contact_role"
71
+        ,'date_modified'
72
+        );
73
+
74
+    var $new_schema = true;
75
+
76
+    var $additional_column_fields = Array();
77
+        var $field_defs = array (
78
+        'id'=>array('name' =>'id', 'type' =>'char', 'len'=>'36', 'default'=>'')
79
+        , 'contact_id'=>array('name' =>'contact_id', 'type' =>'char', 'len'=>'36', )
80
+        , 'opportunity_id'=>array('name' =>'opportunity_id', 'type' =>'char', 'len'=>'36',)
81
+        , 'contact_role'=>array('name' =>'contact_role', 'type' =>'char', 'len'=>'50')
82
+        , 'date_modified'=>array ('name' => 'date_modified','type' => 'datetime')
83
+        , 'deleted'=>array('name' =>'deleted', 'type' =>'bool', 'len'=>'1', 'default'=>'0', 'required'=>true)
84
+        );
85
+    function __construct() {
86 86
         parent::__construct();
87
-		$this->db = DBManagerFactory::getInstance();
87
+        $this->db = DBManagerFactory::getInstance();
88 88
         $this->dbManager = DBManagerFactory::getInstance();
89 89
 
90
-		$this->disable_row_level_security =true;
91
-
92
-		}
93
-
94
-	function fill_in_additional_detail_fields()
95
-	{
96
-		global $locale;
97
-		if(isset($this->contact_id) && $this->contact_id != "")
98
-		{
99
-			$query = "SELECT first_name, last_name from contacts where id='$this->contact_id' AND deleted=0";
100
-			$result =$this->db->query($query,true," Error filling in additional detail fields: ");
101
-			// Get the id and the name.
102
-			$row = $this->db->fetchByAssoc($result);
103
-
104
-			if($row != null)
105
-			{
106
-				$this->contact_name = $locale->getLocaleFormattedName($row['first_name'], $row['last_name']);
107
-			}
108
-		}
109
-
110
-		if(isset($this->opportunity_id) && $this->opportunity_id != "")
111
-		{
112
-			$query = "SELECT name from opportunities where id='$this->opportunity_id' AND deleted=0";
113
-			$result =$this->db->query($query,true," Error filling in additional detail fields: ");
114
-			// Get the id and the name.
115
-			$row = $this->db->fetchByAssoc($result);
116
-
117
-			if($row != null)
118
-			{
119
-				$this->opportunity_name = $row['name'];
120
-			}
121
-		}
122
-
123
-	}
90
+        $this->disable_row_level_security =true;
91
+
92
+        }
93
+
94
+    function fill_in_additional_detail_fields()
95
+    {
96
+        global $locale;
97
+        if(isset($this->contact_id) && $this->contact_id != "")
98
+        {
99
+            $query = "SELECT first_name, last_name from contacts where id='$this->contact_id' AND deleted=0";
100
+            $result =$this->db->query($query,true," Error filling in additional detail fields: ");
101
+            // Get the id and the name.
102
+            $row = $this->db->fetchByAssoc($result);
103
+
104
+            if($row != null)
105
+            {
106
+                $this->contact_name = $locale->getLocaleFormattedName($row['first_name'], $row['last_name']);
107
+            }
108
+        }
109
+
110
+        if(isset($this->opportunity_id) && $this->opportunity_id != "")
111
+        {
112
+            $query = "SELECT name from opportunities where id='$this->opportunity_id' AND deleted=0";
113
+            $result =$this->db->query($query,true," Error filling in additional detail fields: ");
114
+            // Get the id and the name.
115
+            $row = $this->db->fetchByAssoc($result);
116
+
117
+            if($row != null)
118
+            {
119
+                $this->opportunity_name = $row['name'];
120
+            }
121
+        }
122
+
123
+    }
124 124
 }
125 125
 
126 126
 
Please login to merge, or discard this patch.
modules/Contacts/metadata/additionalDetails.php 3 patches
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -40,13 +40,13 @@  discard block
 block discarded – undo
40 40
 
41 41
 
42 42
 function additionalDetailsContact($fields) {
43
-	static $mod_strings;
44
-	if(empty($mod_strings)) {
45
-		global $current_language;
46
-		$mod_strings = return_module_language($current_language, 'Contacts');
47
-	}
43
+    static $mod_strings;
44
+    if(empty($mod_strings)) {
45
+        global $current_language;
46
+        $mod_strings = return_module_language($current_language, 'Contacts');
47
+    }
48 48
 	 
49
-	$overlib_string = '';
49
+    $overlib_string = '';
50 50
     if(!empty($fields['ID'])) {
51 51
         $overlib_string .= '<input type="hidden" value="'. $fields['ID'];
52 52
         $overlib_string .= '">';
@@ -55,35 +55,35 @@  discard block
 block discarded – undo
55 55
     $overlib_string .= '<h2><img src="index.php?entryPoint=getImage&themeName=' . SugarThemeRegistry::current()->name .'&imageName=Contacts.gif"/> '.$mod_strings['LBL_CONTACT'].'</h2>';
56 56
 
57 57
     if(!empty($fields['PRIMARY_ADDRESS_STREET']) || !empty($fields['PRIMARY_ADDRESS_CITY']) ||
58
-		!empty($fields['PRIMARY_ADDRESS_STATE']) || !empty($fields['PRIMARY_ADDRESS_POSTALCODE']) ||
59
-		!empty($fields['PRIMARY_ADDRESS_COUNTRY']))
60
-			$overlib_string .= '<b>' . $mod_strings['LBL_PRIMARY_ADDRESS'] . '</b><br>';
61
-	if(!empty($fields['PRIMARY_ADDRESS_STREET'])) $overlib_string .= $fields['PRIMARY_ADDRESS_STREET'] . '<br>';
62
-	if(!empty($fields['PRIMARY_ADDRESS_STREET_2'])) $overlib_string .= $fields['PRIMARY_ADDRESS_STREET_2'] . '<br>';
63
-	if(!empty($fields['PRIMARY_ADDRESS_STREET_3'])) $overlib_string .= $fields['PRIMARY_ADDRESS_STREET_3'] . '<br>';
64
-	if(!empty($fields['PRIMARY_ADDRESS_CITY'])) $overlib_string .= $fields['PRIMARY_ADDRESS_CITY'] . ', ';
65
-	if(!empty($fields['PRIMARY_ADDRESS_STATE'])) $overlib_string .= $fields['PRIMARY_ADDRESS_STATE'] . ' ';
66
-	if(!empty($fields['PRIMARY_ADDRESS_POSTALCODE'])) $overlib_string .= $fields['PRIMARY_ADDRESS_POSTALCODE'] . ' ';
67
-	if(!empty($fields['PRIMARY_ADDRESS_COUNTRY'])) $overlib_string .= $fields['PRIMARY_ADDRESS_COUNTRY'] . '<br>';
68
-	if(strlen($overlib_string) > 0 && !(strrpos($overlib_string, '<br>') == strlen($overlib_string) - 4)) 
69
-		$overlib_string .= '<br>';  
70
-	if(!empty($fields['PHONE_MOBILE'])) $overlib_string .= '<b>'. $mod_strings['LBL_MOBILE_PHONE'] . '</b> <span class="phone">' . $fields['PHONE_MOBILE'] . '</span><br>';
71
-	if(!empty($fields['PHONE_HOME'])) $overlib_string .= '<b>'. $mod_strings['LBL_HOME_PHONE'] . '</b> <span class="phone">' . $fields['PHONE_HOME'] . '</span><br>';
72
-	if(!empty($fields['PHONE_OTHER'])) $overlib_string .= '<b>'. $mod_strings['LBL_OTHER_PHONE'] . '</b> <span class="phone">' . $fields['PHONE_OTHER'] . '</span><br>';
58
+        !empty($fields['PRIMARY_ADDRESS_STATE']) || !empty($fields['PRIMARY_ADDRESS_POSTALCODE']) ||
59
+        !empty($fields['PRIMARY_ADDRESS_COUNTRY']))
60
+            $overlib_string .= '<b>' . $mod_strings['LBL_PRIMARY_ADDRESS'] . '</b><br>';
61
+    if(!empty($fields['PRIMARY_ADDRESS_STREET'])) $overlib_string .= $fields['PRIMARY_ADDRESS_STREET'] . '<br>';
62
+    if(!empty($fields['PRIMARY_ADDRESS_STREET_2'])) $overlib_string .= $fields['PRIMARY_ADDRESS_STREET_2'] . '<br>';
63
+    if(!empty($fields['PRIMARY_ADDRESS_STREET_3'])) $overlib_string .= $fields['PRIMARY_ADDRESS_STREET_3'] . '<br>';
64
+    if(!empty($fields['PRIMARY_ADDRESS_CITY'])) $overlib_string .= $fields['PRIMARY_ADDRESS_CITY'] . ', ';
65
+    if(!empty($fields['PRIMARY_ADDRESS_STATE'])) $overlib_string .= $fields['PRIMARY_ADDRESS_STATE'] . ' ';
66
+    if(!empty($fields['PRIMARY_ADDRESS_POSTALCODE'])) $overlib_string .= $fields['PRIMARY_ADDRESS_POSTALCODE'] . ' ';
67
+    if(!empty($fields['PRIMARY_ADDRESS_COUNTRY'])) $overlib_string .= $fields['PRIMARY_ADDRESS_COUNTRY'] . '<br>';
68
+    if(strlen($overlib_string) > 0 && !(strrpos($overlib_string, '<br>') == strlen($overlib_string) - 4)) 
69
+        $overlib_string .= '<br>';  
70
+    if(!empty($fields['PHONE_MOBILE'])) $overlib_string .= '<b>'. $mod_strings['LBL_MOBILE_PHONE'] . '</b> <span class="phone">' . $fields['PHONE_MOBILE'] . '</span><br>';
71
+    if(!empty($fields['PHONE_HOME'])) $overlib_string .= '<b>'. $mod_strings['LBL_HOME_PHONE'] . '</b> <span class="phone">' . $fields['PHONE_HOME'] . '</span><br>';
72
+    if(!empty($fields['PHONE_OTHER'])) $overlib_string .= '<b>'. $mod_strings['LBL_OTHER_PHONE'] . '</b> <span class="phone">' . $fields['PHONE_OTHER'] . '</span><br>';
73 73
 
74
-	if(!empty($fields['DATE_MODIFIED'])) $overlib_string .= '<b>'. $mod_strings['LBL_DATE_MODIFIED'] . '</b> ' . $fields['DATE_MODIFIED'] . '<br>';
74
+    if(!empty($fields['DATE_MODIFIED'])) $overlib_string .= '<b>'. $mod_strings['LBL_DATE_MODIFIED'] . '</b> ' . $fields['DATE_MODIFIED'] . '<br>';
75 75
 	
76
-	if(!empty($fields['DESCRIPTION'])) { 
77
-		$overlib_string .= '<b>'. $mod_strings['LBL_DESCRIPTION'] . '</b> ' . substr($fields['DESCRIPTION'], 0, 300);
78
-		if(strlen($fields['DESCRIPTION']) > 300) $overlib_string .= '...';
79
-	}	
76
+    if(!empty($fields['DESCRIPTION'])) { 
77
+        $overlib_string .= '<b>'. $mod_strings['LBL_DESCRIPTION'] . '</b> ' . substr($fields['DESCRIPTION'], 0, 300);
78
+        if(strlen($fields['DESCRIPTION']) > 300) $overlib_string .= '...';
79
+    }	
80 80
 	
81
-	return array('fieldToAddTo' => 'NAME', 
82
-				 'string' => $overlib_string, 
83
-				 'editLink' => "index.php?action=EditView&module=Contacts&return_module=Contacts&record={$fields['ID']}", 
84
-				 'viewLink' => "index.php?action=DetailView&module=Contacts&return_module=Contacts&record={$fields['ID']}");
81
+    return array('fieldToAddTo' => 'NAME', 
82
+                    'string' => $overlib_string, 
83
+                    'editLink' => "index.php?action=EditView&module=Contacts&return_module=Contacts&record={$fields['ID']}", 
84
+                    'viewLink' => "index.php?action=DetailView&module=Contacts&return_module=Contacts&record={$fields['ID']}");
85 85
 }
86 86
  
87
- ?>
87
+    ?>
88 88
  
89 89
  
90 90
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 /*********************************************************************************
4 4
  * SugarCRM Community Edition is a customer relationship management program developed by
5 5
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -41,41 +41,41 @@  discard block
 block discarded – undo
41 41
 
42 42
 function additionalDetailsContact($fields) {
43 43
 	static $mod_strings;
44
-	if(empty($mod_strings)) {
44
+	if (empty($mod_strings)) {
45 45
 		global $current_language;
46 46
 		$mod_strings = return_module_language($current_language, 'Contacts');
47 47
 	}
48 48
 	 
49 49
 	$overlib_string = '';
50
-    if(!empty($fields['ID'])) {
51
-        $overlib_string .= '<input type="hidden" value="'. $fields['ID'];
50
+    if (!empty($fields['ID'])) {
51
+        $overlib_string .= '<input type="hidden" value="'.$fields['ID'];
52 52
         $overlib_string .= '">';
53 53
     }
54 54
 
55
-    $overlib_string .= '<h2><img src="index.php?entryPoint=getImage&themeName=' . SugarThemeRegistry::current()->name .'&imageName=Contacts.gif"/> '.$mod_strings['LBL_CONTACT'].'</h2>';
55
+    $overlib_string .= '<h2><img src="index.php?entryPoint=getImage&themeName='.SugarThemeRegistry::current()->name.'&imageName=Contacts.gif"/> '.$mod_strings['LBL_CONTACT'].'</h2>';
56 56
 
57
-    if(!empty($fields['PRIMARY_ADDRESS_STREET']) || !empty($fields['PRIMARY_ADDRESS_CITY']) ||
57
+    if (!empty($fields['PRIMARY_ADDRESS_STREET']) || !empty($fields['PRIMARY_ADDRESS_CITY']) ||
58 58
 		!empty($fields['PRIMARY_ADDRESS_STATE']) || !empty($fields['PRIMARY_ADDRESS_POSTALCODE']) ||
59 59
 		!empty($fields['PRIMARY_ADDRESS_COUNTRY']))
60
-			$overlib_string .= '<b>' . $mod_strings['LBL_PRIMARY_ADDRESS'] . '</b><br>';
61
-	if(!empty($fields['PRIMARY_ADDRESS_STREET'])) $overlib_string .= $fields['PRIMARY_ADDRESS_STREET'] . '<br>';
62
-	if(!empty($fields['PRIMARY_ADDRESS_STREET_2'])) $overlib_string .= $fields['PRIMARY_ADDRESS_STREET_2'] . '<br>';
63
-	if(!empty($fields['PRIMARY_ADDRESS_STREET_3'])) $overlib_string .= $fields['PRIMARY_ADDRESS_STREET_3'] . '<br>';
64
-	if(!empty($fields['PRIMARY_ADDRESS_CITY'])) $overlib_string .= $fields['PRIMARY_ADDRESS_CITY'] . ', ';
65
-	if(!empty($fields['PRIMARY_ADDRESS_STATE'])) $overlib_string .= $fields['PRIMARY_ADDRESS_STATE'] . ' ';
66
-	if(!empty($fields['PRIMARY_ADDRESS_POSTALCODE'])) $overlib_string .= $fields['PRIMARY_ADDRESS_POSTALCODE'] . ' ';
67
-	if(!empty($fields['PRIMARY_ADDRESS_COUNTRY'])) $overlib_string .= $fields['PRIMARY_ADDRESS_COUNTRY'] . '<br>';
68
-	if(strlen($overlib_string) > 0 && !(strrpos($overlib_string, '<br>') == strlen($overlib_string) - 4)) 
60
+			$overlib_string .= '<b>'.$mod_strings['LBL_PRIMARY_ADDRESS'].'</b><br>';
61
+	if (!empty($fields['PRIMARY_ADDRESS_STREET'])) $overlib_string .= $fields['PRIMARY_ADDRESS_STREET'].'<br>';
62
+	if (!empty($fields['PRIMARY_ADDRESS_STREET_2'])) $overlib_string .= $fields['PRIMARY_ADDRESS_STREET_2'].'<br>';
63
+	if (!empty($fields['PRIMARY_ADDRESS_STREET_3'])) $overlib_string .= $fields['PRIMARY_ADDRESS_STREET_3'].'<br>';
64
+	if (!empty($fields['PRIMARY_ADDRESS_CITY'])) $overlib_string .= $fields['PRIMARY_ADDRESS_CITY'].', ';
65
+	if (!empty($fields['PRIMARY_ADDRESS_STATE'])) $overlib_string .= $fields['PRIMARY_ADDRESS_STATE'].' ';
66
+	if (!empty($fields['PRIMARY_ADDRESS_POSTALCODE'])) $overlib_string .= $fields['PRIMARY_ADDRESS_POSTALCODE'].' ';
67
+	if (!empty($fields['PRIMARY_ADDRESS_COUNTRY'])) $overlib_string .= $fields['PRIMARY_ADDRESS_COUNTRY'].'<br>';
68
+	if (strlen($overlib_string) > 0 && !(strrpos($overlib_string, '<br>') == strlen($overlib_string) - 4)) 
69 69
 		$overlib_string .= '<br>';  
70
-	if(!empty($fields['PHONE_MOBILE'])) $overlib_string .= '<b>'. $mod_strings['LBL_MOBILE_PHONE'] . '</b> <span class="phone">' . $fields['PHONE_MOBILE'] . '</span><br>';
71
-	if(!empty($fields['PHONE_HOME'])) $overlib_string .= '<b>'. $mod_strings['LBL_HOME_PHONE'] . '</b> <span class="phone">' . $fields['PHONE_HOME'] . '</span><br>';
72
-	if(!empty($fields['PHONE_OTHER'])) $overlib_string .= '<b>'. $mod_strings['LBL_OTHER_PHONE'] . '</b> <span class="phone">' . $fields['PHONE_OTHER'] . '</span><br>';
70
+	if (!empty($fields['PHONE_MOBILE'])) $overlib_string .= '<b>'.$mod_strings['LBL_MOBILE_PHONE'].'</b> <span class="phone">'.$fields['PHONE_MOBILE'].'</span><br>';
71
+	if (!empty($fields['PHONE_HOME'])) $overlib_string .= '<b>'.$mod_strings['LBL_HOME_PHONE'].'</b> <span class="phone">'.$fields['PHONE_HOME'].'</span><br>';
72
+	if (!empty($fields['PHONE_OTHER'])) $overlib_string .= '<b>'.$mod_strings['LBL_OTHER_PHONE'].'</b> <span class="phone">'.$fields['PHONE_OTHER'].'</span><br>';
73 73
 
74
-	if(!empty($fields['DATE_MODIFIED'])) $overlib_string .= '<b>'. $mod_strings['LBL_DATE_MODIFIED'] . '</b> ' . $fields['DATE_MODIFIED'] . '<br>';
74
+	if (!empty($fields['DATE_MODIFIED'])) $overlib_string .= '<b>'.$mod_strings['LBL_DATE_MODIFIED'].'</b> '.$fields['DATE_MODIFIED'].'<br>';
75 75
 	
76
-	if(!empty($fields['DESCRIPTION'])) { 
77
-		$overlib_string .= '<b>'. $mod_strings['LBL_DESCRIPTION'] . '</b> ' . substr($fields['DESCRIPTION'], 0, 300);
78
-		if(strlen($fields['DESCRIPTION']) > 300) $overlib_string .= '...';
76
+	if (!empty($fields['DESCRIPTION'])) { 
77
+		$overlib_string .= '<b>'.$mod_strings['LBL_DESCRIPTION'].'</b> '.substr($fields['DESCRIPTION'], 0, 300);
78
+		if (strlen($fields['DESCRIPTION']) > 300) $overlib_string .= '...';
79 79
 	}	
80 80
 	
81 81
 	return array('fieldToAddTo' => 'NAME', 
Please login to merge, or discard this patch.
Braces   +45 added lines, -17 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -56,26 +58,52 @@  discard block
 block discarded – undo
56 58
 
57 59
     if(!empty($fields['PRIMARY_ADDRESS_STREET']) || !empty($fields['PRIMARY_ADDRESS_CITY']) ||
58 60
 		!empty($fields['PRIMARY_ADDRESS_STATE']) || !empty($fields['PRIMARY_ADDRESS_POSTALCODE']) ||
59
-		!empty($fields['PRIMARY_ADDRESS_COUNTRY']))
60
-			$overlib_string .= '<b>' . $mod_strings['LBL_PRIMARY_ADDRESS'] . '</b><br>';
61
-	if(!empty($fields['PRIMARY_ADDRESS_STREET'])) $overlib_string .= $fields['PRIMARY_ADDRESS_STREET'] . '<br>';
62
-	if(!empty($fields['PRIMARY_ADDRESS_STREET_2'])) $overlib_string .= $fields['PRIMARY_ADDRESS_STREET_2'] . '<br>';
63
-	if(!empty($fields['PRIMARY_ADDRESS_STREET_3'])) $overlib_string .= $fields['PRIMARY_ADDRESS_STREET_3'] . '<br>';
64
-	if(!empty($fields['PRIMARY_ADDRESS_CITY'])) $overlib_string .= $fields['PRIMARY_ADDRESS_CITY'] . ', ';
65
-	if(!empty($fields['PRIMARY_ADDRESS_STATE'])) $overlib_string .= $fields['PRIMARY_ADDRESS_STATE'] . ' ';
66
-	if(!empty($fields['PRIMARY_ADDRESS_POSTALCODE'])) $overlib_string .= $fields['PRIMARY_ADDRESS_POSTALCODE'] . ' ';
67
-	if(!empty($fields['PRIMARY_ADDRESS_COUNTRY'])) $overlib_string .= $fields['PRIMARY_ADDRESS_COUNTRY'] . '<br>';
68
-	if(strlen($overlib_string) > 0 && !(strrpos($overlib_string, '<br>') == strlen($overlib_string) - 4)) 
69
-		$overlib_string .= '<br>';  
70
-	if(!empty($fields['PHONE_MOBILE'])) $overlib_string .= '<b>'. $mod_strings['LBL_MOBILE_PHONE'] . '</b> <span class="phone">' . $fields['PHONE_MOBILE'] . '</span><br>';
71
-	if(!empty($fields['PHONE_HOME'])) $overlib_string .= '<b>'. $mod_strings['LBL_HOME_PHONE'] . '</b> <span class="phone">' . $fields['PHONE_HOME'] . '</span><br>';
72
-	if(!empty($fields['PHONE_OTHER'])) $overlib_string .= '<b>'. $mod_strings['LBL_OTHER_PHONE'] . '</b> <span class="phone">' . $fields['PHONE_OTHER'] . '</span><br>';
61
+		!empty($fields['PRIMARY_ADDRESS_COUNTRY'])) {
62
+    			$overlib_string .= '<b>' . $mod_strings['LBL_PRIMARY_ADDRESS'] . '</b><br>';
63
+    }
64
+	if(!empty($fields['PRIMARY_ADDRESS_STREET'])) {
65
+	    $overlib_string .= $fields['PRIMARY_ADDRESS_STREET'] . '<br>';
66
+	}
67
+	if(!empty($fields['PRIMARY_ADDRESS_STREET_2'])) {
68
+	    $overlib_string .= $fields['PRIMARY_ADDRESS_STREET_2'] . '<br>';
69
+	}
70
+	if(!empty($fields['PRIMARY_ADDRESS_STREET_3'])) {
71
+	    $overlib_string .= $fields['PRIMARY_ADDRESS_STREET_3'] . '<br>';
72
+	}
73
+	if(!empty($fields['PRIMARY_ADDRESS_CITY'])) {
74
+	    $overlib_string .= $fields['PRIMARY_ADDRESS_CITY'] . ', ';
75
+	}
76
+	if(!empty($fields['PRIMARY_ADDRESS_STATE'])) {
77
+	    $overlib_string .= $fields['PRIMARY_ADDRESS_STATE'] . ' ';
78
+	}
79
+	if(!empty($fields['PRIMARY_ADDRESS_POSTALCODE'])) {
80
+	    $overlib_string .= $fields['PRIMARY_ADDRESS_POSTALCODE'] . ' ';
81
+	}
82
+	if(!empty($fields['PRIMARY_ADDRESS_COUNTRY'])) {
83
+	    $overlib_string .= $fields['PRIMARY_ADDRESS_COUNTRY'] . '<br>';
84
+	}
85
+	if(strlen($overlib_string) > 0 && !(strrpos($overlib_string, '<br>') == strlen($overlib_string) - 4)) {
86
+			$overlib_string .= '<br>';
87
+	}
88
+	if(!empty($fields['PHONE_MOBILE'])) {
89
+	    $overlib_string .= '<b>'. $mod_strings['LBL_MOBILE_PHONE'] . '</b> <span class="phone">' . $fields['PHONE_MOBILE'] . '</span><br>';
90
+	}
91
+	if(!empty($fields['PHONE_HOME'])) {
92
+	    $overlib_string .= '<b>'. $mod_strings['LBL_HOME_PHONE'] . '</b> <span class="phone">' . $fields['PHONE_HOME'] . '</span><br>';
93
+	}
94
+	if(!empty($fields['PHONE_OTHER'])) {
95
+	    $overlib_string .= '<b>'. $mod_strings['LBL_OTHER_PHONE'] . '</b> <span class="phone">' . $fields['PHONE_OTHER'] . '</span><br>';
96
+	}
73 97
 
74
-	if(!empty($fields['DATE_MODIFIED'])) $overlib_string .= '<b>'. $mod_strings['LBL_DATE_MODIFIED'] . '</b> ' . $fields['DATE_MODIFIED'] . '<br>';
98
+	if(!empty($fields['DATE_MODIFIED'])) {
99
+	    $overlib_string .= '<b>'. $mod_strings['LBL_DATE_MODIFIED'] . '</b> ' . $fields['DATE_MODIFIED'] . '<br>';
100
+	}
75 101
 	
76 102
 	if(!empty($fields['DESCRIPTION'])) { 
77 103
 		$overlib_string .= '<b>'. $mod_strings['LBL_DESCRIPTION'] . '</b> ' . substr($fields['DESCRIPTION'], 0, 300);
78
-		if(strlen($fields['DESCRIPTION']) > 300) $overlib_string .= '...';
104
+		if(strlen($fields['DESCRIPTION']) > 300) {
105
+		    $overlib_string .= '...';
106
+		}
79 107
 	}	
80 108
 	
81 109
 	return array('fieldToAddTo' => 'NAME', 
Please login to merge, or discard this patch.