Test Failed
Push — CI ( 0f01dd...c95a04 )
by Adam
55:13
created
modules/Campaigns/WizardMarketingSave.php 1 patch
Spacing   +32 added lines, -32 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.
@@ -53,18 +53,18 @@  discard block
 block discarded – undo
53 53
 $master = 'save';
54 54
 if (isset($_REQUEST['wiz_home_next_step']) && !empty($_REQUEST['wiz_home_next_step'])) {
55 55
     
56
-    if($_REQUEST['wiz_home_next_step']==3){
56
+    if ($_REQUEST['wiz_home_next_step'] == 3) {
57 57
         //user has chosen to save and schedule this campaign for email
58 58
         $master = 'send';
59
-    }elseif($_REQUEST['wiz_home_next_step']==2){
59
+    }elseif ($_REQUEST['wiz_home_next_step'] == 2) {
60 60
         //user has chosen to save and send this campaign in test mode
61 61
         $master = 'test';
62
-    }else{
62
+    } else {
63 63
         //user has chosen to simply save
64
-        $master  = 'save';        
64
+        $master = 'save';        
65 65
     }
66 66
         
67
-}else{
67
+} else {
68 68
      //default to just saving and exiting wizard
69 69
      $master = 'save';   
70 70
 }
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 if (isset($_REQUEST['record']) && !empty($_REQUEST['record'])) {
78 78
     $marketing->retrieve($_REQUEST['record']);
79 79
 }
80
-if(!$marketing->ACLAccess('Save')){
80
+if (!$marketing->ACLAccess('Save')) {
81 81
         ACLController::displayNoAccess(true);
82 82
         sugar_cleanup(true);
83 83
 }
@@ -90,40 +90,40 @@  discard block
 block discarded – undo
90 90
 }
91 91
 
92 92
     foreach ($_REQUEST as $key => $val) {
93
-              if((strstr($key, $prefix )) && (strpos($key, $prefix )== 0)){
94
-              $newkey  =substr($key, strlen($prefix)) ;
93
+              if ((strstr($key, $prefix)) && (strpos($key, $prefix) == 0)) {
94
+              $newkey = substr($key, strlen($prefix));
95 95
               $_REQUEST[$newkey] = $val;
96 96
          }               
97 97
     }
98 98
 
99 99
     foreach ($_REQUEST as $key => $val) {
100
-              if((strstr($key, $prefix )) && (strpos($key, $prefix )== 0)){
101
-              $newkey  =substr($key, strlen($prefix)) ;
100
+              if ((strstr($key, $prefix)) && (strpos($key, $prefix) == 0)) {
101
+              $newkey = substr($key, strlen($prefix));
102 102
               $_REQUEST[$newkey] = $val;
103 103
          }               
104 104
     }
105 105
 
106
-if(!empty($_REQUEST['meridiem'])){
107
-    $_REQUEST['time_start'] = $timedate->merge_time_meridiem($_REQUEST['time_start'],$timedate->get_time_format(), $_REQUEST['meridiem']);
106
+if (!empty($_REQUEST['meridiem'])) {
107
+    $_REQUEST['time_start'] = $timedate->merge_time_meridiem($_REQUEST['time_start'], $timedate->get_time_format(), $_REQUEST['meridiem']);
108 108
 }
109 109
 
110
-if(empty($_REQUEST['time_start'])) {
111
-  $_REQUEST['date_start'] = $_REQUEST['date_start'] . ' 00:00';	
110
+if (empty($_REQUEST['time_start'])) {
111
+  $_REQUEST['date_start'] = $_REQUEST['date_start'].' 00:00';	
112 112
 } else {
113
-  $_REQUEST['date_start'] = $_REQUEST['date_start'] . ' ' . $_REQUEST['time_start'];
113
+  $_REQUEST['date_start'] = $_REQUEST['date_start'].' '.$_REQUEST['time_start'];
114 114
 }
115 115
 
116
-foreach($marketing->column_fields as $field)
116
+foreach ($marketing->column_fields as $field)
117 117
 {
118 118
     if ($field == 'all_prospect_lists') {
119
-        if(isset($_REQUEST[$field]) && $_REQUEST[$field]='on' )
119
+        if (isset($_REQUEST[$field]) && $_REQUEST[$field] = 'on')
120 120
         {
121 121
             $marketing->$field = 1;
122 122
         } else {
123 123
             $marketing->$field = 0;         
124 124
         }
125
-    }else {
126
-        if(isset($_REQUEST[$field]))
125
+    } else {
126
+        if (isset($_REQUEST[$field]))
127 127
         {
128 128
             $value = $_REQUEST[$field];
129 129
             $marketing->$field = trim($value);
@@ -131,9 +131,9 @@  discard block
 block discarded – undo
131 131
     }
132 132
 }
133 133
 
134
-foreach($marketing->additional_column_fields as $field)
134
+foreach ($marketing->additional_column_fields as $field)
135 135
 {
136
-    if(isset($_REQUEST[$field]))
136
+    if (isset($_REQUEST[$field]))
137 137
     {
138 138
         $value = $_REQUEST[$field];
139 139
         $marketing->$field = $value;
@@ -145,8 +145,8 @@  discard block
 block discarded – undo
145 145
 
146 146
 //add prospect lists to campaign.
147 147
 $marketing->load_relationship('prospectlists');
148
-$prospectlists=$marketing->prospectlists->get();
149
-if ($marketing->all_prospect_lists==1) {
148
+$prospectlists = $marketing->prospectlists->get();
149
+if ($marketing->all_prospect_lists == 1) {
150 150
     //remove all related prospect lists.
151 151
     if (!empty($prospectlists)) {
152 152
         $marketing->prospectlists->delete($marketing->id);
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
     if (isset($_REQUEST['message_for']) && is_array($_REQUEST['message_for'])) {
156 156
         foreach ($_REQUEST['message_for'] as $prospect_list_id) {
157 157
             
158
-            $key=array_search($prospect_list_id,$prospectlists);
158
+            $key = array_search($prospect_list_id, $prospectlists);
159 159
             if ($key === null or $key === false) {
160 160
                 $marketing->prospectlists->add($prospect_list_id);          
161 161
             } else {
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
         }
165 165
         if (count($prospectlists) != 0) {
166 166
             foreach ($prospectlists as $key=>$list_id) {
167
-                $marketing->prospectlists->delete($marketing->id,$list_id);             
167
+                $marketing->prospectlists->delete($marketing->id, $list_id);             
168 168
             }   
169 169
         }
170 170
     }
@@ -174,14 +174,14 @@  discard block
 block discarded – undo
174 174
 $mass[] = $marketing->id; 
175 175
 //if sending an email was chosen, set all the needed variables for queuing campaign
176 176
 
177
-if($master !='save'){
178
-    $_REQUEST['mass']= $mass;
179
-    $_POST['mass']=$mass;
180
-    $_REQUEST['record'] =$marketing->campaign_id;
181
-    $_POST['record']=$marketing->campaign_id;
177
+if ($master != 'save') {
178
+    $_REQUEST['mass'] = $mass;
179
+    $_POST['mass'] = $mass;
180
+    $_REQUEST['record'] = $marketing->campaign_id;
181
+    $_POST['record'] = $marketing->campaign_id;
182 182
     $_REQUEST['mode'] = $master;
183 183
      $_POST['mode'] = $master; 
184
-     $_REQUEST['from_wiz']= 'true';
184
+     $_REQUEST['from_wiz'] = 'true';
185 185
     require_once('modules/Campaigns/QueueCampaign.php');
186 186
 }
187 187
 
Please login to merge, or discard this patch.
modules/AOR_Conditions/vardefs.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -26,9 +26,9 @@  discard block
 block discarded – undo
26 26
 	'table'=>'aor_conditions',
27 27
 	'audited'=>false,
28 28
 	'duplicate_merge'=>true,
29
-	'fields'=>array (
29
+	'fields'=>array(
30 30
   'aor_report_id' =>
31
-  array (
31
+  array(
32 32
     'required' => false,
33 33
     'name' => 'aor_report_id',
34 34
     'vname' => 'LBL_AOR_REPORT_ID',
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
     'size' => '20',
48 48
   ),
49 49
   'condition_order' => 
50
-  array (
50
+  array(
51 51
     'required' => false,
52 52
     'name' => 'condition_order',
53 53
     'vname' => 'LBL_ORDER',
@@ -79,14 +79,14 @@  discard block
 block discarded – undo
79 79
             'type' => 'varchar',
80 80
         ),
81 81
   'module_path' =>
82
-  array (
82
+  array(
83 83
     'name' => 'module_path',
84 84
     'type' => 'longtext',
85 85
     'vname' => 'LBL_MODULE_PATH',
86 86
     'isnull' => true,
87 87
   ),
88 88
   'field' => 
89
-  array (
89
+  array(
90 90
     'required' => false,
91 91
     'name' => 'field',
92 92
     'vname' => 'LBL_FIELD',
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
     'dependency' => false,
109 109
   ),
110 110
   'operator' => 
111
-  array (
111
+  array(
112 112
     'required' => false,
113 113
     'name' => 'operator',
114 114
     'vname' => 'LBL_OPERATOR',
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
     'dependency' => false,
132 132
   ),
133 133
     'value_type' =>
134
-    array (
134
+    array(
135 135
     'required' => false,
136 136
     'name' => 'value_type',
137 137
     'vname' => 'LBL_VALUE_TYPE',
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
     'size' => '20',
151 151
     ),
152 152
   'value' => 
153
-  array (
153
+  array(
154 154
     'required' => false,
155 155
     'name' => 'value',
156 156
     'vname' => 'LBL_VALUE',
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
     'size' => '20',
170 170
   ),
171 171
         'parameter' =>
172
-            array (
172
+            array(
173 173
                 'required' => false,
174 174
                 'name' => 'parameter',
175 175
                 'vname' => 'LBL_PARAMETER',
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
                 'studio' => 'visible',
188 188
             ),
189 189
   'aor_reports' =>
190
-  array (
190
+  array(
191 191
     'name' => 'aor_reports',
192 192
     'type' => 'link',
193 193
     'relationship' => 'aor_report_aor_conditions',
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
     'source'=>'non-db',
197 197
   ),
198 198
 ),
199
-	'relationships'=>array (
199
+	'relationships'=>array(
200 200
 ),
201 201
     'indices' => array(
202 202
         array(
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 	'unified_search'=>true,
210 210
 );
211 211
 
212
-if (!class_exists('VardefManager')){
212
+if (!class_exists('VardefManager')) {
213 213
         require_once('include/SugarObjects/VardefManager.php');
214 214
 }
215
-VardefManager::createVardef('AOR_Conditions','AOR_Condition', array('basic'));
215
+VardefManager::createVardef('AOR_Conditions', 'AOR_Condition', array('basic'));
Please login to merge, or discard this patch.
modules/AOR_Conditions/AOR_Condition.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 	var $table_name = 'aor_conditions';
31 31
     var $tracker_visibility = false;
32 32
 	var $importable = true;
33
-	var $disable_row_level_security = true ;
33
+	var $disable_row_level_security = true;
34 34
 	
35 35
 	var $id;
36 36
 	var $name;
@@ -52,11 +52,11 @@  discard block
 block discarded – undo
52 52
 	var $operator;
53 53
 	var $value;
54 54
 	
55
-	function AOR_Condition(){
55
+	function AOR_Condition() {
56 56
 		parent::Basic();
57 57
 	}
58 58
 
59
-    function save_lines($post_data, $parent, $key = ''){
59
+    function save_lines($post_data, $parent, $key = '') {
60 60
 
61 61
         require_once('modules/AOW_WorkFlow/aow_utils.php');
62 62
 
@@ -64,57 +64,57 @@  discard block
 block discarded – undo
64 64
         $j = 0;
65 65
         for ($i = 0; $i < $line_count; ++$i) {
66 66
 
67
-            if($post_data[$key.'deleted'][$i] == 1){
67
+            if ($post_data[$key.'deleted'][$i] == 1) {
68 68
                 $this->mark_deleted($post_data[$key.'id'][$i]);
69 69
             } else {
70 70
                 $condition = new AOR_Condition();
71
-                foreach($this->field_defs as $field_def) {
72
-                    if(isset($post_data[$key.$field_def['name']][$i])){
73
-                        if(is_array($post_data[$key.$field_def['name']][$i])){
71
+                foreach ($this->field_defs as $field_def) {
72
+                    if (isset($post_data[$key.$field_def['name']][$i])) {
73
+                        if (is_array($post_data[$key.$field_def['name']][$i])) {
74 74
 
75
-                                switch($condition->value_type) {
75
+                                switch ($condition->value_type) {
76 76
                                     case 'Date':
77 77
                                         $post_data[$key.$field_def['name']][$i] = base64_encode(serialize($post_data[$key.$field_def['name']][$i]));
78 78
                                     default:
79 79
                                         $post_data[$key.$field_def['name']][$i] = encodeMultienumValue($post_data[$key.$field_def['name']][$i]);
80 80
                                 }
81
-                        } else if($field_def['name'] == 'value' && $post_data[$key.'value_type'][$i] === 'Value') {
81
+                        } else if ($field_def['name'] == 'value' && $post_data[$key.'value_type'][$i] === 'Value') {
82 82
                             $post_data[$key.$field_def['name']][$i] = fixUpFormatting($_REQUEST['report_module'], $condition->field, $post_data[$key.$field_def['name']][$i]);
83
-                        }else if($field_def['name'] == 'parameter'){
83
+                        } else if ($field_def['name'] == 'parameter') {
84 84
                             $post_data[$key.$field_def['name']][$i] = isset($post_data[$key.$field_def['name']][$i]);
85
-                        }else if($field_def['name'] == 'module_path'){
86
-                            $post_data[$key.$field_def['name']][$i] = base64_encode(serialize(explode(":",$post_data[$key.$field_def['name']][$i])));
85
+                        } else if ($field_def['name'] == 'module_path') {
86
+                            $post_data[$key.$field_def['name']][$i] = base64_encode(serialize(explode(":", $post_data[$key.$field_def['name']][$i])));
87 87
                         }
88
-                        if($field_def['name'] == 'parenthesis' && $post_data[$key.$field_def['name']][$i] == 'END') {
89
-                            if(!isset($lastParenthesisStartConditionId)) {
88
+                        if ($field_def['name'] == 'parenthesis' && $post_data[$key.$field_def['name']][$i] == 'END') {
89
+                            if (!isset($lastParenthesisStartConditionId)) {
90 90
                                 throw new Exception('a closure parenthesis has no starter pair');
91 91
                             }
92 92
                             $condition->parenthesis = $lastParenthesisStartConditionId;
93 93
                         }
94 94
                         else {
95
-                            $condition->$field_def['name'] = $post_data[$key . $field_def['name']][$i];
95
+                            $condition->$field_def['name'] = $post_data[$key.$field_def['name']][$i];
96 96
                         }
97
-                    }else if($field_def['name'] == 'parameter'){
97
+                    } else if ($field_def['name'] == 'parameter') {
98 98
                         $condition->$field_def['name'] = 0;
99 99
                     }
100 100
 
101 101
                 }
102 102
                 // Period must be saved as a string instead of a base64 encoded datetime.
103 103
                 // Overwriting value
104
-                if((!isset($condition->parenthesis) || !$condition->parenthesis) && isset($condition->value_type) && $condition->value_type == 'Period') {
104
+                if ((!isset($condition->parenthesis) || !$condition->parenthesis) && isset($condition->value_type) && $condition->value_type == 'Period') {
105 105
                     $condition->value = base64_encode($_POST['aor_conditions_value'][$i]);
106 106
 //                    $condition->value = $_POST['aor_conditions_value'][$i];
107 107
                 }
108
-                if(trim($condition->field) != '' || $condition->parenthesis){
109
-                    if(isset($_POST['aor_conditions_order'][$i])) {
110
-                        $condition->condition_order = (int) $_POST['aor_conditions_order'][$i];
108
+                if (trim($condition->field) != '' || $condition->parenthesis) {
109
+                    if (isset($_POST['aor_conditions_order'][$i])) {
110
+                        $condition->condition_order = (int)$_POST['aor_conditions_order'][$i];
111 111
                     }
112 112
                     else {
113 113
                         $condition->condition_order = ++$j;
114 114
                     }
115 115
                     $condition->aor_report_id = $parent->id;
116 116
                     $conditionId = $condition->save();
117
-                    if($condition->parenthesis=='START') {
117
+                    if ($condition->parenthesis == 'START') {
118 118
                         $lastParenthesisStartConditionId = $conditionId;
119 119
                     }
120 120
                 }
Please login to merge, or discard this patch.
modules/AOR_Conditions/conditionLines.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -23,19 +23,19 @@  discard block
 block discarded – undo
23 23
  */
24 24
 
25 25
 
26
-function display_condition_lines($focus, $field, $value, $view){
26
+function display_condition_lines($focus, $field, $value, $view) {
27 27
 
28 28
     global $locale, $app_list_strings, $mod_strings;
29 29
 
30 30
     $html = '';
31 31
 
32
-    if (!is_file('cache/jsLanguage/AOR_Conditions/' . $GLOBALS['current_language'] . '.js')) {
32
+    if (!is_file('cache/jsLanguage/AOR_Conditions/'.$GLOBALS['current_language'].'.js')) {
33 33
         require_once ('include/language/jsLanguage.php');
34 34
         jsLanguage::createModuleStringsCache('AOR_Conditions', $GLOBALS['current_language']);
35 35
     }
36
-    $html .= '<script src="cache/jsLanguage/AOR_Conditions/'. $GLOBALS['current_language'] . '.js"></script>';
36
+    $html .= '<script src="cache/jsLanguage/AOR_Conditions/'.$GLOBALS['current_language'].'.js"></script>';
37 37
 
38
-    if($view == 'EditView'){
38
+    if ($view == 'EditView') {
39 39
 
40 40
         $html .= '<script src="modules/AOR_Conditions/conditionLines.js"></script>';
41 41
         $html .= "<table border='0' cellspacing='4' width='100%' id='conditionLines'></table>";
@@ -45,12 +45,12 @@  discard block
 block discarded – undo
45 45
         $html .= "</div>";
46 46
 
47 47
 
48
-        if(isset($focus->report_module) && $focus->report_module != ''){
48
+        if (isset($focus->report_module) && $focus->report_module != '') {
49 49
             require_once("modules/AOW_WorkFlow/aow_utils.php");
50 50
             $html .= "<script>";
51 51
             $html .= "report_module = \"".$focus->report_module."\";";
52 52
             $html .= "document.getElementById('btn_ConditionLine').disabled = '';";
53
-            if($focus->id != ''){
53
+            if ($focus->id != '') {
54 54
                 $sql = "SELECT id FROM aor_conditions WHERE aor_report_id = '".$focus->id."' AND deleted = 0 ORDER BY condition_order ASC";
55 55
                 $result = $focus->db->query($sql);
56 56
 
@@ -58,8 +58,8 @@  discard block
 block discarded – undo
58 58
                     $condition_name = new AOR_Condition();
59 59
                     $condition_name->retrieve($row['id']);
60 60
                     $condition_name->module_path = unserialize(base64_decode($condition_name->module_path));
61
-                    $html .= "report_fields = \"".trim(preg_replace('/\s+/', ' ', getModuleFields(getRelatedModule($focus->report_module,$condition_name->module_path[0]))))."\";";
62
-                    if($condition_name->value_type == 'Date'){
61
+                    $html .= "report_fields = \"".trim(preg_replace('/\s+/', ' ', getModuleFields(getRelatedModule($focus->report_module, $condition_name->module_path[0]))))."\";";
62
+                    if ($condition_name->value_type == 'Date') {
63 63
                         $condition_name->value = unserialize(base64_decode($condition_name->value));
64 64
                     }
65 65
                     $condition_item = json_encode($condition_name->toArray());
@@ -71,12 +71,12 @@  discard block
 block discarded – undo
71 71
         }
72 72
 
73 73
     }
74
-    else if($view == 'DetailView'){
74
+    else if ($view == 'DetailView') {
75 75
         $html .= '<script src="modules/AOR_Conditions/conditionLines.js"></script>';
76 76
         $html .= "<table border='0' cellspacing='0' width='100%' id='conditionLines'></table>";
77 77
 
78 78
 
79
-        if(isset($focus->report_module) && $focus->report_module != ''){
79
+        if (isset($focus->report_module) && $focus->report_module != '') {
80 80
             require_once("modules/AOW_WorkFlow/aow_utils.php");
81 81
             $html .= "<script>";
82 82
             $html .= "report_fields = \"".trim(preg_replace('/\s+/', ' ', getModuleFields($focus->report_module)))."\";";
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
                 $condition_name = new AOR_Condition();
89 89
                 $condition_name->retrieve($row['id']);
90 90
                 $condition_name->module_path = unserialize(base64_decode($condition_name->module_path));
91
-                if($condition_name->value_type == 'Date'){
91
+                if ($condition_name->value_type == 'Date') {
92 92
                     $condition_name->value = unserialize(base64_decode($condition_name->value));
93 93
                 }
94 94
                 $condition_item = json_encode($condition_name->toArray());
Please login to merge, or discard this patch.
modules/EmailTemplates/field_arrays.php 1 patch
Spacing   +3 added lines, -3 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.
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
  * All Rights Reserved.
46 46
  * Contributor(s): ______________________________________..
47 47
  ********************************************************************************/
48
-$fields_array['EmailTemplate'] = array ('column_fields' => Array("id"
48
+$fields_array['EmailTemplate'] = array('column_fields' => Array("id"
49 49
 		, "date_entered"
50 50
 		, "date_modified"
51 51
 		, "modified_user_id"
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 		, "name"
58 58
 		, "published"
59 59
 		),
60
-        'list_fields' =>  Array('id', 'name', 'description','date_modified'
60
+        'list_fields' =>  Array('id', 'name', 'description', 'date_modified'
61 61
 	),
62 62
     'required_fields' => array("name"=>1),
63 63
 );
Please login to merge, or discard this patch.
modules/EmailTemplates/PopupDocumentsCampaignTemplate.php 1 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.
@@ -73,8 +73,8 @@  discard block
 block discarded – undo
73 73
 
74 74
 
75 75
 $hide_clear_button = empty($_REQUEST['hide_clear_button']) ? false : true;
76
-$button  = "<form action='index.php' method='post' name='form' id='form'>\n";
77
-if(!$hide_clear_button)
76
+$button = "<form action='index.php' method='post' name='form' id='form'>\n";
77
+if (!$hide_clear_button)
78 78
 {
79 79
 	$button .= "<input type='button' name='button' class='button' onclick=\"send_back('','');\" title='"
80 80
 		.$app_strings['LBL_CLEAR_BUTTON_TITLE']."' value='  "
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 $form->assign('MODULE_NAME', $currentModule);
95 95
 $form->assign('NAME', $name);
96 96
 $form->assign('DOCUMENT_NAME', $document_name);
97
-if(isset($_REQUEST['target'])) $form->assign('DOCUMENT_TARGET', $_REQUEST['target']);
97
+if (isset($_REQUEST['target'])) $form->assign('DOCUMENT_TARGET', $_REQUEST['target']);
98 98
 else $form->assign('DOCUMENT_TARGET', '');
99 99
 
100 100
 $form->assign('DOCUMENT_REVISION_ID', $document_revision_id);
Please login to merge, or discard this patch.
modules/EmailTemplates/EmailTemplateFormBase.php 1 patch
Spacing   +45 added lines, -45 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.
@@ -54,14 +54,14 @@  discard block
 block discarded – undo
54 54
 
55 55
     }
56 56
 
57
-	function getFormBody($prefix, $mod='',$formname='', $size='30') {
57
+	function getFormBody($prefix, $mod = '', $formname = '', $size = '30') {
58 58
 
59 59
 
60 60
 		global $mod_strings;
61 61
 
62 62
 		$temp_strings = $mod_strings;
63 63
 
64
-		if(!empty($mod)) {
64
+		if (!empty($mod)) {
65 65
 			global $current_language;
66 66
 			$mod_strings = return_module_language($current_language, $mod);
67 67
 		}
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 				$lbl_required_symbol = $app_strings['LBL_REQUIRED_SYMBOL'];
72 72
 				$lbl_subject = $mod_strings['LBL_NOTE_SUBJECT'];
73 73
 				$lbl_description = $mod_strings['LBL_NOTE'];
74
-				$default_parent_type= $app_list_strings['record_type_default_key'];
74
+				$default_parent_type = $app_list_strings['record_type_default_key'];
75 75
 
76 76
 $form = <<<EOF
77 77
 				<input type="hidden" name="${prefix}record" value="">
@@ -97,16 +97,16 @@  discard block
 block discarded – undo
97 97
 	$javascript->setFormName($formname);
98 98
 	$javascript->setSugarBean(new EmailTemplate());
99 99
 	$javascript->addRequiredFields($prefix);
100
-	$form .=$javascript->getScript();
100
+	$form .= $javascript->getScript();
101 101
 	$mod_strings = $temp_strings;
102 102
 	return $form;
103 103
 	}
104 104
 
105
-	function getForm($prefix, $mod='') {
106
-		if(!empty($mod)) {
105
+	function getForm($prefix, $mod = '') {
106
+		if (!empty($mod)) {
107 107
 		global $current_language;
108 108
 		$mod_strings = return_module_language($current_language, $mod);
109
-	}else global $mod_strings;
109
+	} else global $mod_strings;
110 110
 		global $app_strings;
111 111
 		global $app_list_strings;
112 112
 
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 	}
138 138
 
139 139
 
140
-	function handleSave($prefix,$redirect=true, $useRequired=false)
140
+	function handleSave($prefix, $redirect = true, $useRequired = false)
141 141
 	{
142 142
 		require_once('include/formbase.php');
143 143
 		require_once('include/upload_file.php');
@@ -146,30 +146,30 @@  discard block
 block discarded – undo
146 146
 		global $sugar_config;
147 147
 
148 148
 		$focus = new EmailTemplate();
149
-		if($useRequired && !checkRequired($prefix, array_keys($focus->required_fields))) {
149
+		if ($useRequired && !checkRequired($prefix, array_keys($focus->required_fields))) {
150 150
 			return null;
151 151
 		}
152 152
 		$focus = populateFromPost($prefix, $focus);
153 153
         //process the text only flag
154
-        if(isset($_POST['text_only']) && ($_POST['text_only'] == '1')){
154
+        if (isset($_POST['text_only']) && ($_POST['text_only'] == '1')) {
155 155
             $focus->text_only = 1;
156
-        }else{
156
+        } else {
157 157
             $focus->text_only = 0;
158 158
         }
159
-		if(!$focus->ACLAccess('Save')) {
159
+		if (!$focus->ACLAccess('Save')) {
160 160
 			ACLController::displayNoAccess(true);
161 161
 			sugar_cleanup(true);
162 162
 		}
163
-		if(!isset($_REQUEST['published'])) $focus->published = 'off';
163
+		if (!isset($_REQUEST['published'])) $focus->published = 'off';
164 164
 
165 165
 		$preProcessedImages = array();
166 166
 		$emailTemplateBodyHtml = from_html($focus->body_html);
167
-		if(strpos($emailTemplateBodyHtml, '"cache/images/')) {
167
+		if (strpos($emailTemplateBodyHtml, '"cache/images/')) {
168 168
 			$matches = array();
169 169
 			preg_match_all('#<img[^>]*[\s]+src[^=]*=[\s]*["\']cache/images/(.+?)["\']#si', $emailTemplateBodyHtml, $matches);
170
-			foreach($matches[1] as $match) {
170
+			foreach ($matches[1] as $match) {
171 171
 				$filename = urldecode($match);
172
-                if($filename != pathinfo($filename, PATHINFO_BASENAME)) {
172
+                if ($filename != pathinfo($filename, PATHINFO_BASENAME)) {
173 173
                     // don't allow paths there
174 174
                     $emailTemplateBodyHtml = str_replace("cache/images/$match", "", $emailTemplateBodyHtml);
175 175
                     continue;
@@ -177,10 +177,10 @@  discard block
 block discarded – undo
177 177
 				$file_location = sugar_cached("images/{$filename}");
178 178
 				$mime_type = pathinfo($filename, PATHINFO_EXTENSION);
179 179
 
180
-				if(file_exists($file_location)) {
180
+				if (file_exists($file_location)) {
181 181
 					$id = create_guid();
182 182
 					$newFileLocation = "upload://$id";
183
-					if(!copy($file_location, $newFileLocation)) {
183
+					if (!copy($file_location, $newFileLocation)) {
184 184
 						$GLOBALS['log']->debug("EMAIL Template could not copy attachment to $newFileLocation");
185 185
 					} else {
186 186
 						$secureLink = "index.php?entryPoint=download&type=Notes&id={$id}";
@@ -207,20 +207,20 @@  discard block
 block discarded – undo
207 207
 
208 208
 		$max_files_upload = count($_FILES);
209 209
 
210
-		if(!empty($focus->id)) {
210
+		if (!empty($focus->id)) {
211 211
 			$note = new Note();
212 212
 			$where = "notes.parent_id='{$focus->id}'";
213
-			if(!empty($_REQUEST['old_id'])) { // to support duplication of email templates
213
+			if (!empty($_REQUEST['old_id'])) { // to support duplication of email templates
214 214
 				$where .= " OR notes.parent_id='".htmlspecialchars($_REQUEST['old_id'], ENT_QUOTES)."'";
215 215
 			}
216 216
 			$notes_list = $note->get_full_list("", $where, true);
217 217
 		}
218 218
 
219
-		if(!isset($notes_list)) {
219
+		if (!isset($notes_list)) {
220 220
 			$notes_list = array();
221 221
 		}
222 222
 
223
-		if(!is_array($focus->attachments)) { // PHP5 does not auto-create arrays(). Need to initialize it here.
223
+		if (!is_array($focus->attachments)) { // PHP5 does not auto-create arrays(). Need to initialize it here.
224 224
 			$focus->attachments = array();
225 225
 		}
226 226
 		$focus->attachments = array_merge($focus->attachments, $notes_list);
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 			$note = new Note();
235 235
 
236 236
 			//Images are presaved above so we need to prevent duplicate files from being created.
237
-			if( isset($preProcessedImages[$file['name']]) )
237
+			if (isset($preProcessedImages[$file['name']]))
238 238
 			{
239 239
 			    $oldId = $preProcessedImages[$file['name']];
240 240
 			    $note->id = $oldId;
@@ -242,19 +242,19 @@  discard block
 block discarded – undo
242 242
 			    $GLOBALS['log']->debug("Image {$file['name']} has already been processed.");
243 243
             }
244 244
 
245
-			$i=preg_replace("/email_attachment(.+)/",'$1',$key);
245
+			$i = preg_replace("/email_attachment(.+)/", '$1', $key);
246 246
 			$upload_file = new UploadFile($key);
247 247
 
248
-			if(isset($_FILES[$key]) && $upload_file->confirm_upload() && preg_match("/^email_attachment/",$key)) {
248
+			if (isset($_FILES[$key]) && $upload_file->confirm_upload() && preg_match("/^email_attachment/", $key)) {
249 249
 				$note->filename = $upload_file->get_stored_file_name();
250 250
 				$note->file = $upload_file;
251 251
 				$note->name = $mod_strings['LBL_EMAIL_ATTACHMENT'].': '.$note->file->original_file_name;
252
-				if(isset($_REQUEST['embedded'.$i]) && !empty($_REQUEST['embedded'.$i])){
253
-                  if($_REQUEST['embedded'.$i]=='true'){
254
-				  	$note->embed_flag =true;
252
+				if (isset($_REQUEST['embedded'.$i]) && !empty($_REQUEST['embedded'.$i])) {
253
+                  if ($_REQUEST['embedded'.$i] == 'true') {
254
+				  	$note->embed_flag = true;
255 255
                   }
256
-                  else{
257
-                  	$note->embed_flag =false;
256
+                  else {
257
+                  	$note->embed_flag = false;
258 258
                   }
259 259
 				}
260 260
 				array_push($focus->attachments, $note);
@@ -263,11 +263,11 @@  discard block
 block discarded – undo
263 263
 		}
264 264
 
265 265
 		$focus->saved_attachments = array();
266
-		foreach($focus->attachments as $note)
266
+		foreach ($focus->attachments as $note)
267 267
 		{
268
-			if( !empty($note->id) && $note->new_with_id === FALSE)
268
+			if (!empty($note->id) && $note->new_with_id === FALSE)
269 269
 			{
270
-				if(empty($_REQUEST['old_id']))
270
+				if (empty($_REQUEST['old_id']))
271 271
 					array_push($focus->saved_attachments, $note); // to support duplication of email templates
272 272
 				else
273 273
 				{
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
 			array_push($focus->saved_attachments, $note);
304 304
 			$note->id = $note_id;
305 305
 
306
-			if($note->new_with_id === FALSE)
306
+			if ($note->new_with_id === FALSE)
307 307
     			$note->file->final_move($note->id);
308 308
     	    else
309 309
     	       $GLOBALS['log']->debug("Not performing final move for note id {$note->id} as it has already been processed");
@@ -314,18 +314,18 @@  discard block
 block discarded – undo
314 314
 
315 315
 	///////////////////////////////////////////////////////////////////////////
316 316
 	////	ATTACHMENTS FROM DOCUMENTS
317
-	$count='';
317
+	$count = '';
318 318
 	//_pp($_REQUEST);
319 319
 	//_ppd(count($_REQUEST['document']));
320
-	if(!empty($_REQUEST['document'])){
320
+	if (!empty($_REQUEST['document'])) {
321 321
       $count = count($_REQUEST['document']);
322 322
     }
323
-    else{
324
-    	$count=10;
323
+    else {
324
+    	$count = 10;
325 325
     }
326 326
 
327
-	for($i=0; $i<$count; $i++) {
328
-		if(isset($_REQUEST['documentId'.$i]) && !empty($_REQUEST['documentId'.$i])) {
327
+	for ($i = 0; $i < $count; $i++) {
328
+		if (isset($_REQUEST['documentId'.$i]) && !empty($_REQUEST['documentId'.$i])) {
329 329
 			$doc = new Document();
330 330
 			$docRev = new DocumentRevision();
331 331
 			$docNote = new Note();
@@ -354,8 +354,8 @@  discard block
 block discarded – undo
354 354
 		///////////////////////////////////////////////////////////////////////////
355 355
 		////	REMOVE ATTACHMENTS
356 356
 
357
-		if(isset($_REQUEST['remove_attachment']) && !empty($_REQUEST['remove_attachment'])) {
358
-			foreach($_REQUEST['remove_attachment'] as $noteId) {
357
+		if (isset($_REQUEST['remove_attachment']) && !empty($_REQUEST['remove_attachment'])) {
358
+			foreach ($_REQUEST['remove_attachment'] as $noteId) {
359 359
 				$q = 'UPDATE notes SET deleted = 1 WHERE id = \''.$noteId.'\'';
360 360
 				$focus->db->query($q);
361 361
 			}
@@ -369,10 +369,10 @@  discard block
 block discarded – undo
369 369
 
370 370
         clear_register_value('select_array', $focus->object_name);
371 371
 
372
-		if($redirect) {
372
+		if ($redirect) {
373 373
 		$GLOBALS['log']->debug("Saved record with id of ".$return_id);
374 374
 			handleRedirect($return_id, "EmailTemplates");
375
-		}else{
375
+		} else {
376 376
 			return $focus;
377 377
 		}
378 378
 	}
Please login to merge, or discard this patch.
modules/EmailTemplates/AttachFiles.php 1 patch
Spacing   +6 added lines, -6 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,17 +55,17 @@  discard block
 block discarded – undo
55 55
 
56 56
 $ret = array();
57 57
 
58
-foreach($_FILES as $k => $file) {
59
-	if(in_array(strtolower($_FILES[$k]['type']), $imgType) && $_FILES[$k]['size'] > 0) {
58
+foreach ($_FILES as $k => $file) {
59
+	if (in_array(strtolower($_FILES[$k]['type']), $imgType) && $_FILES[$k]['size'] > 0) {
60 60
 	    $upload_file = new UploadFile($k);
61 61
 		// check the file
62
-		if($upload_file->confirm_upload()) {
62
+		if ($upload_file->confirm_upload()) {
63 63
 		    $dest = $cachedir.basename($upload_file->get_stored_file_name()); // target name
64 64
 		    $guid = create_guid();
65
-		    if($upload_file->final_move($guid)) { // move to uploads
65
+		    if ($upload_file->final_move($guid)) { // move to uploads
66 66
 		        $path = $upload_file->get_upload_path($guid);
67 67
 		        // if file is OK, copy to cache
68
-		        if(verify_uploaded_image($path) && copy($path, $dest)) {
68
+		        if (verify_uploaded_image($path) && copy($path, $dest)) {
69 69
 		            $ret[] = $dest;
70 70
 		        }
71 71
 		        // remove temp file
Please login to merge, or discard this patch.
modules/EmailTemplates/EditView.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -74,9 +74,9 @@  discard block
 block discarded – undo
74 74
 $GLOBALS['log']->info("EmailTemplate detail view");
75 75
 
76 76
 if ($has_campaign || $inboundEmail) {
77
-    $xtpl = new XTemplate ('modules/EmailTemplates/EditView.html');
77
+    $xtpl = new XTemplate('modules/EmailTemplates/EditView.html');
78 78
 } else {
79
-    $xtpl = new XTemplate ('modules/EmailTemplates/EditViewMain.html');
79
+    $xtpl = new XTemplate('modules/EmailTemplates/EditViewMain.html');
80 80
 } // else
81 81
 $xtpl->assign("MOD", $mod_strings);
82 82
 $xtpl->assign("APP", $app_strings);
@@ -128,13 +128,13 @@  discard block
 block discarded – undo
128 128
 require_once('include/QuickSearchDefaults.php');
129 129
 $qsd = QuickSearchDefaults::getQuickSearchDefaults();
130 130
 $sqs_objects = array('EditView_assigned_user_name' => $qsd->getQSUser());
131
-$quicksearch_js = '<script type="text/javascript" language="javascript">sqs_objects = ' . $json->encode($sqs_objects) . '; enableQS();</script>';
131
+$quicksearch_js = '<script type="text/javascript" language="javascript">sqs_objects = '.$json->encode($sqs_objects).'; enableQS();</script>';
132 132
 
133 133
 $xtpl->assign("CANCEL_SCRIPT", $cancel_script);
134
-$xtpl->assign("PRINT_URL", "index.php?" . $GLOBALS['request_string']);
135
-$xtpl->assign("JAVASCRIPT", get_set_focus_js() . $quicksearch_js);
134
+$xtpl->assign("PRINT_URL", "index.php?".$GLOBALS['request_string']);
135
+$xtpl->assign("JAVASCRIPT", get_set_focus_js().$quicksearch_js);
136 136
 
137
-if (!is_file(sugar_cached('jsLanguage/') . $GLOBALS['current_language'] . '.js')) {
137
+if (!is_file(sugar_cached('jsLanguage/').$GLOBALS['current_language'].'.js')) {
138 138
     require_once('include/language/jsLanguage.php');
139 139
     jsLanguage::createAppStringsCache($GLOBALS['current_language']);
140 140
 }
@@ -183,18 +183,18 @@  discard block
 block discarded – undo
183 183
         $record = $_REQUEST['record'];
184 184
     }
185 185
 
186
-    $xtpl->assign("ADMIN_EDIT", "<a href='index.php?action=index&module=DynamicLayout&from_action=" . $_REQUEST['action'] . "&from_module=" . $_REQUEST['module'] . "&record=" . $record . "'>" . SugarThemeRegistry::current()->getImage("EditLayout", "border='0' align='bottom'", null, null, '.gif', $mod_strings['LBL_EDIT_LAYOUT']) . "</a>");
186
+    $xtpl->assign("ADMIN_EDIT", "<a href='index.php?action=index&module=DynamicLayout&from_action=".$_REQUEST['action']."&from_module=".$_REQUEST['module']."&record=".$record."'>".SugarThemeRegistry::current()->getImage("EditLayout", "border='0' align='bottom'", null, null, '.gif', $mod_strings['LBL_EDIT_LAYOUT'])."</a>");
187 187
 
188 188
 }
189 189
 if (isset($focus->parent_type) && $focus->parent_type != "") {
190
-    $change_parent_button = "<input title='" . $app_strings['LBL_SELECT_BUTTON_TITLE'] . "'
191
-tabindex='3' type='button' class='button' value='" . $app_strings['LBL_SELECT_BUTTON_LABEL'] . "' name='button' LANGUAGE=javascript onclick='return
190
+    $change_parent_button = "<input title='".$app_strings['LBL_SELECT_BUTTON_TITLE']."'
191
+tabindex='3' type='button' class='button' value='" . $app_strings['LBL_SELECT_BUTTON_LABEL']."' name='button' LANGUAGE=javascript onclick='return
192 192
 window.open(\"index.php?module=\"+ document.EditView.parent_type.value +
193 193
 \"&action=Popup&html=Popup_picker&form=TasksEditView\",\"test\",\"width=600,height=400,resizable=1,scrollbars=1\");'>";
194 194
     $xtpl->assign("CHANGE_PARENT_BUTTON", $change_parent_button);
195 195
 }
196 196
 if ($focus->parent_type == "Account") {
197
-    $xtpl->assign("DEFAULT_SEARCH", "&query=true&account_id=$focus->parent_id&account_name=" . urlencode($focus->parent_name));
197
+    $xtpl->assign("DEFAULT_SEARCH", "&query=true&account_id=$focus->parent_id&account_name=".urlencode($focus->parent_name));
198 198
 }
199 199
 
200 200
 $xtpl->assign("DESCRIPTION", $focus->description);
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
     // If it's campaign then hide the Account.
252 252
     if ($has_campaign) {
253 253
         $dropdown = "<option value='Contacts'>
254
-						" . $lblContactAndOthers . "
254
+						" . $lblContactAndOthers."
255 255
 			       </option>";
256 256
         $xtpl->assign("DROPDOWN", $dropdown);
257 257
         $xtpl->assign("DEFAULT_MODULE", 'Contacts');
@@ -285,13 +285,13 @@  discard block
 block discarded – undo
285 285
             if (empty($the_note->filename)) {
286 286
                 continue;
287 287
             }
288
-            $secureLink = 'index.php?entryPoint=download&id=' . $the_note->id . '&type=Notes';
289
-            $attachments .= '<input type="checkbox" name="remove_attachment[]" value="' . $the_note->id . '"> ' . $app_strings['LNK_REMOVE'] . '&nbsp;&nbsp;';
290
-            $attachments .= '<a href="' . $secureLink . '" target="_blank">' . $the_note->filename . '</a><br>';
288
+            $secureLink = 'index.php?entryPoint=download&id='.$the_note->id.'&type=Notes';
289
+            $attachments .= '<input type="checkbox" name="remove_attachment[]" value="'.$the_note->id.'"> '.$app_strings['LNK_REMOVE'].'&nbsp;&nbsp;';
290
+            $attachments .= '<a href="'.$secureLink.'" target="_blank">'.$the_note->filename.'</a><br>';
291 291
         }
292 292
     }
293 293
     $attJs = '<script type="text/javascript">';
294
-    $attJs .= 'var lnk_remove = "' . $app_strings['LNK_REMOVE'] . '";';
294
+    $attJs .= 'var lnk_remove = "'.$app_strings['LNK_REMOVE'].'";';
295 295
     $attJs .= '</script>';
296 296
     $xtpl->assign('ATTACHMENTS', $attachments);
297 297
     $xtpl->assign('ATTACHMENTS_JAVASCRIPT', $attJs);
Please login to merge, or discard this patch.