@@ -44,126 +44,126 @@ discard block |
||
| 44 | 44 | * @api |
| 45 | 45 | */ |
| 46 | 46 | class SugarController{ |
| 47 | - /** |
|
| 48 | - * remap actions in here |
|
| 49 | - * e.g. make all detail views go to edit views |
|
| 50 | - * $action_remap = array('detailview'=>'editview'); |
|
| 51 | - */ |
|
| 52 | - protected $action_remap = array('index'=>'listview'); |
|
| 53 | - /** |
|
| 54 | - * The name of the current module. |
|
| 55 | - */ |
|
| 56 | - public $module = 'Home'; |
|
| 57 | - /** |
|
| 58 | - * The name of the target module. |
|
| 59 | - */ |
|
| 60 | - public $target_module = null; |
|
| 61 | - /** |
|
| 62 | - * The name of the current action. |
|
| 63 | - */ |
|
| 64 | - public $action = 'index'; |
|
| 65 | - /** |
|
| 66 | - * The id of the current record. |
|
| 67 | - */ |
|
| 68 | - public $record = ''; |
|
| 69 | - /** |
|
| 70 | - * The name of the return module. |
|
| 71 | - */ |
|
| 72 | - public $return_module = null; |
|
| 73 | - /** |
|
| 74 | - * The name of the return action. |
|
| 75 | - */ |
|
| 76 | - public $return_action = null; |
|
| 77 | - /** |
|
| 78 | - * The id of the return record. |
|
| 79 | - */ |
|
| 80 | - public $return_id = null; |
|
| 81 | - /** |
|
| 82 | - * If the action was remapped it will be set to do_action and then we will just |
|
| 83 | - * use do_action for the actual action to perform. |
|
| 84 | - */ |
|
| 85 | - protected $do_action = 'index'; |
|
| 86 | - /** |
|
| 87 | - * If a bean is present that set it. |
|
| 88 | - */ |
|
| 89 | - public $bean = null; |
|
| 90 | - /** |
|
| 91 | - * url to redirect to |
|
| 92 | - */ |
|
| 93 | - public $redirect_url = ''; |
|
| 94 | - /** |
|
| 95 | - * any subcontroller can modify this to change the view |
|
| 96 | - */ |
|
| 97 | - public $view = 'classic'; |
|
| 98 | - /** |
|
| 99 | - * this array will hold the mappings between a key and an object for use within the view. |
|
| 100 | - */ |
|
| 101 | - public $view_object_map = array(); |
|
| 47 | + /** |
|
| 48 | + * remap actions in here |
|
| 49 | + * e.g. make all detail views go to edit views |
|
| 50 | + * $action_remap = array('detailview'=>'editview'); |
|
| 51 | + */ |
|
| 52 | + protected $action_remap = array('index'=>'listview'); |
|
| 53 | + /** |
|
| 54 | + * The name of the current module. |
|
| 55 | + */ |
|
| 56 | + public $module = 'Home'; |
|
| 57 | + /** |
|
| 58 | + * The name of the target module. |
|
| 59 | + */ |
|
| 60 | + public $target_module = null; |
|
| 61 | + /** |
|
| 62 | + * The name of the current action. |
|
| 63 | + */ |
|
| 64 | + public $action = 'index'; |
|
| 65 | + /** |
|
| 66 | + * The id of the current record. |
|
| 67 | + */ |
|
| 68 | + public $record = ''; |
|
| 69 | + /** |
|
| 70 | + * The name of the return module. |
|
| 71 | + */ |
|
| 72 | + public $return_module = null; |
|
| 73 | + /** |
|
| 74 | + * The name of the return action. |
|
| 75 | + */ |
|
| 76 | + public $return_action = null; |
|
| 77 | + /** |
|
| 78 | + * The id of the return record. |
|
| 79 | + */ |
|
| 80 | + public $return_id = null; |
|
| 81 | + /** |
|
| 82 | + * If the action was remapped it will be set to do_action and then we will just |
|
| 83 | + * use do_action for the actual action to perform. |
|
| 84 | + */ |
|
| 85 | + protected $do_action = 'index'; |
|
| 86 | + /** |
|
| 87 | + * If a bean is present that set it. |
|
| 88 | + */ |
|
| 89 | + public $bean = null; |
|
| 90 | + /** |
|
| 91 | + * url to redirect to |
|
| 92 | + */ |
|
| 93 | + public $redirect_url = ''; |
|
| 94 | + /** |
|
| 95 | + * any subcontroller can modify this to change the view |
|
| 96 | + */ |
|
| 97 | + public $view = 'classic'; |
|
| 98 | + /** |
|
| 99 | + * this array will hold the mappings between a key and an object for use within the view. |
|
| 100 | + */ |
|
| 101 | + public $view_object_map = array(); |
|
| 102 | 102 | |
| 103 | - /** |
|
| 104 | - * This array holds the methods that handleAction() will invoke, in sequence. |
|
| 105 | - */ |
|
| 106 | - protected $tasks = array( |
|
| 107 | - 'pre_action', |
|
| 108 | - 'do_action', |
|
| 109 | - 'post_action' |
|
| 110 | - ); |
|
| 111 | - /** |
|
| 112 | - * List of options to run through within the process() method. |
|
| 113 | - * This list is meant to easily allow additions for new functionality as well as |
|
| 114 | - * the ability to add a controller's own handling. |
|
| 115 | - */ |
|
| 116 | - public $process_tasks = array( |
|
| 117 | - 'blockFileAccess', |
|
| 118 | - 'handleEntryPoint', |
|
| 119 | - 'callLegacyCode', |
|
| 120 | - 'remapAction', |
|
| 121 | - 'handle_action', |
|
| 122 | - 'handleActionMaps', |
|
| 123 | - ); |
|
| 124 | - /** |
|
| 125 | - * Whether or not the action has been handled by $process_tasks |
|
| 126 | - * |
|
| 127 | - * @var bool |
|
| 128 | - */ |
|
| 129 | - protected $_processed = false; |
|
| 130 | - /** |
|
| 131 | - * Map an action directly to a file |
|
| 132 | - */ |
|
| 133 | - /** |
|
| 134 | - * Map an action directly to a file. This will be loaded from action_file_map.php |
|
| 135 | - */ |
|
| 136 | - protected $action_file_map = array(); |
|
| 137 | - /** |
|
| 138 | - * Map an action directly to a view |
|
| 139 | - */ |
|
| 140 | - /** |
|
| 141 | - * Map an action directly to a view. This will be loaded from action_view_map.php |
|
| 142 | - */ |
|
| 143 | - protected $action_view_map = array(); |
|
| 103 | + /** |
|
| 104 | + * This array holds the methods that handleAction() will invoke, in sequence. |
|
| 105 | + */ |
|
| 106 | + protected $tasks = array( |
|
| 107 | + 'pre_action', |
|
| 108 | + 'do_action', |
|
| 109 | + 'post_action' |
|
| 110 | + ); |
|
| 111 | + /** |
|
| 112 | + * List of options to run through within the process() method. |
|
| 113 | + * This list is meant to easily allow additions for new functionality as well as |
|
| 114 | + * the ability to add a controller's own handling. |
|
| 115 | + */ |
|
| 116 | + public $process_tasks = array( |
|
| 117 | + 'blockFileAccess', |
|
| 118 | + 'handleEntryPoint', |
|
| 119 | + 'callLegacyCode', |
|
| 120 | + 'remapAction', |
|
| 121 | + 'handle_action', |
|
| 122 | + 'handleActionMaps', |
|
| 123 | + ); |
|
| 124 | + /** |
|
| 125 | + * Whether or not the action has been handled by $process_tasks |
|
| 126 | + * |
|
| 127 | + * @var bool |
|
| 128 | + */ |
|
| 129 | + protected $_processed = false; |
|
| 130 | + /** |
|
| 131 | + * Map an action directly to a file |
|
| 132 | + */ |
|
| 133 | + /** |
|
| 134 | + * Map an action directly to a file. This will be loaded from action_file_map.php |
|
| 135 | + */ |
|
| 136 | + protected $action_file_map = array(); |
|
| 137 | + /** |
|
| 138 | + * Map an action directly to a view |
|
| 139 | + */ |
|
| 140 | + /** |
|
| 141 | + * Map an action directly to a view. This will be loaded from action_view_map.php |
|
| 142 | + */ |
|
| 143 | + protected $action_view_map = array(); |
|
| 144 | 144 | |
| 145 | - /** |
|
| 146 | - * This can be set from the application to tell us whether we have authorization to |
|
| 147 | - * process the action. If this is set we will default to the noaccess view. |
|
| 148 | - */ |
|
| 149 | - public $hasAccess = true; |
|
| 145 | + /** |
|
| 146 | + * This can be set from the application to tell us whether we have authorization to |
|
| 147 | + * process the action. If this is set we will default to the noaccess view. |
|
| 148 | + */ |
|
| 149 | + public $hasAccess = true; |
|
| 150 | 150 | |
| 151 | - /** |
|
| 152 | - * Map case sensitive filenames to action. This is used for linux/unix systems |
|
| 153 | - * where filenames are case sensitive |
|
| 154 | - */ |
|
| 155 | - public static $action_case_file = array( |
|
| 156 | - 'editview'=>'EditView', |
|
| 157 | - 'detailview'=>'DetailView', |
|
| 158 | - 'listview'=>'ListView' |
|
| 159 | - ); |
|
| 160 | - |
|
| 161 | - /** |
|
| 162 | - * Constructor. This ie meant tot load up the module, action, record as well |
|
| 163 | - * as the mapping arrays. |
|
| 164 | - */ |
|
| 165 | - public function __construct(){ |
|
| 166 | - } |
|
| 151 | + /** |
|
| 152 | + * Map case sensitive filenames to action. This is used for linux/unix systems |
|
| 153 | + * where filenames are case sensitive |
|
| 154 | + */ |
|
| 155 | + public static $action_case_file = array( |
|
| 156 | + 'editview'=>'EditView', |
|
| 157 | + 'detailview'=>'DetailView', |
|
| 158 | + 'listview'=>'ListView' |
|
| 159 | + ); |
|
| 160 | + |
|
| 161 | + /** |
|
| 162 | + * Constructor. This ie meant tot load up the module, action, record as well |
|
| 163 | + * as the mapping arrays. |
|
| 164 | + */ |
|
| 165 | + public function __construct(){ |
|
| 166 | + } |
|
| 167 | 167 | |
| 168 | 168 | /** |
| 169 | 169 | * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead |
@@ -180,126 +180,126 @@ discard block |
||
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | |
| 183 | - /** |
|
| 184 | - * Called from SugarApplication and is meant to perform the setup operations |
|
| 185 | - * on the controller. |
|
| 186 | - * |
|
| 187 | - */ |
|
| 188 | - public function setup($module = ''){ |
|
| 189 | - if(empty($module) && !empty($_REQUEST['module'])) |
|
| 190 | - $module = $_REQUEST['module']; |
|
| 191 | - //set the module |
|
| 192 | - if(!empty($module)) |
|
| 193 | - $this->setModule($module); |
|
| 194 | - |
|
| 195 | - if(!empty($_REQUEST['target_module']) && $_REQUEST['target_module'] != 'undefined') { |
|
| 196 | - $this->target_module = $_REQUEST['target_module']; |
|
| 197 | - } |
|
| 198 | - //set properties on the controller from the $_REQUEST |
|
| 199 | - $this->loadPropertiesFromRequest(); |
|
| 200 | - //load the mapping files |
|
| 201 | - $this->loadMappings(); |
|
| 202 | - } |
|
| 203 | - /** |
|
| 204 | - * Set the module on the Controller |
|
| 205 | - * |
|
| 206 | - * @param object $module |
|
| 207 | - */ |
|
| 208 | - public function setModule($module){ |
|
| 209 | - $this->module = $module; |
|
| 210 | - } |
|
| 183 | + /** |
|
| 184 | + * Called from SugarApplication and is meant to perform the setup operations |
|
| 185 | + * on the controller. |
|
| 186 | + * |
|
| 187 | + */ |
|
| 188 | + public function setup($module = ''){ |
|
| 189 | + if(empty($module) && !empty($_REQUEST['module'])) |
|
| 190 | + $module = $_REQUEST['module']; |
|
| 191 | + //set the module |
|
| 192 | + if(!empty($module)) |
|
| 193 | + $this->setModule($module); |
|
| 194 | + |
|
| 195 | + if(!empty($_REQUEST['target_module']) && $_REQUEST['target_module'] != 'undefined') { |
|
| 196 | + $this->target_module = $_REQUEST['target_module']; |
|
| 197 | + } |
|
| 198 | + //set properties on the controller from the $_REQUEST |
|
| 199 | + $this->loadPropertiesFromRequest(); |
|
| 200 | + //load the mapping files |
|
| 201 | + $this->loadMappings(); |
|
| 202 | + } |
|
| 203 | + /** |
|
| 204 | + * Set the module on the Controller |
|
| 205 | + * |
|
| 206 | + * @param object $module |
|
| 207 | + */ |
|
| 208 | + public function setModule($module){ |
|
| 209 | + $this->module = $module; |
|
| 210 | + } |
|
| 211 | 211 | |
| 212 | - /** |
|
| 213 | - * Set properties on the Controller from the $_REQUEST |
|
| 214 | - * |
|
| 215 | - */ |
|
| 216 | - private function loadPropertiesFromRequest(){ |
|
| 217 | - if(!empty($_REQUEST['action'])) |
|
| 218 | - $this->action = $_REQUEST['action']; |
|
| 219 | - if(!empty($_REQUEST['record'])) |
|
| 220 | - $this->record = $_REQUEST['record']; |
|
| 221 | - if(!empty($_REQUEST['view'])) |
|
| 222 | - $this->view = $_REQUEST['view']; |
|
| 223 | - if(!empty($_REQUEST['return_module'])) |
|
| 224 | - $this->return_module = $_REQUEST['return_module']; |
|
| 225 | - if(!empty($_REQUEST['return_action'])) |
|
| 226 | - $this->return_action = $_REQUEST['return_action']; |
|
| 227 | - if(!empty($_REQUEST['return_id'])) |
|
| 228 | - $this->return_id = $_REQUEST['return_id']; |
|
| 229 | - } |
|
| 212 | + /** |
|
| 213 | + * Set properties on the Controller from the $_REQUEST |
|
| 214 | + * |
|
| 215 | + */ |
|
| 216 | + private function loadPropertiesFromRequest(){ |
|
| 217 | + if(!empty($_REQUEST['action'])) |
|
| 218 | + $this->action = $_REQUEST['action']; |
|
| 219 | + if(!empty($_REQUEST['record'])) |
|
| 220 | + $this->record = $_REQUEST['record']; |
|
| 221 | + if(!empty($_REQUEST['view'])) |
|
| 222 | + $this->view = $_REQUEST['view']; |
|
| 223 | + if(!empty($_REQUEST['return_module'])) |
|
| 224 | + $this->return_module = $_REQUEST['return_module']; |
|
| 225 | + if(!empty($_REQUEST['return_action'])) |
|
| 226 | + $this->return_action = $_REQUEST['return_action']; |
|
| 227 | + if(!empty($_REQUEST['return_id'])) |
|
| 228 | + $this->return_id = $_REQUEST['return_id']; |
|
| 229 | + } |
|
| 230 | 230 | |
| 231 | - /** |
|
| 232 | - * Load map files for use within the Controller |
|
| 233 | - * |
|
| 234 | - */ |
|
| 235 | - private function loadMappings(){ |
|
| 236 | - $this->loadMapping('action_view_map'); |
|
| 237 | - $this->loadMapping('action_file_map'); |
|
| 238 | - $this->loadMapping('action_remap', true); |
|
| 239 | - } |
|
| 231 | + /** |
|
| 232 | + * Load map files for use within the Controller |
|
| 233 | + * |
|
| 234 | + */ |
|
| 235 | + private function loadMappings(){ |
|
| 236 | + $this->loadMapping('action_view_map'); |
|
| 237 | + $this->loadMapping('action_file_map'); |
|
| 238 | + $this->loadMapping('action_remap', true); |
|
| 239 | + } |
|
| 240 | 240 | |
| 241 | - /** |
|
| 242 | - * Given a record id load the bean. This bean is accessible from any sub controllers. |
|
| 243 | - */ |
|
| 244 | - public function loadBean() |
|
| 245 | - { |
|
| 246 | - if(!empty($GLOBALS['beanList'][$this->module])){ |
|
| 247 | - $class = $GLOBALS['beanList'][$this->module]; |
|
| 248 | - if(!empty($GLOBALS['beanFiles'][$class])){ |
|
| 249 | - require_once($GLOBALS['beanFiles'][$class]); |
|
| 250 | - $this->bean = new $class(); |
|
| 251 | - if(!empty($this->record)){ |
|
| 252 | - $this->bean->retrieve($this->record); |
|
| 253 | - if($this->bean) |
|
| 254 | - $GLOBALS['FOCUS'] = $this->bean; |
|
| 255 | - } |
|
| 256 | - } |
|
| 257 | - } |
|
| 258 | - } |
|
| 241 | + /** |
|
| 242 | + * Given a record id load the bean. This bean is accessible from any sub controllers. |
|
| 243 | + */ |
|
| 244 | + public function loadBean() |
|
| 245 | + { |
|
| 246 | + if(!empty($GLOBALS['beanList'][$this->module])){ |
|
| 247 | + $class = $GLOBALS['beanList'][$this->module]; |
|
| 248 | + if(!empty($GLOBALS['beanFiles'][$class])){ |
|
| 249 | + require_once($GLOBALS['beanFiles'][$class]); |
|
| 250 | + $this->bean = new $class(); |
|
| 251 | + if(!empty($this->record)){ |
|
| 252 | + $this->bean->retrieve($this->record); |
|
| 253 | + if($this->bean) |
|
| 254 | + $GLOBALS['FOCUS'] = $this->bean; |
|
| 255 | + } |
|
| 256 | + } |
|
| 257 | + } |
|
| 258 | + } |
|
| 259 | 259 | |
| 260 | - /** |
|
| 261 | - * Generic load method to load mapping arrays. |
|
| 262 | - */ |
|
| 263 | - private function loadMapping($var, $merge = false){ |
|
| 264 | - $$var = sugar_cache_retrieve("CONTROLLER_". $var . "_".$this->module); |
|
| 265 | - if(!$$var){ |
|
| 266 | - if($merge && !empty($this->$var)){ |
|
| 267 | - $$var = $this->$var; |
|
| 268 | - }else{ |
|
| 269 | - $$var = array(); |
|
| 270 | - } |
|
| 271 | - if(file_exists('include/MVC/Controller/'. $var . '.php')){ |
|
| 272 | - require('include/MVC/Controller/'. $var . '.php'); |
|
| 273 | - } |
|
| 274 | - if(file_exists('modules/'.$this->module.'/'. $var . '.php')){ |
|
| 275 | - require('modules/'.$this->module.'/'. $var . '.php'); |
|
| 276 | - } |
|
| 277 | - if(file_exists('custom/modules/'.$this->module.'/'. $var . '.php')){ |
|
| 278 | - require('custom/modules/'.$this->module.'/'. $var . '.php'); |
|
| 279 | - } |
|
| 280 | - if(file_exists('custom/include/MVC/Controller/'. $var . '.php')){ |
|
| 281 | - require('custom/include/MVC/Controller/'. $var . '.php'); |
|
| 282 | - } |
|
| 260 | + /** |
|
| 261 | + * Generic load method to load mapping arrays. |
|
| 262 | + */ |
|
| 263 | + private function loadMapping($var, $merge = false){ |
|
| 264 | + $$var = sugar_cache_retrieve("CONTROLLER_". $var . "_".$this->module); |
|
| 265 | + if(!$$var){ |
|
| 266 | + if($merge && !empty($this->$var)){ |
|
| 267 | + $$var = $this->$var; |
|
| 268 | + }else{ |
|
| 269 | + $$var = array(); |
|
| 270 | + } |
|
| 271 | + if(file_exists('include/MVC/Controller/'. $var . '.php')){ |
|
| 272 | + require('include/MVC/Controller/'. $var . '.php'); |
|
| 273 | + } |
|
| 274 | + if(file_exists('modules/'.$this->module.'/'. $var . '.php')){ |
|
| 275 | + require('modules/'.$this->module.'/'. $var . '.php'); |
|
| 276 | + } |
|
| 277 | + if(file_exists('custom/modules/'.$this->module.'/'. $var . '.php')){ |
|
| 278 | + require('custom/modules/'.$this->module.'/'. $var . '.php'); |
|
| 279 | + } |
|
| 280 | + if(file_exists('custom/include/MVC/Controller/'. $var . '.php')){ |
|
| 281 | + require('custom/include/MVC/Controller/'. $var . '.php'); |
|
| 282 | + } |
|
| 283 | 283 | |
| 284 | 284 | // entry_point_registry -> EntryPointRegistry |
| 285 | 285 | |
| 286 | - $varname = str_replace(" ","",ucwords(str_replace("_"," ", $var))); |
|
| 286 | + $varname = str_replace(" ","",ucwords(str_replace("_"," ", $var))); |
|
| 287 | 287 | if(file_exists("custom/application/Ext/$varname/$var.ext.php")){ |
| 288 | - require("custom/application/Ext/$varname/$var.ext.php"); |
|
| 289 | - } |
|
| 290 | - if(file_exists("custom/modules/{$this->module}/Ext/$varname/$var.ext.php")){ |
|
| 291 | - require("custom/modules/{$this->module}/Ext/$varname/$var.ext.php"); |
|
| 292 | - } |
|
| 293 | - |
|
| 294 | - sugar_cache_put("CONTROLLER_". $var . "_".$this->module, $$var); |
|
| 295 | - } |
|
| 296 | - $this->$var = $$var; |
|
| 297 | - } |
|
| 288 | + require("custom/application/Ext/$varname/$var.ext.php"); |
|
| 289 | + } |
|
| 290 | + if(file_exists("custom/modules/{$this->module}/Ext/$varname/$var.ext.php")){ |
|
| 291 | + require("custom/modules/{$this->module}/Ext/$varname/$var.ext.php"); |
|
| 292 | + } |
|
| 298 | 293 | |
| 299 | - /** |
|
| 300 | - * This method is called from SugarApplication->execute and it will bootstrap the entire controller process |
|
| 301 | - */ |
|
| 302 | - final public function execute() |
|
| 294 | + sugar_cache_put("CONTROLLER_". $var . "_".$this->module, $$var); |
|
| 295 | + } |
|
| 296 | + $this->$var = $$var; |
|
| 297 | + } |
|
| 298 | + |
|
| 299 | + /** |
|
| 300 | + * This method is called from SugarApplication->execute and it will bootstrap the entire controller process |
|
| 301 | + */ |
|
| 302 | + final public function execute() |
|
| 303 | 303 | { |
| 304 | 304 | |
| 305 | 305 | try |
@@ -311,7 +311,7 @@ discard block |
||
| 311 | 311 | } |
| 312 | 312 | elseif(!empty($this->redirect_url)) |
| 313 | 313 | { |
| 314 | - $this->redirect(); |
|
| 314 | + $this->redirect(); |
|
| 315 | 315 | } |
| 316 | 316 | } |
| 317 | 317 | catch (Exception $e) |
@@ -321,12 +321,12 @@ discard block |
||
| 321 | 321 | |
| 322 | 322 | |
| 323 | 323 | |
| 324 | - } |
|
| 324 | + } |
|
| 325 | 325 | |
| 326 | 326 | /** |
| 327 | - * Handle exception |
|
| 328 | - * @param Exception $e |
|
| 329 | - */ |
|
| 327 | + * Handle exception |
|
| 328 | + * @param Exception $e |
|
| 329 | + */ |
|
| 330 | 330 | protected function handleException(Exception $e) |
| 331 | 331 | { |
| 332 | 332 | $GLOBALS['log']->fatal('Exception in Controller: ' . $e->getMessage()); |
@@ -343,52 +343,52 @@ discard block |
||
| 343 | 343 | } |
| 344 | 344 | } |
| 345 | 345 | |
| 346 | - /** |
|
| 347 | - * Display the appropriate view. |
|
| 348 | - */ |
|
| 349 | - private function processView(){ |
|
| 350 | - if(!isset($this->view_object_map['remap_action']) && isset($this->action_view_map[strtolower($this->action)])) |
|
| 351 | - { |
|
| 352 | - $this->view_object_map['remap_action'] = $this->action_view_map[strtolower($this->action)]; |
|
| 353 | - } |
|
| 354 | - $view = ViewFactory::loadView($this->view, $this->module, $this->bean, $this->view_object_map, $this->target_module); |
|
| 355 | - $GLOBALS['current_view'] = $view; |
|
| 356 | - if(!empty($this->bean) && !$this->bean->ACLAccess($view->type) && $view->type != 'list'){ |
|
| 357 | - ACLController::displayNoAccess(true); |
|
| 358 | - sugar_cleanup(true); |
|
| 359 | - } |
|
| 360 | - if(isset($this->errors)){ |
|
| 361 | - $view->errors = $this->errors; |
|
| 362 | - } |
|
| 363 | - $view->process(); |
|
| 364 | - } |
|
| 346 | + /** |
|
| 347 | + * Display the appropriate view. |
|
| 348 | + */ |
|
| 349 | + private function processView(){ |
|
| 350 | + if(!isset($this->view_object_map['remap_action']) && isset($this->action_view_map[strtolower($this->action)])) |
|
| 351 | + { |
|
| 352 | + $this->view_object_map['remap_action'] = $this->action_view_map[strtolower($this->action)]; |
|
| 353 | + } |
|
| 354 | + $view = ViewFactory::loadView($this->view, $this->module, $this->bean, $this->view_object_map, $this->target_module); |
|
| 355 | + $GLOBALS['current_view'] = $view; |
|
| 356 | + if(!empty($this->bean) && !$this->bean->ACLAccess($view->type) && $view->type != 'list'){ |
|
| 357 | + ACLController::displayNoAccess(true); |
|
| 358 | + sugar_cleanup(true); |
|
| 359 | + } |
|
| 360 | + if(isset($this->errors)){ |
|
| 361 | + $view->errors = $this->errors; |
|
| 362 | + } |
|
| 363 | + $view->process(); |
|
| 364 | + } |
|
| 365 | 365 | |
| 366 | - /** |
|
| 367 | - * Meant to be overridden by a subclass and allows for specific functionality to be |
|
| 368 | - * injected prior to the process() method being called. |
|
| 369 | - */ |
|
| 370 | - public function preProcess() |
|
| 371 | - {} |
|
| 372 | - |
|
| 373 | - /** |
|
| 374 | - * if we have a function to support the action use it otherwise use the default action |
|
| 375 | - * |
|
| 376 | - * 1) check for file |
|
| 377 | - * 2) check for action |
|
| 378 | - */ |
|
| 379 | - public function process(){ |
|
| 380 | - $GLOBALS['action'] = $this->action; |
|
| 381 | - $GLOBALS['module'] = $this->module; |
|
| 366 | + /** |
|
| 367 | + * Meant to be overridden by a subclass and allows for specific functionality to be |
|
| 368 | + * injected prior to the process() method being called. |
|
| 369 | + */ |
|
| 370 | + public function preProcess() |
|
| 371 | + {} |
|
| 372 | + |
|
| 373 | + /** |
|
| 374 | + * if we have a function to support the action use it otherwise use the default action |
|
| 375 | + * |
|
| 376 | + * 1) check for file |
|
| 377 | + * 2) check for action |
|
| 378 | + */ |
|
| 379 | + public function process(){ |
|
| 380 | + $GLOBALS['action'] = $this->action; |
|
| 381 | + $GLOBALS['module'] = $this->module; |
|
| 382 | 382 | |
| 383 | - //check to ensure we have access to the module. |
|
| 384 | - if($this->hasAccess){ |
|
| 385 | - $this->do_action = $this->action; |
|
| 383 | + //check to ensure we have access to the module. |
|
| 384 | + if($this->hasAccess){ |
|
| 385 | + $this->do_action = $this->action; |
|
| 386 | 386 | |
| 387 | - $file = self::getActionFilename($this->do_action); |
|
| 387 | + $file = self::getActionFilename($this->do_action); |
|
| 388 | 388 | |
| 389 | - $this->loadBean(); |
|
| 389 | + $this->loadBean(); |
|
| 390 | 390 | |
| 391 | - $processed = false; |
|
| 391 | + $processed = false; |
|
| 392 | 392 | if (!$this->_processed) { |
| 393 | 393 | foreach ($this->process_tasks as $process) { |
| 394 | 394 | $this->$process(); |
@@ -398,172 +398,172 @@ discard block |
||
| 398 | 398 | } |
| 399 | 399 | } |
| 400 | 400 | |
| 401 | - $this->redirect(); |
|
| 402 | - }else{ |
|
| 403 | - $this->no_access(); |
|
| 404 | - } |
|
| 405 | - } |
|
| 401 | + $this->redirect(); |
|
| 402 | + }else{ |
|
| 403 | + $this->no_access(); |
|
| 404 | + } |
|
| 405 | + } |
|
| 406 | 406 | |
| 407 | - /** |
|
| 408 | - * This method is called from the process method. I could also be called within an action_* method. |
|
| 409 | - * It allows a developer to override any one of these methods contained within, |
|
| 410 | - * or if the developer so chooses they can override the entire action_* method. |
|
| 411 | - * |
|
| 412 | - * @return true if any one of the pre_, do_, or post_ methods have been defined, |
|
| 413 | - * false otherwise. This is important b/c if none of these methods exists, then we will run the |
|
| 414 | - * action_default() method. |
|
| 415 | - */ |
|
| 416 | - protected function handle_action(){ |
|
| 417 | - $processed = false; |
|
| 418 | - foreach($this->tasks as $task){ |
|
| 419 | - $processed = ($this->$task() || $processed); |
|
| 420 | - } |
|
| 421 | - $this->_processed = $processed; |
|
| 422 | - } |
|
| 407 | + /** |
|
| 408 | + * This method is called from the process method. I could also be called within an action_* method. |
|
| 409 | + * It allows a developer to override any one of these methods contained within, |
|
| 410 | + * or if the developer so chooses they can override the entire action_* method. |
|
| 411 | + * |
|
| 412 | + * @return true if any one of the pre_, do_, or post_ methods have been defined, |
|
| 413 | + * false otherwise. This is important b/c if none of these methods exists, then we will run the |
|
| 414 | + * action_default() method. |
|
| 415 | + */ |
|
| 416 | + protected function handle_action(){ |
|
| 417 | + $processed = false; |
|
| 418 | + foreach($this->tasks as $task){ |
|
| 419 | + $processed = ($this->$task() || $processed); |
|
| 420 | + } |
|
| 421 | + $this->_processed = $processed; |
|
| 422 | + } |
|
| 423 | 423 | |
| 424 | - /** |
|
| 425 | - * Perform an action prior to the specified action. |
|
| 426 | - * This can be overridde in a sub-class |
|
| 427 | - */ |
|
| 428 | - private function pre_action(){ |
|
| 429 | - $function = 'pre_' . $this->action; |
|
| 430 | - if($this->hasFunction($function)){ |
|
| 431 | - $GLOBALS['log']->debug('Performing pre_action'); |
|
| 432 | - $this->$function(); |
|
| 433 | - return true; |
|
| 434 | - } |
|
| 435 | - return false; |
|
| 436 | - } |
|
| 424 | + /** |
|
| 425 | + * Perform an action prior to the specified action. |
|
| 426 | + * This can be overridde in a sub-class |
|
| 427 | + */ |
|
| 428 | + private function pre_action(){ |
|
| 429 | + $function = 'pre_' . $this->action; |
|
| 430 | + if($this->hasFunction($function)){ |
|
| 431 | + $GLOBALS['log']->debug('Performing pre_action'); |
|
| 432 | + $this->$function(); |
|
| 433 | + return true; |
|
| 434 | + } |
|
| 435 | + return false; |
|
| 436 | + } |
|
| 437 | 437 | |
| 438 | - /** |
|
| 439 | - * Perform the specified action. |
|
| 440 | - * This can be overridde in a sub-class |
|
| 441 | - */ |
|
| 442 | - private function do_action(){ |
|
| 443 | - $function = 'action_'. strtolower($this->do_action); |
|
| 444 | - if($this->hasFunction($function)){ |
|
| 445 | - $GLOBALS['log']->debug('Performing action: '.$function.' MODULE: '.$this->module); |
|
| 446 | - $this->$function(); |
|
| 447 | - return true; |
|
| 448 | - } |
|
| 449 | - return false; |
|
| 450 | - } |
|
| 438 | + /** |
|
| 439 | + * Perform the specified action. |
|
| 440 | + * This can be overridde in a sub-class |
|
| 441 | + */ |
|
| 442 | + private function do_action(){ |
|
| 443 | + $function = 'action_'. strtolower($this->do_action); |
|
| 444 | + if($this->hasFunction($function)){ |
|
| 445 | + $GLOBALS['log']->debug('Performing action: '.$function.' MODULE: '.$this->module); |
|
| 446 | + $this->$function(); |
|
| 447 | + return true; |
|
| 448 | + } |
|
| 449 | + return false; |
|
| 450 | + } |
|
| 451 | 451 | |
| 452 | - /** |
|
| 453 | - * Perform an action after to the specified action has occurred. |
|
| 454 | - * This can be overridde in a sub-class |
|
| 455 | - */ |
|
| 456 | - private function post_action(){ |
|
| 457 | - $function = 'post_' . $this->action; |
|
| 458 | - if($this->hasFunction($function)){ |
|
| 459 | - $GLOBALS['log']->debug('Performing post_action'); |
|
| 460 | - $this->$function(); |
|
| 461 | - return true; |
|
| 462 | - } |
|
| 463 | - return false; |
|
| 464 | - } |
|
| 452 | + /** |
|
| 453 | + * Perform an action after to the specified action has occurred. |
|
| 454 | + * This can be overridde in a sub-class |
|
| 455 | + */ |
|
| 456 | + private function post_action(){ |
|
| 457 | + $function = 'post_' . $this->action; |
|
| 458 | + if($this->hasFunction($function)){ |
|
| 459 | + $GLOBALS['log']->debug('Performing post_action'); |
|
| 460 | + $this->$function(); |
|
| 461 | + return true; |
|
| 462 | + } |
|
| 463 | + return false; |
|
| 464 | + } |
|
| 465 | 465 | |
| 466 | - /** |
|
| 467 | - * If there is no action found then display an error to the user. |
|
| 468 | - */ |
|
| 469 | - protected function no_action(){ |
|
| 470 | - sugar_die($GLOBALS['app_strings']['LBL_NO_ACTION']); |
|
| 471 | - } |
|
| 466 | + /** |
|
| 467 | + * If there is no action found then display an error to the user. |
|
| 468 | + */ |
|
| 469 | + protected function no_action(){ |
|
| 470 | + sugar_die($GLOBALS['app_strings']['LBL_NO_ACTION']); |
|
| 471 | + } |
|
| 472 | 472 | |
| 473 | - /** |
|
| 474 | - * The default action handler for instances where we do not have access to process. |
|
| 475 | - */ |
|
| 476 | - protected function no_access(){ |
|
| 477 | - $this->view = 'noaccess'; |
|
| 478 | - } |
|
| 473 | + /** |
|
| 474 | + * The default action handler for instances where we do not have access to process. |
|
| 475 | + */ |
|
| 476 | + protected function no_access(){ |
|
| 477 | + $this->view = 'noaccess'; |
|
| 478 | + } |
|
| 479 | 479 | |
| 480 | - /////////////////////////////////////////////// |
|
| 481 | - /////// HELPER FUNCTIONS |
|
| 482 | - /////////////////////////////////////////////// |
|
| 480 | + /////////////////////////////////////////////// |
|
| 481 | + /////// HELPER FUNCTIONS |
|
| 482 | + /////////////////////////////////////////////// |
|
| 483 | 483 | |
| 484 | - /** |
|
| 485 | - * Determine if a given function exists on the objects |
|
| 486 | - * @param function - the function to check |
|
| 487 | - * @return true if the method exists on the object, false otherwise |
|
| 488 | - */ |
|
| 489 | - protected function hasFunction($function){ |
|
| 490 | - return method_exists($this, $function); |
|
| 491 | - } |
|
| 484 | + /** |
|
| 485 | + * Determine if a given function exists on the objects |
|
| 486 | + * @param function - the function to check |
|
| 487 | + * @return true if the method exists on the object, false otherwise |
|
| 488 | + */ |
|
| 489 | + protected function hasFunction($function){ |
|
| 490 | + return method_exists($this, $function); |
|
| 491 | + } |
|
| 492 | 492 | |
| 493 | 493 | |
| 494 | - /** |
|
| 495 | - * Set the url to which we will want to redirect |
|
| 496 | - * |
|
| 497 | - * @param string url - the url to which we will want to redirect |
|
| 498 | - */ |
|
| 499 | - protected function set_redirect($url){ |
|
| 500 | - $this->redirect_url = $url; |
|
| 501 | - } |
|
| 494 | + /** |
|
| 495 | + * Set the url to which we will want to redirect |
|
| 496 | + * |
|
| 497 | + * @param string url - the url to which we will want to redirect |
|
| 498 | + */ |
|
| 499 | + protected function set_redirect($url){ |
|
| 500 | + $this->redirect_url = $url; |
|
| 501 | + } |
|
| 502 | 502 | |
| 503 | - /** |
|
| 504 | - * Perform redirection based on the redirect_url |
|
| 505 | - * |
|
| 506 | - */ |
|
| 507 | - protected function redirect(){ |
|
| 503 | + /** |
|
| 504 | + * Perform redirection based on the redirect_url |
|
| 505 | + * |
|
| 506 | + */ |
|
| 507 | + protected function redirect(){ |
|
| 508 | 508 | |
| 509 | - if(!empty($this->redirect_url)) |
|
| 510 | - SugarApplication::redirect($this->redirect_url); |
|
| 511 | - } |
|
| 509 | + if(!empty($this->redirect_url)) |
|
| 510 | + SugarApplication::redirect($this->redirect_url); |
|
| 511 | + } |
|
| 512 | 512 | |
| 513 | - //////////////////////////////////////////////////////// |
|
| 514 | - ////// DEFAULT ACTIONS |
|
| 515 | - /////////////////////////////////////////////////////// |
|
| 513 | + //////////////////////////////////////////////////////// |
|
| 514 | + ////// DEFAULT ACTIONS |
|
| 515 | + /////////////////////////////////////////////////////// |
|
| 516 | 516 | |
| 517 | - /* |
|
| 517 | + /* |
|
| 518 | 518 | * Save a bean |
| 519 | 519 | */ |
| 520 | 520 | |
| 521 | - /** |
|
| 522 | - * Do some processing before saving the bean to the database. |
|
| 523 | - */ |
|
| 524 | - public function pre_save(){ |
|
| 525 | - if(!empty($_POST['assigned_user_id']) && $_POST['assigned_user_id'] != $this->bean->assigned_user_id && $_POST['assigned_user_id'] != $GLOBALS['current_user']->id && empty($GLOBALS['sugar_config']['exclude_notifications'][$this->bean->module_dir])){ |
|
| 526 | - $this->bean->notify_on_save = true; |
|
| 527 | - } |
|
| 528 | - $GLOBALS['log']->debug("SugarController:: performing pre_save."); |
|
| 521 | + /** |
|
| 522 | + * Do some processing before saving the bean to the database. |
|
| 523 | + */ |
|
| 524 | + public function pre_save(){ |
|
| 525 | + if(!empty($_POST['assigned_user_id']) && $_POST['assigned_user_id'] != $this->bean->assigned_user_id && $_POST['assigned_user_id'] != $GLOBALS['current_user']->id && empty($GLOBALS['sugar_config']['exclude_notifications'][$this->bean->module_dir])){ |
|
| 526 | + $this->bean->notify_on_save = true; |
|
| 527 | + } |
|
| 528 | + $GLOBALS['log']->debug("SugarController:: performing pre_save."); |
|
| 529 | 529 | require_once('include/SugarFields/SugarFieldHandler.php'); |
| 530 | 530 | $sfh = new SugarFieldHandler(); |
| 531 | - foreach($this->bean->field_defs as $field => $properties) { |
|
| 532 | - $type = !empty($properties['custom_type']) ? $properties['custom_type'] : $properties['type']; |
|
| 533 | - $sf = $sfh->getSugarField(ucfirst($type), true); |
|
| 534 | - if(isset($_POST[$field])) { |
|
| 535 | - if(is_array($_POST[$field]) && !empty($properties['isMultiSelect'])) { |
|
| 536 | - if(empty($_POST[$field][0])) { |
|
| 537 | - unset($_POST[$field][0]); |
|
| 538 | - } |
|
| 539 | - $_POST[$field] = encodeMultienumValue($_POST[$field]); |
|
| 540 | - } |
|
| 541 | - $this->bean->$field = $_POST[$field]; |
|
| 542 | - } else if(!empty($properties['isMultiSelect']) && !isset($_POST[$field]) && isset($_POST[$field . '_multiselect'])) { |
|
| 543 | - $this->bean->$field = ''; |
|
| 544 | - } |
|
| 531 | + foreach($this->bean->field_defs as $field => $properties) { |
|
| 532 | + $type = !empty($properties['custom_type']) ? $properties['custom_type'] : $properties['type']; |
|
| 533 | + $sf = $sfh->getSugarField(ucfirst($type), true); |
|
| 534 | + if(isset($_POST[$field])) { |
|
| 535 | + if(is_array($_POST[$field]) && !empty($properties['isMultiSelect'])) { |
|
| 536 | + if(empty($_POST[$field][0])) { |
|
| 537 | + unset($_POST[$field][0]); |
|
| 538 | + } |
|
| 539 | + $_POST[$field] = encodeMultienumValue($_POST[$field]); |
|
| 540 | + } |
|
| 541 | + $this->bean->$field = $_POST[$field]; |
|
| 542 | + } else if(!empty($properties['isMultiSelect']) && !isset($_POST[$field]) && isset($_POST[$field . '_multiselect'])) { |
|
| 543 | + $this->bean->$field = ''; |
|
| 544 | + } |
|
| 545 | 545 | if($sf != null){ |
| 546 | 546 | $sf->save($this->bean, $_POST, $field, $properties); |
| 547 | 547 | } |
| 548 | - } |
|
| 549 | - |
|
| 550 | - foreach($this->bean->relationship_fields as $field=>$link){ |
|
| 551 | - if(!empty($_POST[$field])){ |
|
| 552 | - $this->bean->$field = $_POST[$field]; |
|
| 553 | - } |
|
| 554 | - } |
|
| 555 | - if(!$this->bean->ACLAccess('save')){ |
|
| 556 | - ACLController::displayNoAccess(true); |
|
| 557 | - sugar_cleanup(true); |
|
| 558 | - } |
|
| 559 | - } |
|
| 548 | + } |
|
| 560 | 549 | |
| 561 | - /** |
|
| 562 | - * Perform the actual save |
|
| 563 | - */ |
|
| 564 | - public function action_save(){ |
|
| 565 | - $this->bean->save(!empty($this->bean->notify_on_save)); |
|
| 566 | - } |
|
| 550 | + foreach($this->bean->relationship_fields as $field=>$link){ |
|
| 551 | + if(!empty($_POST[$field])){ |
|
| 552 | + $this->bean->$field = $_POST[$field]; |
|
| 553 | + } |
|
| 554 | + } |
|
| 555 | + if(!$this->bean->ACLAccess('save')){ |
|
| 556 | + ACLController::displayNoAccess(true); |
|
| 557 | + sugar_cleanup(true); |
|
| 558 | + } |
|
| 559 | + } |
|
| 560 | + |
|
| 561 | + /** |
|
| 562 | + * Perform the actual save |
|
| 563 | + */ |
|
| 564 | + public function action_save(){ |
|
| 565 | + $this->bean->save(!empty($this->bean->notify_on_save)); |
|
| 566 | + } |
|
| 567 | 567 | |
| 568 | 568 | |
| 569 | 569 | public function action_spot() |
@@ -572,43 +572,43 @@ discard block |
||
| 572 | 572 | } |
| 573 | 573 | |
| 574 | 574 | |
| 575 | - /** |
|
| 576 | - * Specify what happens after the save has occurred. |
|
| 577 | - */ |
|
| 578 | - protected function post_save(){ |
|
| 579 | - $module = (!empty($this->return_module) ? $this->return_module : $this->module); |
|
| 580 | - $action = (!empty($this->return_action) ? $this->return_action : 'DetailView'); |
|
| 581 | - $id = (!empty($this->return_id) ? $this->return_id : $this->bean->id); |
|
| 575 | + /** |
|
| 576 | + * Specify what happens after the save has occurred. |
|
| 577 | + */ |
|
| 578 | + protected function post_save(){ |
|
| 579 | + $module = (!empty($this->return_module) ? $this->return_module : $this->module); |
|
| 580 | + $action = (!empty($this->return_action) ? $this->return_action : 'DetailView'); |
|
| 581 | + $id = (!empty($this->return_id) ? $this->return_id : $this->bean->id); |
|
| 582 | 582 | |
| 583 | - $url = "index.php?module=".$module."&action=".$action."&record=".$id; |
|
| 584 | - $this->set_redirect($url); |
|
| 585 | - } |
|
| 583 | + $url = "index.php?module=".$module."&action=".$action."&record=".$id; |
|
| 584 | + $this->set_redirect($url); |
|
| 585 | + } |
|
| 586 | 586 | |
| 587 | - /* |
|
| 587 | + /* |
|
| 588 | 588 | * Delete a bean |
| 589 | 589 | */ |
| 590 | 590 | |
| 591 | - /** |
|
| 592 | - * Perform the actual deletion. |
|
| 593 | - */ |
|
| 594 | - protected function action_delete(){ |
|
| 595 | - //do any pre delete processing |
|
| 596 | - //if there is some custom logic for deletion. |
|
| 597 | - if(!empty($_REQUEST['record'])){ |
|
| 598 | - if(!$this->bean->ACLAccess('Delete')){ |
|
| 599 | - ACLController::displayNoAccess(true); |
|
| 600 | - sugar_cleanup(true); |
|
| 601 | - } |
|
| 602 | - $this->bean->mark_deleted($_REQUEST['record']); |
|
| 603 | - }else{ |
|
| 604 | - sugar_die("A record number must be specified to delete"); |
|
| 605 | - } |
|
| 606 | - } |
|
| 591 | + /** |
|
| 592 | + * Perform the actual deletion. |
|
| 593 | + */ |
|
| 594 | + protected function action_delete(){ |
|
| 595 | + //do any pre delete processing |
|
| 596 | + //if there is some custom logic for deletion. |
|
| 597 | + if(!empty($_REQUEST['record'])){ |
|
| 598 | + if(!$this->bean->ACLAccess('Delete')){ |
|
| 599 | + ACLController::displayNoAccess(true); |
|
| 600 | + sugar_cleanup(true); |
|
| 601 | + } |
|
| 602 | + $this->bean->mark_deleted($_REQUEST['record']); |
|
| 603 | + }else{ |
|
| 604 | + sugar_die("A record number must be specified to delete"); |
|
| 605 | + } |
|
| 606 | + } |
|
| 607 | 607 | |
| 608 | - /** |
|
| 609 | - * Specify what happens after the deletion has occurred. |
|
| 610 | - */ |
|
| 611 | - protected function post_delete(){ |
|
| 608 | + /** |
|
| 609 | + * Specify what happens after the deletion has occurred. |
|
| 610 | + */ |
|
| 611 | + protected function post_delete(){ |
|
| 612 | 612 | if (empty($_REQUEST['return_url'])) { |
| 613 | 613 | $return_module = isset($_REQUEST['return_module']) ? |
| 614 | 614 | $_REQUEST['return_module'] : |
@@ -624,23 +624,23 @@ discard block |
||
| 624 | 624 | $url = $_REQUEST['return_url']; |
| 625 | 625 | } |
| 626 | 626 | |
| 627 | - //eggsurplus Bug 23816: maintain VCR after an edit/save. If it is a duplicate then don't worry about it. The offset is now worthless. |
|
| 628 | - if(isset($_REQUEST['offset']) && empty($_REQUEST['duplicateSave'])) { |
|
| 629 | - $url .= "&offset=".$_REQUEST['offset']; |
|
| 630 | - } |
|
| 627 | + //eggsurplus Bug 23816: maintain VCR after an edit/save. If it is a duplicate then don't worry about it. The offset is now worthless. |
|
| 628 | + if(isset($_REQUEST['offset']) && empty($_REQUEST['duplicateSave'])) { |
|
| 629 | + $url .= "&offset=".$_REQUEST['offset']; |
|
| 630 | + } |
|
| 631 | 631 | |
| 632 | - $this->set_redirect($url); |
|
| 633 | - } |
|
| 634 | - /** |
|
| 635 | - * Perform the actual massupdate. |
|
| 636 | - */ |
|
| 637 | - protected function action_massupdate(){ |
|
| 638 | - if(!empty($_REQUEST['massupdate']) && $_REQUEST['massupdate'] == 'true' && (!empty($_REQUEST['uid']) || !empty($_REQUEST['entire']))){ |
|
| 639 | - if(!empty($_REQUEST['Delete']) && $_REQUEST['Delete']=='true' && !$this->bean->ACLAccess('delete') |
|
| 632 | + $this->set_redirect($url); |
|
| 633 | + } |
|
| 634 | + /** |
|
| 635 | + * Perform the actual massupdate. |
|
| 636 | + */ |
|
| 637 | + protected function action_massupdate(){ |
|
| 638 | + if(!empty($_REQUEST['massupdate']) && $_REQUEST['massupdate'] == 'true' && (!empty($_REQUEST['uid']) || !empty($_REQUEST['entire']))){ |
|
| 639 | + if(!empty($_REQUEST['Delete']) && $_REQUEST['Delete']=='true' && !$this->bean->ACLAccess('delete') |
|
| 640 | 640 | || (empty($_REQUEST['Delete']) || $_REQUEST['Delete']!='true') && !$this->bean->ACLAccess('save')){ |
| 641 | - ACLController::displayNoAccess(true); |
|
| 642 | - sugar_cleanup(true); |
|
| 643 | - } |
|
| 641 | + ACLController::displayNoAccess(true); |
|
| 642 | + sugar_cleanup(true); |
|
| 643 | + } |
|
| 644 | 644 | |
| 645 | 645 | set_time_limit(0);//I'm wondering if we will set it never goes timeout here. |
| 646 | 646 | // until we have more efficient way of handling MU, we have to disable the limit |
@@ -666,35 +666,35 @@ discard block |
||
| 666 | 666 | unset($_REQUEST[$seed->module_dir.'2_'.strtoupper($seed->object_name).'_offset']);//after massupdate, the page should redirect to no offset page |
| 667 | 667 | $storeQuery->saveFromRequest($_REQUEST['module']); |
| 668 | 668 | $_REQUEST = array('return_module' => $temp_req['return_module'], 'return_action' => $temp_req['return_action']);//for post_massupdate, to go back to original page. |
| 669 | - }else{ |
|
| 670 | - sugar_die("You must massupdate at least one record"); |
|
| 671 | - } |
|
| 672 | - } |
|
| 673 | - /** |
|
| 674 | - * Specify what happens after the massupdate has occurred. |
|
| 675 | - */ |
|
| 676 | - protected function post_massupdate(){ |
|
| 677 | - $return_module = isset($_REQUEST['return_module']) ? |
|
| 678 | - $_REQUEST['return_module'] : |
|
| 679 | - $GLOBALS['sugar_config']['default_module']; |
|
| 680 | - $return_action = isset($_REQUEST['return_action']) ? |
|
| 681 | - $_REQUEST['return_action'] : |
|
| 682 | - $GLOBALS['sugar_config']['default_action']; |
|
| 683 | - $url = "index.php?module=".$return_module."&action=".$return_action; |
|
| 684 | - if($return_module == 'Emails'){//specificly for My Achieves |
|
| 685 | - if(!empty($this->req_for_email['type']) && !empty($this->req_for_email['ie_assigned_user_id'])) { |
|
| 686 | - $url = $url . "&type=".$this->req_for_email['type']."&assigned_user_id=".$this->req_for_email['ie_assigned_user_id']; |
|
| 687 | - } |
|
| 688 | - } |
|
| 689 | - $this->set_redirect($url); |
|
| 690 | - } |
|
| 691 | - /** |
|
| 692 | - * Perform the listview action |
|
| 693 | - */ |
|
| 694 | - protected function action_listview(){ |
|
| 695 | - $this->view_object_map['bean'] = $this->bean; |
|
| 696 | - $this->view = 'list'; |
|
| 697 | - } |
|
| 669 | + }else{ |
|
| 670 | + sugar_die("You must massupdate at least one record"); |
|
| 671 | + } |
|
| 672 | + } |
|
| 673 | + /** |
|
| 674 | + * Specify what happens after the massupdate has occurred. |
|
| 675 | + */ |
|
| 676 | + protected function post_massupdate(){ |
|
| 677 | + $return_module = isset($_REQUEST['return_module']) ? |
|
| 678 | + $_REQUEST['return_module'] : |
|
| 679 | + $GLOBALS['sugar_config']['default_module']; |
|
| 680 | + $return_action = isset($_REQUEST['return_action']) ? |
|
| 681 | + $_REQUEST['return_action'] : |
|
| 682 | + $GLOBALS['sugar_config']['default_action']; |
|
| 683 | + $url = "index.php?module=".$return_module."&action=".$return_action; |
|
| 684 | + if($return_module == 'Emails'){//specificly for My Achieves |
|
| 685 | + if(!empty($this->req_for_email['type']) && !empty($this->req_for_email['ie_assigned_user_id'])) { |
|
| 686 | + $url = $url . "&type=".$this->req_for_email['type']."&assigned_user_id=".$this->req_for_email['ie_assigned_user_id']; |
|
| 687 | + } |
|
| 688 | + } |
|
| 689 | + $this->set_redirect($url); |
|
| 690 | + } |
|
| 691 | + /** |
|
| 692 | + * Perform the listview action |
|
| 693 | + */ |
|
| 694 | + protected function action_listview(){ |
|
| 695 | + $this->view_object_map['bean'] = $this->bean; |
|
| 696 | + $this->view = 'list'; |
|
| 697 | + } |
|
| 698 | 698 | |
| 699 | 699 | /* |
| 700 | 700 | |
@@ -703,63 +703,63 @@ discard block |
||
| 703 | 703 | } |
| 704 | 704 | */ |
| 705 | 705 | |
| 706 | - /** |
|
| 707 | - * Action to handle when using a file as was done in previous versions of Sugar. |
|
| 708 | - */ |
|
| 709 | - protected function action_default(){ |
|
| 710 | - $this->view = 'classic'; |
|
| 711 | - } |
|
| 706 | + /** |
|
| 707 | + * Action to handle when using a file as was done in previous versions of Sugar. |
|
| 708 | + */ |
|
| 709 | + protected function action_default(){ |
|
| 710 | + $this->view = 'classic'; |
|
| 711 | + } |
|
| 712 | 712 | |
| 713 | - /** |
|
| 714 | - * this method id used within a Dashlet when performing an ajax call |
|
| 715 | - */ |
|
| 716 | - protected function action_callmethoddashlet(){ |
|
| 717 | - if(!empty($_REQUEST['id'])) { |
|
| 718 | - $id = $_REQUEST['id']; |
|
| 719 | - $requestedMethod = $_REQUEST['method']; |
|
| 720 | - $dashletDefs = $GLOBALS['current_user']->getPreference('dashlets', 'Home'); // load user's dashlets config |
|
| 721 | - if(!empty($dashletDefs[$id])) { |
|
| 722 | - require_once($dashletDefs[$id]['fileLocation']); |
|
| 723 | - |
|
| 724 | - $dashlet = new $dashletDefs[$id]['className']($id, (isset($dashletDefs[$id]['options']) ? $dashletDefs[$id]['options'] : array())); |
|
| 725 | - |
|
| 726 | - if(method_exists($dashlet, $requestedMethod) || method_exists($dashlet, '__call')) { |
|
| 727 | - echo $dashlet->$requestedMethod(); |
|
| 728 | - } |
|
| 729 | - else { |
|
| 730 | - echo 'no method'; |
|
| 731 | - } |
|
| 732 | - } |
|
| 733 | - } |
|
| 734 | - } |
|
| 713 | + /** |
|
| 714 | + * this method id used within a Dashlet when performing an ajax call |
|
| 715 | + */ |
|
| 716 | + protected function action_callmethoddashlet(){ |
|
| 717 | + if(!empty($_REQUEST['id'])) { |
|
| 718 | + $id = $_REQUEST['id']; |
|
| 719 | + $requestedMethod = $_REQUEST['method']; |
|
| 720 | + $dashletDefs = $GLOBALS['current_user']->getPreference('dashlets', 'Home'); // load user's dashlets config |
|
| 721 | + if(!empty($dashletDefs[$id])) { |
|
| 722 | + require_once($dashletDefs[$id]['fileLocation']); |
|
| 723 | + |
|
| 724 | + $dashlet = new $dashletDefs[$id]['className']($id, (isset($dashletDefs[$id]['options']) ? $dashletDefs[$id]['options'] : array())); |
|
| 725 | + |
|
| 726 | + if(method_exists($dashlet, $requestedMethod) || method_exists($dashlet, '__call')) { |
|
| 727 | + echo $dashlet->$requestedMethod(); |
|
| 728 | + } |
|
| 729 | + else { |
|
| 730 | + echo 'no method'; |
|
| 731 | + } |
|
| 732 | + } |
|
| 733 | + } |
|
| 734 | + } |
|
| 735 | 735 | |
| 736 | - /** |
|
| 737 | - * this method is used within a Dashlet when the options configuration is posted |
|
| 738 | - */ |
|
| 739 | - protected function action_configuredashlet(){ |
|
| 740 | - global $current_user, $mod_strings; |
|
| 741 | - |
|
| 742 | - if(!empty($_REQUEST['id'])) { |
|
| 743 | - $id = $_REQUEST['id']; |
|
| 744 | - $dashletDefs = $current_user->getPreference('dashlets', $_REQUEST['module']); // load user's dashlets config |
|
| 745 | - require_once($dashletDefs[$id]['fileLocation']); |
|
| 746 | - |
|
| 747 | - $dashlet = new $dashletDefs[$id]['className']($id, (isset($dashletDefs[$id]['options']) ? $dashletDefs[$id]['options'] : array())); |
|
| 748 | - if(!empty($_REQUEST['configure']) && $_REQUEST['configure']) { // save settings |
|
| 749 | - $dashletDefs[$id]['options'] = $dashlet->saveOptions($_REQUEST); |
|
| 750 | - $current_user->setPreference('dashlets', $dashletDefs, 0, $_REQUEST['module']); |
|
| 751 | - } |
|
| 752 | - else { // display options |
|
| 753 | - $json = getJSONobj(); |
|
| 754 | - return 'result = ' . $json->encode((array('header' => $dashlet->title . ' : ' . $mod_strings['LBL_OPTIONS'], |
|
| 755 | - 'body' => $dashlet->displayOptions()))); |
|
| 756 | - |
|
| 757 | - } |
|
| 758 | - } |
|
| 759 | - else { |
|
| 760 | - return '0'; |
|
| 761 | - } |
|
| 762 | - } |
|
| 736 | + /** |
|
| 737 | + * this method is used within a Dashlet when the options configuration is posted |
|
| 738 | + */ |
|
| 739 | + protected function action_configuredashlet(){ |
|
| 740 | + global $current_user, $mod_strings; |
|
| 741 | + |
|
| 742 | + if(!empty($_REQUEST['id'])) { |
|
| 743 | + $id = $_REQUEST['id']; |
|
| 744 | + $dashletDefs = $current_user->getPreference('dashlets', $_REQUEST['module']); // load user's dashlets config |
|
| 745 | + require_once($dashletDefs[$id]['fileLocation']); |
|
| 746 | + |
|
| 747 | + $dashlet = new $dashletDefs[$id]['className']($id, (isset($dashletDefs[$id]['options']) ? $dashletDefs[$id]['options'] : array())); |
|
| 748 | + if(!empty($_REQUEST['configure']) && $_REQUEST['configure']) { // save settings |
|
| 749 | + $dashletDefs[$id]['options'] = $dashlet->saveOptions($_REQUEST); |
|
| 750 | + $current_user->setPreference('dashlets', $dashletDefs, 0, $_REQUEST['module']); |
|
| 751 | + } |
|
| 752 | + else { // display options |
|
| 753 | + $json = getJSONobj(); |
|
| 754 | + return 'result = ' . $json->encode((array('header' => $dashlet->title . ' : ' . $mod_strings['LBL_OPTIONS'], |
|
| 755 | + 'body' => $dashlet->displayOptions()))); |
|
| 756 | + |
|
| 757 | + } |
|
| 758 | + } |
|
| 759 | + else { |
|
| 760 | + return '0'; |
|
| 761 | + } |
|
| 762 | + } |
|
| 763 | 763 | |
| 764 | 764 | /** |
| 765 | 765 | * Global method to delete an attachment |
@@ -789,84 +789,84 @@ discard block |
||
| 789 | 789 | sugar_cleanup(true); |
| 790 | 790 | } |
| 791 | 791 | |
| 792 | - /** |
|
| 793 | - * getActionFilename |
|
| 794 | - */ |
|
| 795 | - public static function getActionFilename($action) { |
|
| 796 | - if(isset(self::$action_case_file[$action])) { |
|
| 797 | - return self::$action_case_file[$action]; |
|
| 798 | - } |
|
| 799 | - return $action; |
|
| 800 | - } |
|
| 792 | + /** |
|
| 793 | + * getActionFilename |
|
| 794 | + */ |
|
| 795 | + public static function getActionFilename($action) { |
|
| 796 | + if(isset(self::$action_case_file[$action])) { |
|
| 797 | + return self::$action_case_file[$action]; |
|
| 798 | + } |
|
| 799 | + return $action; |
|
| 800 | + } |
|
| 801 | 801 | |
| 802 | - /********************************************************************/ |
|
| 803 | - // PROCESS TASKS |
|
| 804 | - /********************************************************************/ |
|
| 802 | + /********************************************************************/ |
|
| 803 | + // PROCESS TASKS |
|
| 804 | + /********************************************************************/ |
|
| 805 | 805 | |
| 806 | - /** |
|
| 807 | - * Given the module and action, determine whether the super/admin has prevented access |
|
| 808 | - * to this url. In addition if any links specified for this module, load the links into |
|
| 809 | - * GLOBALS |
|
| 810 | - * |
|
| 811 | - * @return true if we want to stop processing, false if processing should continue |
|
| 812 | - */ |
|
| 813 | - private function blockFileAccess(){ |
|
| 814 | - //check if the we have enabled file_access_control and if so then check the mappings on the request; |
|
| 815 | - if(!empty($GLOBALS['sugar_config']['admin_access_control']) && $GLOBALS['sugar_config']['admin_access_control']){ |
|
| 816 | - $this->loadMapping('file_access_control_map'); |
|
| 817 | - //since we have this turned on, check the mapping file |
|
| 818 | - $module = strtolower($this->module); |
|
| 819 | - $action = strtolower($this->do_action); |
|
| 820 | - if(!empty($this->file_access_control_map['modules'][$module]['links'])){ |
|
| 821 | - $GLOBALS['admin_access_control_links'] = $this->file_access_control_map['modules'][$module]['links']; |
|
| 822 | - } |
|
| 823 | - |
|
| 824 | - if(!empty($this->file_access_control_map['modules'][$module]['actions']) && (in_array($action, $this->file_access_control_map['modules'][$module]['actions']) || !empty($this->file_access_control_map['modules'][$module]['actions'][$action]))){ |
|
| 825 | - //check params |
|
| 826 | - if(!empty($this->file_access_control_map['modules'][$module]['actions'][$action]['params'])){ |
|
| 827 | - $block = true; |
|
| 828 | - $params = $this->file_access_control_map['modules'][$module]['actions'][$action]['params']; |
|
| 829 | - foreach($params as $param => $paramVals){ |
|
| 830 | - if(!empty($_REQUEST[$param])){ |
|
| 831 | - if(!in_array($_REQUEST[$param], $paramVals)){ |
|
| 832 | - $block = false; |
|
| 833 | - break; |
|
| 834 | - } |
|
| 835 | - } |
|
| 836 | - } |
|
| 837 | - if($block){ |
|
| 838 | - $this->_processed = true; |
|
| 839 | - $this->no_access(); |
|
| 840 | - } |
|
| 841 | - }else{ |
|
| 842 | - $this->_processed = true; |
|
| 843 | - $this->no_access(); |
|
| 844 | - } |
|
| 845 | - } |
|
| 846 | - }else |
|
| 847 | - $this->_processed = false; |
|
| 848 | - } |
|
| 806 | + /** |
|
| 807 | + * Given the module and action, determine whether the super/admin has prevented access |
|
| 808 | + * to this url. In addition if any links specified for this module, load the links into |
|
| 809 | + * GLOBALS |
|
| 810 | + * |
|
| 811 | + * @return true if we want to stop processing, false if processing should continue |
|
| 812 | + */ |
|
| 813 | + private function blockFileAccess(){ |
|
| 814 | + //check if the we have enabled file_access_control and if so then check the mappings on the request; |
|
| 815 | + if(!empty($GLOBALS['sugar_config']['admin_access_control']) && $GLOBALS['sugar_config']['admin_access_control']){ |
|
| 816 | + $this->loadMapping('file_access_control_map'); |
|
| 817 | + //since we have this turned on, check the mapping file |
|
| 818 | + $module = strtolower($this->module); |
|
| 819 | + $action = strtolower($this->do_action); |
|
| 820 | + if(!empty($this->file_access_control_map['modules'][$module]['links'])){ |
|
| 821 | + $GLOBALS['admin_access_control_links'] = $this->file_access_control_map['modules'][$module]['links']; |
|
| 822 | + } |
|
| 849 | 823 | |
| 850 | - /** |
|
| 851 | - * This code is part of the entry points reworking. We have consolidated all |
|
| 852 | - * entry points to go through index.php. Now in order to bring up an entry point |
|
| 853 | - * it will follow the format: |
|
| 854 | - * 'index.php?entryPoint=download' |
|
| 855 | - * the download entry point is mapped in the following file: entry_point_registry.php |
|
| 856 | - * |
|
| 857 | - */ |
|
| 858 | - private function handleEntryPoint(){ |
|
| 859 | - if(!empty($_REQUEST['entryPoint'])){ |
|
| 860 | - $this->loadMapping('entry_point_registry'); |
|
| 861 | - $entryPoint = $_REQUEST['entryPoint']; |
|
| 862 | - |
|
| 863 | - if(!empty($this->entry_point_registry[$entryPoint])){ |
|
| 864 | - require_once($this->entry_point_registry[$entryPoint]['file']); |
|
| 865 | - $this->_processed = true; |
|
| 866 | - $this->view = ''; |
|
| 867 | - } |
|
| 868 | - } |
|
| 869 | - } |
|
| 824 | + if(!empty($this->file_access_control_map['modules'][$module]['actions']) && (in_array($action, $this->file_access_control_map['modules'][$module]['actions']) || !empty($this->file_access_control_map['modules'][$module]['actions'][$action]))){ |
|
| 825 | + //check params |
|
| 826 | + if(!empty($this->file_access_control_map['modules'][$module]['actions'][$action]['params'])){ |
|
| 827 | + $block = true; |
|
| 828 | + $params = $this->file_access_control_map['modules'][$module]['actions'][$action]['params']; |
|
| 829 | + foreach($params as $param => $paramVals){ |
|
| 830 | + if(!empty($_REQUEST[$param])){ |
|
| 831 | + if(!in_array($_REQUEST[$param], $paramVals)){ |
|
| 832 | + $block = false; |
|
| 833 | + break; |
|
| 834 | + } |
|
| 835 | + } |
|
| 836 | + } |
|
| 837 | + if($block){ |
|
| 838 | + $this->_processed = true; |
|
| 839 | + $this->no_access(); |
|
| 840 | + } |
|
| 841 | + }else{ |
|
| 842 | + $this->_processed = true; |
|
| 843 | + $this->no_access(); |
|
| 844 | + } |
|
| 845 | + } |
|
| 846 | + }else |
|
| 847 | + $this->_processed = false; |
|
| 848 | + } |
|
| 849 | + |
|
| 850 | + /** |
|
| 851 | + * This code is part of the entry points reworking. We have consolidated all |
|
| 852 | + * entry points to go through index.php. Now in order to bring up an entry point |
|
| 853 | + * it will follow the format: |
|
| 854 | + * 'index.php?entryPoint=download' |
|
| 855 | + * the download entry point is mapped in the following file: entry_point_registry.php |
|
| 856 | + * |
|
| 857 | + */ |
|
| 858 | + private function handleEntryPoint(){ |
|
| 859 | + if(!empty($_REQUEST['entryPoint'])){ |
|
| 860 | + $this->loadMapping('entry_point_registry'); |
|
| 861 | + $entryPoint = $_REQUEST['entryPoint']; |
|
| 862 | + |
|
| 863 | + if(!empty($this->entry_point_registry[$entryPoint])){ |
|
| 864 | + require_once($this->entry_point_registry[$entryPoint]['file']); |
|
| 865 | + $this->_processed = true; |
|
| 866 | + $this->view = ''; |
|
| 867 | + } |
|
| 868 | + } |
|
| 869 | + } |
|
| 870 | 870 | |
| 871 | 871 | /** |
| 872 | 872 | * Checks to see if the requested entry point requires auth |
@@ -884,67 +884,67 @@ discard block |
||
| 884 | 884 | return true; |
| 885 | 885 | } |
| 886 | 886 | |
| 887 | - /** |
|
| 888 | - * Meant to handle old views e.g. DetailView.php. |
|
| 889 | - * |
|
| 890 | - */ |
|
| 891 | - protected function callLegacyCode() |
|
| 892 | - { |
|
| 893 | - $file = self::getActionFilename($this->do_action); |
|
| 894 | - if ( isset($this->action_view_map[strtolower($this->do_action)]) ) { |
|
| 895 | - $action = $this->action_view_map[strtolower($this->do_action)]; |
|
| 896 | - } |
|
| 897 | - else { |
|
| 898 | - $action = $this->do_action; |
|
| 899 | - } |
|
| 900 | - // index actions actually maps to the view.list.php view |
|
| 901 | - if ( $action == 'index' ) { |
|
| 902 | - $action = 'list'; |
|
| 903 | - } |
|
| 904 | - |
|
| 905 | - if ((file_exists('modules/' . $this->module . '/'. $file . '.php') |
|
| 887 | + /** |
|
| 888 | + * Meant to handle old views e.g. DetailView.php. |
|
| 889 | + * |
|
| 890 | + */ |
|
| 891 | + protected function callLegacyCode() |
|
| 892 | + { |
|
| 893 | + $file = self::getActionFilename($this->do_action); |
|
| 894 | + if ( isset($this->action_view_map[strtolower($this->do_action)]) ) { |
|
| 895 | + $action = $this->action_view_map[strtolower($this->do_action)]; |
|
| 896 | + } |
|
| 897 | + else { |
|
| 898 | + $action = $this->do_action; |
|
| 899 | + } |
|
| 900 | + // index actions actually maps to the view.list.php view |
|
| 901 | + if ( $action == 'index' ) { |
|
| 902 | + $action = 'list'; |
|
| 903 | + } |
|
| 904 | + |
|
| 905 | + if ((file_exists('modules/' . $this->module . '/'. $file . '.php') |
|
| 906 | 906 | && !file_exists('modules/' . $this->module . '/views/view.'. $action . '.php')) |
| 907 | 907 | || (file_exists('custom/modules/' . $this->module . '/'. $file . '.php') |
| 908 | 908 | && !file_exists('custom/modules/' . $this->module . '/views/view.'. $action . '.php')) |
| 909 | 909 | ) { |
| 910 | - // A 'classic' module, using the old pre-MVC display files |
|
| 911 | - // We should now discard the bean we just obtained for tracking as the pre-MVC module will instantiate its own |
|
| 912 | - unset($GLOBALS['FOCUS']); |
|
| 913 | - $GLOBALS['log']->debug('Module:' . $this->module . ' using file: '. $file); |
|
| 914 | - $this->action_default(); |
|
| 915 | - $this->_processed = true; |
|
| 916 | - } |
|
| 917 | - } |
|
| 910 | + // A 'classic' module, using the old pre-MVC display files |
|
| 911 | + // We should now discard the bean we just obtained for tracking as the pre-MVC module will instantiate its own |
|
| 912 | + unset($GLOBALS['FOCUS']); |
|
| 913 | + $GLOBALS['log']->debug('Module:' . $this->module . ' using file: '. $file); |
|
| 914 | + $this->action_default(); |
|
| 915 | + $this->_processed = true; |
|
| 916 | + } |
|
| 917 | + } |
|
| 918 | 918 | |
| 919 | - /** |
|
| 920 | - * If the action has been remapped to a different action as defined in |
|
| 921 | - * action_file_map.php or action_view_map.php load those maps here. |
|
| 922 | - * |
|
| 923 | - */ |
|
| 924 | - private function handleActionMaps(){ |
|
| 925 | - if(!empty($this->action_file_map[strtolower($this->do_action)])){ |
|
| 926 | - $this->view = ''; |
|
| 927 | - $GLOBALS['log']->debug('Using Action File Map:' . $this->action_file_map[strtolower($this->do_action)]); |
|
| 928 | - require_once($this->action_file_map[strtolower($this->do_action)]); |
|
| 929 | - $this->_processed = true; |
|
| 930 | - }elseif(!empty($this->action_view_map[strtolower($this->do_action)])){ |
|
| 931 | - $GLOBALS['log']->debug('Using Action View Map:' . $this->action_view_map[strtolower($this->do_action)]); |
|
| 932 | - $this->view = $this->action_view_map[strtolower($this->do_action)]; |
|
| 933 | - $this->_processed = true; |
|
| 934 | - }else |
|
| 935 | - $this->no_action(); |
|
| 936 | - } |
|
| 919 | + /** |
|
| 920 | + * If the action has been remapped to a different action as defined in |
|
| 921 | + * action_file_map.php or action_view_map.php load those maps here. |
|
| 922 | + * |
|
| 923 | + */ |
|
| 924 | + private function handleActionMaps(){ |
|
| 925 | + if(!empty($this->action_file_map[strtolower($this->do_action)])){ |
|
| 926 | + $this->view = ''; |
|
| 927 | + $GLOBALS['log']->debug('Using Action File Map:' . $this->action_file_map[strtolower($this->do_action)]); |
|
| 928 | + require_once($this->action_file_map[strtolower($this->do_action)]); |
|
| 929 | + $this->_processed = true; |
|
| 930 | + }elseif(!empty($this->action_view_map[strtolower($this->do_action)])){ |
|
| 931 | + $GLOBALS['log']->debug('Using Action View Map:' . $this->action_view_map[strtolower($this->do_action)]); |
|
| 932 | + $this->view = $this->action_view_map[strtolower($this->do_action)]; |
|
| 933 | + $this->_processed = true; |
|
| 934 | + }else |
|
| 935 | + $this->no_action(); |
|
| 936 | + } |
|
| 937 | 937 | |
| 938 | - /** |
|
| 939 | - * Actually remap the action if required. |
|
| 940 | - * |
|
| 941 | - */ |
|
| 942 | - protected function remapAction(){ |
|
| 943 | - if(!empty($this->action_remap[$this->do_action])){ |
|
| 944 | - $this->action = $this->action_remap[$this->do_action]; |
|
| 945 | - $this->do_action = $this->action; |
|
| 946 | - } |
|
| 947 | - } |
|
| 938 | + /** |
|
| 939 | + * Actually remap the action if required. |
|
| 940 | + * |
|
| 941 | + */ |
|
| 942 | + protected function remapAction(){ |
|
| 943 | + if(!empty($this->action_remap[$this->do_action])){ |
|
| 944 | + $this->action = $this->action_remap[$this->do_action]; |
|
| 945 | + $this->do_action = $this->action; |
|
| 946 | + } |
|
| 947 | + } |
|
| 948 | 948 | |
| 949 | 949 | } |
| 950 | 950 | ?> |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | * Main SugarCRM controller |
| 44 | 44 | * @api |
| 45 | 45 | */ |
| 46 | -class SugarController{ |
|
| 46 | +class SugarController { |
|
| 47 | 47 | /** |
| 48 | 48 | * remap actions in here |
| 49 | 49 | * e.g. make all detail views go to edit views |
@@ -162,15 +162,15 @@ discard block |
||
| 162 | 162 | * Constructor. This ie meant tot load up the module, action, record as well |
| 163 | 163 | * as the mapping arrays. |
| 164 | 164 | */ |
| 165 | - public function __construct(){ |
|
| 165 | + public function __construct() { |
|
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | /** |
| 169 | 169 | * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead |
| 170 | 170 | */ |
| 171 | - public function SugarController(){ |
|
| 171 | + public function SugarController() { |
|
| 172 | 172 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 173 | - if(isset($GLOBALS['log'])) { |
|
| 173 | + if (isset($GLOBALS['log'])) { |
|
| 174 | 174 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 175 | 175 | } |
| 176 | 176 | else { |
@@ -185,14 +185,14 @@ discard block |
||
| 185 | 185 | * on the controller. |
| 186 | 186 | * |
| 187 | 187 | */ |
| 188 | - public function setup($module = ''){ |
|
| 189 | - if(empty($module) && !empty($_REQUEST['module'])) |
|
| 188 | + public function setup($module = '') { |
|
| 189 | + if (empty($module) && !empty($_REQUEST['module'])) |
|
| 190 | 190 | $module = $_REQUEST['module']; |
| 191 | 191 | //set the module |
| 192 | - if(!empty($module)) |
|
| 192 | + if (!empty($module)) |
|
| 193 | 193 | $this->setModule($module); |
| 194 | 194 | |
| 195 | - if(!empty($_REQUEST['target_module']) && $_REQUEST['target_module'] != 'undefined') { |
|
| 195 | + if (!empty($_REQUEST['target_module']) && $_REQUEST['target_module'] != 'undefined') { |
|
| 196 | 196 | $this->target_module = $_REQUEST['target_module']; |
| 197 | 197 | } |
| 198 | 198 | //set properties on the controller from the $_REQUEST |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | * |
| 206 | 206 | * @param object $module |
| 207 | 207 | */ |
| 208 | - public function setModule($module){ |
|
| 208 | + public function setModule($module) { |
|
| 209 | 209 | $this->module = $module; |
| 210 | 210 | } |
| 211 | 211 | |
@@ -213,18 +213,18 @@ discard block |
||
| 213 | 213 | * Set properties on the Controller from the $_REQUEST |
| 214 | 214 | * |
| 215 | 215 | */ |
| 216 | - private function loadPropertiesFromRequest(){ |
|
| 217 | - if(!empty($_REQUEST['action'])) |
|
| 216 | + private function loadPropertiesFromRequest() { |
|
| 217 | + if (!empty($_REQUEST['action'])) |
|
| 218 | 218 | $this->action = $_REQUEST['action']; |
| 219 | - if(!empty($_REQUEST['record'])) |
|
| 219 | + if (!empty($_REQUEST['record'])) |
|
| 220 | 220 | $this->record = $_REQUEST['record']; |
| 221 | - if(!empty($_REQUEST['view'])) |
|
| 221 | + if (!empty($_REQUEST['view'])) |
|
| 222 | 222 | $this->view = $_REQUEST['view']; |
| 223 | - if(!empty($_REQUEST['return_module'])) |
|
| 223 | + if (!empty($_REQUEST['return_module'])) |
|
| 224 | 224 | $this->return_module = $_REQUEST['return_module']; |
| 225 | - if(!empty($_REQUEST['return_action'])) |
|
| 225 | + if (!empty($_REQUEST['return_action'])) |
|
| 226 | 226 | $this->return_action = $_REQUEST['return_action']; |
| 227 | - if(!empty($_REQUEST['return_id'])) |
|
| 227 | + if (!empty($_REQUEST['return_id'])) |
|
| 228 | 228 | $this->return_id = $_REQUEST['return_id']; |
| 229 | 229 | } |
| 230 | 230 | |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | * Load map files for use within the Controller |
| 233 | 233 | * |
| 234 | 234 | */ |
| 235 | - private function loadMappings(){ |
|
| 235 | + private function loadMappings() { |
|
| 236 | 236 | $this->loadMapping('action_view_map'); |
| 237 | 237 | $this->loadMapping('action_file_map'); |
| 238 | 238 | $this->loadMapping('action_remap', true); |
@@ -243,14 +243,14 @@ discard block |
||
| 243 | 243 | */ |
| 244 | 244 | public function loadBean() |
| 245 | 245 | { |
| 246 | - if(!empty($GLOBALS['beanList'][$this->module])){ |
|
| 246 | + if (!empty($GLOBALS['beanList'][$this->module])) { |
|
| 247 | 247 | $class = $GLOBALS['beanList'][$this->module]; |
| 248 | - if(!empty($GLOBALS['beanFiles'][$class])){ |
|
| 248 | + if (!empty($GLOBALS['beanFiles'][$class])) { |
|
| 249 | 249 | require_once($GLOBALS['beanFiles'][$class]); |
| 250 | 250 | $this->bean = new $class(); |
| 251 | - if(!empty($this->record)){ |
|
| 251 | + if (!empty($this->record)) { |
|
| 252 | 252 | $this->bean->retrieve($this->record); |
| 253 | - if($this->bean) |
|
| 253 | + if ($this->bean) |
|
| 254 | 254 | $GLOBALS['FOCUS'] = $this->bean; |
| 255 | 255 | } |
| 256 | 256 | } |
@@ -260,38 +260,38 @@ discard block |
||
| 260 | 260 | /** |
| 261 | 261 | * Generic load method to load mapping arrays. |
| 262 | 262 | */ |
| 263 | - private function loadMapping($var, $merge = false){ |
|
| 264 | - $$var = sugar_cache_retrieve("CONTROLLER_". $var . "_".$this->module); |
|
| 265 | - if(!$$var){ |
|
| 266 | - if($merge && !empty($this->$var)){ |
|
| 263 | + private function loadMapping($var, $merge = false) { |
|
| 264 | + $$var = sugar_cache_retrieve("CONTROLLER_".$var."_".$this->module); |
|
| 265 | + if (!$$var) { |
|
| 266 | + if ($merge && !empty($this->$var)) { |
|
| 267 | 267 | $$var = $this->$var; |
| 268 | - }else{ |
|
| 268 | + } else { |
|
| 269 | 269 | $$var = array(); |
| 270 | 270 | } |
| 271 | - if(file_exists('include/MVC/Controller/'. $var . '.php')){ |
|
| 272 | - require('include/MVC/Controller/'. $var . '.php'); |
|
| 271 | + if (file_exists('include/MVC/Controller/'.$var.'.php')) { |
|
| 272 | + require('include/MVC/Controller/'.$var.'.php'); |
|
| 273 | 273 | } |
| 274 | - if(file_exists('modules/'.$this->module.'/'. $var . '.php')){ |
|
| 275 | - require('modules/'.$this->module.'/'. $var . '.php'); |
|
| 274 | + if (file_exists('modules/'.$this->module.'/'.$var.'.php')) { |
|
| 275 | + require('modules/'.$this->module.'/'.$var.'.php'); |
|
| 276 | 276 | } |
| 277 | - if(file_exists('custom/modules/'.$this->module.'/'. $var . '.php')){ |
|
| 278 | - require('custom/modules/'.$this->module.'/'. $var . '.php'); |
|
| 277 | + if (file_exists('custom/modules/'.$this->module.'/'.$var.'.php')) { |
|
| 278 | + require('custom/modules/'.$this->module.'/'.$var.'.php'); |
|
| 279 | 279 | } |
| 280 | - if(file_exists('custom/include/MVC/Controller/'. $var . '.php')){ |
|
| 281 | - require('custom/include/MVC/Controller/'. $var . '.php'); |
|
| 280 | + if (file_exists('custom/include/MVC/Controller/'.$var.'.php')) { |
|
| 281 | + require('custom/include/MVC/Controller/'.$var.'.php'); |
|
| 282 | 282 | } |
| 283 | 283 | |
| 284 | 284 | // entry_point_registry -> EntryPointRegistry |
| 285 | 285 | |
| 286 | - $varname = str_replace(" ","",ucwords(str_replace("_"," ", $var))); |
|
| 287 | - if(file_exists("custom/application/Ext/$varname/$var.ext.php")){ |
|
| 286 | + $varname = str_replace(" ", "", ucwords(str_replace("_", " ", $var))); |
|
| 287 | + if (file_exists("custom/application/Ext/$varname/$var.ext.php")) { |
|
| 288 | 288 | require("custom/application/Ext/$varname/$var.ext.php"); |
| 289 | 289 | } |
| 290 | - if(file_exists("custom/modules/{$this->module}/Ext/$varname/$var.ext.php")){ |
|
| 290 | + if (file_exists("custom/modules/{$this->module}/Ext/$varname/$var.ext.php")) { |
|
| 291 | 291 | require("custom/modules/{$this->module}/Ext/$varname/$var.ext.php"); |
| 292 | 292 | } |
| 293 | 293 | |
| 294 | - sugar_cache_put("CONTROLLER_". $var . "_".$this->module, $$var); |
|
| 294 | + sugar_cache_put("CONTROLLER_".$var."_".$this->module, $$var); |
|
| 295 | 295 | } |
| 296 | 296 | $this->$var = $$var; |
| 297 | 297 | } |
@@ -305,11 +305,11 @@ discard block |
||
| 305 | 305 | try |
| 306 | 306 | { |
| 307 | 307 | $this->process(); |
| 308 | - if(!empty($this->view)) |
|
| 308 | + if (!empty($this->view)) |
|
| 309 | 309 | { |
| 310 | 310 | $this->processView(); |
| 311 | 311 | } |
| 312 | - elseif(!empty($this->redirect_url)) |
|
| 312 | + elseif (!empty($this->redirect_url)) |
|
| 313 | 313 | { |
| 314 | 314 | $this->redirect(); |
| 315 | 315 | } |
@@ -329,7 +329,7 @@ discard block |
||
| 329 | 329 | */ |
| 330 | 330 | protected function handleException(Exception $e) |
| 331 | 331 | { |
| 332 | - $GLOBALS['log']->fatal('Exception in Controller: ' . $e->getMessage()); |
|
| 332 | + $GLOBALS['log']->fatal('Exception in Controller: '.$e->getMessage()); |
|
| 333 | 333 | $logicHook = new LogicHook(); |
| 334 | 334 | |
| 335 | 335 | if (isset($this->bean)) |
@@ -346,18 +346,18 @@ discard block |
||
| 346 | 346 | /** |
| 347 | 347 | * Display the appropriate view. |
| 348 | 348 | */ |
| 349 | - private function processView(){ |
|
| 350 | - if(!isset($this->view_object_map['remap_action']) && isset($this->action_view_map[strtolower($this->action)])) |
|
| 349 | + private function processView() { |
|
| 350 | + if (!isset($this->view_object_map['remap_action']) && isset($this->action_view_map[strtolower($this->action)])) |
|
| 351 | 351 | { |
| 352 | 352 | $this->view_object_map['remap_action'] = $this->action_view_map[strtolower($this->action)]; |
| 353 | 353 | } |
| 354 | 354 | $view = ViewFactory::loadView($this->view, $this->module, $this->bean, $this->view_object_map, $this->target_module); |
| 355 | 355 | $GLOBALS['current_view'] = $view; |
| 356 | - if(!empty($this->bean) && !$this->bean->ACLAccess($view->type) && $view->type != 'list'){ |
|
| 356 | + if (!empty($this->bean) && !$this->bean->ACLAccess($view->type) && $view->type != 'list') { |
|
| 357 | 357 | ACLController::displayNoAccess(true); |
| 358 | 358 | sugar_cleanup(true); |
| 359 | 359 | } |
| 360 | - if(isset($this->errors)){ |
|
| 360 | + if (isset($this->errors)) { |
|
| 361 | 361 | $view->errors = $this->errors; |
| 362 | 362 | } |
| 363 | 363 | $view->process(); |
@@ -376,12 +376,12 @@ discard block |
||
| 376 | 376 | * 1) check for file |
| 377 | 377 | * 2) check for action |
| 378 | 378 | */ |
| 379 | - public function process(){ |
|
| 379 | + public function process() { |
|
| 380 | 380 | $GLOBALS['action'] = $this->action; |
| 381 | 381 | $GLOBALS['module'] = $this->module; |
| 382 | 382 | |
| 383 | 383 | //check to ensure we have access to the module. |
| 384 | - if($this->hasAccess){ |
|
| 384 | + if ($this->hasAccess) { |
|
| 385 | 385 | $this->do_action = $this->action; |
| 386 | 386 | |
| 387 | 387 | $file = self::getActionFilename($this->do_action); |
@@ -399,7 +399,7 @@ discard block |
||
| 399 | 399 | } |
| 400 | 400 | |
| 401 | 401 | $this->redirect(); |
| 402 | - }else{ |
|
| 402 | + } else { |
|
| 403 | 403 | $this->no_access(); |
| 404 | 404 | } |
| 405 | 405 | } |
@@ -413,9 +413,9 @@ discard block |
||
| 413 | 413 | * false otherwise. This is important b/c if none of these methods exists, then we will run the |
| 414 | 414 | * action_default() method. |
| 415 | 415 | */ |
| 416 | - protected function handle_action(){ |
|
| 416 | + protected function handle_action() { |
|
| 417 | 417 | $processed = false; |
| 418 | - foreach($this->tasks as $task){ |
|
| 418 | + foreach ($this->tasks as $task) { |
|
| 419 | 419 | $processed = ($this->$task() || $processed); |
| 420 | 420 | } |
| 421 | 421 | $this->_processed = $processed; |
@@ -425,9 +425,9 @@ discard block |
||
| 425 | 425 | * Perform an action prior to the specified action. |
| 426 | 426 | * This can be overridde in a sub-class |
| 427 | 427 | */ |
| 428 | - private function pre_action(){ |
|
| 429 | - $function = 'pre_' . $this->action; |
|
| 430 | - if($this->hasFunction($function)){ |
|
| 428 | + private function pre_action() { |
|
| 429 | + $function = 'pre_'.$this->action; |
|
| 430 | + if ($this->hasFunction($function)) { |
|
| 431 | 431 | $GLOBALS['log']->debug('Performing pre_action'); |
| 432 | 432 | $this->$function(); |
| 433 | 433 | return true; |
@@ -439,9 +439,9 @@ discard block |
||
| 439 | 439 | * Perform the specified action. |
| 440 | 440 | * This can be overridde in a sub-class |
| 441 | 441 | */ |
| 442 | - private function do_action(){ |
|
| 443 | - $function = 'action_'. strtolower($this->do_action); |
|
| 444 | - if($this->hasFunction($function)){ |
|
| 442 | + private function do_action() { |
|
| 443 | + $function = 'action_'.strtolower($this->do_action); |
|
| 444 | + if ($this->hasFunction($function)) { |
|
| 445 | 445 | $GLOBALS['log']->debug('Performing action: '.$function.' MODULE: '.$this->module); |
| 446 | 446 | $this->$function(); |
| 447 | 447 | return true; |
@@ -453,9 +453,9 @@ discard block |
||
| 453 | 453 | * Perform an action after to the specified action has occurred. |
| 454 | 454 | * This can be overridde in a sub-class |
| 455 | 455 | */ |
| 456 | - private function post_action(){ |
|
| 457 | - $function = 'post_' . $this->action; |
|
| 458 | - if($this->hasFunction($function)){ |
|
| 456 | + private function post_action() { |
|
| 457 | + $function = 'post_'.$this->action; |
|
| 458 | + if ($this->hasFunction($function)) { |
|
| 459 | 459 | $GLOBALS['log']->debug('Performing post_action'); |
| 460 | 460 | $this->$function(); |
| 461 | 461 | return true; |
@@ -466,14 +466,14 @@ discard block |
||
| 466 | 466 | /** |
| 467 | 467 | * If there is no action found then display an error to the user. |
| 468 | 468 | */ |
| 469 | - protected function no_action(){ |
|
| 469 | + protected function no_action() { |
|
| 470 | 470 | sugar_die($GLOBALS['app_strings']['LBL_NO_ACTION']); |
| 471 | 471 | } |
| 472 | 472 | |
| 473 | 473 | /** |
| 474 | 474 | * The default action handler for instances where we do not have access to process. |
| 475 | 475 | */ |
| 476 | - protected function no_access(){ |
|
| 476 | + protected function no_access() { |
|
| 477 | 477 | $this->view = 'noaccess'; |
| 478 | 478 | } |
| 479 | 479 | |
@@ -486,7 +486,7 @@ discard block |
||
| 486 | 486 | * @param function - the function to check |
| 487 | 487 | * @return true if the method exists on the object, false otherwise |
| 488 | 488 | */ |
| 489 | - protected function hasFunction($function){ |
|
| 489 | + protected function hasFunction($function) { |
|
| 490 | 490 | return method_exists($this, $function); |
| 491 | 491 | } |
| 492 | 492 | |
@@ -496,7 +496,7 @@ discard block |
||
| 496 | 496 | * |
| 497 | 497 | * @param string url - the url to which we will want to redirect |
| 498 | 498 | */ |
| 499 | - protected function set_redirect($url){ |
|
| 499 | + protected function set_redirect($url) { |
|
| 500 | 500 | $this->redirect_url = $url; |
| 501 | 501 | } |
| 502 | 502 | |
@@ -504,9 +504,9 @@ discard block |
||
| 504 | 504 | * Perform redirection based on the redirect_url |
| 505 | 505 | * |
| 506 | 506 | */ |
| 507 | - protected function redirect(){ |
|
| 507 | + protected function redirect() { |
|
| 508 | 508 | |
| 509 | - if(!empty($this->redirect_url)) |
|
| 509 | + if (!empty($this->redirect_url)) |
|
| 510 | 510 | SugarApplication::redirect($this->redirect_url); |
| 511 | 511 | } |
| 512 | 512 | |
@@ -521,38 +521,38 @@ discard block |
||
| 521 | 521 | /** |
| 522 | 522 | * Do some processing before saving the bean to the database. |
| 523 | 523 | */ |
| 524 | - public function pre_save(){ |
|
| 525 | - if(!empty($_POST['assigned_user_id']) && $_POST['assigned_user_id'] != $this->bean->assigned_user_id && $_POST['assigned_user_id'] != $GLOBALS['current_user']->id && empty($GLOBALS['sugar_config']['exclude_notifications'][$this->bean->module_dir])){ |
|
| 524 | + public function pre_save() { |
|
| 525 | + if (!empty($_POST['assigned_user_id']) && $_POST['assigned_user_id'] != $this->bean->assigned_user_id && $_POST['assigned_user_id'] != $GLOBALS['current_user']->id && empty($GLOBALS['sugar_config']['exclude_notifications'][$this->bean->module_dir])) { |
|
| 526 | 526 | $this->bean->notify_on_save = true; |
| 527 | 527 | } |
| 528 | 528 | $GLOBALS['log']->debug("SugarController:: performing pre_save."); |
| 529 | 529 | require_once('include/SugarFields/SugarFieldHandler.php'); |
| 530 | 530 | $sfh = new SugarFieldHandler(); |
| 531 | - foreach($this->bean->field_defs as $field => $properties) { |
|
| 531 | + foreach ($this->bean->field_defs as $field => $properties) { |
|
| 532 | 532 | $type = !empty($properties['custom_type']) ? $properties['custom_type'] : $properties['type']; |
| 533 | 533 | $sf = $sfh->getSugarField(ucfirst($type), true); |
| 534 | - if(isset($_POST[$field])) { |
|
| 535 | - if(is_array($_POST[$field]) && !empty($properties['isMultiSelect'])) { |
|
| 536 | - if(empty($_POST[$field][0])) { |
|
| 534 | + if (isset($_POST[$field])) { |
|
| 535 | + if (is_array($_POST[$field]) && !empty($properties['isMultiSelect'])) { |
|
| 536 | + if (empty($_POST[$field][0])) { |
|
| 537 | 537 | unset($_POST[$field][0]); |
| 538 | 538 | } |
| 539 | 539 | $_POST[$field] = encodeMultienumValue($_POST[$field]); |
| 540 | 540 | } |
| 541 | 541 | $this->bean->$field = $_POST[$field]; |
| 542 | - } else if(!empty($properties['isMultiSelect']) && !isset($_POST[$field]) && isset($_POST[$field . '_multiselect'])) { |
|
| 542 | + } else if (!empty($properties['isMultiSelect']) && !isset($_POST[$field]) && isset($_POST[$field.'_multiselect'])) { |
|
| 543 | 543 | $this->bean->$field = ''; |
| 544 | 544 | } |
| 545 | - if($sf != null){ |
|
| 545 | + if ($sf != null) { |
|
| 546 | 546 | $sf->save($this->bean, $_POST, $field, $properties); |
| 547 | 547 | } |
| 548 | 548 | } |
| 549 | 549 | |
| 550 | - foreach($this->bean->relationship_fields as $field=>$link){ |
|
| 551 | - if(!empty($_POST[$field])){ |
|
| 550 | + foreach ($this->bean->relationship_fields as $field=>$link) { |
|
| 551 | + if (!empty($_POST[$field])) { |
|
| 552 | 552 | $this->bean->$field = $_POST[$field]; |
| 553 | 553 | } |
| 554 | 554 | } |
| 555 | - if(!$this->bean->ACLAccess('save')){ |
|
| 555 | + if (!$this->bean->ACLAccess('save')) { |
|
| 556 | 556 | ACLController::displayNoAccess(true); |
| 557 | 557 | sugar_cleanup(true); |
| 558 | 558 | } |
@@ -561,7 +561,7 @@ discard block |
||
| 561 | 561 | /** |
| 562 | 562 | * Perform the actual save |
| 563 | 563 | */ |
| 564 | - public function action_save(){ |
|
| 564 | + public function action_save() { |
|
| 565 | 565 | $this->bean->save(!empty($this->bean->notify_on_save)); |
| 566 | 566 | } |
| 567 | 567 | |
@@ -575,7 +575,7 @@ discard block |
||
| 575 | 575 | /** |
| 576 | 576 | * Specify what happens after the save has occurred. |
| 577 | 577 | */ |
| 578 | - protected function post_save(){ |
|
| 578 | + protected function post_save() { |
|
| 579 | 579 | $module = (!empty($this->return_module) ? $this->return_module : $this->module); |
| 580 | 580 | $action = (!empty($this->return_action) ? $this->return_action : 'DetailView'); |
| 581 | 581 | $id = (!empty($this->return_id) ? $this->return_id : $this->bean->id); |
@@ -591,16 +591,16 @@ discard block |
||
| 591 | 591 | /** |
| 592 | 592 | * Perform the actual deletion. |
| 593 | 593 | */ |
| 594 | - protected function action_delete(){ |
|
| 594 | + protected function action_delete() { |
|
| 595 | 595 | //do any pre delete processing |
| 596 | 596 | //if there is some custom logic for deletion. |
| 597 | - if(!empty($_REQUEST['record'])){ |
|
| 598 | - if(!$this->bean->ACLAccess('Delete')){ |
|
| 597 | + if (!empty($_REQUEST['record'])) { |
|
| 598 | + if (!$this->bean->ACLAccess('Delete')) { |
|
| 599 | 599 | ACLController::displayNoAccess(true); |
| 600 | 600 | sugar_cleanup(true); |
| 601 | 601 | } |
| 602 | 602 | $this->bean->mark_deleted($_REQUEST['record']); |
| 603 | - }else{ |
|
| 603 | + } else { |
|
| 604 | 604 | sugar_die("A record number must be specified to delete"); |
| 605 | 605 | } |
| 606 | 606 | } |
@@ -608,24 +608,21 @@ discard block |
||
| 608 | 608 | /** |
| 609 | 609 | * Specify what happens after the deletion has occurred. |
| 610 | 610 | */ |
| 611 | - protected function post_delete(){ |
|
| 611 | + protected function post_delete() { |
|
| 612 | 612 | if (empty($_REQUEST['return_url'])) { |
| 613 | 613 | $return_module = isset($_REQUEST['return_module']) ? |
| 614 | - $_REQUEST['return_module'] : |
|
| 615 | - $GLOBALS['sugar_config']['default_module']; |
|
| 614 | + $_REQUEST['return_module'] : $GLOBALS['sugar_config']['default_module']; |
|
| 616 | 615 | $return_action = isset($_REQUEST['return_action']) ? |
| 617 | - $_REQUEST['return_action'] : |
|
| 618 | - $GLOBALS['sugar_config']['default_action']; |
|
| 616 | + $_REQUEST['return_action'] : $GLOBALS['sugar_config']['default_action']; |
|
| 619 | 617 | $return_id = isset($_REQUEST['return_id']) ? |
| 620 | - $_REQUEST['return_id'] : |
|
| 621 | - ''; |
|
| 618 | + $_REQUEST['return_id'] : ''; |
|
| 622 | 619 | $url = "index.php?module=".$return_module."&action=".$return_action."&record=".$return_id; |
| 623 | 620 | } else { |
| 624 | 621 | $url = $_REQUEST['return_url']; |
| 625 | 622 | } |
| 626 | 623 | |
| 627 | 624 | //eggsurplus Bug 23816: maintain VCR after an edit/save. If it is a duplicate then don't worry about it. The offset is now worthless. |
| 628 | - if(isset($_REQUEST['offset']) && empty($_REQUEST['duplicateSave'])) { |
|
| 625 | + if (isset($_REQUEST['offset']) && empty($_REQUEST['duplicateSave'])) { |
|
| 629 | 626 | $url .= "&offset=".$_REQUEST['offset']; |
| 630 | 627 | } |
| 631 | 628 | |
@@ -634,15 +631,15 @@ discard block |
||
| 634 | 631 | /** |
| 635 | 632 | * Perform the actual massupdate. |
| 636 | 633 | */ |
| 637 | - protected function action_massupdate(){ |
|
| 638 | - if(!empty($_REQUEST['massupdate']) && $_REQUEST['massupdate'] == 'true' && (!empty($_REQUEST['uid']) || !empty($_REQUEST['entire']))){ |
|
| 639 | - if(!empty($_REQUEST['Delete']) && $_REQUEST['Delete']=='true' && !$this->bean->ACLAccess('delete') |
|
| 640 | - || (empty($_REQUEST['Delete']) || $_REQUEST['Delete']!='true') && !$this->bean->ACLAccess('save')){ |
|
| 634 | + protected function action_massupdate() { |
|
| 635 | + if (!empty($_REQUEST['massupdate']) && $_REQUEST['massupdate'] == 'true' && (!empty($_REQUEST['uid']) || !empty($_REQUEST['entire']))) { |
|
| 636 | + if (!empty($_REQUEST['Delete']) && $_REQUEST['Delete'] == 'true' && !$this->bean->ACLAccess('delete') |
|
| 637 | + || (empty($_REQUEST['Delete']) || $_REQUEST['Delete'] != 'true') && !$this->bean->ACLAccess('save')) { |
|
| 641 | 638 | ACLController::displayNoAccess(true); |
| 642 | 639 | sugar_cleanup(true); |
| 643 | 640 | } |
| 644 | 641 | |
| 645 | - set_time_limit(0);//I'm wondering if we will set it never goes timeout here. |
|
| 642 | + set_time_limit(0); //I'm wondering if we will set it never goes timeout here. |
|
| 646 | 643 | // until we have more efficient way of handling MU, we have to disable the limit |
| 647 | 644 | $GLOBALS['db']->setQueryLimit(0); |
| 648 | 645 | require_once("include/MassUpdate.php"); |
@@ -650,40 +647,38 @@ discard block |
||
| 650 | 647 | $seed = loadBean($_REQUEST['module']); |
| 651 | 648 | $mass = new MassUpdate(); |
| 652 | 649 | $mass->setSugarBean($seed); |
| 653 | - if(isset($_REQUEST['entire']) && empty($_POST['mass'])) { |
|
| 650 | + if (isset($_REQUEST['entire']) && empty($_POST['mass'])) { |
|
| 654 | 651 | $mass->generateSearchWhere($_REQUEST['module'], $_REQUEST['current_query_by_page']); |
| 655 | 652 | } |
| 656 | 653 | $mass->handleMassUpdate(); |
| 657 | - $storeQuery = new StoreQuery();//restore the current search. to solve bug 24722 for multi tabs massupdate. |
|
| 654 | + $storeQuery = new StoreQuery(); //restore the current search. to solve bug 24722 for multi tabs massupdate. |
|
| 658 | 655 | $temp_req = array('current_query_by_page' => $_REQUEST['current_query_by_page'], 'return_module' => $_REQUEST['return_module'], 'return_action' => $_REQUEST['return_action']); |
| 659 | - if($_REQUEST['return_module'] == 'Emails') { |
|
| 660 | - if(!empty($_REQUEST['type']) && !empty($_REQUEST['ie_assigned_user_id'])) { |
|
| 656 | + if ($_REQUEST['return_module'] == 'Emails') { |
|
| 657 | + if (!empty($_REQUEST['type']) && !empty($_REQUEST['ie_assigned_user_id'])) { |
|
| 661 | 658 | $this->req_for_email = array('type' => $_REQUEST['type'], 'ie_assigned_user_id' => $_REQUEST['ie_assigned_user_id']); // Specifically for My Achieves |
| 662 | 659 | } |
| 663 | 660 | } |
| 664 | 661 | $_REQUEST = array(); |
| 665 | 662 | $_REQUEST = sugar_unserialize(base64_decode($temp_req['current_query_by_page'])); |
| 666 | - unset($_REQUEST[$seed->module_dir.'2_'.strtoupper($seed->object_name).'_offset']);//after massupdate, the page should redirect to no offset page |
|
| 663 | + unset($_REQUEST[$seed->module_dir.'2_'.strtoupper($seed->object_name).'_offset']); //after massupdate, the page should redirect to no offset page |
|
| 667 | 664 | $storeQuery->saveFromRequest($_REQUEST['module']); |
| 668 | - $_REQUEST = array('return_module' => $temp_req['return_module'], 'return_action' => $temp_req['return_action']);//for post_massupdate, to go back to original page. |
|
| 669 | - }else{ |
|
| 665 | + $_REQUEST = array('return_module' => $temp_req['return_module'], 'return_action' => $temp_req['return_action']); //for post_massupdate, to go back to original page. |
|
| 666 | + } else { |
|
| 670 | 667 | sugar_die("You must massupdate at least one record"); |
| 671 | 668 | } |
| 672 | 669 | } |
| 673 | 670 | /** |
| 674 | 671 | * Specify what happens after the massupdate has occurred. |
| 675 | 672 | */ |
| 676 | - protected function post_massupdate(){ |
|
| 673 | + protected function post_massupdate() { |
|
| 677 | 674 | $return_module = isset($_REQUEST['return_module']) ? |
| 678 | - $_REQUEST['return_module'] : |
|
| 679 | - $GLOBALS['sugar_config']['default_module']; |
|
| 675 | + $_REQUEST['return_module'] : $GLOBALS['sugar_config']['default_module']; |
|
| 680 | 676 | $return_action = isset($_REQUEST['return_action']) ? |
| 681 | - $_REQUEST['return_action'] : |
|
| 682 | - $GLOBALS['sugar_config']['default_action']; |
|
| 677 | + $_REQUEST['return_action'] : $GLOBALS['sugar_config']['default_action']; |
|
| 683 | 678 | $url = "index.php?module=".$return_module."&action=".$return_action; |
| 684 | - if($return_module == 'Emails'){//specificly for My Achieves |
|
| 685 | - if(!empty($this->req_for_email['type']) && !empty($this->req_for_email['ie_assigned_user_id'])) { |
|
| 686 | - $url = $url . "&type=".$this->req_for_email['type']."&assigned_user_id=".$this->req_for_email['ie_assigned_user_id']; |
|
| 679 | + if ($return_module == 'Emails') {//specificly for My Achieves |
|
| 680 | + if (!empty($this->req_for_email['type']) && !empty($this->req_for_email['ie_assigned_user_id'])) { |
|
| 681 | + $url = $url."&type=".$this->req_for_email['type']."&assigned_user_id=".$this->req_for_email['ie_assigned_user_id']; |
|
| 687 | 682 | } |
| 688 | 683 | } |
| 689 | 684 | $this->set_redirect($url); |
@@ -691,7 +686,7 @@ discard block |
||
| 691 | 686 | /** |
| 692 | 687 | * Perform the listview action |
| 693 | 688 | */ |
| 694 | - protected function action_listview(){ |
|
| 689 | + protected function action_listview() { |
|
| 695 | 690 | $this->view_object_map['bean'] = $this->bean; |
| 696 | 691 | $this->view = 'list'; |
| 697 | 692 | } |
@@ -706,24 +701,24 @@ discard block |
||
| 706 | 701 | /** |
| 707 | 702 | * Action to handle when using a file as was done in previous versions of Sugar. |
| 708 | 703 | */ |
| 709 | - protected function action_default(){ |
|
| 704 | + protected function action_default() { |
|
| 710 | 705 | $this->view = 'classic'; |
| 711 | 706 | } |
| 712 | 707 | |
| 713 | 708 | /** |
| 714 | 709 | * this method id used within a Dashlet when performing an ajax call |
| 715 | 710 | */ |
| 716 | - protected function action_callmethoddashlet(){ |
|
| 717 | - if(!empty($_REQUEST['id'])) { |
|
| 711 | + protected function action_callmethoddashlet() { |
|
| 712 | + if (!empty($_REQUEST['id'])) { |
|
| 718 | 713 | $id = $_REQUEST['id']; |
| 719 | 714 | $requestedMethod = $_REQUEST['method']; |
| 720 | 715 | $dashletDefs = $GLOBALS['current_user']->getPreference('dashlets', 'Home'); // load user's dashlets config |
| 721 | - if(!empty($dashletDefs[$id])) { |
|
| 716 | + if (!empty($dashletDefs[$id])) { |
|
| 722 | 717 | require_once($dashletDefs[$id]['fileLocation']); |
| 723 | 718 | |
| 724 | 719 | $dashlet = new $dashletDefs[$id]['className']($id, (isset($dashletDefs[$id]['options']) ? $dashletDefs[$id]['options'] : array())); |
| 725 | 720 | |
| 726 | - if(method_exists($dashlet, $requestedMethod) || method_exists($dashlet, '__call')) { |
|
| 721 | + if (method_exists($dashlet, $requestedMethod) || method_exists($dashlet, '__call')) { |
|
| 727 | 722 | echo $dashlet->$requestedMethod(); |
| 728 | 723 | } |
| 729 | 724 | else { |
@@ -736,22 +731,22 @@ discard block |
||
| 736 | 731 | /** |
| 737 | 732 | * this method is used within a Dashlet when the options configuration is posted |
| 738 | 733 | */ |
| 739 | - protected function action_configuredashlet(){ |
|
| 734 | + protected function action_configuredashlet() { |
|
| 740 | 735 | global $current_user, $mod_strings; |
| 741 | 736 | |
| 742 | - if(!empty($_REQUEST['id'])) { |
|
| 737 | + if (!empty($_REQUEST['id'])) { |
|
| 743 | 738 | $id = $_REQUEST['id']; |
| 744 | 739 | $dashletDefs = $current_user->getPreference('dashlets', $_REQUEST['module']); // load user's dashlets config |
| 745 | 740 | require_once($dashletDefs[$id]['fileLocation']); |
| 746 | 741 | |
| 747 | 742 | $dashlet = new $dashletDefs[$id]['className']($id, (isset($dashletDefs[$id]['options']) ? $dashletDefs[$id]['options'] : array())); |
| 748 | - if(!empty($_REQUEST['configure']) && $_REQUEST['configure']) { // save settings |
|
| 743 | + if (!empty($_REQUEST['configure']) && $_REQUEST['configure']) { // save settings |
|
| 749 | 744 | $dashletDefs[$id]['options'] = $dashlet->saveOptions($_REQUEST); |
| 750 | 745 | $current_user->setPreference('dashlets', $dashletDefs, 0, $_REQUEST['module']); |
| 751 | 746 | } |
| 752 | 747 | else { // display options |
| 753 | 748 | $json = getJSONobj(); |
| 754 | - return 'result = ' . $json->encode((array('header' => $dashlet->title . ' : ' . $mod_strings['LBL_OPTIONS'], |
|
| 749 | + return 'result = '.$json->encode((array('header' => $dashlet->title.' : '.$mod_strings['LBL_OPTIONS'], |
|
| 755 | 750 | 'body' => $dashlet->displayOptions()))); |
| 756 | 751 | |
| 757 | 752 | } |
@@ -775,7 +770,7 @@ discard block |
||
| 775 | 770 | ob_clean(); |
| 776 | 771 | $retval = false; |
| 777 | 772 | |
| 778 | - if(method_exists($this->bean, 'deleteAttachment')) { |
|
| 773 | + if (method_exists($this->bean, 'deleteAttachment')) { |
|
| 779 | 774 | $duplicate = "false"; |
| 780 | 775 | if (isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == "true") { |
| 781 | 776 | $duplicate = "true"; |
@@ -793,7 +788,7 @@ discard block |
||
| 793 | 788 | * getActionFilename |
| 794 | 789 | */ |
| 795 | 790 | public static function getActionFilename($action) { |
| 796 | - if(isset(self::$action_case_file[$action])) { |
|
| 791 | + if (isset(self::$action_case_file[$action])) { |
|
| 797 | 792 | return self::$action_case_file[$action]; |
| 798 | 793 | } |
| 799 | 794 | return $action; |
@@ -810,40 +805,40 @@ discard block |
||
| 810 | 805 | * |
| 811 | 806 | * @return true if we want to stop processing, false if processing should continue |
| 812 | 807 | */ |
| 813 | - private function blockFileAccess(){ |
|
| 808 | + private function blockFileAccess() { |
|
| 814 | 809 | //check if the we have enabled file_access_control and if so then check the mappings on the request; |
| 815 | - if(!empty($GLOBALS['sugar_config']['admin_access_control']) && $GLOBALS['sugar_config']['admin_access_control']){ |
|
| 810 | + if (!empty($GLOBALS['sugar_config']['admin_access_control']) && $GLOBALS['sugar_config']['admin_access_control']) { |
|
| 816 | 811 | $this->loadMapping('file_access_control_map'); |
| 817 | 812 | //since we have this turned on, check the mapping file |
| 818 | 813 | $module = strtolower($this->module); |
| 819 | 814 | $action = strtolower($this->do_action); |
| 820 | - if(!empty($this->file_access_control_map['modules'][$module]['links'])){ |
|
| 815 | + if (!empty($this->file_access_control_map['modules'][$module]['links'])) { |
|
| 821 | 816 | $GLOBALS['admin_access_control_links'] = $this->file_access_control_map['modules'][$module]['links']; |
| 822 | 817 | } |
| 823 | 818 | |
| 824 | - if(!empty($this->file_access_control_map['modules'][$module]['actions']) && (in_array($action, $this->file_access_control_map['modules'][$module]['actions']) || !empty($this->file_access_control_map['modules'][$module]['actions'][$action]))){ |
|
| 819 | + if (!empty($this->file_access_control_map['modules'][$module]['actions']) && (in_array($action, $this->file_access_control_map['modules'][$module]['actions']) || !empty($this->file_access_control_map['modules'][$module]['actions'][$action]))) { |
|
| 825 | 820 | //check params |
| 826 | - if(!empty($this->file_access_control_map['modules'][$module]['actions'][$action]['params'])){ |
|
| 821 | + if (!empty($this->file_access_control_map['modules'][$module]['actions'][$action]['params'])) { |
|
| 827 | 822 | $block = true; |
| 828 | 823 | $params = $this->file_access_control_map['modules'][$module]['actions'][$action]['params']; |
| 829 | - foreach($params as $param => $paramVals){ |
|
| 830 | - if(!empty($_REQUEST[$param])){ |
|
| 831 | - if(!in_array($_REQUEST[$param], $paramVals)){ |
|
| 824 | + foreach ($params as $param => $paramVals) { |
|
| 825 | + if (!empty($_REQUEST[$param])) { |
|
| 826 | + if (!in_array($_REQUEST[$param], $paramVals)) { |
|
| 832 | 827 | $block = false; |
| 833 | 828 | break; |
| 834 | 829 | } |
| 835 | 830 | } |
| 836 | 831 | } |
| 837 | - if($block){ |
|
| 832 | + if ($block) { |
|
| 838 | 833 | $this->_processed = true; |
| 839 | 834 | $this->no_access(); |
| 840 | 835 | } |
| 841 | - }else{ |
|
| 836 | + } else { |
|
| 842 | 837 | $this->_processed = true; |
| 843 | 838 | $this->no_access(); |
| 844 | 839 | } |
| 845 | 840 | } |
| 846 | - }else |
|
| 841 | + } else |
|
| 847 | 842 | $this->_processed = false; |
| 848 | 843 | } |
| 849 | 844 | |
@@ -855,12 +850,12 @@ discard block |
||
| 855 | 850 | * the download entry point is mapped in the following file: entry_point_registry.php |
| 856 | 851 | * |
| 857 | 852 | */ |
| 858 | - private function handleEntryPoint(){ |
|
| 859 | - if(!empty($_REQUEST['entryPoint'])){ |
|
| 853 | + private function handleEntryPoint() { |
|
| 854 | + if (!empty($_REQUEST['entryPoint'])) { |
|
| 860 | 855 | $this->loadMapping('entry_point_registry'); |
| 861 | 856 | $entryPoint = $_REQUEST['entryPoint']; |
| 862 | 857 | |
| 863 | - if(!empty($this->entry_point_registry[$entryPoint])){ |
|
| 858 | + if (!empty($this->entry_point_registry[$entryPoint])) { |
|
| 864 | 859 | require_once($this->entry_point_registry[$entryPoint]['file']); |
| 865 | 860 | $this->_processed = true; |
| 866 | 861 | $this->view = ''; |
@@ -878,8 +873,8 @@ discard block |
||
| 878 | 873 | { |
| 879 | 874 | $this->loadMapping('entry_point_registry'); |
| 880 | 875 | |
| 881 | - if ( isset($this->entry_point_registry[$entryPoint]['auth']) |
|
| 882 | - && !$this->entry_point_registry[$entryPoint]['auth'] ) |
|
| 876 | + if (isset($this->entry_point_registry[$entryPoint]['auth']) |
|
| 877 | + && !$this->entry_point_registry[$entryPoint]['auth']) |
|
| 883 | 878 | return false; |
| 884 | 879 | return true; |
| 885 | 880 | } |
@@ -891,26 +886,26 @@ discard block |
||
| 891 | 886 | protected function callLegacyCode() |
| 892 | 887 | { |
| 893 | 888 | $file = self::getActionFilename($this->do_action); |
| 894 | - if ( isset($this->action_view_map[strtolower($this->do_action)]) ) { |
|
| 889 | + if (isset($this->action_view_map[strtolower($this->do_action)])) { |
|
| 895 | 890 | $action = $this->action_view_map[strtolower($this->do_action)]; |
| 896 | 891 | } |
| 897 | 892 | else { |
| 898 | 893 | $action = $this->do_action; |
| 899 | 894 | } |
| 900 | 895 | // index actions actually maps to the view.list.php view |
| 901 | - if ( $action == 'index' ) { |
|
| 896 | + if ($action == 'index') { |
|
| 902 | 897 | $action = 'list'; |
| 903 | 898 | } |
| 904 | 899 | |
| 905 | - if ((file_exists('modules/' . $this->module . '/'. $file . '.php') |
|
| 906 | - && !file_exists('modules/' . $this->module . '/views/view.'. $action . '.php')) |
|
| 907 | - || (file_exists('custom/modules/' . $this->module . '/'. $file . '.php') |
|
| 908 | - && !file_exists('custom/modules/' . $this->module . '/views/view.'. $action . '.php')) |
|
| 900 | + if ((file_exists('modules/'.$this->module.'/'.$file.'.php') |
|
| 901 | + && !file_exists('modules/'.$this->module.'/views/view.'.$action.'.php')) |
|
| 902 | + || (file_exists('custom/modules/'.$this->module.'/'.$file.'.php') |
|
| 903 | + && !file_exists('custom/modules/'.$this->module.'/views/view.'.$action.'.php')) |
|
| 909 | 904 | ) { |
| 910 | 905 | // A 'classic' module, using the old pre-MVC display files |
| 911 | 906 | // We should now discard the bean we just obtained for tracking as the pre-MVC module will instantiate its own |
| 912 | 907 | unset($GLOBALS['FOCUS']); |
| 913 | - $GLOBALS['log']->debug('Module:' . $this->module . ' using file: '. $file); |
|
| 908 | + $GLOBALS['log']->debug('Module:'.$this->module.' using file: '.$file); |
|
| 914 | 909 | $this->action_default(); |
| 915 | 910 | $this->_processed = true; |
| 916 | 911 | } |
@@ -921,17 +916,17 @@ discard block |
||
| 921 | 916 | * action_file_map.php or action_view_map.php load those maps here. |
| 922 | 917 | * |
| 923 | 918 | */ |
| 924 | - private function handleActionMaps(){ |
|
| 925 | - if(!empty($this->action_file_map[strtolower($this->do_action)])){ |
|
| 919 | + private function handleActionMaps() { |
|
| 920 | + if (!empty($this->action_file_map[strtolower($this->do_action)])) { |
|
| 926 | 921 | $this->view = ''; |
| 927 | - $GLOBALS['log']->debug('Using Action File Map:' . $this->action_file_map[strtolower($this->do_action)]); |
|
| 922 | + $GLOBALS['log']->debug('Using Action File Map:'.$this->action_file_map[strtolower($this->do_action)]); |
|
| 928 | 923 | require_once($this->action_file_map[strtolower($this->do_action)]); |
| 929 | 924 | $this->_processed = true; |
| 930 | - }elseif(!empty($this->action_view_map[strtolower($this->do_action)])){ |
|
| 931 | - $GLOBALS['log']->debug('Using Action View Map:' . $this->action_view_map[strtolower($this->do_action)]); |
|
| 925 | + }elseif (!empty($this->action_view_map[strtolower($this->do_action)])) { |
|
| 926 | + $GLOBALS['log']->debug('Using Action View Map:'.$this->action_view_map[strtolower($this->do_action)]); |
|
| 932 | 927 | $this->view = $this->action_view_map[strtolower($this->do_action)]; |
| 933 | 928 | $this->_processed = true; |
| 934 | - }else |
|
| 929 | + } else |
|
| 935 | 930 | $this->no_action(); |
| 936 | 931 | } |
| 937 | 932 | |
@@ -939,8 +934,8 @@ discard block |
||
| 939 | 934 | * Actually remap the action if required. |
| 940 | 935 | * |
| 941 | 936 | */ |
| 942 | - protected function remapAction(){ |
|
| 943 | - if(!empty($this->action_remap[$this->do_action])){ |
|
| 937 | + protected function remapAction() { |
|
| 938 | + if (!empty($this->action_remap[$this->do_action])) { |
|
| 944 | 939 | $this->action = $this->action_remap[$this->do_action]; |
| 945 | 940 | $this->do_action = $this->action; |
| 946 | 941 | } |
@@ -172,8 +172,7 @@ discard block |
||
| 172 | 172 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 173 | 173 | if(isset($GLOBALS['log'])) { |
| 174 | 174 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 175 | - } |
|
| 176 | - else { |
|
| 175 | + } else { |
|
| 177 | 176 | trigger_error($deprecatedMessage, E_USER_DEPRECATED); |
| 178 | 177 | } |
| 179 | 178 | self::__construct(); |
@@ -186,11 +185,13 @@ discard block |
||
| 186 | 185 | * |
| 187 | 186 | */ |
| 188 | 187 | public function setup($module = ''){ |
| 189 | - if(empty($module) && !empty($_REQUEST['module'])) |
|
| 190 | - $module = $_REQUEST['module']; |
|
| 188 | + if(empty($module) && !empty($_REQUEST['module'])) { |
|
| 189 | + $module = $_REQUEST['module']; |
|
| 190 | + } |
|
| 191 | 191 | //set the module |
| 192 | - if(!empty($module)) |
|
| 193 | - $this->setModule($module); |
|
| 192 | + if(!empty($module)) { |
|
| 193 | + $this->setModule($module); |
|
| 194 | + } |
|
| 194 | 195 | |
| 195 | 196 | if(!empty($_REQUEST['target_module']) && $_REQUEST['target_module'] != 'undefined') { |
| 196 | 197 | $this->target_module = $_REQUEST['target_module']; |
@@ -214,18 +215,24 @@ discard block |
||
| 214 | 215 | * |
| 215 | 216 | */ |
| 216 | 217 | private function loadPropertiesFromRequest(){ |
| 217 | - if(!empty($_REQUEST['action'])) |
|
| 218 | - $this->action = $_REQUEST['action']; |
|
| 219 | - if(!empty($_REQUEST['record'])) |
|
| 220 | - $this->record = $_REQUEST['record']; |
|
| 221 | - if(!empty($_REQUEST['view'])) |
|
| 222 | - $this->view = $_REQUEST['view']; |
|
| 223 | - if(!empty($_REQUEST['return_module'])) |
|
| 224 | - $this->return_module = $_REQUEST['return_module']; |
|
| 225 | - if(!empty($_REQUEST['return_action'])) |
|
| 226 | - $this->return_action = $_REQUEST['return_action']; |
|
| 227 | - if(!empty($_REQUEST['return_id'])) |
|
| 228 | - $this->return_id = $_REQUEST['return_id']; |
|
| 218 | + if(!empty($_REQUEST['action'])) { |
|
| 219 | + $this->action = $_REQUEST['action']; |
|
| 220 | + } |
|
| 221 | + if(!empty($_REQUEST['record'])) { |
|
| 222 | + $this->record = $_REQUEST['record']; |
|
| 223 | + } |
|
| 224 | + if(!empty($_REQUEST['view'])) { |
|
| 225 | + $this->view = $_REQUEST['view']; |
|
| 226 | + } |
|
| 227 | + if(!empty($_REQUEST['return_module'])) { |
|
| 228 | + $this->return_module = $_REQUEST['return_module']; |
|
| 229 | + } |
|
| 230 | + if(!empty($_REQUEST['return_action'])) { |
|
| 231 | + $this->return_action = $_REQUEST['return_action']; |
|
| 232 | + } |
|
| 233 | + if(!empty($_REQUEST['return_id'])) { |
|
| 234 | + $this->return_id = $_REQUEST['return_id']; |
|
| 235 | + } |
|
| 229 | 236 | } |
| 230 | 237 | |
| 231 | 238 | /** |
@@ -250,8 +257,9 @@ discard block |
||
| 250 | 257 | $this->bean = new $class(); |
| 251 | 258 | if(!empty($this->record)){ |
| 252 | 259 | $this->bean->retrieve($this->record); |
| 253 | - if($this->bean) |
|
| 254 | - $GLOBALS['FOCUS'] = $this->bean; |
|
| 260 | + if($this->bean) { |
|
| 261 | + $GLOBALS['FOCUS'] = $this->bean; |
|
| 262 | + } |
|
| 255 | 263 | } |
| 256 | 264 | } |
| 257 | 265 | } |
@@ -265,7 +273,7 @@ discard block |
||
| 265 | 273 | if(!$$var){ |
| 266 | 274 | if($merge && !empty($this->$var)){ |
| 267 | 275 | $$var = $this->$var; |
| 268 | - }else{ |
|
| 276 | + } else{ |
|
| 269 | 277 | $$var = array(); |
| 270 | 278 | } |
| 271 | 279 | if(file_exists('include/MVC/Controller/'. $var . '.php')){ |
@@ -308,13 +316,11 @@ discard block |
||
| 308 | 316 | if(!empty($this->view)) |
| 309 | 317 | { |
| 310 | 318 | $this->processView(); |
| 311 | - } |
|
| 312 | - elseif(!empty($this->redirect_url)) |
|
| 319 | + } elseif(!empty($this->redirect_url)) |
|
| 313 | 320 | { |
| 314 | 321 | $this->redirect(); |
| 315 | 322 | } |
| 316 | - } |
|
| 317 | - catch (Exception $e) |
|
| 323 | + } catch (Exception $e) |
|
| 318 | 324 | { |
| 319 | 325 | $this->handleException($e); |
| 320 | 326 | } |
@@ -336,8 +342,7 @@ discard block |
||
| 336 | 342 | { |
| 337 | 343 | $logicHook->setBean($this->bean); |
| 338 | 344 | $logicHook->call_custom_logic($this->bean->module_dir, "handle_exception", $e); |
| 339 | - } |
|
| 340 | - else |
|
| 345 | + } else |
|
| 341 | 346 | { |
| 342 | 347 | $logicHook->call_custom_logic('', "handle_exception", $e); |
| 343 | 348 | } |
@@ -399,7 +404,7 @@ discard block |
||
| 399 | 404 | } |
| 400 | 405 | |
| 401 | 406 | $this->redirect(); |
| 402 | - }else{ |
|
| 407 | + } else{ |
|
| 403 | 408 | $this->no_access(); |
| 404 | 409 | } |
| 405 | 410 | } |
@@ -506,8 +511,9 @@ discard block |
||
| 506 | 511 | */ |
| 507 | 512 | protected function redirect(){ |
| 508 | 513 | |
| 509 | - if(!empty($this->redirect_url)) |
|
| 510 | - SugarApplication::redirect($this->redirect_url); |
|
| 514 | + if(!empty($this->redirect_url)) { |
|
| 515 | + SugarApplication::redirect($this->redirect_url); |
|
| 516 | + } |
|
| 511 | 517 | } |
| 512 | 518 | |
| 513 | 519 | //////////////////////////////////////////////////////// |
@@ -600,7 +606,7 @@ discard block |
||
| 600 | 606 | sugar_cleanup(true); |
| 601 | 607 | } |
| 602 | 608 | $this->bean->mark_deleted($_REQUEST['record']); |
| 603 | - }else{ |
|
| 609 | + } else{ |
|
| 604 | 610 | sugar_die("A record number must be specified to delete"); |
| 605 | 611 | } |
| 606 | 612 | } |
@@ -666,7 +672,7 @@ discard block |
||
| 666 | 672 | unset($_REQUEST[$seed->module_dir.'2_'.strtoupper($seed->object_name).'_offset']);//after massupdate, the page should redirect to no offset page |
| 667 | 673 | $storeQuery->saveFromRequest($_REQUEST['module']); |
| 668 | 674 | $_REQUEST = array('return_module' => $temp_req['return_module'], 'return_action' => $temp_req['return_action']);//for post_massupdate, to go back to original page. |
| 669 | - }else{ |
|
| 675 | + } else{ |
|
| 670 | 676 | sugar_die("You must massupdate at least one record"); |
| 671 | 677 | } |
| 672 | 678 | } |
@@ -725,8 +731,7 @@ discard block |
||
| 725 | 731 | |
| 726 | 732 | if(method_exists($dashlet, $requestedMethod) || method_exists($dashlet, '__call')) { |
| 727 | 733 | echo $dashlet->$requestedMethod(); |
| 728 | - } |
|
| 729 | - else { |
|
| 734 | + } else { |
|
| 730 | 735 | echo 'no method'; |
| 731 | 736 | } |
| 732 | 737 | } |
@@ -748,15 +753,13 @@ discard block |
||
| 748 | 753 | if(!empty($_REQUEST['configure']) && $_REQUEST['configure']) { // save settings |
| 749 | 754 | $dashletDefs[$id]['options'] = $dashlet->saveOptions($_REQUEST); |
| 750 | 755 | $current_user->setPreference('dashlets', $dashletDefs, 0, $_REQUEST['module']); |
| 751 | - } |
|
| 752 | - else { // display options |
|
| 756 | + } else { // display options |
|
| 753 | 757 | $json = getJSONobj(); |
| 754 | 758 | return 'result = ' . $json->encode((array('header' => $dashlet->title . ' : ' . $mod_strings['LBL_OPTIONS'], |
| 755 | 759 | 'body' => $dashlet->displayOptions()))); |
| 756 | 760 | |
| 757 | 761 | } |
| 758 | - } |
|
| 759 | - else { |
|
| 762 | + } else { |
|
| 760 | 763 | return '0'; |
| 761 | 764 | } |
| 762 | 765 | } |
@@ -838,13 +841,14 @@ discard block |
||
| 838 | 841 | $this->_processed = true; |
| 839 | 842 | $this->no_access(); |
| 840 | 843 | } |
| 841 | - }else{ |
|
| 844 | + } else{ |
|
| 842 | 845 | $this->_processed = true; |
| 843 | 846 | $this->no_access(); |
| 844 | 847 | } |
| 845 | 848 | } |
| 846 | - }else |
|
| 847 | - $this->_processed = false; |
|
| 849 | + } else { |
|
| 850 | + $this->_processed = false; |
|
| 851 | + } |
|
| 848 | 852 | } |
| 849 | 853 | |
| 850 | 854 | /** |
@@ -879,8 +883,9 @@ discard block |
||
| 879 | 883 | $this->loadMapping('entry_point_registry'); |
| 880 | 884 | |
| 881 | 885 | if ( isset($this->entry_point_registry[$entryPoint]['auth']) |
| 882 | - && !$this->entry_point_registry[$entryPoint]['auth'] ) |
|
| 883 | - return false; |
|
| 886 | + && !$this->entry_point_registry[$entryPoint]['auth'] ) { |
|
| 887 | + return false; |
|
| 888 | + } |
|
| 884 | 889 | return true; |
| 885 | 890 | } |
| 886 | 891 | |
@@ -893,8 +898,7 @@ discard block |
||
| 893 | 898 | $file = self::getActionFilename($this->do_action); |
| 894 | 899 | if ( isset($this->action_view_map[strtolower($this->do_action)]) ) { |
| 895 | 900 | $action = $this->action_view_map[strtolower($this->do_action)]; |
| 896 | - } |
|
| 897 | - else { |
|
| 901 | + } else { |
|
| 898 | 902 | $action = $this->do_action; |
| 899 | 903 | } |
| 900 | 904 | // index actions actually maps to the view.list.php view |
@@ -927,12 +931,13 @@ discard block |
||
| 927 | 931 | $GLOBALS['log']->debug('Using Action File Map:' . $this->action_file_map[strtolower($this->do_action)]); |
| 928 | 932 | require_once($this->action_file_map[strtolower($this->do_action)]); |
| 929 | 933 | $this->_processed = true; |
| 930 | - }elseif(!empty($this->action_view_map[strtolower($this->do_action)])){ |
|
| 934 | + } elseif(!empty($this->action_view_map[strtolower($this->do_action)])){ |
|
| 931 | 935 | $GLOBALS['log']->debug('Using Action View Map:' . $this->action_view_map[strtolower($this->do_action)]); |
| 932 | 936 | $this->view = $this->action_view_map[strtolower($this->do_action)]; |
| 933 | 937 | $this->_processed = true; |
| 934 | - }else |
|
| 935 | - $this->no_action(); |
|
| 938 | + } else { |
|
| 939 | + $this->no_action(); |
|
| 940 | + } |
|
| 936 | 941 | } |
| 937 | 942 | |
| 938 | 943 | /** |
@@ -98,9 +98,9 @@ discard block |
||
| 98 | 98 | */ |
| 99 | 99 | public function SugarView($bean = null, |
| 100 | 100 | $view_object_map = array() |
| 101 | - ){ |
|
| 101 | + ) { |
|
| 102 | 102 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 103 | - if(isset($GLOBALS['log'])) { |
|
| 103 | + if (isset($GLOBALS['log'])) { |
|
| 104 | 104 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 105 | 105 | } |
| 106 | 106 | else { |
@@ -141,9 +141,9 @@ discard block |
||
| 141 | 141 | $this->_trackView(); |
| 142 | 142 | |
| 143 | 143 | //For the ajaxUI, we need to use output buffering to return the page in an ajax friendly format |
| 144 | - if ($this->_getOption('json_output')){ |
|
| 144 | + if ($this->_getOption('json_output')) { |
|
| 145 | 145 | ob_start(); |
| 146 | - if(!empty($_REQUEST['ajax_load']) && !empty($_REQUEST['loadLanguageJS'])) { |
|
| 146 | + if (!empty($_REQUEST['ajax_load']) && !empty($_REQUEST['loadLanguageJS'])) { |
|
| 147 | 147 | echo $this->_getModLanguageJS(); |
| 148 | 148 | } |
| 149 | 149 | } |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | $this->preDisplay(); |
| 159 | 159 | $this->displayErrors(); |
| 160 | 160 | $this->display(); |
| 161 | - if ( !empty($this->module) ) { |
|
| 161 | + if (!empty($this->module)) { |
|
| 162 | 162 | $GLOBALS['logic_hook']->call_custom_logic($this->module, 'after_ui_frame'); |
| 163 | 163 | } else { |
| 164 | 164 | $GLOBALS['logic_hook']->call_custom_logic('', 'after_ui_frame'); |
@@ -203,10 +203,10 @@ discard block |
||
| 203 | 203 | 'favicon' => $this->getFavicon(), |
| 204 | 204 | ); |
| 205 | 205 | |
| 206 | - if(SugarThemeRegistry::current()->name == 'Classic' || SugarThemeRegistry::current()->classic) |
|
| 206 | + if (SugarThemeRegistry::current()->name == 'Classic' || SugarThemeRegistry::current()->classic) |
|
| 207 | 207 | $ajax_ret['moduleList'] = $this->displayHeader(true); |
| 208 | 208 | |
| 209 | - if(empty($this->responseTime)) |
|
| 209 | + if (empty($this->responseTime)) |
|
| 210 | 210 | $this->_calculateFooterMetrics(); |
| 211 | 211 | $ajax_ret['responseTime'] = $this->responseTime; |
| 212 | 212 | $json = getJSONobj(); |
@@ -225,11 +225,11 @@ discard block |
||
| 225 | 225 | { |
| 226 | 226 | $errors = ''; |
| 227 | 227 | |
| 228 | - foreach($this->errors as $error) { |
|
| 229 | - $errors .= '<span class="error">' . $error . '</span><br>'; |
|
| 228 | + foreach ($this->errors as $error) { |
|
| 229 | + $errors .= '<span class="error">'.$error.'</span><br>'; |
|
| 230 | 230 | } |
| 231 | 231 | |
| 232 | - if ( !$this->suppressDisplayErrors ) { |
|
| 232 | + if (!$this->suppressDisplayErrors) { |
|
| 233 | 233 | echo $errors; |
| 234 | 234 | } |
| 235 | 235 | else { |
@@ -266,14 +266,14 @@ discard block |
||
| 266 | 266 | { |
| 267 | 267 | $action = strtolower($this->action); |
| 268 | 268 | //Skip save, tracked in SugarBean instead |
| 269 | - if($action == 'save') { |
|
| 269 | + if ($action == 'save') { |
|
| 270 | 270 | return; |
| 271 | 271 | } |
| 272 | 272 | |
| 273 | 273 | |
| 274 | 274 | $trackerManager = TrackerManager::getInstance(); |
| 275 | 275 | $timeStamp = TimeDate::getInstance()->nowDb(); |
| 276 | - if($monitor = $trackerManager->getMonitor('tracker')){ |
|
| 276 | + if ($monitor = $trackerManager->getMonitor('tracker')) { |
|
| 277 | 277 | $monitor->setValue('action', $action); |
| 278 | 278 | $monitor->setValue('user_id', $GLOBALS['current_user']->id); |
| 279 | 279 | $monitor->setValue('module_name', $this->module); |
@@ -288,7 +288,7 @@ discard block |
||
| 288 | 288 | |
| 289 | 289 | //If visible is true, but there is no bean, do not track (invalid/unauthorized reference) |
| 290 | 290 | //Also, do not track save actions where there is no bean id |
| 291 | - if($monitor->visible && empty($this->bean->id)) { |
|
| 291 | + if ($monitor->visible && empty($this->bean->id)) { |
|
| 292 | 292 | $trackerManager->unsetMonitor($monitor); |
| 293 | 293 | return; |
| 294 | 294 | } |
@@ -300,7 +300,7 @@ discard block |
||
| 300 | 300 | /** |
| 301 | 301 | * Displays the header on section of the page; basically everything before the content |
| 302 | 302 | */ |
| 303 | - public function displayHeader($retModTabs=false) |
|
| 303 | + public function displayHeader($retModTabs = false) |
|
| 304 | 304 | { |
| 305 | 305 | global $theme; |
| 306 | 306 | global $max_tabs; |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | $ss->assign("APP", $app_strings); |
| 321 | 321 | $ss->assign("THEME", $theme); |
| 322 | 322 | $ss->assign("THEME_CONFIG", $themeObject->getConfig()); |
| 323 | - $ss->assign("THEME_IE6COMPAT", $themeObject->ie6compat ? 'true':'false'); |
|
| 323 | + $ss->assign("THEME_IE6COMPAT", $themeObject->ie6compat ? 'true' : 'false'); |
|
| 324 | 324 | $ss->assign("MODULE_NAME", $this->module); |
| 325 | 325 | $ss->assign("langHeader", get_language_header()); |
| 326 | 326 | |
@@ -336,17 +336,17 @@ discard block |
||
| 336 | 336 | if ($this->_getOption('view_print')) { |
| 337 | 337 | $css .= '<link rel="stylesheet" type="text/css" href="'.$themeObject->getCSSURL('print.css').'" media="all" />'; |
| 338 | 338 | } |
| 339 | - $ss->assign("SUGAR_CSS",$css); |
|
| 339 | + $ss->assign("SUGAR_CSS", $css); |
|
| 340 | 340 | |
| 341 | 341 | // get javascript |
| 342 | 342 | ob_start(); |
| 343 | 343 | $this->renderJavascript(); |
| 344 | 344 | |
| 345 | - $ss->assign("SUGAR_JS",ob_get_contents().$themeObject->getJS()); |
|
| 345 | + $ss->assign("SUGAR_JS", ob_get_contents().$themeObject->getJS()); |
|
| 346 | 346 | ob_end_clean(); |
| 347 | 347 | |
| 348 | 348 | // get favicon |
| 349 | - if(isset($GLOBALS['sugar_config']['default_module_favicon'])) |
|
| 349 | + if (isset($GLOBALS['sugar_config']['default_module_favicon'])) |
|
| 350 | 350 | $module_favicon = $GLOBALS['sugar_config']['default_module_favicon']; |
| 351 | 351 | else |
| 352 | 352 | $module_favicon = false; |
@@ -356,24 +356,24 @@ discard block |
||
| 356 | 356 | |
| 357 | 357 | // build the shortcut menu |
| 358 | 358 | $shortcut_menu = array(); |
| 359 | - foreach ( $this->getMenu() as $key => $menu_item ) |
|
| 359 | + foreach ($this->getMenu() as $key => $menu_item) |
|
| 360 | 360 | $shortcut_menu[$key] = array( |
| 361 | 361 | "URL" => $menu_item[0], |
| 362 | 362 | "LABEL" => $menu_item[1], |
| 363 | 363 | "MODULE_NAME" => $menu_item[2], |
| 364 | 364 | "IMAGE" => $themeObject |
| 365 | - ->getImage($menu_item[2],"border='0' align='absmiddle'",null,null,'.gif',$menu_item[1]), |
|
| 365 | + ->getImage($menu_item[2], "border='0' align='absmiddle'", null, null, '.gif', $menu_item[1]), |
|
| 366 | 366 | ); |
| 367 | - $ss->assign("SHORTCUT_MENU",$shortcut_menu); |
|
| 367 | + $ss->assign("SHORTCUT_MENU", $shortcut_menu); |
|
| 368 | 368 | |
| 369 | 369 | // handle rtl text direction |
| 370 | - if(isset($_REQUEST['RTL']) && $_REQUEST['RTL'] == 'RTL'){ |
|
| 370 | + if (isset($_REQUEST['RTL']) && $_REQUEST['RTL'] == 'RTL') { |
|
| 371 | 371 | $_SESSION['RTL'] = true; |
| 372 | 372 | } |
| 373 | - if(isset($_REQUEST['LTR']) && $_REQUEST['LTR'] == 'LTR'){ |
|
| 373 | + if (isset($_REQUEST['LTR']) && $_REQUEST['LTR'] == 'LTR') { |
|
| 374 | 374 | unset($_SESSION['RTL']); |
| 375 | 375 | } |
| 376 | - if(isset($_SESSION['RTL']) && $_SESSION['RTL']){ |
|
| 376 | + if (isset($_SESSION['RTL']) && $_SESSION['RTL']) { |
|
| 377 | 377 | $ss->assign("DIR", 'dir="RTL"'); |
| 378 | 378 | } |
| 379 | 379 | |
@@ -383,7 +383,7 @@ discard block |
||
| 383 | 383 | $companyLogoURL = $companyLogoURL_arr[0]; |
| 384 | 384 | |
| 385 | 385 | $company_logo_attributes = sugar_cache_retrieve('company_logo_attributes'); |
| 386 | - if(!empty($company_logo_attributes)) { |
|
| 386 | + if (!empty($company_logo_attributes)) { |
|
| 387 | 387 | $ss->assign("COMPANY_LOGO_MD5", $company_logo_attributes[0]); |
| 388 | 388 | $ss->assign("COMPANY_LOGO_WIDTH", $company_logo_attributes[1]); |
| 389 | 389 | $ss->assign("COMPANY_LOGO_HEIGHT", $company_logo_attributes[2]); |
@@ -392,16 +392,16 @@ discard block |
||
| 392 | 392 | // Always need to md5 the file |
| 393 | 393 | $ss->assign("COMPANY_LOGO_MD5", md5_file($companyLogoURL)); |
| 394 | 394 | |
| 395 | - list($width,$height) = getimagesize($companyLogoURL); |
|
| 396 | - if ( $width > 212 || $height > 40 ) { |
|
| 397 | - $resizePctWidth = ($width - 212)/212; |
|
| 398 | - $resizePctHeight = ($height - 40)/40; |
|
| 399 | - if ( $resizePctWidth > $resizePctHeight ) |
|
| 395 | + list($width, $height) = getimagesize($companyLogoURL); |
|
| 396 | + if ($width > 212 || $height > 40) { |
|
| 397 | + $resizePctWidth = ($width - 212) / 212; |
|
| 398 | + $resizePctHeight = ($height - 40) / 40; |
|
| 399 | + if ($resizePctWidth > $resizePctHeight) |
|
| 400 | 400 | $resizeAmount = $width / 212; |
| 401 | 401 | else |
| 402 | 402 | $resizeAmount = $height / 40; |
| 403 | - $ss->assign("COMPANY_LOGO_WIDTH", round($width * (1/$resizeAmount))); |
|
| 404 | - $ss->assign("COMPANY_LOGO_HEIGHT", round($height * (1/$resizeAmount))); |
|
| 403 | + $ss->assign("COMPANY_LOGO_WIDTH", round($width * (1 / $resizeAmount))); |
|
| 404 | + $ss->assign("COMPANY_LOGO_HEIGHT", round($height * (1 / $resizeAmount))); |
|
| 405 | 405 | } |
| 406 | 406 | else { |
| 407 | 407 | $ss->assign("COMPANY_LOGO_WIDTH", $width); |
@@ -417,110 +417,110 @@ discard block |
||
| 417 | 417 | ) |
| 418 | 418 | ); |
| 419 | 419 | } |
| 420 | - $ss->assign("COMPANY_LOGO_URL",getJSPath($companyLogoURL)."&logo_md5=".$ss->get_template_vars("COMPANY_LOGO_MD5")); |
|
| 420 | + $ss->assign("COMPANY_LOGO_URL", getJSPath($companyLogoURL)."&logo_md5=".$ss->get_template_vars("COMPANY_LOGO_MD5")); |
|
| 421 | 421 | |
| 422 | 422 | // get the global links |
| 423 | 423 | $gcls = array(); |
| 424 | 424 | $global_control_links = array(); |
| 425 | 425 | require("include/globalControlLinks.php"); |
| 426 | 426 | |
| 427 | - foreach($global_control_links as $key => $value) { |
|
| 428 | - if ($key == 'users') { //represents logout link. |
|
| 427 | + foreach ($global_control_links as $key => $value) { |
|
| 428 | + if ($key == 'users') { //represents logout link. |
|
| 429 | 429 | $ss->assign("LOGOUT_LINK", $value['linkinfo'][key($value['linkinfo'])]); |
| 430 | - $ss->assign("LOGOUT_LABEL", key($value['linkinfo']));//key value for first element. |
|
| 430 | + $ss->assign("LOGOUT_LABEL", key($value['linkinfo'])); //key value for first element. |
|
| 431 | 431 | continue; |
| 432 | 432 | } |
| 433 | 433 | |
| 434 | 434 | foreach ($value as $linkattribute => $attributevalue) { |
| 435 | 435 | // get the main link info |
| 436 | - if ( $linkattribute == 'linkinfo' ) { |
|
| 436 | + if ($linkattribute == 'linkinfo') { |
|
| 437 | 437 | $gcls[$key] = array( |
| 438 | 438 | "LABEL" => key($attributevalue), |
| 439 | 439 | "URL" => current($attributevalue), |
| 440 | 440 | "SUBMENU" => array(), |
| 441 | 441 | ); |
| 442 | - if(substr($gcls[$key]["URL"], 0, 11) == "javascript:") { |
|
| 443 | - $gcls[$key]["ONCLICK"] = substr($gcls[$key]["URL"],11); |
|
| 442 | + if (substr($gcls[$key]["URL"], 0, 11) == "javascript:") { |
|
| 443 | + $gcls[$key]["ONCLICK"] = substr($gcls[$key]["URL"], 11); |
|
| 444 | 444 | $gcls[$key]["URL"] = "javascript:void(0)"; |
| 445 | 445 | } |
| 446 | 446 | } |
| 447 | 447 | // and now the sublinks |
| 448 | - if ( $linkattribute == 'submenu' && is_array($attributevalue) ) { |
|
| 448 | + if ($linkattribute == 'submenu' && is_array($attributevalue)) { |
|
| 449 | 449 | foreach ($attributevalue as $submenulinkkey => $submenulinkinfo) |
| 450 | 450 | $gcls[$key]['SUBMENU'][$submenulinkkey] = array( |
| 451 | 451 | "LABEL" => key($submenulinkinfo), |
| 452 | 452 | "URL" => current($submenulinkinfo), |
| 453 | 453 | ); |
| 454 | - if(substr($gcls[$key]['SUBMENU'][$submenulinkkey]["URL"], 0, 11) == "javascript:") { |
|
| 455 | - $gcls[$key]['SUBMENU'][$submenulinkkey]["ONCLICK"] = substr($gcls[$key]['SUBMENU'][$submenulinkkey]["URL"],11); |
|
| 454 | + if (substr($gcls[$key]['SUBMENU'][$submenulinkkey]["URL"], 0, 11) == "javascript:") { |
|
| 455 | + $gcls[$key]['SUBMENU'][$submenulinkkey]["ONCLICK"] = substr($gcls[$key]['SUBMENU'][$submenulinkkey]["URL"], 11); |
|
| 456 | 456 | $gcls[$key]['SUBMENU'][$submenulinkkey]["URL"] = "javascript:void(0)"; |
| 457 | 457 | } |
| 458 | 458 | } |
| 459 | 459 | } |
| 460 | 460 | } |
| 461 | - $ss->assign("GCLS",$gcls); |
|
| 461 | + $ss->assign("GCLS", $gcls); |
|
| 462 | 462 | |
| 463 | 463 | $ss->assign("SEARCH", isset($_REQUEST['query_string']) ? $_REQUEST['query_string'] : ''); |
| 464 | 464 | |
| 465 | 465 | if ($this->action == "EditView" || $this->action == "Login") |
| 466 | 466 | $ss->assign("ONLOAD", 'onload="set_focus()"'); |
| 467 | 467 | |
| 468 | - $ss->assign("AUTHENTICATED",isset($_SESSION["authenticated_user_id"])); |
|
| 468 | + $ss->assign("AUTHENTICATED", isset($_SESSION["authenticated_user_id"])); |
|
| 469 | 469 | |
| 470 | 470 | // get other things needed for page style popup |
| 471 | 471 | if (isset($_SESSION["authenticated_user_id"])) { |
| 472 | 472 | // get the current user name and id |
| 473 | 473 | $ss->assign("CURRENT_USER", $current_user->full_name == '' || !showFullName() |
| 474 | - ? $current_user->user_name : $current_user->full_name ); |
|
| 474 | + ? $current_user->user_name : $current_user->full_name); |
|
| 475 | 475 | $ss->assign("CURRENT_USER_ID", $current_user->id); |
| 476 | 476 | |
| 477 | 477 | // get the last viewed records |
| 478 | 478 | require_once("modules/Favorites/Favorites.php"); |
| 479 | 479 | $favorites = new Favorites(); |
| 480 | 480 | $favorite_records = $favorites->getCurrentUserSidebarFavorites(); |
| 481 | - $ss->assign("favoriteRecords",$favorite_records); |
|
| 481 | + $ss->assign("favoriteRecords", $favorite_records); |
|
| 482 | 482 | |
| 483 | 483 | $tracker = new Tracker(); |
| 484 | 484 | $history = $tracker->get_recently_viewed($current_user->id); |
| 485 | - $ss->assign("recentRecords",$this->processRecentRecords($history)); |
|
| 485 | + $ss->assign("recentRecords", $this->processRecentRecords($history)); |
|
| 486 | 486 | } |
| 487 | 487 | |
| 488 | 488 | $bakModStrings = $mod_strings; |
| 489 | - if (isset($_SESSION["authenticated_user_id"]) ) { |
|
| 489 | + if (isset($_SESSION["authenticated_user_id"])) { |
|
| 490 | 490 | // get the module list |
| 491 | 491 | $moduleTopMenu = array(); |
| 492 | 492 | |
| 493 | 493 | $max_tabs = $current_user->getPreference('max_tabs'); |
| 494 | 494 | // Attempt to correct if max tabs count is extremely high. |
| 495 | - if ( !isset($max_tabs) || $max_tabs <= 0 || $max_tabs > 10 ) { |
|
| 495 | + if (!isset($max_tabs) || $max_tabs <= 0 || $max_tabs > 10) { |
|
| 496 | 496 | $max_tabs = $GLOBALS['sugar_config']['default_max_tabs']; |
| 497 | 497 | $current_user->setPreference('max_tabs', $max_tabs, 0, 'global'); |
| 498 | 498 | } |
| 499 | 499 | |
| 500 | 500 | $moduleTab = $this->_getModuleTab(); |
| 501 | - $ss->assign('MODULE_TAB',$moduleTab); |
|
| 501 | + $ss->assign('MODULE_TAB', $moduleTab); |
|
| 502 | 502 | |
| 503 | 503 | |
| 504 | 504 | // See if they are using grouped tabs or not (removed in 6.0, returned in 6.1) |
| 505 | 505 | $user_navigation_paradigm = $current_user->getPreference('navigation_paradigm'); |
| 506 | - if ( !isset($user_navigation_paradigm) ) { |
|
| 506 | + if (!isset($user_navigation_paradigm)) { |
|
| 507 | 507 | $user_navigation_paradigm = $GLOBALS['sugar_config']['default_navigation_paradigm']; |
| 508 | 508 | } |
| 509 | 509 | |
| 510 | 510 | |
| 511 | 511 | // Get the full module list for later use |
| 512 | - foreach ( query_module_access_list($current_user) as $module ) { |
|
| 512 | + foreach (query_module_access_list($current_user) as $module) { |
|
| 513 | 513 | // Bug 25948 - Check for the module being in the moduleList |
| 514 | - if ( isset($app_list_strings['moduleList'][$module]) ) { |
|
| 514 | + if (isset($app_list_strings['moduleList'][$module])) { |
|
| 515 | 515 | $fullModuleList[$module] = $app_list_strings['moduleList'][$module]; |
| 516 | 516 | } |
| 517 | 517 | } |
| 518 | 518 | |
| 519 | 519 | |
| 520 | - if(!should_hide_iframes()) { |
|
| 520 | + if (!should_hide_iframes()) { |
|
| 521 | 521 | $iFrame = new iFrame(); |
| 522 | 522 | $frames = $iFrame->lookup_frames('tab'); |
| 523 | - foreach($frames as $key => $values){ |
|
| 523 | + foreach ($frames as $key => $values) { |
|
| 524 | 524 | $fullModuleList[$key] = $values; |
| 525 | 525 | } |
| 526 | 526 | } |
@@ -528,7 +528,7 @@ discard block |
||
| 528 | 528 | unset($fullModuleList['iFrames']); |
| 529 | 529 | } |
| 530 | 530 | |
| 531 | - if ( $user_navigation_paradigm == 'gm' && isset($themeObject->group_tabs) && $themeObject->group_tabs) { |
|
| 531 | + if ($user_navigation_paradigm == 'gm' && isset($themeObject->group_tabs) && $themeObject->group_tabs) { |
|
| 532 | 532 | // We are using grouped tabs |
| 533 | 533 | require_once('include/GroupedTabs/GroupedTabStructure.php'); |
| 534 | 534 | $groupedTabsClass = new GroupedTabStructure(); |
@@ -536,12 +536,12 @@ discard block |
||
| 536 | 536 | //handle with submoremodules |
| 537 | 537 | $max_tabs = $current_user->getPreference('max_tabs'); |
| 538 | 538 | // If the max_tabs isn't set incorrectly, set it within the range, to the default max sub tabs size |
| 539 | - if ( !isset($max_tabs) || $max_tabs <= 0 || $max_tabs > 10){ |
|
| 539 | + if (!isset($max_tabs) || $max_tabs <= 0 || $max_tabs > 10) { |
|
| 540 | 540 | // We have a default value. Use it |
| 541 | - if(isset($GLOBALS['sugar_config']['default_max_tabs'])){ |
|
| 541 | + if (isset($GLOBALS['sugar_config']['default_max_tabs'])) { |
|
| 542 | 542 | $max_tabs = $GLOBALS['sugar_config']['default_max_tabs']; |
| 543 | 543 | } |
| 544 | - else{ |
|
| 544 | + else { |
|
| 545 | 545 | $max_tabs = 8; |
| 546 | 546 | } |
| 547 | 547 | } |
@@ -554,22 +554,22 @@ discard block |
||
| 554 | 554 | |
| 555 | 555 | // Setup the default group tab. |
| 556 | 556 | $allGroup = $app_strings['LBL_TABGROUP_ALL']; |
| 557 | - $ss->assign('currentGroupTab',$allGroup); |
|
| 557 | + $ss->assign('currentGroupTab', $allGroup); |
|
| 558 | 558 | $currentGroupTab = $allGroup; |
| 559 | 559 | $usersGroup = $current_user->getPreference('theme_current_group'); |
| 560 | 560 | // Figure out which tab they currently have selected (stored as a user preference) |
| 561 | - if ( !empty($usersGroup) && isset($groupTabs[$usersGroup]) ) { |
|
| 561 | + if (!empty($usersGroup) && isset($groupTabs[$usersGroup])) { |
|
| 562 | 562 | $currentGroupTab = $usersGroup; |
| 563 | 563 | } else { |
| 564 | - $current_user->setPreference('theme_current_group',$currentGroupTab); |
|
| 564 | + $current_user->setPreference('theme_current_group', $currentGroupTab); |
|
| 565 | 565 | } |
| 566 | 566 | |
| 567 | - $ss->assign('currentGroupTab',$currentGroupTab); |
|
| 567 | + $ss->assign('currentGroupTab', $currentGroupTab); |
|
| 568 | 568 | $usingGroupTabs = true; |
| 569 | 569 | |
| 570 | 570 | } else { |
| 571 | 571 | // Setup the default group tab. |
| 572 | - $ss->assign('currentGroupTab',$app_strings['LBL_TABGROUP_ALL']); |
|
| 572 | + $ss->assign('currentGroupTab', $app_strings['LBL_TABGROUP_ALL']); |
|
| 573 | 573 | |
| 574 | 574 | $usingGroupTabs = false; |
| 575 | 575 | |
@@ -581,31 +581,31 @@ discard block |
||
| 581 | 581 | $topTabList = array(); |
| 582 | 582 | |
| 583 | 583 | // Now time to go through each of the tab sets and fix them up. |
| 584 | - foreach ( $groupTabs as $tabIdx => $tabData ) { |
|
| 584 | + foreach ($groupTabs as $tabIdx => $tabData) { |
|
| 585 | 585 | $topTabs = $tabData['modules']; |
| 586 | - if ( ! is_array($topTabs) ) { |
|
| 586 | + if (!is_array($topTabs)) { |
|
| 587 | 587 | $topTabs = array(); |
| 588 | 588 | } |
| 589 | 589 | $extraTabs = array(); |
| 590 | 590 | |
| 591 | 591 | // Split it in to the tabs that go across the top, and the ones that are on the extra menu. |
| 592 | - if ( count($topTabs) > $max_tabs ) { |
|
| 593 | - $extraTabs = array_splice($topTabs,$max_tabs); |
|
| 592 | + if (count($topTabs) > $max_tabs) { |
|
| 593 | + $extraTabs = array_splice($topTabs, $max_tabs); |
|
| 594 | 594 | } |
| 595 | 595 | // Make sure the current module is accessable through one of the top tabs |
| 596 | - if ( !isset($topTabs[$moduleTab]) ) { |
|
| 596 | + if (!isset($topTabs[$moduleTab])) { |
|
| 597 | 597 | // Nope, we need to add it. |
| 598 | 598 | // First, take it out of the extra menu, if it's there |
| 599 | - if ( isset($extraTabs[$moduleTab]) ) { |
|
| 599 | + if (isset($extraTabs[$moduleTab])) { |
|
| 600 | 600 | unset($extraTabs[$moduleTab]); |
| 601 | 601 | } |
| 602 | - if ( count($topTabs) >= $max_tabs - 1 ) { |
|
| 602 | + if (count($topTabs) >= $max_tabs - 1) { |
|
| 603 | 603 | // We already have the maximum number of tabs, so we need to shuffle the last one |
| 604 | 604 | // from the top to the first one of the extras |
| 605 | - $lastElem = array_splice($topTabs,$max_tabs-1); |
|
| 605 | + $lastElem = array_splice($topTabs, $max_tabs - 1); |
|
| 606 | 606 | $extraTabs = $lastElem + $extraTabs; |
| 607 | 607 | } |
| 608 | - if ( !empty($moduleTab) ) { |
|
| 608 | + if (!empty($moduleTab)) { |
|
| 609 | 609 | $topTabs[$moduleTab] = $app_list_strings['moduleList'][$moduleTab]; |
| 610 | 610 | } |
| 611 | 611 | } |
@@ -624,7 +624,7 @@ discard block |
||
| 624 | 624 | */ |
| 625 | 625 | |
| 626 | 626 | // Get a unique list of the top tabs so we can build the popup menus for them |
| 627 | - foreach ( $topTabs as $moduleKey => $module ) { |
|
| 627 | + foreach ($topTabs as $moduleKey => $module) { |
|
| 628 | 628 | $topTabList[$moduleKey] = $module; |
| 629 | 629 | } |
| 630 | 630 | |
@@ -633,67 +633,67 @@ discard block |
||
| 633 | 633 | } |
| 634 | 634 | } |
| 635 | 635 | |
| 636 | - if ( isset($topTabList) && is_array($topTabList) ) { |
|
| 636 | + if (isset($topTabList) && is_array($topTabList)) { |
|
| 637 | 637 | // Adding shortcuts array to menu array for displaying shortcuts associated with each module |
| 638 | 638 | $shortcutTopMenu = array(); |
| 639 | - foreach($topTabList as $module_key => $label) { |
|
| 639 | + foreach ($topTabList as $module_key => $label) { |
|
| 640 | 640 | global $mod_strings; |
| 641 | 641 | $mod_strings = return_module_language($current_language, $module_key); |
| 642 | - foreach ( $this->getMenu($module_key) as $key => $menu_item ) { |
|
| 642 | + foreach ($this->getMenu($module_key) as $key => $menu_item) { |
|
| 643 | 643 | $shortcutTopMenu[$module_key][$key] = array( |
| 644 | 644 | "URL" => $menu_item[0], |
| 645 | 645 | "LABEL" => $menu_item[1], |
| 646 | 646 | "MODULE_NAME" => $menu_item[2], |
| 647 | 647 | "IMAGE" => $themeObject |
| 648 | - ->getImage($menu_item[2],"border='0' align='absmiddle'",null,null,'.gif',$menu_item[1]), |
|
| 648 | + ->getImage($menu_item[2], "border='0' align='absmiddle'", null, null, '.gif', $menu_item[1]), |
|
| 649 | 649 | "ID" => $menu_item[2]."_link", |
| 650 | 650 | ); |
| 651 | 651 | } |
| 652 | 652 | } |
| 653 | - if(!empty($sugar_config['lock_homepage']) && $sugar_config['lock_homepage'] == true) $ss->assign('lock_homepage', true); |
|
| 654 | - $ss->assign("groupTabs",$groupTabs); |
|
| 655 | - $ss->assign("shortcutTopMenu",$shortcutTopMenu); |
|
| 656 | - $ss->assign('USE_GROUP_TABS',$usingGroupTabs); |
|
| 653 | + if (!empty($sugar_config['lock_homepage']) && $sugar_config['lock_homepage'] == true) $ss->assign('lock_homepage', true); |
|
| 654 | + $ss->assign("groupTabs", $groupTabs); |
|
| 655 | + $ss->assign("shortcutTopMenu", $shortcutTopMenu); |
|
| 656 | + $ss->assign('USE_GROUP_TABS', $usingGroupTabs); |
|
| 657 | 657 | |
| 658 | 658 | // This is here for backwards compatibility, someday, somewhere, it will be able to be removed |
| 659 | - $ss->assign("moduleTopMenu",$groupTabs[$app_strings['LBL_TABGROUP_ALL']]['modules']); |
|
| 660 | - $ss->assign("moduleExtraMenu",$groupTabs[$app_strings['LBL_TABGROUP_ALL']]['extra']); |
|
| 659 | + $ss->assign("moduleTopMenu", $groupTabs[$app_strings['LBL_TABGROUP_ALL']]['modules']); |
|
| 660 | + $ss->assign("moduleExtraMenu", $groupTabs[$app_strings['LBL_TABGROUP_ALL']]['extra']); |
|
| 661 | 661 | |
| 662 | 662 | |
| 663 | 663 | } |
| 664 | 664 | |
| 665 | - if ( isset($extraTabs) && is_array($extraTabs) ) { |
|
| 665 | + if (isset($extraTabs) && is_array($extraTabs)) { |
|
| 666 | 666 | // Adding shortcuts array to extra menu array for displaying shortcuts associated with each module |
| 667 | 667 | $shortcutExtraMenu = array(); |
| 668 | - foreach($extraTabs as $module_key => $label) { |
|
| 668 | + foreach ($extraTabs as $module_key => $label) { |
|
| 669 | 669 | global $mod_strings; |
| 670 | 670 | $mod_strings = return_module_language($current_language, $module_key); |
| 671 | - foreach ( $this->getMenu($module_key) as $key => $menu_item ) { |
|
| 671 | + foreach ($this->getMenu($module_key) as $key => $menu_item) { |
|
| 672 | 672 | $shortcutExtraMenu[$module_key][$key] = array( |
| 673 | 673 | "URL" => $menu_item[0], |
| 674 | 674 | "LABEL" => $menu_item[1], |
| 675 | 675 | "MODULE_NAME" => $menu_item[2], |
| 676 | 676 | "IMAGE" => $themeObject |
| 677 | - ->getImage($menu_item[2],"border='0' align='absmiddle'",null,null,'.gif',$menu_item[1]), |
|
| 677 | + ->getImage($menu_item[2], "border='0' align='absmiddle'", null, null, '.gif', $menu_item[1]), |
|
| 678 | 678 | "ID" => $menu_item[2]."_link", |
| 679 | 679 | ); |
| 680 | 680 | } |
| 681 | 681 | } |
| 682 | - $ss->assign("shortcutExtraMenu",$shortcutExtraMenu); |
|
| 682 | + $ss->assign("shortcutExtraMenu", $shortcutExtraMenu); |
|
| 683 | 683 | } |
| 684 | 684 | |
| 685 | - if(!empty($current_user)){ |
|
| 685 | + if (!empty($current_user)) { |
|
| 686 | 686 | $ss->assign("max_tabs", $current_user->getPreference("max_tabs")); |
| 687 | 687 | } |
| 688 | 688 | |
| 689 | 689 | |
| 690 | 690 | $imageURL = SugarThemeRegistry::current()->getImageURL("dashboard.png"); |
| 691 | 691 | $homeImage = "<img src='$imageURL'>"; |
| 692 | - $ss->assign("homeImage",$homeImage); |
|
| 692 | + $ss->assign("homeImage", $homeImage); |
|
| 693 | 693 | global $mod_strings; |
| 694 | 694 | $mod_strings = $bakModStrings; |
| 695 | 695 | $headerTpl = $themeObject->getTemplate('header.tpl'); |
| 696 | - if (inDeveloperMode() ) |
|
| 696 | + if (inDeveloperMode()) |
|
| 697 | 697 | $ss->clear_compiled_tpl($headerTpl); |
| 698 | 698 | |
| 699 | 699 | if ($retModTabs) |
@@ -705,9 +705,9 @@ discard block |
||
| 705 | 705 | $this->includeClassicFile('modules/Administration/DisplayWarnings.php'); |
| 706 | 706 | |
| 707 | 707 | $errorMessages = SugarApplication::getErrorMessages(); |
| 708 | - if ( !empty($errorMessages)) { |
|
| 709 | - foreach ( $errorMessages as $error_message ) { |
|
| 710 | - echo('<p class="error">' . $error_message.'</p>'); |
|
| 708 | + if (!empty($errorMessages)) { |
|
| 709 | + foreach ($errorMessages as $error_message) { |
|
| 710 | + echo('<p class="error">'.$error_message.'</p>'); |
|
| 711 | 711 | } |
| 712 | 712 | } |
| 713 | 713 | } |
@@ -742,13 +742,13 @@ discard block |
||
| 742 | 742 | { |
| 743 | 743 | global $sugar_config, $timedate; |
| 744 | 744 | |
| 745 | - if(isset($this->bean->module_dir)){ |
|
| 745 | + if (isset($this->bean->module_dir)) { |
|
| 746 | 746 | echo "<script>var module_sugar_grp1 = '{$this->bean->module_dir}';</script>"; |
| 747 | 747 | } |
| 748 | - if(isset($_REQUEST['action'])){ |
|
| 748 | + if (isset($_REQUEST['action'])) { |
|
| 749 | 749 | echo "<script>var action_sugar_grp1 = '{$_REQUEST['action']}';</script>"; |
| 750 | 750 | } |
| 751 | - echo '<script>jscal_today = 1000*' . $timedate->asUserTs($timedate->getNow()) . '; if(typeof app_strings == "undefined") app_strings = new Array();</script>'; |
|
| 751 | + echo '<script>jscal_today = 1000*'.$timedate->asUserTs($timedate->getNow()).'; if(typeof app_strings == "undefined") app_strings = new Array();</script>'; |
|
| 752 | 752 | if (!is_file(sugar_cached("include/javascript/sugar_grp1.js"))) { |
| 753 | 753 | $_REQUEST['root_directory'] = "."; |
| 754 | 754 | require_once("jssource/minify_utils.php"); |
@@ -764,7 +764,7 @@ discard block |
||
| 764 | 764 | if ( typeof(SUGAR.themes) == 'undefined' ) SUGAR.themes = {}; |
| 765 | 765 | </script> |
| 766 | 766 | EOQ; |
| 767 | - if(isset( $sugar_config['disc_client']) && $sugar_config['disc_client']) |
|
| 767 | + if (isset($sugar_config['disc_client']) && $sugar_config['disc_client']) |
|
| 768 | 768 | echo getVersionedScript('modules/Sync/headersync.js'); |
| 769 | 769 | } |
| 770 | 770 | |
@@ -793,13 +793,13 @@ discard block |
||
| 793 | 793 | require_once ('modules/Currencies/Currency.php'); |
| 794 | 794 | list ($num_grp_sep, $dec_sep) = get_number_seperators(); |
| 795 | 795 | |
| 796 | - $the_script = "<script type=\"text/javascript\">\n" . "\tvar time_reg_format = '" . |
|
| 797 | - $timereg['format'] . "';\n" . "\tvar date_reg_format = '" . |
|
| 798 | - $datereg['format'] . "';\n" . "\tvar date_reg_positions = { $date_pos };\n" . |
|
| 799 | - "\tvar time_separator = '$time_separator';\n" . |
|
| 800 | - "\tvar cal_date_format = '$cal_date_format';\n" . |
|
| 801 | - "\tvar time_offset = $hour_offset;\n" . "\tvar num_grp_sep = '$num_grp_sep';\n" . |
|
| 802 | - "\tvar dec_sep = '$dec_sep';\n" . "</script>"; |
|
| 796 | + $the_script = "<script type=\"text/javascript\">\n"."\tvar time_reg_format = '". |
|
| 797 | + $timereg['format']."';\n"."\tvar date_reg_format = '". |
|
| 798 | + $datereg['format']."';\n"."\tvar date_reg_positions = { $date_pos };\n". |
|
| 799 | + "\tvar time_separator = '$time_separator';\n". |
|
| 800 | + "\tvar cal_date_format = '$cal_date_format';\n". |
|
| 801 | + "\tvar time_offset = $hour_offset;\n"."\tvar num_grp_sep = '$num_grp_sep';\n". |
|
| 802 | + "\tvar dec_sep = '$dec_sep';\n"."</script>"; |
|
| 803 | 803 | |
| 804 | 804 | return $the_script; |
| 805 | 805 | } |
@@ -827,13 +827,13 @@ discard block |
||
| 827 | 827 | "sugar_cache_dir" => "cache/", |
| 828 | 828 | ); |
| 829 | 829 | |
| 830 | - if(isset($this->bean->module_dir)){ |
|
| 830 | + if (isset($this->bean->module_dir)) { |
|
| 831 | 831 | $js_vars['module_sugar_grp1'] = $this->bean->module_dir; |
| 832 | 832 | } |
| 833 | - if(isset($_REQUEST['action'])){ |
|
| 833 | + if (isset($_REQUEST['action'])) { |
|
| 834 | 834 | $js_vars['action_sugar_grp1'] = $_REQUEST['action']; |
| 835 | 835 | } |
| 836 | - echo '<script>jscal_today = 1000*' . $timedate->asUserTs($timedate->getNow()) . '; if(typeof app_strings == "undefined") app_strings = new Array();</script>'; |
|
| 836 | + echo '<script>jscal_today = 1000*'.$timedate->asUserTs($timedate->getNow()).'; if(typeof app_strings == "undefined") app_strings = new Array();</script>'; |
|
| 837 | 837 | if (!is_file(sugar_cached("include/javascript/sugar_grp1.js")) || !is_file(sugar_cached("include/javascript/sugar_grp1_yui.js")) || !is_file(sugar_cached("include/javascript/sugar_grp1_jquery.js"))) { |
| 838 | 838 | $_REQUEST['root_directory'] = "."; |
| 839 | 839 | require_once("jssource/minify_utils.php"); |
@@ -846,33 +846,33 @@ discard block |
||
| 846 | 846 | |
| 847 | 847 | // output necessary config js in the top of the page |
| 848 | 848 | $config_js = $this->getSugarConfigJS(); |
| 849 | - if(!empty($config_js)){ |
|
| 849 | + if (!empty($config_js)) { |
|
| 850 | 850 | echo "<script>\n".implode("\n", $config_js)."</script>\n"; |
| 851 | 851 | } |
| 852 | 852 | |
| 853 | - if ( isset($sugar_config['email_sugarclient_listviewmaxselect']) ) { |
|
| 853 | + if (isset($sugar_config['email_sugarclient_listviewmaxselect'])) { |
|
| 854 | 854 | echo "<script>SUGAR.config.email_sugarclient_listviewmaxselect = {$GLOBALS['sugar_config']['email_sugarclient_listviewmaxselect']};</script>"; |
| 855 | 855 | } |
| 856 | 856 | |
| 857 | - $image_server = (defined('TEMPLATE_URL'))?TEMPLATE_URL . '/':''; |
|
| 858 | - echo '<script type="text/javascript">SUGAR.themes.image_server="' . $image_server . '";</script>'; // cn: bug 12274 - create session-stored key to defend against CSRF |
|
| 859 | - echo '<script type="text/javascript">var name_format = "' . $locale->getLocaleFormatMacro() . '";</script>'; |
|
| 857 | + $image_server = (defined('TEMPLATE_URL')) ? TEMPLATE_URL.'/' : ''; |
|
| 858 | + echo '<script type="text/javascript">SUGAR.themes.image_server="'.$image_server.'";</script>'; // cn: bug 12274 - create session-stored key to defend against CSRF |
|
| 859 | + echo '<script type="text/javascript">var name_format = "'.$locale->getLocaleFormatMacro().'";</script>'; |
|
| 860 | 860 | echo self::getJavascriptValidation(); |
| 861 | - if (!is_file(sugar_cached('jsLanguage/') . $GLOBALS['current_language'] . '.js')) { |
|
| 861 | + if (!is_file(sugar_cached('jsLanguage/').$GLOBALS['current_language'].'.js')) { |
|
| 862 | 862 | require_once ('include/language/jsLanguage.php'); |
| 863 | 863 | jsLanguage::createAppStringsCache($GLOBALS['current_language']); |
| 864 | 864 | } |
| 865 | - echo getVersionedScript('cache/jsLanguage/'. $GLOBALS['current_language'] . '.js', $GLOBALS['sugar_config']['js_lang_version']); |
|
| 865 | + echo getVersionedScript('cache/jsLanguage/'.$GLOBALS['current_language'].'.js', $GLOBALS['sugar_config']['js_lang_version']); |
|
| 866 | 866 | |
| 867 | 867 | echo $this->_getModLanguageJS(); |
| 868 | 868 | |
| 869 | - if(isset( $sugar_config['disc_client']) && $sugar_config['disc_client']) |
|
| 869 | + if (isset($sugar_config['disc_client']) && $sugar_config['disc_client']) |
|
| 870 | 870 | echo getVersionedScript('modules/Sync/headersync.js'); |
| 871 | 871 | |
| 872 | 872 | |
| 873 | 873 | //echo out the $js_vars variables as javascript variables |
| 874 | 874 | echo "<script type='text/javascript'>\n"; |
| 875 | - foreach($js_vars as $var=>$value) |
|
| 875 | + foreach ($js_vars as $var=>$value) |
|
| 876 | 876 | { |
| 877 | 877 | echo "var {$var} = '{$value}';\n"; |
| 878 | 878 | } |
@@ -880,12 +880,12 @@ discard block |
||
| 880 | 880 | } |
| 881 | 881 | } |
| 882 | 882 | |
| 883 | - protected function _getModLanguageJS(){ |
|
| 884 | - if (!is_file(sugar_cached('jsLanguage/') . $this->module . '/' . $GLOBALS['current_language'] . '.js')) { |
|
| 883 | + protected function _getModLanguageJS() { |
|
| 884 | + if (!is_file(sugar_cached('jsLanguage/').$this->module.'/'.$GLOBALS['current_language'].'.js')) { |
|
| 885 | 885 | require_once ('include/language/jsLanguage.php'); |
| 886 | 886 | jsLanguage::createModuleStringsCache($this->module, $GLOBALS['current_language']); |
| 887 | 887 | } |
| 888 | - return getVersionedScript("cache/jsLanguage/{$this->module}/". $GLOBALS['current_language'] . '.js', $GLOBALS['sugar_config']['js_lang_version']); |
|
| 888 | + return getVersionedScript("cache/jsLanguage/{$this->module}/".$GLOBALS['current_language'].'.js', $GLOBALS['sugar_config']['js_lang_version']); |
|
| 889 | 889 | } |
| 890 | 890 | |
| 891 | 891 | /** |
@@ -907,8 +907,8 @@ discard block |
||
| 907 | 907 | } |
| 908 | 908 | |
| 909 | 909 | $ss = new Sugar_Smarty(); |
| 910 | - $ss->assign("AUTHENTICATED",isset($_SESSION["authenticated_user_id"])); |
|
| 911 | - $ss->assign('MOD',return_module_language($GLOBALS['current_language'], 'Users')); |
|
| 910 | + $ss->assign("AUTHENTICATED", isset($_SESSION["authenticated_user_id"])); |
|
| 911 | + $ss->assign('MOD', return_module_language($GLOBALS['current_language'], 'Users')); |
|
| 912 | 912 | |
| 913 | 913 | $bottomLinkList = array(); |
| 914 | 914 | if (isset($this->action) && $this->action != "EditView") { |
@@ -917,11 +917,11 @@ discard block |
||
| 917 | 917 | $bottomLinkList['backtotop'] = array($app_strings['LNK_BACKTOTOP'] => 'javascript:SUGAR.util.top();'); |
| 918 | 918 | |
| 919 | 919 | $bottomLinksStr = ""; |
| 920 | - foreach($bottomLinkList as $key => $value) { |
|
| 921 | - foreach($value as $text => $link) { |
|
| 920 | + foreach ($bottomLinkList as $key => $value) { |
|
| 921 | + foreach ($value as $text => $link) { |
|
| 922 | 922 | $href = $link; |
| 923 | - if(substr($link, 0, 11) == "javascript:") { |
|
| 924 | - $onclick = " onclick=\"".substr($link,11)."\""; |
|
| 923 | + if (substr($link, 0, 11) == "javascript:") { |
|
| 924 | + $onclick = " onclick=\"".substr($link, 11)."\""; |
|
| 925 | 925 | $href = "javascript:void(0)"; |
| 926 | 926 | } else { |
| 927 | 927 | $onclick = ""; |
@@ -933,9 +933,9 @@ discard block |
||
| 933 | 933 | $bottomLinksStr .= " ".$text."</a>"; |
| 934 | 934 | } |
| 935 | 935 | } |
| 936 | - $ss->assign("BOTTOMLINKS",$bottomLinksStr); |
|
| 936 | + $ss->assign("BOTTOMLINKS", $bottomLinksStr); |
|
| 937 | 937 | if (SugarConfig::getInstance()->get('calculate_response_time', false)) |
| 938 | - $ss->assign('STATISTICS',$this->_getStatistics()); |
|
| 938 | + $ss->assign('STATISTICS', $this->_getStatistics()); |
|
| 939 | 939 | |
| 940 | 940 | // Under the License referenced above, you are required to leave in all copyright statements in both |
| 941 | 941 | // the code and end-user application. |
@@ -969,7 +969,7 @@ discard block |
||
| 969 | 969 | $companyLogoURL = $companyLogoURL_arr[0]; |
| 970 | 970 | |
| 971 | 971 | $company_logo_attributes = sugar_cache_retrieve('company_logo_attributes'); |
| 972 | - if(!empty($company_logo_attributes)) { |
|
| 972 | + if (!empty($company_logo_attributes)) { |
|
| 973 | 973 | $ss->assign("COMPANY_LOGO_MD5", $company_logo_attributes[0]); |
| 974 | 974 | $ss->assign("COMPANY_LOGO_WIDTH", $company_logo_attributes[1]); |
| 975 | 975 | $ss->assign("COMPANY_LOGO_HEIGHT", $company_logo_attributes[2]); |
@@ -978,16 +978,16 @@ discard block |
||
| 978 | 978 | // Always need to md5 the file |
| 979 | 979 | $ss->assign("COMPANY_LOGO_MD5", md5_file($companyLogoURL)); |
| 980 | 980 | |
| 981 | - list($width,$height) = getimagesize($companyLogoURL); |
|
| 982 | - if ( $width > 212 || $height > 40 ) { |
|
| 983 | - $resizePctWidth = ($width - 212)/212; |
|
| 984 | - $resizePctHeight = ($height - 40)/40; |
|
| 985 | - if ( $resizePctWidth > $resizePctHeight ) |
|
| 981 | + list($width, $height) = getimagesize($companyLogoURL); |
|
| 982 | + if ($width > 212 || $height > 40) { |
|
| 983 | + $resizePctWidth = ($width - 212) / 212; |
|
| 984 | + $resizePctHeight = ($height - 40) / 40; |
|
| 985 | + if ($resizePctWidth > $resizePctHeight) |
|
| 986 | 986 | $resizeAmount = $width / 212; |
| 987 | 987 | else |
| 988 | 988 | $resizeAmount = $height / 40; |
| 989 | - $ss->assign("COMPANY_LOGO_WIDTH", round($width * (1/$resizeAmount))); |
|
| 990 | - $ss->assign("COMPANY_LOGO_HEIGHT", round($height * (1/$resizeAmount))); |
|
| 989 | + $ss->assign("COMPANY_LOGO_WIDTH", round($width * (1 / $resizeAmount))); |
|
| 990 | + $ss->assign("COMPANY_LOGO_HEIGHT", round($height * (1 / $resizeAmount))); |
|
| 991 | 991 | } |
| 992 | 992 | else { |
| 993 | 993 | $ss->assign("COMPANY_LOGO_WIDTH", $width); |
@@ -1003,28 +1003,28 @@ discard block |
||
| 1003 | 1003 | ) |
| 1004 | 1004 | ); |
| 1005 | 1005 | } |
| 1006 | - $ss->assign("COMPANY_LOGO_URL",getJSPath($companyLogoURL)."&logo_md5=".$ss->get_template_vars("COMPANY_LOGO_MD5")); |
|
| 1006 | + $ss->assign("COMPANY_LOGO_URL", getJSPath($companyLogoURL)."&logo_md5=".$ss->get_template_vars("COMPANY_LOGO_MD5")); |
|
| 1007 | 1007 | |
| 1008 | 1008 | // Bug 38594 - Add in Trademark wording |
| 1009 | 1009 | $copyright .= 'SugarCRM is a trademark of SugarCRM, Inc. All other company and product names may be trademarks of the respective companies with which they are associated.<br />'; |
| 1010 | 1010 | |
| 1011 | 1011 | //rrs bug: 20923 - if this image does not exist as per the license, then the proper image will be displayed regardless, so no need |
| 1012 | 1012 | //to display an empty image here. |
| 1013 | - if(file_exists('include/images/poweredby_sugarcrm_65.png')){ |
|
| 1013 | + if (file_exists('include/images/poweredby_sugarcrm_65.png')) { |
|
| 1014 | 1014 | $copyright .= $attribLinkImg; |
| 1015 | 1015 | } |
| 1016 | 1016 | // End Required Image |
| 1017 | - $ss->assign('COPYRIGHT',$copyright); |
|
| 1017 | + $ss->assign('COPYRIGHT', $copyright); |
|
| 1018 | 1018 | |
| 1019 | 1019 | // here we allocate the help link data |
| 1020 | 1020 | $help_actions_blacklist = array('Login'); // we don't want to show a context help link here |
| 1021 | - if (!in_array($this->action,$help_actions_blacklist)) { |
|
| 1021 | + if (!in_array($this->action, $help_actions_blacklist)) { |
|
| 1022 | 1022 | $url = 'javascript:void(window.open(\'index.php?module=Administration&action=SupportPortal&view=documentation&version='.$GLOBALS['sugar_version'].'&edition='.$GLOBALS['sugar_flavor'].'&lang='.$GLOBALS['current_language']. |
| 1023 | 1023 | '&help_module='.$this->module.'&help_action='.$this->action.'&key='.$GLOBALS['server_unique_key'].'\'))'; |
| 1024 | 1024 | $label = (isset($GLOBALS['app_list_strings']['moduleList'][$this->module]) ? |
| 1025 | - $GLOBALS['app_list_strings']['moduleList'][$this->module] : $this->module). ' '.$app_strings['LNK_HELP']; |
|
| 1026 | - $ss->assign('HELP_LINK',SugarThemeRegistry::current()->getLink($url, $label, "id='help_link_two'", |
|
| 1027 | - 'help-dashlet.png', 'class="icon"',null,null,'','left')); |
|
| 1025 | + $GLOBALS['app_list_strings']['moduleList'][$this->module] : $this->module).' '.$app_strings['LNK_HELP']; |
|
| 1026 | + $ss->assign('HELP_LINK', SugarThemeRegistry::current()->getLink($url, $label, "id='help_link_two'", |
|
| 1027 | + 'help-dashlet.png', 'class="icon"', null, null, '', 'left')); |
|
| 1028 | 1028 | } |
| 1029 | 1029 | // end |
| 1030 | 1030 | |
@@ -1037,7 +1037,7 @@ discard block |
||
| 1037 | 1037 | */ |
| 1038 | 1038 | protected function _displaySubPanels() |
| 1039 | 1039 | { |
| 1040 | - if (isset($this->bean) && !empty($this->bean->id) && (file_exists('modules/' . $this->module . '/metadata/subpaneldefs.php') || file_exists('custom/modules/' . $this->module . '/metadata/subpaneldefs.php') || file_exists('custom/modules/' . $this->module . '/Ext/Layoutdefs/layoutdefs.ext.php'))) { |
|
| 1040 | + if (isset($this->bean) && !empty($this->bean->id) && (file_exists('modules/'.$this->module.'/metadata/subpaneldefs.php') || file_exists('custom/modules/'.$this->module.'/metadata/subpaneldefs.php') || file_exists('custom/modules/'.$this->module.'/Ext/Layoutdefs/layoutdefs.ext.php'))) { |
|
| 1041 | 1041 | $GLOBALS['focus'] = $this->bean; |
| 1042 | 1042 | require_once ('include/SubPanel/SubPanelTiles.php'); |
| 1043 | 1043 | $subpanel = new SubPanelTiles($this->bean, $this->module); |
@@ -1095,7 +1095,7 @@ discard block |
||
| 1095 | 1095 | */ |
| 1096 | 1096 | protected function _checkModule() |
| 1097 | 1097 | { |
| 1098 | - if(!empty($this->module) && !file_exists('modules/'.$this->module)){ |
|
| 1098 | + if (!empty($this->module) && !file_exists('modules/'.$this->module)) { |
|
| 1099 | 1099 | $error = str_replace("[module]", "$this->module", $GLOBALS['app_strings']['ERR_CANNOT_FIND_MODULE']); |
| 1100 | 1100 | $GLOBALS['log']->fatal($error); |
| 1101 | 1101 | echo $error; |
@@ -1124,7 +1124,7 @@ discard block |
||
| 1124 | 1124 | { |
| 1125 | 1125 | $endTime = microtime(true); |
| 1126 | 1126 | $deltaTime = $endTime - $GLOBALS['startTime']; |
| 1127 | - $response_time_string = $GLOBALS['app_strings']['LBL_SERVER_RESPONSE_TIME'] . ' ' . number_format(round($deltaTime, 2), 2) . ' ' . $GLOBALS['app_strings']['LBL_SERVER_RESPONSE_TIME_SECONDS']; |
|
| 1127 | + $response_time_string = $GLOBALS['app_strings']['LBL_SERVER_RESPONSE_TIME'].' '.number_format(round($deltaTime, 2), 2).' '.$GLOBALS['app_strings']['LBL_SERVER_RESPONSE_TIME_SECONDS']; |
|
| 1128 | 1128 | $return = $response_time_string; |
| 1129 | 1129 | // $return .= '<br />'; |
| 1130 | 1130 | if (!empty($GLOBALS['sugar_config']['show_page_resources'])) { |
@@ -1135,16 +1135,16 @@ discard block |
||
| 1135 | 1135 | // I believe the full get_include_files result set appears to have one entry for each file in real |
| 1136 | 1136 | // case, and one entry in all lower case. |
| 1137 | 1137 | $list_of_files_case_insensitive = array(); |
| 1138 | - foreach($included_files as $key => $name) { |
|
| 1138 | + foreach ($included_files as $key => $name) { |
|
| 1139 | 1139 | // preserve the first capitalization encountered. |
| 1140 | - $list_of_files_case_insensitive[mb_strtolower($name) ] = $name; |
|
| 1140 | + $list_of_files_case_insensitive[mb_strtolower($name)] = $name; |
|
| 1141 | 1141 | } |
| 1142 | - $return .= $GLOBALS['app_strings']['LBL_SERVER_RESPONSE_RESOURCES'] . '(' . DBManager::getQueryCount() . ',' . sizeof($list_of_files_case_insensitive) . ')<br>'; |
|
| 1142 | + $return .= $GLOBALS['app_strings']['LBL_SERVER_RESPONSE_RESOURCES'].'('.DBManager::getQueryCount().','.sizeof($list_of_files_case_insensitive).')<br>'; |
|
| 1143 | 1143 | // Display performance of the internal and external caches.... |
| 1144 | 1144 | $cacheStats = SugarCache::instance()->getCacheStats(); |
| 1145 | - $return .= "External cache (hits/total=ratio) local ({$cacheStats['localHits']}/{$cacheStats['requests']}=" . round($cacheStats['localHits']*100/$cacheStats['requests'], 0) . "%)"; |
|
| 1146 | - $return .= " external ({$cacheStats['externalHits']}/{$cacheStats['requests']}=" . round($cacheStats['externalHits']*100/$cacheStats['requests'], 0) . "%)<br />"; |
|
| 1147 | - $return .= " misses ({$cacheStats['misses']}/{$cacheStats['requests']}=" . round($cacheStats['misses']*100/$cacheStats['requests'], 0) . "%)<br />"; |
|
| 1145 | + $return .= "External cache (hits/total=ratio) local ({$cacheStats['localHits']}/{$cacheStats['requests']}=".round($cacheStats['localHits'] * 100 / $cacheStats['requests'], 0)."%)"; |
|
| 1146 | + $return .= " external ({$cacheStats['externalHits']}/{$cacheStats['requests']}=".round($cacheStats['externalHits'] * 100 / $cacheStats['requests'], 0)."%)<br />"; |
|
| 1147 | + $return .= " misses ({$cacheStats['misses']}/{$cacheStats['requests']}=".round($cacheStats['misses'] * 100 / $cacheStats['requests'], 0)."%)<br />"; |
|
| 1148 | 1148 | } |
| 1149 | 1149 | |
| 1150 | 1150 | $return .= $this->logMemoryStatistics(); |
@@ -1161,37 +1161,36 @@ discard block |
||
| 1161 | 1161 | * @param $newline String of newline character to use (defaults to </ br>) |
| 1162 | 1162 | * @return $message String formatted message about memory statistics |
| 1163 | 1163 | */ |
| 1164 | - protected function logMemoryStatistics($newline='<br>') |
|
| 1164 | + protected function logMemoryStatistics($newline = '<br>') |
|
| 1165 | 1165 | { |
| 1166 | 1166 | $log_message = ''; |
| 1167 | 1167 | |
| 1168 | - if(!empty($GLOBALS['sugar_config']['log_memory_usage'])) |
|
| 1168 | + if (!empty($GLOBALS['sugar_config']['log_memory_usage'])) |
|
| 1169 | 1169 | { |
| 1170 | - if(function_exists('memory_get_usage')) |
|
| 1170 | + if (function_exists('memory_get_usage')) |
|
| 1171 | 1171 | { |
| 1172 | 1172 | $memory_usage = memory_get_usage(); |
| 1173 | 1173 | $bytes = $GLOBALS['app_strings']['LBL_SERVER_MEMORY_BYTES']; |
| 1174 | 1174 | $data = array($memory_usage, $bytes); |
| 1175 | - $log_message = string_format($GLOBALS['app_strings']['LBL_SERVER_MEMORY_USAGE'], $data) . $newline; |
|
| 1175 | + $log_message = string_format($GLOBALS['app_strings']['LBL_SERVER_MEMORY_USAGE'], $data).$newline; |
|
| 1176 | 1176 | } |
| 1177 | 1177 | |
| 1178 | - if(function_exists('memory_get_peak_usage')) |
|
| 1178 | + if (function_exists('memory_get_peak_usage')) |
|
| 1179 | 1179 | { |
| 1180 | 1180 | $memory_peak_usage = memory_get_peak_usage(); |
| 1181 | 1181 | $bytes = $GLOBALS['app_strings']['LBL_SERVER_MEMORY_BYTES']; |
| 1182 | 1182 | $data = array($memory_peak_usage, $bytes); |
| 1183 | - $log_message .= string_format($GLOBALS['app_strings']['LBL_SERVER_PEAK_MEMORY_USAGE'], $data) . $newline; |
|
| 1183 | + $log_message .= string_format($GLOBALS['app_strings']['LBL_SERVER_PEAK_MEMORY_USAGE'], $data).$newline; |
|
| 1184 | 1184 | } |
| 1185 | 1185 | |
| 1186 | - if(!empty($log_message)) |
|
| 1186 | + if (!empty($log_message)) |
|
| 1187 | 1187 | { |
| 1188 | - $data = array |
|
| 1189 | - ( |
|
| 1188 | + $data = array( |
|
| 1190 | 1189 | !empty($this->module) ? $this->module : $GLOBALS['app_strings']['LBL_LINK_NONE'], |
| 1191 | 1190 | !empty($this->action) ? $this->action : $GLOBALS['app_strings']['LBL_LINK_NONE'], |
| 1192 | 1191 | ); |
| 1193 | 1192 | |
| 1194 | - $output = string_format($GLOBALS['app_strings']['LBL_SERVER_MEMORY_LOG_MESSAGE'], $data) . $newline; |
|
| 1193 | + $output = string_format($GLOBALS['app_strings']['LBL_SERVER_MEMORY_LOG_MESSAGE'], $data).$newline; |
|
| 1195 | 1194 | $output .= $log_message; |
| 1196 | 1195 | $fp = fopen("memory_usage.log", "ab"); |
| 1197 | 1196 | fwrite($fp, $output); |
@@ -1215,30 +1214,30 @@ discard block |
||
| 1215 | 1214 | { |
| 1216 | 1215 | global $current_language, $current_user, $mod_strings, $app_strings, $module_menu; |
| 1217 | 1216 | |
| 1218 | - if ( empty($module) ) |
|
| 1217 | + if (empty($module)) |
|
| 1219 | 1218 | $module = $this->module; |
| 1220 | 1219 | |
| 1221 | 1220 | //Need to make sure the mod_strings match the requested module or Menus may fail |
| 1222 | 1221 | $curr_mod_strings = $mod_strings; |
| 1223 | - $mod_strings = return_module_language ( $current_language, $module ) ; |
|
| 1222 | + $mod_strings = return_module_language($current_language, $module); |
|
| 1224 | 1223 | |
| 1225 | 1224 | $module_menu = array(); |
| 1226 | 1225 | |
| 1227 | - if (file_exists('modules/' . $module . '/Menu.php')) { |
|
| 1228 | - require('modules/' . $module . '/Menu.php'); |
|
| 1226 | + if (file_exists('modules/'.$module.'/Menu.php')) { |
|
| 1227 | + require('modules/'.$module.'/Menu.php'); |
|
| 1229 | 1228 | } |
| 1230 | - if (file_exists('custom/modules/' . $module . '/Ext/Menus/menu.ext.php')) { |
|
| 1231 | - require('custom/modules/' . $module . '/Ext/Menus/menu.ext.php'); |
|
| 1229 | + if (file_exists('custom/modules/'.$module.'/Ext/Menus/menu.ext.php')) { |
|
| 1230 | + require('custom/modules/'.$module.'/Ext/Menus/menu.ext.php'); |
|
| 1232 | 1231 | } |
| 1233 | - if (!file_exists('modules/' . $module . '/Menu.php') |
|
| 1234 | - && !file_exists('custom/modules/' . $module . '/Ext/Menus/menu.ext.php') |
|
| 1232 | + if (!file_exists('modules/'.$module.'/Menu.php') |
|
| 1233 | + && !file_exists('custom/modules/'.$module.'/Ext/Menus/menu.ext.php') |
|
| 1235 | 1234 | && !empty($GLOBALS['mod_strings']['LNK_NEW_RECORD'])) { |
| 1236 | 1235 | $module_menu[] = array("index.php?module=$module&action=EditView&return_module=$module&return_action=DetailView", |
| 1237 | - $GLOBALS['mod_strings']['LNK_NEW_RECORD'],"{$GLOBALS['app_strings']['LBL_CREATE_BUTTON_LABEL']}$module" ,$module ); |
|
| 1236 | + $GLOBALS['mod_strings']['LNK_NEW_RECORD'], "{$GLOBALS['app_strings']['LBL_CREATE_BUTTON_LABEL']}$module", $module); |
|
| 1238 | 1237 | $module_menu[] = array("index.php?module=$module&action=index", $GLOBALS['mod_strings']['LNK_LIST'], |
| 1239 | 1238 | $module, $module); |
| 1240 | - if ( ($this->bean instanceOf SugarBean) && !empty($this->bean->importable) ) |
|
| 1241 | - if ( !empty($mod_strings['LNK_IMPORT_'.strtoupper($module)]) ) |
|
| 1239 | + if (($this->bean instanceOf SugarBean) && !empty($this->bean->importable)) |
|
| 1240 | + if (!empty($mod_strings['LNK_IMPORT_'.strtoupper($module)])) |
|
| 1242 | 1241 | $module_menu[] = array("index.php?module=Import&action=Step1&import_module=$module&return_module=$module&return_action=index", |
| 1243 | 1242 | $mod_strings['LNK_IMPORT_'.strtoupper($module)], "Import", $module); |
| 1244 | 1243 | else |
@@ -1265,22 +1264,22 @@ discard block |
||
| 1265 | 1264 | |
| 1266 | 1265 | $userTabs = query_module_access_list($current_user); |
| 1267 | 1266 | //If the home tab is in the user array use it as the default tab, otherwise use the first element in the tab array |
| 1268 | - $defaultTab = (in_array("Home",$userTabs)) ? "Home" : key($userTabs); |
|
| 1267 | + $defaultTab = (in_array("Home", $userTabs)) ? "Home" : key($userTabs); |
|
| 1269 | 1268 | |
| 1270 | 1269 | // Need to figure out what tab this module belongs to, most modules have their own tabs, but there are exceptions. |
| 1271 | - if ( !empty($_REQUEST['module_tab']) ) |
|
| 1270 | + if (!empty($_REQUEST['module_tab'])) |
|
| 1272 | 1271 | return $_REQUEST['module_tab']; |
| 1273 | - elseif ( isset($moduleTabMap[$this->module]) ) |
|
| 1272 | + elseif (isset($moduleTabMap[$this->module])) |
|
| 1274 | 1273 | return $moduleTabMap[$this->module]; |
| 1275 | 1274 | // Special cases |
| 1276 | - elseif ( $this->module == 'MergeRecords' ) |
|
| 1275 | + elseif ($this->module == 'MergeRecords') |
|
| 1277 | 1276 | return !empty($_REQUEST['merge_module']) ? $_REQUEST['merge_module'] : $_REQUEST['return_module']; |
| 1278 | - elseif ( $this->module == 'Users' && $this->action == 'SetTimezone' ) |
|
| 1277 | + elseif ($this->module == 'Users' && $this->action == 'SetTimezone') |
|
| 1279 | 1278 | return $defaultTab; |
| 1280 | 1279 | // Default anonymous pages to be under Home |
| 1281 | - elseif ( !isset($app_list_strings['moduleList'][$this->module]) ) |
|
| 1280 | + elseif (!isset($app_list_strings['moduleList'][$this->module])) |
|
| 1282 | 1281 | return $defaultTab; |
| 1283 | - elseif ( isset($_REQUEST['action']) && $_REQUEST['action'] == "ajaxui" ) |
|
| 1282 | + elseif (isset($_REQUEST['action']) && $_REQUEST['action'] == "ajaxui") |
|
| 1284 | 1283 | return $defaultTab; |
| 1285 | 1284 | else |
| 1286 | 1285 | return $this->module; |
@@ -1300,42 +1299,42 @@ discard block |
||
| 1300 | 1299 | |
| 1301 | 1300 | $theTitle = "<div class='moduleTitle'>\n"; |
| 1302 | 1301 | |
| 1303 | - $module = preg_replace("/ /","",$this->module); |
|
| 1302 | + $module = preg_replace("/ /", "", $this->module); |
|
| 1304 | 1303 | |
| 1305 | 1304 | $params = $this->_getModuleTitleParams(); |
| 1306 | 1305 | $index = 0; |
| 1307 | 1306 | |
| 1308 | - if(SugarThemeRegistry::current()->directionality == "rtl") { |
|
| 1307 | + if (SugarThemeRegistry::current()->directionality == "rtl") { |
|
| 1309 | 1308 | $params = array_reverse($params); |
| 1310 | 1309 | } |
| 1311 | - if(count($params) > 1) { |
|
| 1310 | + if (count($params) > 1) { |
|
| 1312 | 1311 | array_shift($params); |
| 1313 | 1312 | } |
| 1314 | 1313 | $count = count($params); |
| 1315 | 1314 | $paramString = ''; |
| 1316 | - foreach($params as $parm){ |
|
| 1315 | + foreach ($params as $parm) { |
|
| 1317 | 1316 | $index++; |
| 1318 | 1317 | $paramString .= $parm; |
| 1319 | - if($index < $count){ |
|
| 1318 | + if ($index < $count) { |
|
| 1320 | 1319 | $paramString .= $this->getBreadCrumbSymbol(); |
| 1321 | 1320 | } |
| 1322 | 1321 | } |
| 1323 | 1322 | |
| 1324 | - if(!empty($paramString)){ |
|
| 1323 | + if (!empty($paramString)) { |
|
| 1325 | 1324 | $theTitle .= "<h2> $paramString </h2>"; |
| 1326 | 1325 | |
| 1327 | - if($this->type == "detail"){ |
|
| 1328 | - $theTitle .= "<div class='favorite' record_id='" . $this->bean->id . "' module='" . $this->bean->module_dir . "'><div class='favorite_icon_outline'>" . SugarThemeRegistry::current()->getImage('favorite-star-outline','title="' . translate('LBL_DASHLET_EDIT', 'Home') . '" border="0" align="absmiddle"', null,null,'.gif',translate('LBL_DASHLET_EDIT', 'Home')) . "</div> |
|
| 1329 | - <div class='favorite_icon_fill'>" . SugarThemeRegistry::current()->getImage('favorite-star','title="' . translate('LBL_DASHLET_EDIT', 'Home') . '" border="0" align="absmiddle"', null,null,'.gif',translate('LBL_DASHLET_EDIT', 'Home')) . "</div></div>"; |
|
| 1326 | + if ($this->type == "detail") { |
|
| 1327 | + $theTitle .= "<div class='favorite' record_id='".$this->bean->id."' module='".$this->bean->module_dir."'><div class='favorite_icon_outline'>".SugarThemeRegistry::current()->getImage('favorite-star-outline', 'title="'.translate('LBL_DASHLET_EDIT', 'Home').'" border="0" align="absmiddle"', null, null, '.gif', translate('LBL_DASHLET_EDIT', 'Home'))."</div> |
|
| 1328 | + <div class='favorite_icon_fill'>" . SugarThemeRegistry::current()->getImage('favorite-star', 'title="'.translate('LBL_DASHLET_EDIT', 'Home').'" border="0" align="absmiddle"', null, null, '.gif', translate('LBL_DASHLET_EDIT', 'Home'))."</div></div>"; |
|
| 1330 | 1329 | } |
| 1331 | 1330 | } |
| 1332 | 1331 | |
| 1333 | 1332 | // bug 56131 - restore conditional so that link doesn't appear where it shouldn't |
| 1334 | - if($show_help || $this->type == 'list') { |
|
| 1333 | + if ($show_help || $this->type == 'list') { |
|
| 1335 | 1334 | $theTitle .= "<span class='utils'>"; |
| 1336 | 1335 | $createImageURL = SugarThemeRegistry::current()->getImageURL('create-record.gif'); |
| 1337 | - if($this->type == 'list') $theTitle .= '<a href="#" class="btn btn-success showsearch"><span class=" glyphicon glyphicon-search" aria-hidden="true"></span></a>';$url = ajaxLink("index.php?module=$module&action=EditView&return_module=$module&return_action=DetailView"); |
|
| 1338 | - if($show_help) { |
|
| 1336 | + if ($this->type == 'list') $theTitle .= '<a href="#" class="btn btn-success showsearch"><span class=" glyphicon glyphicon-search" aria-hidden="true"></span></a>'; $url = ajaxLink("index.php?module=$module&action=EditView&return_module=$module&return_action=DetailView"); |
|
| 1337 | + if ($show_help) { |
|
| 1339 | 1338 | $theTitle .= <<<EOHTML |
| 1340 | 1339 | |
| 1341 | 1340 | <a id="create_image" href="{$url}" class="utilsLink"> |
@@ -1361,31 +1360,31 @@ discard block |
||
| 1361 | 1360 | { |
| 1362 | 1361 | $metadataFile = null; |
| 1363 | 1362 | $foundViewDefs = false; |
| 1364 | - $viewDef = strtolower($this->type) . 'viewdefs'; |
|
| 1365 | - $coreMetaPath = 'modules/'.$this->module.'/metadata/' . $viewDef . '.php'; |
|
| 1366 | - if(file_exists('custom/' .$coreMetaPath )){ |
|
| 1367 | - $metadataFile = 'custom/' . $coreMetaPath; |
|
| 1363 | + $viewDef = strtolower($this->type).'viewdefs'; |
|
| 1364 | + $coreMetaPath = 'modules/'.$this->module.'/metadata/'.$viewDef.'.php'; |
|
| 1365 | + if (file_exists('custom/'.$coreMetaPath)) { |
|
| 1366 | + $metadataFile = 'custom/'.$coreMetaPath; |
|
| 1368 | 1367 | $foundViewDefs = true; |
| 1369 | - }else{ |
|
| 1370 | - if(file_exists('custom/modules/'.$this->module.'/metadata/metafiles.php')){ |
|
| 1368 | + } else { |
|
| 1369 | + if (file_exists('custom/modules/'.$this->module.'/metadata/metafiles.php')) { |
|
| 1371 | 1370 | require_once('custom/modules/'.$this->module.'/metadata/metafiles.php'); |
| 1372 | - if(!empty($metafiles[$this->module][$viewDef])){ |
|
| 1371 | + if (!empty($metafiles[$this->module][$viewDef])) { |
|
| 1373 | 1372 | $metadataFile = $metafiles[$this->module][$viewDef]; |
| 1374 | 1373 | $foundViewDefs = true; |
| 1375 | 1374 | } |
| 1376 | - }elseif(file_exists('modules/'.$this->module.'/metadata/metafiles.php')){ |
|
| 1375 | + }elseif (file_exists('modules/'.$this->module.'/metadata/metafiles.php')) { |
|
| 1377 | 1376 | require_once('modules/'.$this->module.'/metadata/metafiles.php'); |
| 1378 | - if(!empty($metafiles[$this->module][$viewDef])){ |
|
| 1377 | + if (!empty($metafiles[$this->module][$viewDef])) { |
|
| 1379 | 1378 | $metadataFile = $metafiles[$this->module][$viewDef]; |
| 1380 | 1379 | $foundViewDefs = true; |
| 1381 | 1380 | } |
| 1382 | 1381 | } |
| 1383 | 1382 | } |
| 1384 | 1383 | |
| 1385 | - if(!$foundViewDefs && file_exists($coreMetaPath)){ |
|
| 1384 | + if (!$foundViewDefs && file_exists($coreMetaPath)) { |
|
| 1386 | 1385 | $metadataFile = $coreMetaPath; |
| 1387 | 1386 | } |
| 1388 | - $GLOBALS['log']->debug("metadatafile=". $metadataFile); |
|
| 1387 | + $GLOBALS['log']->debug("metadatafile=".$metadataFile); |
|
| 1389 | 1388 | |
| 1390 | 1389 | return $metadataFile; |
| 1391 | 1390 | } |
@@ -1402,10 +1401,10 @@ discard block |
||
| 1402 | 1401 | { |
| 1403 | 1402 | $params = array($this->_getModuleTitleListParam($browserTitle)); |
| 1404 | 1403 | //$params = array(); |
| 1405 | - if (isset($this->action)){ |
|
| 1404 | + if (isset($this->action)) { |
|
| 1406 | 1405 | switch ($this->action) { |
| 1407 | 1406 | case 'EditView': |
| 1408 | - if(!empty($this->bean->id) && (empty($_REQUEST['isDuplicate']) || $_REQUEST['isDuplicate'] === 'false')) { |
|
| 1407 | + if (!empty($this->bean->id) && (empty($_REQUEST['isDuplicate']) || $_REQUEST['isDuplicate'] === 'false')) { |
|
| 1409 | 1408 | $params[] = "<a href='index.php?module={$this->module}&action=DetailView&record={$this->bean->id}'>".$this->bean->get_summary_text()."</a>"; |
| 1410 | 1409 | $params[] = $GLOBALS['app_strings']['LBL_EDIT_BUTTON_LABEL']; |
| 1411 | 1410 | } |
@@ -1429,18 +1428,18 @@ discard block |
||
| 1429 | 1428 | * there should be no HTML in the string |
| 1430 | 1429 | * @return string |
| 1431 | 1430 | */ |
| 1432 | - protected function _getModuleTitleListParam( $browserTitle = false ) |
|
| 1431 | + protected function _getModuleTitleListParam($browserTitle = false) |
|
| 1433 | 1432 | { |
| 1434 | 1433 | global $current_user; |
| 1435 | 1434 | global $app_strings; |
| 1436 | 1435 | |
| 1437 | - if(!empty($GLOBALS['app_list_strings']['moduleList'][$this->module])) |
|
| 1436 | + if (!empty($GLOBALS['app_list_strings']['moduleList'][$this->module])) |
|
| 1438 | 1437 | $firstParam = $GLOBALS['app_list_strings']['moduleList'][$this->module]; |
| 1439 | 1438 | else |
| 1440 | 1439 | $firstParam = $this->module; |
| 1441 | 1440 | |
| 1442 | 1441 | $iconPath = $this->getModuleTitleIconPath($this->module); |
| 1443 | - if($this->action == "ListView" || $this->action == "index") { |
|
| 1442 | + if ($this->action == "ListView" || $this->action == "index") { |
|
| 1444 | 1443 | if (!empty($iconPath) && !$browserTitle) { |
| 1445 | 1444 | if (SugarThemeRegistry::current()->directionality == "ltr") { |
| 1446 | 1445 | return $app_strings['LBL_SEARCH']." " |
@@ -1466,10 +1465,10 @@ discard block |
||
| 1466 | 1465 | protected function getModuleTitleIconPath($module) |
| 1467 | 1466 | { |
| 1468 | 1467 | $iconPath = ""; |
| 1469 | - if(is_file(SugarThemeRegistry::current()->getImageURL('icon_'.$module.'_32.png',false))) { |
|
| 1468 | + if (is_file(SugarThemeRegistry::current()->getImageURL('icon_'.$module.'_32.png', false))) { |
|
| 1470 | 1469 | $iconPath = SugarThemeRegistry::current()->getImageURL('icon_'.$module.'_32.png'); |
| 1471 | 1470 | } |
| 1472 | - else if (is_file(SugarThemeRegistry::current()->getImageURL('icon_'.ucfirst($module).'_32.png',false))) { |
|
| 1471 | + else if (is_file(SugarThemeRegistry::current()->getImageURL('icon_'.ucfirst($module).'_32.png', false))) { |
|
| 1473 | 1472 | $iconPath = SugarThemeRegistry::current()->getImageURL('icon_'.ucfirst($module).'_32.png'); |
| 1474 | 1473 | } |
| 1475 | 1474 | return $iconPath; |
@@ -1486,11 +1485,11 @@ discard block |
||
| 1486 | 1485 | global $app_strings; |
| 1487 | 1486 | |
| 1488 | 1487 | $browserTitle = $app_strings['LBL_BROWSER_TITLE']; |
| 1489 | - if ( $this->module == 'Users' && ($this->action == 'SetTimezone' || $this->action == 'Login') ) |
|
| 1488 | + if ($this->module == 'Users' && ($this->action == 'SetTimezone' || $this->action == 'Login')) |
|
| 1490 | 1489 | return $browserTitle; |
| 1491 | 1490 | $params = $this->_getModuleTitleParams(true); |
| 1492 | - foreach ($params as $value ) |
|
| 1493 | - $browserTitle = strip_tags($value) . ' » ' . $browserTitle; |
|
| 1491 | + foreach ($params as $value) |
|
| 1492 | + $browserTitle = strip_tags($value).' » '.$browserTitle; |
|
| 1494 | 1493 | |
| 1495 | 1494 | return $browserTitle; |
| 1496 | 1495 | } |
@@ -1502,7 +1501,7 @@ discard block |
||
| 1502 | 1501 | */ |
| 1503 | 1502 | public function getBreadCrumbSymbol() |
| 1504 | 1503 | { |
| 1505 | - if(SugarThemeRegistry::current()->directionality == "ltr") { |
|
| 1504 | + if (SugarThemeRegistry::current()->directionality == "ltr") { |
|
| 1506 | 1505 | return "<span class='pointer'>»</span>"; |
| 1507 | 1506 | } |
| 1508 | 1507 | else { |
@@ -1515,29 +1514,29 @@ discard block |
||
| 1515 | 1514 | * |
| 1516 | 1515 | * @return array |
| 1517 | 1516 | */ |
| 1518 | - protected function getSugarConfigJS(){ |
|
| 1517 | + protected function getSugarConfigJS() { |
|
| 1519 | 1518 | global $sugar_config; |
| 1520 | 1519 | |
| 1521 | 1520 | // Set all the config parameters in the JS config as necessary |
| 1522 | 1521 | $config_js = array(); |
| 1523 | 1522 | // AjaxUI stock banned modules |
| 1524 | 1523 | $config_js[] = "SUGAR.config.stockAjaxBannedModules = ".json_encode(ajaxBannedModules()).";"; |
| 1525 | - if ( isset($sugar_config['quicksearch_querydelay']) ) { |
|
| 1524 | + if (isset($sugar_config['quicksearch_querydelay'])) { |
|
| 1526 | 1525 | $config_js[] = $this->prepareConfigVarForJs('quicksearch_querydelay', $sugar_config['quicksearch_querydelay']); |
| 1527 | 1526 | } |
| 1528 | - if ( empty($sugar_config['disableAjaxUI']) ) { |
|
| 1527 | + if (empty($sugar_config['disableAjaxUI'])) { |
|
| 1529 | 1528 | $config_js[] = "SUGAR.config.disableAjaxUI = false;"; |
| 1530 | 1529 | } |
| 1531 | - else{ |
|
| 1530 | + else { |
|
| 1532 | 1531 | $config_js[] = "SUGAR.config.disableAjaxUI = true;"; |
| 1533 | 1532 | } |
| 1534 | - if ( !empty($sugar_config['addAjaxBannedModules']) ){ |
|
| 1533 | + if (!empty($sugar_config['addAjaxBannedModules'])) { |
|
| 1535 | 1534 | $config_js[] = $this->prepareConfigVarForJs('addAjaxBannedModules', $sugar_config['addAjaxBannedModules']); |
| 1536 | 1535 | } |
| 1537 | - if ( !empty($sugar_config['overrideAjaxBannedModules']) ){ |
|
| 1536 | + if (!empty($sugar_config['overrideAjaxBannedModules'])) { |
|
| 1538 | 1537 | $config_js[] = $this->prepareConfigVarForJs('overrideAjaxBannedModules', $sugar_config['overrideAjaxBannedModules']); |
| 1539 | 1538 | } |
| 1540 | - if (!empty($sugar_config['js_available']) && is_array ($sugar_config['js_available'])) |
|
| 1539 | + if (!empty($sugar_config['js_available']) && is_array($sugar_config['js_available'])) |
|
| 1541 | 1540 | { |
| 1542 | 1541 | foreach ($sugar_config['js_available'] as $configKey) |
| 1543 | 1542 | { |
@@ -1598,7 +1597,7 @@ discard block |
||
| 1598 | 1597 | protected function getFavicon() |
| 1599 | 1598 | { |
| 1600 | 1599 | // get favicon |
| 1601 | - if(isset($GLOBALS['sugar_config']['default_module_favicon'])) |
|
| 1600 | + if (isset($GLOBALS['sugar_config']['default_module_favicon'])) |
|
| 1602 | 1601 | $module_favicon = $GLOBALS['sugar_config']['default_module_favicon']; |
| 1603 | 1602 | else |
| 1604 | 1603 | $module_favicon = false; |
@@ -1606,10 +1605,10 @@ discard block |
||
| 1606 | 1605 | $themeObject = SugarThemeRegistry::current(); |
| 1607 | 1606 | |
| 1608 | 1607 | $favicon = ''; |
| 1609 | - if ( $module_favicon ) |
|
| 1610 | - $favicon = $themeObject->getImageURL($this->module.'.gif',false); |
|
| 1611 | - if ( !sugar_is_file($favicon) || !$module_favicon ) |
|
| 1612 | - $favicon = $themeObject->getImageURL('sugar_icon.ico',false); |
|
| 1608 | + if ($module_favicon) |
|
| 1609 | + $favicon = $themeObject->getImageURL($this->module.'.gif', false); |
|
| 1610 | + if (!sugar_is_file($favicon) || !$module_favicon) |
|
| 1611 | + $favicon = $themeObject->getImageURL('sugar_icon.ico', false); |
|
| 1613 | 1612 | |
| 1614 | 1613 | $extension = pathinfo($favicon, PATHINFO_EXTENSION); |
| 1615 | 1614 | switch ($extension) |
@@ -1666,10 +1665,10 @@ discard block |
||
| 1666 | 1665 | * @return array augmented history with image link and shortened name |
| 1667 | 1666 | */ |
| 1668 | 1667 | protected function processRecentRecords($history) { |
| 1669 | - foreach ( $history as $key => $row ) { |
|
| 1668 | + foreach ($history as $key => $row) { |
|
| 1670 | 1669 | $history[$key]['item_summary_short'] = to_html(getTrackerSubstring($row['item_summary'])); //bug 56373 - need to re-HTML-encode |
| 1671 | 1670 | $history[$key]['image'] = SugarThemeRegistry::current() |
| 1672 | - ->getImage($row['module_name'],'border="0" align="absmiddle"',null,null,'.gif',$row['item_summary']); |
|
| 1671 | + ->getImage($row['module_name'], 'border="0" align="absmiddle"', null, null, '.gif', $row['item_summary']); |
|
| 1673 | 1672 | } |
| 1674 | 1673 | return $history; |
| 1675 | 1674 | } |
@@ -1683,10 +1682,10 @@ discard block |
||
| 1683 | 1682 | * |
| 1684 | 1683 | * @return boolean indicating true or false |
| 1685 | 1684 | */ |
| 1686 | - public function checkPostMaxSizeError(){ |
|
| 1685 | + public function checkPostMaxSizeError() { |
|
| 1687 | 1686 | //if the referrer is post, and the post array is empty, then an error has occurred, most likely |
| 1688 | 1687 | //while uploading a file that exceeds the post_max_size. |
| 1689 | - if(empty($_FILES) && empty($_POST) && isset($_SERVER['REQUEST_METHOD']) && strtolower($_SERVER['REQUEST_METHOD']) == 'post'){ |
|
| 1688 | + if (empty($_FILES) && empty($_POST) && isset($_SERVER['REQUEST_METHOD']) && strtolower($_SERVER['REQUEST_METHOD']) == 'post') { |
|
| 1690 | 1689 | $GLOBALS['log']->fatal($GLOBALS['app_strings']['UPLOAD_ERROR_HOME_TEXT']); |
| 1691 | 1690 | return true; |
| 1692 | 1691 | } |
@@ -102,8 +102,7 @@ discard block |
||
| 102 | 102 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 103 | 103 | if(isset($GLOBALS['log'])) { |
| 104 | 104 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 105 | - } |
|
| 106 | - else { |
|
| 105 | + } else { |
|
| 107 | 106 | trigger_error($deprecatedMessage, E_USER_DEPRECATED); |
| 108 | 107 | } |
| 109 | 108 | self::__construct($bean, $view_object_map); |
@@ -178,13 +177,17 @@ discard block |
||
| 178 | 177 | echo $jsAlerts->getScript(); |
| 179 | 178 | } |
| 180 | 179 | |
| 181 | - if ($this->_getOption('show_subpanels') && !empty($_REQUEST['record'])) $this->_displaySubPanels(); |
|
| 180 | + if ($this->_getOption('show_subpanels') && !empty($_REQUEST['record'])) { |
|
| 181 | + $this->_displaySubPanels(); |
|
| 182 | + } |
|
| 182 | 183 | |
| 183 | 184 | if ($this->action === 'Login') { |
| 184 | 185 | //this is needed for a faster loading login page ie won't render unless the tables are closed |
| 185 | 186 | ob_flush(); |
| 186 | 187 | } |
| 187 | - if ($this->_getOption('show_footer')) $this->displayFooter(); |
|
| 188 | + if ($this->_getOption('show_footer')) { |
|
| 189 | + $this->displayFooter(); |
|
| 190 | + } |
|
| 188 | 191 | $GLOBALS['logic_hook']->call_custom_logic('', 'after_ui_footer'); |
| 189 | 192 | if ($this->_getOption('json_output')) |
| 190 | 193 | { |
@@ -203,11 +206,13 @@ discard block |
||
| 203 | 206 | 'favicon' => $this->getFavicon(), |
| 204 | 207 | ); |
| 205 | 208 | |
| 206 | - if(SugarThemeRegistry::current()->name == 'Classic' || SugarThemeRegistry::current()->classic) |
|
| 207 | - $ajax_ret['moduleList'] = $this->displayHeader(true); |
|
| 209 | + if(SugarThemeRegistry::current()->name == 'Classic' || SugarThemeRegistry::current()->classic) { |
|
| 210 | + $ajax_ret['moduleList'] = $this->displayHeader(true); |
|
| 211 | + } |
|
| 208 | 212 | |
| 209 | - if(empty($this->responseTime)) |
|
| 210 | - $this->_calculateFooterMetrics(); |
|
| 213 | + if(empty($this->responseTime)) { |
|
| 214 | + $this->_calculateFooterMetrics(); |
|
| 215 | + } |
|
| 211 | 216 | $ajax_ret['responseTime'] = $this->responseTime; |
| 212 | 217 | $json = getJSONobj(); |
| 213 | 218 | echo $json->encode($ajax_ret); |
@@ -231,8 +236,7 @@ discard block |
||
| 231 | 236 | |
| 232 | 237 | if ( !$this->suppressDisplayErrors ) { |
| 233 | 238 | echo $errors; |
| 234 | - } |
|
| 235 | - else { |
|
| 239 | + } else { |
|
| 236 | 240 | return $errors; |
| 237 | 241 | } |
| 238 | 242 | } |
@@ -346,24 +350,26 @@ discard block |
||
| 346 | 350 | ob_end_clean(); |
| 347 | 351 | |
| 348 | 352 | // get favicon |
| 349 | - if(isset($GLOBALS['sugar_config']['default_module_favicon'])) |
|
| 350 | - $module_favicon = $GLOBALS['sugar_config']['default_module_favicon']; |
|
| 351 | - else |
|
| 352 | - $module_favicon = false; |
|
| 353 | + if(isset($GLOBALS['sugar_config']['default_module_favicon'])) { |
|
| 354 | + $module_favicon = $GLOBALS['sugar_config']['default_module_favicon']; |
|
| 355 | + } else { |
|
| 356 | + $module_favicon = false; |
|
| 357 | + } |
|
| 353 | 358 | |
| 354 | 359 | $favicon = $this->getFavicon(); |
| 355 | 360 | $ss->assign('FAVICON_URL', $favicon['url']); |
| 356 | 361 | |
| 357 | 362 | // build the shortcut menu |
| 358 | 363 | $shortcut_menu = array(); |
| 359 | - foreach ( $this->getMenu() as $key => $menu_item ) |
|
| 360 | - $shortcut_menu[$key] = array( |
|
| 364 | + foreach ( $this->getMenu() as $key => $menu_item ) { |
|
| 365 | + $shortcut_menu[$key] = array( |
|
| 361 | 366 | "URL" => $menu_item[0], |
| 362 | 367 | "LABEL" => $menu_item[1], |
| 363 | 368 | "MODULE_NAME" => $menu_item[2], |
| 364 | 369 | "IMAGE" => $themeObject |
| 365 | 370 | ->getImage($menu_item[2],"border='0' align='absmiddle'",null,null,'.gif',$menu_item[1]), |
| 366 | 371 | ); |
| 372 | + } |
|
| 367 | 373 | $ss->assign("SHORTCUT_MENU",$shortcut_menu); |
| 368 | 374 | |
| 369 | 375 | // handle rtl text direction |
@@ -387,8 +393,7 @@ discard block |
||
| 387 | 393 | $ss->assign("COMPANY_LOGO_MD5", $company_logo_attributes[0]); |
| 388 | 394 | $ss->assign("COMPANY_LOGO_WIDTH", $company_logo_attributes[1]); |
| 389 | 395 | $ss->assign("COMPANY_LOGO_HEIGHT", $company_logo_attributes[2]); |
| 390 | - } |
|
| 391 | - else { |
|
| 396 | + } else { |
|
| 392 | 397 | // Always need to md5 the file |
| 393 | 398 | $ss->assign("COMPANY_LOGO_MD5", md5_file($companyLogoURL)); |
| 394 | 399 | |
@@ -396,14 +401,14 @@ discard block |
||
| 396 | 401 | if ( $width > 212 || $height > 40 ) { |
| 397 | 402 | $resizePctWidth = ($width - 212)/212; |
| 398 | 403 | $resizePctHeight = ($height - 40)/40; |
| 399 | - if ( $resizePctWidth > $resizePctHeight ) |
|
| 400 | - $resizeAmount = $width / 212; |
|
| 401 | - else |
|
| 402 | - $resizeAmount = $height / 40; |
|
| 404 | + if ( $resizePctWidth > $resizePctHeight ) { |
|
| 405 | + $resizeAmount = $width / 212; |
|
| 406 | + } else { |
|
| 407 | + $resizeAmount = $height / 40; |
|
| 408 | + } |
|
| 403 | 409 | $ss->assign("COMPANY_LOGO_WIDTH", round($width * (1/$resizeAmount))); |
| 404 | 410 | $ss->assign("COMPANY_LOGO_HEIGHT", round($height * (1/$resizeAmount))); |
| 405 | - } |
|
| 406 | - else { |
|
| 411 | + } else { |
|
| 407 | 412 | $ss->assign("COMPANY_LOGO_WIDTH", $width); |
| 408 | 413 | $ss->assign("COMPANY_LOGO_HEIGHT", $height); |
| 409 | 414 | } |
@@ -446,11 +451,12 @@ discard block |
||
| 446 | 451 | } |
| 447 | 452 | // and now the sublinks |
| 448 | 453 | if ( $linkattribute == 'submenu' && is_array($attributevalue) ) { |
| 449 | - foreach ($attributevalue as $submenulinkkey => $submenulinkinfo) |
|
| 450 | - $gcls[$key]['SUBMENU'][$submenulinkkey] = array( |
|
| 454 | + foreach ($attributevalue as $submenulinkkey => $submenulinkinfo) { |
|
| 455 | + $gcls[$key]['SUBMENU'][$submenulinkkey] = array( |
|
| 451 | 456 | "LABEL" => key($submenulinkinfo), |
| 452 | 457 | "URL" => current($submenulinkinfo), |
| 453 | 458 | ); |
| 459 | + } |
|
| 454 | 460 | if(substr($gcls[$key]['SUBMENU'][$submenulinkkey]["URL"], 0, 11) == "javascript:") { |
| 455 | 461 | $gcls[$key]['SUBMENU'][$submenulinkkey]["ONCLICK"] = substr($gcls[$key]['SUBMENU'][$submenulinkkey]["URL"],11); |
| 456 | 462 | $gcls[$key]['SUBMENU'][$submenulinkkey]["URL"] = "javascript:void(0)"; |
@@ -462,8 +468,9 @@ discard block |
||
| 462 | 468 | |
| 463 | 469 | $ss->assign("SEARCH", isset($_REQUEST['query_string']) ? $_REQUEST['query_string'] : ''); |
| 464 | 470 | |
| 465 | - if ($this->action == "EditView" || $this->action == "Login") |
|
| 466 | - $ss->assign("ONLOAD", 'onload="set_focus()"'); |
|
| 471 | + if ($this->action == "EditView" || $this->action == "Login") { |
|
| 472 | + $ss->assign("ONLOAD", 'onload="set_focus()"'); |
|
| 473 | + } |
|
| 467 | 474 | |
| 468 | 475 | $ss->assign("AUTHENTICATED",isset($_SESSION["authenticated_user_id"])); |
| 469 | 476 | |
@@ -523,8 +530,7 @@ discard block |
||
| 523 | 530 | foreach($frames as $key => $values){ |
| 524 | 531 | $fullModuleList[$key] = $values; |
| 525 | 532 | } |
| 526 | - } |
|
| 527 | - elseif (isset($fullModuleList['iFrames'])) { |
|
| 533 | + } elseif (isset($fullModuleList['iFrames'])) { |
|
| 528 | 534 | unset($fullModuleList['iFrames']); |
| 529 | 535 | } |
| 530 | 536 | |
@@ -540,8 +546,7 @@ discard block |
||
| 540 | 546 | // We have a default value. Use it |
| 541 | 547 | if(isset($GLOBALS['sugar_config']['default_max_tabs'])){ |
| 542 | 548 | $max_tabs = $GLOBALS['sugar_config']['default_max_tabs']; |
| 543 | - } |
|
| 544 | - else{ |
|
| 549 | + } else{ |
|
| 545 | 550 | $max_tabs = 8; |
| 546 | 551 | } |
| 547 | 552 | } |
@@ -650,7 +655,9 @@ discard block |
||
| 650 | 655 | ); |
| 651 | 656 | } |
| 652 | 657 | } |
| 653 | - if(!empty($sugar_config['lock_homepage']) && $sugar_config['lock_homepage'] == true) $ss->assign('lock_homepage', true); |
|
| 658 | + if(!empty($sugar_config['lock_homepage']) && $sugar_config['lock_homepage'] == true) { |
|
| 659 | + $ss->assign('lock_homepage', true); |
|
| 660 | + } |
|
| 654 | 661 | $ss->assign("groupTabs",$groupTabs); |
| 655 | 662 | $ss->assign("shortcutTopMenu",$shortcutTopMenu); |
| 656 | 663 | $ss->assign('USE_GROUP_TABS',$usingGroupTabs); |
@@ -693,8 +700,9 @@ discard block |
||
| 693 | 700 | global $mod_strings; |
| 694 | 701 | $mod_strings = $bakModStrings; |
| 695 | 702 | $headerTpl = $themeObject->getTemplate('header.tpl'); |
| 696 | - if (inDeveloperMode() ) |
|
| 697 | - $ss->clear_compiled_tpl($headerTpl); |
|
| 703 | + if (inDeveloperMode() ) { |
|
| 704 | + $ss->clear_compiled_tpl($headerTpl); |
|
| 705 | + } |
|
| 698 | 706 | |
| 699 | 707 | if ($retModTabs) |
| 700 | 708 | { |
@@ -733,8 +741,9 @@ discard block |
||
| 733 | 741 | global $gridline, $request_string, $modListHeader, $dashletData, $authController, $locale, $currentModule, $import_bean_map, $image_path, $license; |
| 734 | 742 | global $user_unique_key, $server_unique_key, $barChartColors, $modules_exempt_from_availability_check, $dictionary, $current_language, $beanList, $beanFiles, $sugar_build, $sugar_codename; |
| 735 | 743 | global $timedate, $login_error; // cn: bug 13855 - timedate not available to classic views. |
| 736 | - if (!empty($this->module)) |
|
| 737 | - $currentModule = $this->module; |
|
| 744 | + if (!empty($this->module)) { |
|
| 745 | + $currentModule = $this->module; |
|
| 746 | + } |
|
| 738 | 747 | require_once ($file); |
| 739 | 748 | } |
| 740 | 749 | |
@@ -764,8 +773,9 @@ discard block |
||
| 764 | 773 | if ( typeof(SUGAR.themes) == 'undefined' ) SUGAR.themes = {}; |
| 765 | 774 | </script> |
| 766 | 775 | EOQ; |
| 767 | - if(isset( $sugar_config['disc_client']) && $sugar_config['disc_client']) |
|
| 768 | - echo getVersionedScript('modules/Sync/headersync.js'); |
|
| 776 | + if(isset( $sugar_config['disc_client']) && $sugar_config['disc_client']) { |
|
| 777 | + echo getVersionedScript('modules/Sync/headersync.js'); |
|
| 778 | + } |
|
| 769 | 779 | } |
| 770 | 780 | |
| 771 | 781 | /** |
@@ -866,8 +876,9 @@ discard block |
||
| 866 | 876 | |
| 867 | 877 | echo $this->_getModLanguageJS(); |
| 868 | 878 | |
| 869 | - if(isset( $sugar_config['disc_client']) && $sugar_config['disc_client']) |
|
| 870 | - echo getVersionedScript('modules/Sync/headersync.js'); |
|
| 879 | + if(isset( $sugar_config['disc_client']) && $sugar_config['disc_client']) { |
|
| 880 | + echo getVersionedScript('modules/Sync/headersync.js'); |
|
| 881 | + } |
|
| 871 | 882 | |
| 872 | 883 | |
| 873 | 884 | //echo out the $js_vars variables as javascript variables |
@@ -934,8 +945,9 @@ discard block |
||
| 934 | 945 | } |
| 935 | 946 | } |
| 936 | 947 | $ss->assign("BOTTOMLINKS",$bottomLinksStr); |
| 937 | - if (SugarConfig::getInstance()->get('calculate_response_time', false)) |
|
| 938 | - $ss->assign('STATISTICS',$this->_getStatistics()); |
|
| 948 | + if (SugarConfig::getInstance()->get('calculate_response_time', false)) { |
|
| 949 | + $ss->assign('STATISTICS',$this->_getStatistics()); |
|
| 950 | + } |
|
| 939 | 951 | |
| 940 | 952 | // Under the License referenced above, you are required to leave in all copyright statements in both |
| 941 | 953 | // the code and end-user application. |
@@ -973,8 +985,7 @@ discard block |
||
| 973 | 985 | $ss->assign("COMPANY_LOGO_MD5", $company_logo_attributes[0]); |
| 974 | 986 | $ss->assign("COMPANY_LOGO_WIDTH", $company_logo_attributes[1]); |
| 975 | 987 | $ss->assign("COMPANY_LOGO_HEIGHT", $company_logo_attributes[2]); |
| 976 | - } |
|
| 977 | - else { |
|
| 988 | + } else { |
|
| 978 | 989 | // Always need to md5 the file |
| 979 | 990 | $ss->assign("COMPANY_LOGO_MD5", md5_file($companyLogoURL)); |
| 980 | 991 | |
@@ -982,14 +993,14 @@ discard block |
||
| 982 | 993 | if ( $width > 212 || $height > 40 ) { |
| 983 | 994 | $resizePctWidth = ($width - 212)/212; |
| 984 | 995 | $resizePctHeight = ($height - 40)/40; |
| 985 | - if ( $resizePctWidth > $resizePctHeight ) |
|
| 986 | - $resizeAmount = $width / 212; |
|
| 987 | - else |
|
| 988 | - $resizeAmount = $height / 40; |
|
| 996 | + if ( $resizePctWidth > $resizePctHeight ) { |
|
| 997 | + $resizeAmount = $width / 212; |
|
| 998 | + } else { |
|
| 999 | + $resizeAmount = $height / 40; |
|
| 1000 | + } |
|
| 989 | 1001 | $ss->assign("COMPANY_LOGO_WIDTH", round($width * (1/$resizeAmount))); |
| 990 | 1002 | $ss->assign("COMPANY_LOGO_HEIGHT", round($height * (1/$resizeAmount))); |
| 991 | - } |
|
| 992 | - else { |
|
| 1003 | + } else { |
|
| 993 | 1004 | $ss->assign("COMPANY_LOGO_WIDTH", $width); |
| 994 | 1005 | $ss->assign("COMPANY_LOGO_HEIGHT", $height); |
| 995 | 1006 | } |
@@ -1047,8 +1058,9 @@ discard block |
||
| 1047 | 1058 | |
| 1048 | 1059 | protected function _buildModuleList() |
| 1049 | 1060 | { |
| 1050 | - if (!empty($GLOBALS['current_user']) && empty($GLOBALS['modListHeader'])) |
|
| 1051 | - $GLOBALS['modListHeader'] = query_module_access_list($GLOBALS['current_user']); |
|
| 1061 | + if (!empty($GLOBALS['current_user']) && empty($GLOBALS['modListHeader'])) { |
|
| 1062 | + $GLOBALS['modListHeader'] = query_module_access_list($GLOBALS['current_user']); |
|
| 1063 | + } |
|
| 1052 | 1064 | } |
| 1053 | 1065 | |
| 1054 | 1066 | /** |
@@ -1068,7 +1080,9 @@ discard block |
||
| 1068 | 1080 | return $this->options['show_all']; |
| 1069 | 1081 | } elseif (!empty($this->options) && isset($this->options[$option])) { |
| 1070 | 1082 | return $this->options[$option]; |
| 1071 | - } else return $default; |
|
| 1083 | + } else { |
|
| 1084 | + return $default; |
|
| 1085 | + } |
|
| 1072 | 1086 | } |
| 1073 | 1087 | |
| 1074 | 1088 | /** |
@@ -1105,10 +1119,11 @@ discard block |
||
| 1105 | 1119 | |
| 1106 | 1120 | public function renderJavascript() |
| 1107 | 1121 | { |
| 1108 | - if ($this->action !== 'Login') |
|
| 1109 | - $this->_displayJavascript(); |
|
| 1110 | - else |
|
| 1111 | - $this->_displayLoginJS(); |
|
| 1122 | + if ($this->action !== 'Login') { |
|
| 1123 | + $this->_displayJavascript(); |
|
| 1124 | + } else { |
|
| 1125 | + $this->_displayLoginJS(); |
|
| 1126 | + } |
|
| 1112 | 1127 | } |
| 1113 | 1128 | |
| 1114 | 1129 | private function _calculateFooterMetrics() |
@@ -1215,8 +1230,9 @@ discard block |
||
| 1215 | 1230 | { |
| 1216 | 1231 | global $current_language, $current_user, $mod_strings, $app_strings, $module_menu; |
| 1217 | 1232 | |
| 1218 | - if ( empty($module) ) |
|
| 1219 | - $module = $this->module; |
|
| 1233 | + if ( empty($module) ) { |
|
| 1234 | + $module = $this->module; |
|
| 1235 | + } |
|
| 1220 | 1236 | |
| 1221 | 1237 | //Need to make sure the mod_strings match the requested module or Menus may fail |
| 1222 | 1238 | $curr_mod_strings = $mod_strings; |
@@ -1237,13 +1253,14 @@ discard block |
||
| 1237 | 1253 | $GLOBALS['mod_strings']['LNK_NEW_RECORD'],"{$GLOBALS['app_strings']['LBL_CREATE_BUTTON_LABEL']}$module" ,$module ); |
| 1238 | 1254 | $module_menu[] = array("index.php?module=$module&action=index", $GLOBALS['mod_strings']['LNK_LIST'], |
| 1239 | 1255 | $module, $module); |
| 1240 | - if ( ($this->bean instanceOf SugarBean) && !empty($this->bean->importable) ) |
|
| 1241 | - if ( !empty($mod_strings['LNK_IMPORT_'.strtoupper($module)]) ) |
|
| 1256 | + if ( ($this->bean instanceOf SugarBean) && !empty($this->bean->importable) ) { |
|
| 1257 | + if ( !empty($mod_strings['LNK_IMPORT_'.strtoupper($module)]) ) |
|
| 1242 | 1258 | $module_menu[] = array("index.php?module=Import&action=Step1&import_module=$module&return_module=$module&return_action=index", |
| 1243 | 1259 | $mod_strings['LNK_IMPORT_'.strtoupper($module)], "Import", $module); |
| 1244 | - else |
|
| 1245 | - $module_menu[] = array("index.php?module=Import&action=Step1&import_module=$module&return_module=$module&return_action=index", |
|
| 1260 | + } else { |
|
| 1261 | + $module_menu[] = array("index.php?module=Import&action=Step1&import_module=$module&return_module=$module&return_action=index", |
|
| 1246 | 1262 | $app_strings['LBL_IMPORT'], "Import", $module); |
| 1263 | + } |
|
| 1247 | 1264 | } |
| 1248 | 1265 | if (file_exists('custom/application/Ext/Menus/menu.ext.php')) { |
| 1249 | 1266 | require('custom/application/Ext/Menus/menu.ext.php'); |
@@ -1268,22 +1285,25 @@ discard block |
||
| 1268 | 1285 | $defaultTab = (in_array("Home",$userTabs)) ? "Home" : key($userTabs); |
| 1269 | 1286 | |
| 1270 | 1287 | // Need to figure out what tab this module belongs to, most modules have their own tabs, but there are exceptions. |
| 1271 | - if ( !empty($_REQUEST['module_tab']) ) |
|
| 1272 | - return $_REQUEST['module_tab']; |
|
| 1273 | - elseif ( isset($moduleTabMap[$this->module]) ) |
|
| 1274 | - return $moduleTabMap[$this->module]; |
|
| 1288 | + if ( !empty($_REQUEST['module_tab']) ) { |
|
| 1289 | + return $_REQUEST['module_tab']; |
|
| 1290 | + } elseif ( isset($moduleTabMap[$this->module]) ) { |
|
| 1291 | + return $moduleTabMap[$this->module]; |
|
| 1292 | + } |
|
| 1275 | 1293 | // Special cases |
| 1276 | - elseif ( $this->module == 'MergeRecords' ) |
|
| 1277 | - return !empty($_REQUEST['merge_module']) ? $_REQUEST['merge_module'] : $_REQUEST['return_module']; |
|
| 1278 | - elseif ( $this->module == 'Users' && $this->action == 'SetTimezone' ) |
|
| 1279 | - return $defaultTab; |
|
| 1294 | + elseif ( $this->module == 'MergeRecords' ) { |
|
| 1295 | + return !empty($_REQUEST['merge_module']) ? $_REQUEST['merge_module'] : $_REQUEST['return_module']; |
|
| 1296 | + } elseif ( $this->module == 'Users' && $this->action == 'SetTimezone' ) { |
|
| 1297 | + return $defaultTab; |
|
| 1298 | + } |
|
| 1280 | 1299 | // Default anonymous pages to be under Home |
| 1281 | - elseif ( !isset($app_list_strings['moduleList'][$this->module]) ) |
|
| 1282 | - return $defaultTab; |
|
| 1283 | - elseif ( isset($_REQUEST['action']) && $_REQUEST['action'] == "ajaxui" ) |
|
| 1284 | - return $defaultTab; |
|
| 1285 | - else |
|
| 1286 | - return $this->module; |
|
| 1300 | + elseif ( !isset($app_list_strings['moduleList'][$this->module]) ) { |
|
| 1301 | + return $defaultTab; |
|
| 1302 | + } elseif ( isset($_REQUEST['action']) && $_REQUEST['action'] == "ajaxui" ) { |
|
| 1303 | + return $defaultTab; |
|
| 1304 | + } else { |
|
| 1305 | + return $this->module; |
|
| 1306 | + } |
|
| 1287 | 1307 | } |
| 1288 | 1308 | |
| 1289 | 1309 | /** |
@@ -1334,7 +1354,10 @@ discard block |
||
| 1334 | 1354 | if($show_help || $this->type == 'list') { |
| 1335 | 1355 | $theTitle .= "<span class='utils'>"; |
| 1336 | 1356 | $createImageURL = SugarThemeRegistry::current()->getImageURL('create-record.gif'); |
| 1337 | - if($this->type == 'list') $theTitle .= '<a href="#" class="btn btn-success showsearch"><span class=" glyphicon glyphicon-search" aria-hidden="true"></span></a>';$url = ajaxLink("index.php?module=$module&action=EditView&return_module=$module&return_action=DetailView"); |
|
| 1357 | + if($this->type == 'list') { |
|
| 1358 | + $theTitle .= '<a href="#" class="btn btn-success showsearch"><span class=" glyphicon glyphicon-search" aria-hidden="true"></span></a>'; |
|
| 1359 | + } |
|
| 1360 | + $url = ajaxLink("index.php?module=$module&action=EditView&return_module=$module&return_action=DetailView"); |
|
| 1338 | 1361 | if($show_help) { |
| 1339 | 1362 | $theTitle .= <<<EOHTML |
| 1340 | 1363 | |
@@ -1366,14 +1389,14 @@ discard block |
||
| 1366 | 1389 | if(file_exists('custom/' .$coreMetaPath )){ |
| 1367 | 1390 | $metadataFile = 'custom/' . $coreMetaPath; |
| 1368 | 1391 | $foundViewDefs = true; |
| 1369 | - }else{ |
|
| 1392 | + } else{ |
|
| 1370 | 1393 | if(file_exists('custom/modules/'.$this->module.'/metadata/metafiles.php')){ |
| 1371 | 1394 | require_once('custom/modules/'.$this->module.'/metadata/metafiles.php'); |
| 1372 | 1395 | if(!empty($metafiles[$this->module][$viewDef])){ |
| 1373 | 1396 | $metadataFile = $metafiles[$this->module][$viewDef]; |
| 1374 | 1397 | $foundViewDefs = true; |
| 1375 | 1398 | } |
| 1376 | - }elseif(file_exists('modules/'.$this->module.'/metadata/metafiles.php')){ |
|
| 1399 | + } elseif(file_exists('modules/'.$this->module.'/metadata/metafiles.php')){ |
|
| 1377 | 1400 | require_once('modules/'.$this->module.'/metadata/metafiles.php'); |
| 1378 | 1401 | if(!empty($metafiles[$this->module][$viewDef])){ |
| 1379 | 1402 | $metadataFile = $metafiles[$this->module][$viewDef]; |
@@ -1408,9 +1431,9 @@ discard block |
||
| 1408 | 1431 | if(!empty($this->bean->id) && (empty($_REQUEST['isDuplicate']) || $_REQUEST['isDuplicate'] === 'false')) { |
| 1409 | 1432 | $params[] = "<a href='index.php?module={$this->module}&action=DetailView&record={$this->bean->id}'>".$this->bean->get_summary_text()."</a>"; |
| 1410 | 1433 | $params[] = $GLOBALS['app_strings']['LBL_EDIT_BUTTON_LABEL']; |
| 1434 | + } else { |
|
| 1435 | + $params[] = $GLOBALS['app_strings']['LBL_CREATE_BUTTON_LABEL']; |
|
| 1411 | 1436 | } |
| 1412 | - else |
|
| 1413 | - $params[] = $GLOBALS['app_strings']['LBL_CREATE_BUTTON_LABEL']; |
|
| 1414 | 1437 | break; |
| 1415 | 1438 | case 'DetailView': |
| 1416 | 1439 | $beanName = $this->bean->get_summary_text(); |
@@ -1434,10 +1457,11 @@ discard block |
||
| 1434 | 1457 | global $current_user; |
| 1435 | 1458 | global $app_strings; |
| 1436 | 1459 | |
| 1437 | - if(!empty($GLOBALS['app_list_strings']['moduleList'][$this->module])) |
|
| 1438 | - $firstParam = $GLOBALS['app_list_strings']['moduleList'][$this->module]; |
|
| 1439 | - else |
|
| 1440 | - $firstParam = $this->module; |
|
| 1460 | + if(!empty($GLOBALS['app_list_strings']['moduleList'][$this->module])) { |
|
| 1461 | + $firstParam = $GLOBALS['app_list_strings']['moduleList'][$this->module]; |
|
| 1462 | + } else { |
|
| 1463 | + $firstParam = $this->module; |
|
| 1464 | + } |
|
| 1441 | 1465 | |
| 1442 | 1466 | $iconPath = $this->getModuleTitleIconPath($this->module); |
| 1443 | 1467 | if($this->action == "ListView" || $this->action == "index") { |
@@ -1453,8 +1477,7 @@ discard block |
||
| 1453 | 1477 | } else { |
| 1454 | 1478 | return $firstParam; |
| 1455 | 1479 | } |
| 1456 | - } |
|
| 1457 | - else { |
|
| 1480 | + } else { |
|
| 1458 | 1481 | if (!empty($iconPath) && !$browserTitle) { |
| 1459 | 1482 | //return "<a href='index.php?module={$this->module}&action=index'>$this->module</a>"; |
| 1460 | 1483 | } else { |
@@ -1468,8 +1491,7 @@ discard block |
||
| 1468 | 1491 | $iconPath = ""; |
| 1469 | 1492 | if(is_file(SugarThemeRegistry::current()->getImageURL('icon_'.$module.'_32.png',false))) { |
| 1470 | 1493 | $iconPath = SugarThemeRegistry::current()->getImageURL('icon_'.$module.'_32.png'); |
| 1471 | - } |
|
| 1472 | - else if (is_file(SugarThemeRegistry::current()->getImageURL('icon_'.ucfirst($module).'_32.png',false))) { |
|
| 1494 | + } else if (is_file(SugarThemeRegistry::current()->getImageURL('icon_'.ucfirst($module).'_32.png',false))) { |
|
| 1473 | 1495 | $iconPath = SugarThemeRegistry::current()->getImageURL('icon_'.ucfirst($module).'_32.png'); |
| 1474 | 1496 | } |
| 1475 | 1497 | return $iconPath; |
@@ -1486,11 +1508,13 @@ discard block |
||
| 1486 | 1508 | global $app_strings; |
| 1487 | 1509 | |
| 1488 | 1510 | $browserTitle = $app_strings['LBL_BROWSER_TITLE']; |
| 1489 | - if ( $this->module == 'Users' && ($this->action == 'SetTimezone' || $this->action == 'Login') ) |
|
| 1490 | - return $browserTitle; |
|
| 1511 | + if ( $this->module == 'Users' && ($this->action == 'SetTimezone' || $this->action == 'Login') ) { |
|
| 1512 | + return $browserTitle; |
|
| 1513 | + } |
|
| 1491 | 1514 | $params = $this->_getModuleTitleParams(true); |
| 1492 | - foreach ($params as $value ) |
|
| 1493 | - $browserTitle = strip_tags($value) . ' » ' . $browserTitle; |
|
| 1515 | + foreach ($params as $value ) { |
|
| 1516 | + $browserTitle = strip_tags($value) . ' » ' . $browserTitle; |
|
| 1517 | + } |
|
| 1494 | 1518 | |
| 1495 | 1519 | return $browserTitle; |
| 1496 | 1520 | } |
@@ -1504,8 +1528,7 @@ discard block |
||
| 1504 | 1528 | { |
| 1505 | 1529 | if(SugarThemeRegistry::current()->directionality == "ltr") { |
| 1506 | 1530 | return "<span class='pointer'>»</span>"; |
| 1507 | - } |
|
| 1508 | - else { |
|
| 1531 | + } else { |
|
| 1509 | 1532 | return "<span class='pointer'>«</span>"; |
| 1510 | 1533 | } |
| 1511 | 1534 | } |
@@ -1527,8 +1550,7 @@ discard block |
||
| 1527 | 1550 | } |
| 1528 | 1551 | if ( empty($sugar_config['disableAjaxUI']) ) { |
| 1529 | 1552 | $config_js[] = "SUGAR.config.disableAjaxUI = false;"; |
| 1530 | - } |
|
| 1531 | - else{ |
|
| 1553 | + } else{ |
|
| 1532 | 1554 | $config_js[] = "SUGAR.config.disableAjaxUI = true;"; |
| 1533 | 1555 | } |
| 1534 | 1556 | if ( !empty($sugar_config['addAjaxBannedModules']) ){ |
@@ -1598,18 +1620,21 @@ discard block |
||
| 1598 | 1620 | protected function getFavicon() |
| 1599 | 1621 | { |
| 1600 | 1622 | // get favicon |
| 1601 | - if(isset($GLOBALS['sugar_config']['default_module_favicon'])) |
|
| 1602 | - $module_favicon = $GLOBALS['sugar_config']['default_module_favicon']; |
|
| 1603 | - else |
|
| 1604 | - $module_favicon = false; |
|
| 1623 | + if(isset($GLOBALS['sugar_config']['default_module_favicon'])) { |
|
| 1624 | + $module_favicon = $GLOBALS['sugar_config']['default_module_favicon']; |
|
| 1625 | + } else { |
|
| 1626 | + $module_favicon = false; |
|
| 1627 | + } |
|
| 1605 | 1628 | |
| 1606 | 1629 | $themeObject = SugarThemeRegistry::current(); |
| 1607 | 1630 | |
| 1608 | 1631 | $favicon = ''; |
| 1609 | - if ( $module_favicon ) |
|
| 1610 | - $favicon = $themeObject->getImageURL($this->module.'.gif',false); |
|
| 1611 | - if ( !sugar_is_file($favicon) || !$module_favicon ) |
|
| 1612 | - $favicon = $themeObject->getImageURL('sugar_icon.ico',false); |
|
| 1632 | + if ( $module_favicon ) { |
|
| 1633 | + $favicon = $themeObject->getImageURL($this->module.'.gif',false); |
|
| 1634 | + } |
|
| 1635 | + if ( !sugar_is_file($favicon) || !$module_favicon ) { |
|
| 1636 | + $favicon = $themeObject->getImageURL('sugar_icon.ico',false); |
|
| 1637 | + } |
|
| 1613 | 1638 | |
| 1614 | 1639 | $extension = pathinfo($favicon, PATHINFO_EXTENSION); |
| 1615 | 1640 | switch ($extension) |
@@ -46,9 +46,9 @@ discard block |
||
| 46 | 46 | */ |
| 47 | 47 | class ListViewData { |
| 48 | 48 | |
| 49 | - var $additionalDetails = true; |
|
| 49 | + var $additionalDetails = true; |
|
| 50 | 50 | var $listviewName = null; |
| 51 | - var $additionalDetailsAllow = null; |
|
| 51 | + var $additionalDetailsAllow = null; |
|
| 52 | 52 | var $additionalDetailsAjax = true; // leave this true when using filter fields |
| 53 | 53 | var $additionalDetailsFieldToAdd = 'NAME'; // where the span will be attached to |
| 54 | 54 | var $base_url = null; |
@@ -58,15 +58,15 @@ discard block |
||
| 58 | 58 | */ |
| 59 | 59 | var $count_query = ''; |
| 60 | 60 | |
| 61 | - /** |
|
| 62 | - * Constructor sets the limitName to look up the limit in $sugar_config |
|
| 63 | - * |
|
| 64 | - * @return ListViewData |
|
| 65 | - */ |
|
| 66 | - public function __construct() { |
|
| 67 | - $this->limitName = 'list_max_entries_per_page'; |
|
| 68 | - $this->db = DBManagerFactory::getInstance('listviews'); |
|
| 69 | - } |
|
| 61 | + /** |
|
| 62 | + * Constructor sets the limitName to look up the limit in $sugar_config |
|
| 63 | + * |
|
| 64 | + * @return ListViewData |
|
| 65 | + */ |
|
| 66 | + public function __construct() { |
|
| 67 | + $this->limitName = 'list_max_entries_per_page'; |
|
| 68 | + $this->db = DBManagerFactory::getInstance('listviews'); |
|
| 69 | + } |
|
| 70 | 70 | |
| 71 | 71 | /** |
| 72 | 72 | * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead |
@@ -83,72 +83,72 @@ discard block |
||
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | |
| 86 | - /** |
|
| 87 | - * checks the request for the order by and if that is not set then it checks the session for it |
|
| 88 | - * |
|
| 89 | - * @return array containing the keys orderBy => field being ordered off of and sortOrder => the sort order of that field |
|
| 90 | - */ |
|
| 91 | - function getOrderBy($orderBy = '', $direction = '') { |
|
| 92 | - if (!empty($orderBy) || !empty($_REQUEST[$this->var_order_by])) { |
|
| 86 | + /** |
|
| 87 | + * checks the request for the order by and if that is not set then it checks the session for it |
|
| 88 | + * |
|
| 89 | + * @return array containing the keys orderBy => field being ordered off of and sortOrder => the sort order of that field |
|
| 90 | + */ |
|
| 91 | + function getOrderBy($orderBy = '', $direction = '') { |
|
| 92 | + if (!empty($orderBy) || !empty($_REQUEST[$this->var_order_by])) { |
|
| 93 | 93 | if(!empty($_REQUEST[$this->var_order_by])) { |
| 94 | - $direction = 'ASC'; |
|
| 95 | - $orderBy = $_REQUEST[$this->var_order_by]; |
|
| 96 | - if(!empty($_REQUEST['lvso']) && (empty($_SESSION['lvd']['last_ob']) || strcmp($orderBy, $_SESSION['lvd']['last_ob']) == 0) ){ |
|
| 97 | - $direction = $_REQUEST['lvso']; |
|
| 98 | - } |
|
| 94 | + $direction = 'ASC'; |
|
| 95 | + $orderBy = $_REQUEST[$this->var_order_by]; |
|
| 96 | + if(!empty($_REQUEST['lvso']) && (empty($_SESSION['lvd']['last_ob']) || strcmp($orderBy, $_SESSION['lvd']['last_ob']) == 0) ){ |
|
| 97 | + $direction = $_REQUEST['lvso']; |
|
| 98 | + } |
|
| 99 | 99 | } |
| 100 | 100 | $_SESSION[$this->var_order_by] = array('orderBy'=>$orderBy, 'direction'=> $direction); |
| 101 | 101 | $_SESSION['lvd']['last_ob'] = $orderBy; |
| 102 | 102 | } |
| 103 | - else { |
|
| 103 | + else { |
|
| 104 | 104 | $userPreferenceOrder = $GLOBALS['current_user']->getPreference('listviewOrder', $this->var_name); |
| 105 | - if(!empty($_SESSION[$this->var_order_by])) { |
|
| 106 | - $orderBy = $_SESSION[$this->var_order_by]['orderBy']; |
|
| 107 | - $direction = $_SESSION[$this->var_order_by]['direction']; |
|
| 105 | + if(!empty($_SESSION[$this->var_order_by])) { |
|
| 106 | + $orderBy = $_SESSION[$this->var_order_by]['orderBy']; |
|
| 107 | + $direction = $_SESSION[$this->var_order_by]['direction']; |
|
| 108 | 108 | } elseif (!empty($userPreferenceOrder)) { |
| 109 | 109 | $orderBy = $userPreferenceOrder['orderBy']; |
| 110 | 110 | $direction = $userPreferenceOrder['sortOrder']; |
| 111 | 111 | } else { |
| 112 | - $orderBy = 'date_entered'; |
|
| 113 | - $direction = 'DESC'; |
|
| 114 | - } |
|
| 115 | - } |
|
| 116 | - if(!empty($direction)) { |
|
| 117 | - if(strtolower($direction) == "desc") { |
|
| 118 | - $direction = 'DESC'; |
|
| 119 | - } else { |
|
| 120 | - $direction = 'ASC'; |
|
| 121 | - } |
|
| 122 | - } |
|
| 123 | - return array('orderBy' => $orderBy, 'sortOrder' => $direction); |
|
| 124 | - } |
|
| 125 | - |
|
| 126 | - /** |
|
| 127 | - * gets the reverse of the sort order for use on links to reverse a sort order from what is currently used |
|
| 128 | - * |
|
| 129 | - * @param STRING (ASC or DESC) $current_order |
|
| 130 | - * @return STRING (ASC or DESC) |
|
| 131 | - */ |
|
| 132 | - function getReverseSortOrder($current_order){ |
|
| 133 | - return (strcmp(strtolower($current_order), 'asc') == 0)?'DESC':'ASC'; |
|
| 134 | - } |
|
| 135 | - /** |
|
| 136 | - * gets the limit of how many rows to show per page |
|
| 137 | - * |
|
| 138 | - * @return INT (the limit) |
|
| 139 | - */ |
|
| 140 | - function getLimit() { |
|
| 141 | - return $GLOBALS['sugar_config'][$this->limitName]; |
|
| 142 | - } |
|
| 143 | - |
|
| 144 | - /** |
|
| 145 | - * returns the current offset |
|
| 146 | - * |
|
| 147 | - * @return INT (current offset) |
|
| 148 | - */ |
|
| 149 | - function getOffset() { |
|
| 150 | - return (!empty($_REQUEST[$this->var_offset])) ? $_REQUEST[$this->var_offset] : 0; |
|
| 151 | - } |
|
| 112 | + $orderBy = 'date_entered'; |
|
| 113 | + $direction = 'DESC'; |
|
| 114 | + } |
|
| 115 | + } |
|
| 116 | + if(!empty($direction)) { |
|
| 117 | + if(strtolower($direction) == "desc") { |
|
| 118 | + $direction = 'DESC'; |
|
| 119 | + } else { |
|
| 120 | + $direction = 'ASC'; |
|
| 121 | + } |
|
| 122 | + } |
|
| 123 | + return array('orderBy' => $orderBy, 'sortOrder' => $direction); |
|
| 124 | + } |
|
| 125 | + |
|
| 126 | + /** |
|
| 127 | + * gets the reverse of the sort order for use on links to reverse a sort order from what is currently used |
|
| 128 | + * |
|
| 129 | + * @param STRING (ASC or DESC) $current_order |
|
| 130 | + * @return STRING (ASC or DESC) |
|
| 131 | + */ |
|
| 132 | + function getReverseSortOrder($current_order){ |
|
| 133 | + return (strcmp(strtolower($current_order), 'asc') == 0)?'DESC':'ASC'; |
|
| 134 | + } |
|
| 135 | + /** |
|
| 136 | + * gets the limit of how many rows to show per page |
|
| 137 | + * |
|
| 138 | + * @return INT (the limit) |
|
| 139 | + */ |
|
| 140 | + function getLimit() { |
|
| 141 | + return $GLOBALS['sugar_config'][$this->limitName]; |
|
| 142 | + } |
|
| 143 | + |
|
| 144 | + /** |
|
| 145 | + * returns the current offset |
|
| 146 | + * |
|
| 147 | + * @return INT (current offset) |
|
| 148 | + */ |
|
| 149 | + function getOffset() { |
|
| 150 | + return (!empty($_REQUEST[$this->var_offset])) ? $_REQUEST[$this->var_offset] : 0; |
|
| 151 | + } |
|
| 152 | 152 | |
| 153 | 153 | /** |
| 154 | 154 | * generates the base url without |
@@ -174,18 +174,18 @@ discard block |
||
| 174 | 174 | return $params; |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | - /** |
|
| 178 | - * based off of a base name it sets base, offset, and order by variable names to retrieve them from requests and sessions |
|
| 179 | - * |
|
| 180 | - * @param unknown_type $baseName |
|
| 181 | - */ |
|
| 182 | - function setVariableName($baseName, $where, $listviewName = null){ |
|
| 177 | + /** |
|
| 178 | + * based off of a base name it sets base, offset, and order by variable names to retrieve them from requests and sessions |
|
| 179 | + * |
|
| 180 | + * @param unknown_type $baseName |
|
| 181 | + */ |
|
| 182 | + function setVariableName($baseName, $where, $listviewName = null){ |
|
| 183 | 183 | global $timedate; |
| 184 | 184 | $module = (!empty($listviewName)) ? $listviewName: $_REQUEST['module']; |
| 185 | 185 | $this->var_name = $module .'2_'. strtoupper($baseName); |
| 186 | 186 | |
| 187 | - $this->var_order_by = $this->var_name .'_ORDER_BY'; |
|
| 188 | - $this->var_offset = $this->var_name . '_offset'; |
|
| 187 | + $this->var_order_by = $this->var_name .'_ORDER_BY'; |
|
| 188 | + $this->var_offset = $this->var_name . '_offset'; |
|
| 189 | 189 | $timestamp = sugar_microtime(); |
| 190 | 190 | $this->stamp = $timestamp; |
| 191 | 191 | |
@@ -193,58 +193,58 @@ discard block |
||
| 193 | 193 | |
| 194 | 194 | $_SESSION[strtoupper($baseName) . "_FROM_LIST_VIEW"] = $timestamp; |
| 195 | 195 | $_SESSION[strtoupper($baseName) . "_DETAIL_NAV_HISTORY"] = false; |
| 196 | - } |
|
| 197 | - |
|
| 198 | - function getTotalCount($main_query){ |
|
| 199 | - if(!empty($this->count_query)){ |
|
| 200 | - $count_query = $this->count_query; |
|
| 201 | - }else{ |
|
| 202 | - $count_query = $this->seed->create_list_count_query($main_query); |
|
| 203 | - } |
|
| 204 | - $result = $this->db->query($count_query); |
|
| 205 | - if($row = $this->db->fetchByAssoc($result)){ |
|
| 206 | - return $row['c']; |
|
| 207 | - } |
|
| 208 | - return 0; |
|
| 209 | - } |
|
| 210 | - |
|
| 211 | - /** |
|
| 212 | - * takes in a seed and creates the list view query based off of that seed |
|
| 213 | - * if the $limit value is set to -1 then it will use the default limit and offset values |
|
| 214 | - * |
|
| 215 | - * it will return an array with two key values |
|
| 216 | - * 1. 'data'=> this is an array of row data |
|
| 217 | - * 2. 'pageData'=> this is an array containg three values |
|
| 218 | - * a.'ordering'=> array('orderBy'=> the field being ordered by , 'sortOrder'=> 'ASC' or 'DESC') |
|
| 219 | - * b.'urls'=>array('baseURL'=>url used to generate other urls , |
|
| 220 | - * 'orderBy'=> the base url for order by |
|
| 221 | - * //the following may not be set (so check empty to see if they are set) |
|
| 222 | - * 'nextPage'=> the url for the next group of results, |
|
| 223 | - * 'prevPage'=> the url for the prev group of results, |
|
| 224 | - * 'startPage'=> the url for the start of the group, |
|
| 225 | - * 'endPage'=> the url for the last set of results in the group |
|
| 226 | - * c.'offsets'=>array( |
|
| 227 | - * 'current'=>current offset |
|
| 228 | - * 'next'=> next group offset |
|
| 229 | - * 'prev'=> prev group offset |
|
| 230 | - * 'end'=> the offset of the last group |
|
| 231 | - * 'total'=> the total count (only accurate if totalCounted = true otherwise it is either the total count if less than the limit or the total count + 1 ) |
|
| 232 | - * 'totalCounted'=> if a count query was used to get the total count |
|
| 233 | - * |
|
| 234 | - * @param SugarBean $seed |
|
| 235 | - * @param string $where |
|
| 236 | - * @param int:0 $offset |
|
| 237 | - * @param int:-1 $limit |
|
| 238 | - * @param string[]:array() $filter_fields |
|
| 239 | - * @param array:array() $params |
|
| 240 | - * Potential $params are |
|
| 196 | + } |
|
| 197 | + |
|
| 198 | + function getTotalCount($main_query){ |
|
| 199 | + if(!empty($this->count_query)){ |
|
| 200 | + $count_query = $this->count_query; |
|
| 201 | + }else{ |
|
| 202 | + $count_query = $this->seed->create_list_count_query($main_query); |
|
| 203 | + } |
|
| 204 | + $result = $this->db->query($count_query); |
|
| 205 | + if($row = $this->db->fetchByAssoc($result)){ |
|
| 206 | + return $row['c']; |
|
| 207 | + } |
|
| 208 | + return 0; |
|
| 209 | + } |
|
| 210 | + |
|
| 211 | + /** |
|
| 212 | + * takes in a seed and creates the list view query based off of that seed |
|
| 213 | + * if the $limit value is set to -1 then it will use the default limit and offset values |
|
| 214 | + * |
|
| 215 | + * it will return an array with two key values |
|
| 216 | + * 1. 'data'=> this is an array of row data |
|
| 217 | + * 2. 'pageData'=> this is an array containg three values |
|
| 218 | + * a.'ordering'=> array('orderBy'=> the field being ordered by , 'sortOrder'=> 'ASC' or 'DESC') |
|
| 219 | + * b.'urls'=>array('baseURL'=>url used to generate other urls , |
|
| 220 | + * 'orderBy'=> the base url for order by |
|
| 221 | + * //the following may not be set (so check empty to see if they are set) |
|
| 222 | + * 'nextPage'=> the url for the next group of results, |
|
| 223 | + * 'prevPage'=> the url for the prev group of results, |
|
| 224 | + * 'startPage'=> the url for the start of the group, |
|
| 225 | + * 'endPage'=> the url for the last set of results in the group |
|
| 226 | + * c.'offsets'=>array( |
|
| 227 | + * 'current'=>current offset |
|
| 228 | + * 'next'=> next group offset |
|
| 229 | + * 'prev'=> prev group offset |
|
| 230 | + * 'end'=> the offset of the last group |
|
| 231 | + * 'total'=> the total count (only accurate if totalCounted = true otherwise it is either the total count if less than the limit or the total count + 1 ) |
|
| 232 | + * 'totalCounted'=> if a count query was used to get the total count |
|
| 233 | + * |
|
| 234 | + * @param SugarBean $seed |
|
| 235 | + * @param string $where |
|
| 236 | + * @param int:0 $offset |
|
| 237 | + * @param int:-1 $limit |
|
| 238 | + * @param string[]:array() $filter_fields |
|
| 239 | + * @param array:array() $params |
|
| 240 | + * Potential $params are |
|
| 241 | 241 | $params['distinct'] = use distinct key word |
| 242 | 242 | $params['include_custom_fields'] = (on by default) |
| 243 | 243 | $params['custom_XXXX'] = append custom statements to query |
| 244 | - * @param string:'id' $id_field |
|
| 245 | - * @return array('data'=> row data, 'pageData' => page data information, 'query' => original query string) |
|
| 246 | - */ |
|
| 247 | - function getListViewData($seed, $where, $offset=-1, $limit = -1, $filter_fields=array(),$params=array(),$id_field = 'id',$singleSelect=true) { |
|
| 244 | + * @param string:'id' $id_field |
|
| 245 | + * @return array('data'=> row data, 'pageData' => page data information, 'query' => original query string) |
|
| 246 | + */ |
|
| 247 | + function getListViewData($seed, $where, $offset=-1, $limit = -1, $filter_fields=array(),$params=array(),$id_field = 'id',$singleSelect=true) { |
|
| 248 | 248 | global $current_user; |
| 249 | 249 | SugarVCR::erase($seed->module_dir); |
| 250 | 250 | $this->seed =& $seed; |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | |
| 257 | 257 | $this->setVariableName($seed->object_name, $where, $this->listviewName); |
| 258 | 258 | |
| 259 | - $this->seed->id = '[SELECT_ID_LIST]'; |
|
| 259 | + $this->seed->id = '[SELECT_ID_LIST]'; |
|
| 260 | 260 | |
| 261 | 261 | // if $params tell us to override all ordering |
| 262 | 262 | if(!empty($params['overrideOrder']) && !empty($params['orderBy'])) { |
@@ -280,11 +280,11 @@ discard block |
||
| 280 | 280 | $orderby = substr($order['orderBy'],strpos($order['orderBy'],'.')+1); |
| 281 | 281 | } |
| 282 | 282 | if ($orderby != 'date_entered' && !in_array($orderby, array_keys($filter_fields))) { |
| 283 | - $order['orderBy'] = ''; |
|
| 284 | - $order['sortOrder'] = ''; |
|
| 283 | + $order['orderBy'] = ''; |
|
| 284 | + $order['sortOrder'] = ''; |
|
| 285 | 285 | } |
| 286 | 286 | |
| 287 | - if (empty($order['orderBy'])) { |
|
| 287 | + if (empty($order['orderBy'])) { |
|
| 288 | 288 | $orderBy = ''; |
| 289 | 289 | } else { |
| 290 | 290 | $orderBy = $order['orderBy'] . ' ' . $order['sortOrder']; |
@@ -297,40 +297,40 @@ discard block |
||
| 297 | 297 | $current_user->setPreference('listviewOrder', $order, 0, $this->var_name); // save preference |
| 298 | 298 | } |
| 299 | 299 | |
| 300 | - // If $params tells us to override for the special last_name, first_name sorting |
|
| 301 | - if (!empty($params['overrideLastNameOrder']) && $order['orderBy'] == 'last_name') { |
|
| 302 | - $orderBy = 'last_name '.$order['sortOrder'].', first_name '.$order['sortOrder']; |
|
| 303 | - } |
|
| 300 | + // If $params tells us to override for the special last_name, first_name sorting |
|
| 301 | + if (!empty($params['overrideLastNameOrder']) && $order['orderBy'] == 'last_name') { |
|
| 302 | + $orderBy = 'last_name '.$order['sortOrder'].', first_name '.$order['sortOrder']; |
|
| 303 | + } |
|
| 304 | 304 | |
| 305 | - $ret_array = $seed->create_new_list_query($orderBy, $where, $filter_fields, $params, 0, '', true, $seed, $singleSelect); |
|
| 305 | + $ret_array = $seed->create_new_list_query($orderBy, $where, $filter_fields, $params, 0, '', true, $seed, $singleSelect); |
|
| 306 | 306 | $ret_array['inner_join'] = ''; |
| 307 | 307 | if (!empty($this->seed->listview_inner_join)) { |
| 308 | 308 | $ret_array['inner_join'] = ' ' . implode(' ', $this->seed->listview_inner_join) . ' '; |
| 309 | 309 | } |
| 310 | 310 | |
| 311 | - if(!is_array($params)) $params = array(); |
|
| 311 | + if(!is_array($params)) $params = array(); |
|
| 312 | 312 | if(!isset($params['custom_select'])) $params['custom_select'] = ''; |
| 313 | 313 | if(!isset($params['custom_from'])) $params['custom_from'] = ''; |
| 314 | 314 | if(!isset($params['custom_where'])) $params['custom_where'] = ''; |
| 315 | 315 | if(!isset($params['custom_order_by'])) $params['custom_order_by'] = ''; |
| 316 | - $main_query = $ret_array['select'] . $params['custom_select'] . $ret_array['from'] . $params['custom_from'] . $ret_array['inner_join']. $ret_array['where'] . $params['custom_where'] . $ret_array['order_by'] . $params['custom_order_by']; |
|
| 317 | - //C.L. - Fix for 23461 |
|
| 318 | - if(empty($_REQUEST['action']) || $_REQUEST['action'] != 'Popup') { |
|
| 319 | - $_SESSION['export_where'] = $ret_array['where']; |
|
| 320 | - } |
|
| 321 | - if($limit < -1) { |
|
| 322 | - $result = $this->db->query($main_query); |
|
| 323 | - } |
|
| 324 | - else { |
|
| 325 | - if($limit == -1) { |
|
| 326 | - $limit = $this->getLimit(); |
|
| 316 | + $main_query = $ret_array['select'] . $params['custom_select'] . $ret_array['from'] . $params['custom_from'] . $ret_array['inner_join']. $ret_array['where'] . $params['custom_where'] . $ret_array['order_by'] . $params['custom_order_by']; |
|
| 317 | + //C.L. - Fix for 23461 |
|
| 318 | + if(empty($_REQUEST['action']) || $_REQUEST['action'] != 'Popup') { |
|
| 319 | + $_SESSION['export_where'] = $ret_array['where']; |
|
| 320 | + } |
|
| 321 | + if($limit < -1) { |
|
| 322 | + $result = $this->db->query($main_query); |
|
| 323 | + } |
|
| 324 | + else { |
|
| 325 | + if($limit == -1) { |
|
| 326 | + $limit = $this->getLimit(); |
|
| 327 | 327 | } |
| 328 | - $dyn_offset = $this->getOffset(); |
|
| 329 | - if($dyn_offset > 0 || !is_int($dyn_offset))$offset = $dyn_offset; |
|
| 328 | + $dyn_offset = $this->getOffset(); |
|
| 329 | + if($dyn_offset > 0 || !is_int($dyn_offset))$offset = $dyn_offset; |
|
| 330 | 330 | |
| 331 | 331 | if(strcmp($offset, 'end') == 0){ |
| 332 | - $totalCount = $this->getTotalCount($main_query); |
|
| 333 | - $offset = (floor(($totalCount -1) / $limit)) * $limit; |
|
| 332 | + $totalCount = $this->getTotalCount($main_query); |
|
| 333 | + $offset = (floor(($totalCount -1) / $limit)) * $limit; |
|
| 334 | 334 | } |
| 335 | 335 | if($this->seed->ACLAccess('ListView')) { |
| 336 | 336 | $result = $this->db->limitQuery($main_query, $offset, $limit + 1); |
@@ -339,27 +339,27 @@ discard block |
||
| 339 | 339 | $result = array(); |
| 340 | 340 | } |
| 341 | 341 | |
| 342 | - } |
|
| 342 | + } |
|
| 343 | 343 | |
| 344 | - $data = array(); |
|
| 344 | + $data = array(); |
|
| 345 | 345 | |
| 346 | - $temp = clone $seed; |
|
| 346 | + $temp = clone $seed; |
|
| 347 | 347 | |
| 348 | - $rows = array(); |
|
| 349 | - $count = 0; |
|
| 348 | + $rows = array(); |
|
| 349 | + $count = 0; |
|
| 350 | 350 | $idIndex = array(); |
| 351 | 351 | $id_list = ''; |
| 352 | 352 | |
| 353 | - while(($row = $this->db->fetchByAssoc($result)) != null) |
|
| 353 | + while(($row = $this->db->fetchByAssoc($result)) != null) |
|
| 354 | 354 | { |
| 355 | - if($count < $limit) |
|
| 355 | + if($count < $limit) |
|
| 356 | 356 | { |
| 357 | - $id_list .= ',\''.$row[$id_field].'\''; |
|
| 358 | - $idIndex[$row[$id_field]][] = count($rows); |
|
| 359 | - $rows[] = $seed->convertRow($row); |
|
| 360 | - } |
|
| 361 | - $count++; |
|
| 362 | - } |
|
| 357 | + $id_list .= ',\''.$row[$id_field].'\''; |
|
| 358 | + $idIndex[$row[$id_field]][] = count($rows); |
|
| 359 | + $rows[] = $seed->convertRow($row); |
|
| 360 | + } |
|
| 361 | + $count++; |
|
| 362 | + } |
|
| 363 | 363 | |
| 364 | 364 | if (!empty($id_list)) |
| 365 | 365 | { |
@@ -367,10 +367,10 @@ discard block |
||
| 367 | 367 | } |
| 368 | 368 | |
| 369 | 369 | SugarVCR::store($this->seed->module_dir, $main_query); |
| 370 | - if($count != 0) { |
|
| 371 | - //NOW HANDLE SECONDARY QUERIES |
|
| 372 | - if(!empty($ret_array['secondary_select'])) { |
|
| 373 | - $secondary_query = $ret_array['secondary_select'] . $ret_array['secondary_from'] . ' WHERE '.$this->seed->table_name.'.id IN ' .$id_list; |
|
| 370 | + if($count != 0) { |
|
| 371 | + //NOW HANDLE SECONDARY QUERIES |
|
| 372 | + if(!empty($ret_array['secondary_select'])) { |
|
| 373 | + $secondary_query = $ret_array['secondary_select'] . $ret_array['secondary_from'] . ' WHERE '.$this->seed->table_name.'.id IN ' .$id_list; |
|
| 374 | 374 | if(isset($ret_array['order_by'])) |
| 375 | 375 | { |
| 376 | 376 | $secondary_query .= ' ' . $ret_array['order_by']; |
@@ -379,23 +379,23 @@ discard block |
||
| 379 | 379 | $secondary_result = $this->db->query($secondary_query); |
| 380 | 380 | |
| 381 | 381 | $ref_id_count = array(); |
| 382 | - while($row = $this->db->fetchByAssoc($secondary_result)) { |
|
| 382 | + while($row = $this->db->fetchByAssoc($secondary_result)) { |
|
| 383 | 383 | |
| 384 | 384 | $ref_id_count[$row['ref_id']][] = true; |
| 385 | - foreach($row as $name=>$value) { |
|
| 386 | - //add it to every row with the given id |
|
| 387 | - foreach($idIndex[$row['ref_id']] as $index){ |
|
| 388 | - $rows[$index][$name]=$value; |
|
| 389 | - } |
|
| 390 | - } |
|
| 391 | - } |
|
| 385 | + foreach($row as $name=>$value) { |
|
| 386 | + //add it to every row with the given id |
|
| 387 | + foreach($idIndex[$row['ref_id']] as $index){ |
|
| 388 | + $rows[$index][$name]=$value; |
|
| 389 | + } |
|
| 390 | + } |
|
| 391 | + } |
|
| 392 | 392 | |
| 393 | 393 | $rows_keys = array_keys($rows); |
| 394 | 394 | foreach($rows_keys as $key) |
| 395 | 395 | { |
| 396 | 396 | $rows[$key]['secondary_select_count'] = count($ref_id_count[$rows[$key]['ref_id']]); |
| 397 | 397 | } |
| 398 | - } |
|
| 398 | + } |
|
| 399 | 399 | |
| 400 | 400 | // retrieve parent names |
| 401 | 401 | if(!empty($filter_fields['parent_name']) && !empty($filter_fields['parent_id']) && !empty($filter_fields['parent_type'])) { |
@@ -409,47 +409,47 @@ discard block |
||
| 409 | 409 | $parent_fields = $seed->retrieve_parent_fields($post_retrieve); |
| 410 | 410 | foreach($parent_fields as $child_id => $parent_data) { |
| 411 | 411 | //add it to every row with the given id |
| 412 | - foreach($idIndex[$child_id] as $index){ |
|
| 413 | - $rows[$index]['parent_name']= $parent_data['parent_name']; |
|
| 414 | - } |
|
| 412 | + foreach($idIndex[$child_id] as $index){ |
|
| 413 | + $rows[$index]['parent_name']= $parent_data['parent_name']; |
|
| 414 | + } |
|
| 415 | 415 | } |
| 416 | 416 | } |
| 417 | 417 | } |
| 418 | 418 | |
| 419 | - $pageData = array(); |
|
| 419 | + $pageData = array(); |
|
| 420 | 420 | |
| 421 | - reset($rows); |
|
| 422 | - while($row = current($rows)){ |
|
| 421 | + reset($rows); |
|
| 422 | + while($row = current($rows)){ |
|
| 423 | 423 | |
| 424 | 424 | $temp = clone $seed; |
| 425 | - $dataIndex = count($data); |
|
| 426 | - |
|
| 427 | - $temp->setupCustomFields($temp->module_dir); |
|
| 428 | - $temp->loadFromRow($row); |
|
| 429 | - if (empty($this->seed->assigned_user_id) && !empty($temp->assigned_user_id)) { |
|
| 430 | - $this->seed->assigned_user_id = $temp->assigned_user_id; |
|
| 431 | - } |
|
| 432 | - if($idIndex[$row[$id_field]][0] == $dataIndex){ |
|
| 433 | - $pageData['tag'][$dataIndex] = $temp->listviewACLHelper(); |
|
| 434 | - }else{ |
|
| 435 | - $pageData['tag'][$dataIndex] = $pageData['tag'][$idIndex[$row[$id_field]][0]]; |
|
| 436 | - } |
|
| 437 | - $data[$dataIndex] = $temp->get_list_view_data($filter_fields); |
|
| 425 | + $dataIndex = count($data); |
|
| 426 | + |
|
| 427 | + $temp->setupCustomFields($temp->module_dir); |
|
| 428 | + $temp->loadFromRow($row); |
|
| 429 | + if (empty($this->seed->assigned_user_id) && !empty($temp->assigned_user_id)) { |
|
| 430 | + $this->seed->assigned_user_id = $temp->assigned_user_id; |
|
| 431 | + } |
|
| 432 | + if($idIndex[$row[$id_field]][0] == $dataIndex){ |
|
| 433 | + $pageData['tag'][$dataIndex] = $temp->listviewACLHelper(); |
|
| 434 | + }else{ |
|
| 435 | + $pageData['tag'][$dataIndex] = $pageData['tag'][$idIndex[$row[$id_field]][0]]; |
|
| 436 | + } |
|
| 437 | + $data[$dataIndex] = $temp->get_list_view_data($filter_fields); |
|
| 438 | 438 | $detailViewAccess = $temp->ACLAccess('DetailView'); |
| 439 | 439 | $editViewAccess = $temp->ACLAccess('EditView'); |
| 440 | 440 | $pageData['rowAccess'][$dataIndex] = array('view' => $detailViewAccess, 'edit' => $editViewAccess); |
| 441 | 441 | $additionalDetailsAllow = $this->additionalDetails && $detailViewAccess && (file_exists( |
| 442 | - 'modules/' . $temp->module_dir . '/metadata/additionalDetails.php' |
|
| 443 | - ) || file_exists('custom/modules/' . $temp->module_dir . '/metadata/additionalDetails.php')); |
|
| 442 | + 'modules/' . $temp->module_dir . '/metadata/additionalDetails.php' |
|
| 443 | + ) || file_exists('custom/modules/' . $temp->module_dir . '/metadata/additionalDetails.php')); |
|
| 444 | 444 | $additionalDetailsEdit = $editViewAccess; |
| 445 | 445 | if($additionalDetailsAllow) { |
| 446 | 446 | if($this->additionalDetailsAjax) { |
| 447 | - $ar = $this->getAdditionalDetailsAjax($data[$dataIndex]['ID']); |
|
| 447 | + $ar = $this->getAdditionalDetailsAjax($data[$dataIndex]['ID']); |
|
| 448 | 448 | } |
| 449 | 449 | else { |
| 450 | 450 | $additionalDetailsFile = 'modules/' . $this->seed->module_dir . '/metadata/additionalDetails.php'; |
| 451 | 451 | if(file_exists('custom/modules/' . $this->seed->module_dir . '/metadata/additionalDetails.php')){ |
| 452 | - $additionalDetailsFile = 'custom/modules/' . $this->seed->module_dir . '/metadata/additionalDetails.php'; |
|
| 452 | + $additionalDetailsFile = 'custom/modules/' . $this->seed->module_dir . '/metadata/additionalDetails.php'; |
|
| 453 | 453 | } |
| 454 | 454 | require_once($additionalDetailsFile); |
| 455 | 455 | $ar = $this->getAdditionalDetails($data[$dataIndex], |
@@ -458,42 +458,42 @@ discard block |
||
| 458 | 458 | } |
| 459 | 459 | $pageData['additionalDetails'][$dataIndex] = $ar['string']; |
| 460 | 460 | $pageData['additionalDetails']['fieldToAddTo'] = $ar['fieldToAddTo']; |
| 461 | - } |
|
| 462 | - next($rows); |
|
| 463 | - } |
|
| 464 | - } |
|
| 465 | - $nextOffset = -1; |
|
| 466 | - $prevOffset = -1; |
|
| 467 | - $endOffset = -1; |
|
| 468 | - if($count > $limit) { |
|
| 469 | - $nextOffset = $offset + $limit; |
|
| 470 | - } |
|
| 471 | - |
|
| 472 | - if($offset > 0) { |
|
| 473 | - $prevOffset = $offset - $limit; |
|
| 474 | - if($prevOffset < 0)$prevOffset = 0; |
|
| 475 | - } |
|
| 476 | - $totalCount = $count + $offset; |
|
| 477 | - |
|
| 478 | - if( $count >= $limit && $totalCounted){ |
|
| 479 | - $totalCount = $this->getTotalCount($main_query); |
|
| 480 | - } |
|
| 481 | - SugarVCR::recordIDs($this->seed->module_dir, array_keys($idIndex), $offset, $totalCount); |
|
| 461 | + } |
|
| 462 | + next($rows); |
|
| 463 | + } |
|
| 464 | + } |
|
| 465 | + $nextOffset = -1; |
|
| 466 | + $prevOffset = -1; |
|
| 467 | + $endOffset = -1; |
|
| 468 | + if($count > $limit) { |
|
| 469 | + $nextOffset = $offset + $limit; |
|
| 470 | + } |
|
| 471 | + |
|
| 472 | + if($offset > 0) { |
|
| 473 | + $prevOffset = $offset - $limit; |
|
| 474 | + if($prevOffset < 0)$prevOffset = 0; |
|
| 475 | + } |
|
| 476 | + $totalCount = $count + $offset; |
|
| 477 | + |
|
| 478 | + if( $count >= $limit && $totalCounted){ |
|
| 479 | + $totalCount = $this->getTotalCount($main_query); |
|
| 480 | + } |
|
| 481 | + SugarVCR::recordIDs($this->seed->module_dir, array_keys($idIndex), $offset, $totalCount); |
|
| 482 | 482 | $module_names = array( |
| 483 | 483 | 'Prospects' => 'Targets' |
| 484 | 484 | ); |
| 485 | - $endOffset = (floor(($totalCount - 1) / $limit)) * $limit; |
|
| 486 | - $pageData['ordering'] = $order; |
|
| 487 | - $pageData['ordering']['sortOrder'] = $this->getReverseSortOrder($pageData['ordering']['sortOrder']); |
|
| 485 | + $endOffset = (floor(($totalCount - 1) / $limit)) * $limit; |
|
| 486 | + $pageData['ordering'] = $order; |
|
| 487 | + $pageData['ordering']['sortOrder'] = $this->getReverseSortOrder($pageData['ordering']['sortOrder']); |
|
| 488 | 488 | //get url parameters as an array |
| 489 | 489 | $pageData['queries'] = $this->generateQueries($pageData['ordering']['sortOrder'], $offset, $prevOffset, $nextOffset, $endOffset, $totalCounted); |
| 490 | 490 | //join url parameters from array to a string |
| 491 | 491 | $pageData['urls'] = $this->generateURLS($pageData['queries']); |
| 492 | - $pageData['offsets'] = array( 'current'=>$offset, 'next'=>$nextOffset, 'prev'=>$prevOffset, 'end'=>$endOffset, 'total'=>$totalCount, 'totalCounted'=>$totalCounted); |
|
| 493 | - $pageData['bean'] = array('objectName' => $seed->object_name, 'moduleDir' => $seed->module_dir, 'moduleName' => strtr($seed->module_dir, $module_names)); |
|
| 492 | + $pageData['offsets'] = array( 'current'=>$offset, 'next'=>$nextOffset, 'prev'=>$prevOffset, 'end'=>$endOffset, 'total'=>$totalCount, 'totalCounted'=>$totalCounted); |
|
| 493 | + $pageData['bean'] = array('objectName' => $seed->object_name, 'moduleDir' => $seed->module_dir, 'moduleName' => strtr($seed->module_dir, $module_names)); |
|
| 494 | 494 | $pageData['stamp'] = $this->stamp; |
| 495 | 495 | $pageData['access'] = array('view' => $this->seed->ACLAccess('DetailView'), 'edit' => $this->seed->ACLAccess('EditView')); |
| 496 | - $pageData['idIndex'] = $idIndex; |
|
| 496 | + $pageData['idIndex'] = $idIndex; |
|
| 497 | 497 | if(!$this->seed->ACLAccess('ListView')) { |
| 498 | 498 | $pageData['error'] = 'ACL restricted access'; |
| 499 | 499 | } |
@@ -501,8 +501,8 @@ discard block |
||
| 501 | 501 | $queryString = ''; |
| 502 | 502 | |
| 503 | 503 | if( isset($_REQUEST["searchFormTab"]) && $_REQUEST["searchFormTab"] == "advanced_search" || |
| 504 | - isset($_REQUEST["type_basic"]) && (count($_REQUEST["type_basic"] > 1) || $_REQUEST["type_basic"][0] != "") || |
|
| 505 | - isset($_REQUEST["module"]) && $_REQUEST["module"] == "MergeRecords") |
|
| 504 | + isset($_REQUEST["type_basic"]) && (count($_REQUEST["type_basic"] > 1) || $_REQUEST["type_basic"][0] != "") || |
|
| 505 | + isset($_REQUEST["module"]) && $_REQUEST["module"] == "MergeRecords") |
|
| 506 | 506 | { |
| 507 | 507 | $queryString = "-advanced_search"; |
| 508 | 508 | } |
@@ -529,8 +529,8 @@ discard block |
||
| 529 | 529 | } |
| 530 | 530 | } |
| 531 | 531 | |
| 532 | - return array('data'=>$data , 'pageData'=>$pageData, 'query' => $queryString); |
|
| 533 | - } |
|
| 532 | + return array('data'=>$data , 'pageData'=>$pageData, 'query' => $queryString); |
|
| 533 | + } |
|
| 534 | 534 | |
| 535 | 535 | |
| 536 | 536 | /** |
@@ -597,13 +597,13 @@ discard block |
||
| 597 | 597 | return $queries; |
| 598 | 598 | } |
| 599 | 599 | |
| 600 | - /** |
|
| 601 | - * generates the additional details span to be retrieved via ajax |
|
| 602 | - * |
|
| 603 | - * @param GUID id id of the record |
|
| 604 | - * @return array string to attach to field |
|
| 605 | - */ |
|
| 606 | - function getAdditionalDetailsAjax($id) |
|
| 600 | + /** |
|
| 601 | + * generates the additional details span to be retrieved via ajax |
|
| 602 | + * |
|
| 603 | + * @param GUID id id of the record |
|
| 604 | + * @return array string to attach to field |
|
| 605 | + */ |
|
| 606 | + function getAdditionalDetailsAjax($id) |
|
| 607 | 607 | { |
| 608 | 608 | global $app_strings; |
| 609 | 609 | |
@@ -611,10 +611,10 @@ discard block |
||
| 611 | 611 | |
| 612 | 612 | $extra = "<span id='adspan_" . $id . "' " |
| 613 | 613 | . "onclick=\"lvg_dtails('$id')\" " |
| 614 | - . " style='position: relative;'><!--not_in_theme!--><img vertical-align='middle' class='info' border='0' alt='".$app_strings['LBL_ADDITIONAL_DETAILS']."' src='$jscalendarImage'></span>"; |
|
| 614 | + . " style='position: relative;'><!--not_in_theme!--><img vertical-align='middle' class='info' border='0' alt='".$app_strings['LBL_ADDITIONAL_DETAILS']."' src='$jscalendarImage'></span>"; |
|
| 615 | 615 | |
| 616 | 616 | return array('fieldToAddTo' => $this->additionalDetailsFieldToAdd, 'string' => $extra); |
| 617 | - } |
|
| 617 | + } |
|
| 618 | 618 | |
| 619 | 619 | /** |
| 620 | 620 | * generates the additional details values |
@@ -637,25 +637,25 @@ discard block |
||
| 637 | 637 | { |
| 638 | 638 | $results['string'] = $app_strings['LBL_NONE']; |
| 639 | 639 | } |
| 640 | - $close = false; |
|
| 640 | + $close = false; |
|
| 641 | 641 | $extra = "<img alt='{$app_strings['LBL_INFOINLINE']}' style='padding: 0px 5px 0px 2px' border='0' onclick=\"SUGAR.util.getStaticAdditionalDetails(this,'"; |
| 642 | 642 | |
| 643 | 643 | $extra .= str_replace(array("\rn", "\r", "\n"), array('','','<br />'), $results['string']) ; |
| 644 | 644 | $extra .= "','<div style=\'float:left\'>{$app_strings['LBL_ADDITIONAL_DETAILS']}</div><div style=\'float: right\'>"; |
| 645 | 645 | |
| 646 | - if($editAccess && !empty($results['editLink'])) |
|
| 647 | - { |
|
| 648 | - $extra .= "<a title=\'{$app_strings['LBL_EDIT_BUTTON']}\' href={$results['editLink']}><img style=\'margin-left: 2px;\' border=\'0\' src=\'".SugarThemeRegistry::current()->getImageURL('edit_inline.png')."\'></a>"; |
|
| 649 | - $close = true; |
|
| 650 | - } |
|
| 651 | - $close = (!empty($results['viewLink'])) ? true : $close; |
|
| 652 | - $extra .= (!empty($results['viewLink']) ? "<a title=\'{$app_strings['LBL_VIEW_BUTTON']}\' href={$results['viewLink']}><img style=\'margin-left: 2px;\' border=\'0\' src=".SugarThemeRegistry::current()->getImageURL('view_inline.png')."></a>" : ''); |
|
| 646 | + if($editAccess && !empty($results['editLink'])) |
|
| 647 | + { |
|
| 648 | + $extra .= "<a title=\'{$app_strings['LBL_EDIT_BUTTON']}\' href={$results['editLink']}><img style=\'margin-left: 2px;\' border=\'0\' src=\'".SugarThemeRegistry::current()->getImageURL('edit_inline.png')."\'></a>"; |
|
| 649 | + $close = true; |
|
| 650 | + } |
|
| 651 | + $close = (!empty($results['viewLink'])) ? true : $close; |
|
| 652 | + $extra .= (!empty($results['viewLink']) ? "<a title=\'{$app_strings['LBL_VIEW_BUTTON']}\' href={$results['viewLink']}><img style=\'margin-left: 2px;\' border=\'0\' src=".SugarThemeRegistry::current()->getImageURL('view_inline.png')."></a>" : ''); |
|
| 653 | 653 | |
| 654 | 654 | if($close == true) { |
| 655 | - $closeVal = "true"; |
|
| 656 | - $extra .= "<a title=\'{$app_strings['LBL_ADDITIONAL_DETAILS_CLOSE_TITLE']}\' href=\'javascript: SUGAR.util.closeStaticAdditionalDetails();\'><img style=\'margin-left: 2px;\' border=\'0\' src=\'".SugarThemeRegistry::current()->getImageURL('close.png')."\'></a>"; |
|
| 655 | + $closeVal = "true"; |
|
| 656 | + $extra .= "<a title=\'{$app_strings['LBL_ADDITIONAL_DETAILS_CLOSE_TITLE']}\' href=\'javascript: SUGAR.util.closeStaticAdditionalDetails();\'><img style=\'margin-left: 2px;\' border=\'0\' src=\'".SugarThemeRegistry::current()->getImageURL('close.png')."\'></a>"; |
|
| 657 | 657 | } else { |
| 658 | - $closeVal = "false"; |
|
| 658 | + $closeVal = "false"; |
|
| 659 | 659 | } |
| 660 | 660 | $extra .= "',".$closeVal.")\" src='".SugarThemeRegistry::current()->getImageURL('info_inline.png')."' class='info'>"; |
| 661 | 661 | |
@@ -1,5 +1,5 @@ discard block |
||
| 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. |
@@ -71,9 +71,9 @@ discard block |
||
| 71 | 71 | /** |
| 72 | 72 | * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead |
| 73 | 73 | */ |
| 74 | - public function ListViewData(){ |
|
| 74 | + public function ListViewData() { |
|
| 75 | 75 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 76 | - if(isset($GLOBALS['log'])) { |
|
| 76 | + if (isset($GLOBALS['log'])) { |
|
| 77 | 77 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 78 | 78 | } |
| 79 | 79 | else { |
@@ -90,10 +90,10 @@ discard block |
||
| 90 | 90 | */ |
| 91 | 91 | function getOrderBy($orderBy = '', $direction = '') { |
| 92 | 92 | if (!empty($orderBy) || !empty($_REQUEST[$this->var_order_by])) { |
| 93 | - if(!empty($_REQUEST[$this->var_order_by])) { |
|
| 93 | + if (!empty($_REQUEST[$this->var_order_by])) { |
|
| 94 | 94 | $direction = 'ASC'; |
| 95 | 95 | $orderBy = $_REQUEST[$this->var_order_by]; |
| 96 | - if(!empty($_REQUEST['lvso']) && (empty($_SESSION['lvd']['last_ob']) || strcmp($orderBy, $_SESSION['lvd']['last_ob']) == 0) ){ |
|
| 96 | + if (!empty($_REQUEST['lvso']) && (empty($_SESSION['lvd']['last_ob']) || strcmp($orderBy, $_SESSION['lvd']['last_ob']) == 0)) { |
|
| 97 | 97 | $direction = $_REQUEST['lvso']; |
| 98 | 98 | } |
| 99 | 99 | } |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | } |
| 103 | 103 | else { |
| 104 | 104 | $userPreferenceOrder = $GLOBALS['current_user']->getPreference('listviewOrder', $this->var_name); |
| 105 | - if(!empty($_SESSION[$this->var_order_by])) { |
|
| 105 | + if (!empty($_SESSION[$this->var_order_by])) { |
|
| 106 | 106 | $orderBy = $_SESSION[$this->var_order_by]['orderBy']; |
| 107 | 107 | $direction = $_SESSION[$this->var_order_by]['direction']; |
| 108 | 108 | } elseif (!empty($userPreferenceOrder)) { |
@@ -113,8 +113,8 @@ discard block |
||
| 113 | 113 | $direction = 'DESC'; |
| 114 | 114 | } |
| 115 | 115 | } |
| 116 | - if(!empty($direction)) { |
|
| 117 | - if(strtolower($direction) == "desc") { |
|
| 116 | + if (!empty($direction)) { |
|
| 117 | + if (strtolower($direction) == "desc") { |
|
| 118 | 118 | $direction = 'DESC'; |
| 119 | 119 | } else { |
| 120 | 120 | $direction = 'ASC'; |
@@ -129,8 +129,8 @@ discard block |
||
| 129 | 129 | * @param STRING (ASC or DESC) $current_order |
| 130 | 130 | * @return STRING (ASC or DESC) |
| 131 | 131 | */ |
| 132 | - function getReverseSortOrder($current_order){ |
|
| 133 | - return (strcmp(strtolower($current_order), 'asc') == 0)?'DESC':'ASC'; |
|
| 132 | + function getReverseSortOrder($current_order) { |
|
| 133 | + return (strcmp(strtolower($current_order), 'asc') == 0) ? 'DESC' : 'ASC'; |
|
| 134 | 134 | } |
| 135 | 135 | /** |
| 136 | 136 | * gets the limit of how many rows to show per page |
@@ -160,8 +160,8 @@ discard block |
||
| 160 | 160 | { |
| 161 | 161 | global $beanList; |
| 162 | 162 | |
| 163 | - $blockVariables = array('mass', 'uid', 'massupdate', 'delete', 'merge', 'selectCount',$this->var_order_by, $this->var_offset, 'lvso', 'sortOrder', 'orderBy', 'request_data', 'current_query_by_page'); |
|
| 164 | - foreach($beanList as $bean) |
|
| 163 | + $blockVariables = array('mass', 'uid', 'massupdate', 'delete', 'merge', 'selectCount', $this->var_order_by, $this->var_offset, 'lvso', 'sortOrder', 'orderBy', 'request_data', 'current_query_by_page'); |
|
| 164 | + foreach ($beanList as $bean) |
|
| 165 | 165 | { |
| 166 | 166 | $blockVariables[] = 'Home2_'.strtoupper($bean).'_ORDER_BY'; |
| 167 | 167 | } |
@@ -179,30 +179,30 @@ discard block |
||
| 179 | 179 | * |
| 180 | 180 | * @param unknown_type $baseName |
| 181 | 181 | */ |
| 182 | - function setVariableName($baseName, $where, $listviewName = null){ |
|
| 182 | + function setVariableName($baseName, $where, $listviewName = null) { |
|
| 183 | 183 | global $timedate; |
| 184 | - $module = (!empty($listviewName)) ? $listviewName: $_REQUEST['module']; |
|
| 185 | - $this->var_name = $module .'2_'. strtoupper($baseName); |
|
| 184 | + $module = (!empty($listviewName)) ? $listviewName : $_REQUEST['module']; |
|
| 185 | + $this->var_name = $module.'2_'.strtoupper($baseName); |
|
| 186 | 186 | |
| 187 | - $this->var_order_by = $this->var_name .'_ORDER_BY'; |
|
| 188 | - $this->var_offset = $this->var_name . '_offset'; |
|
| 187 | + $this->var_order_by = $this->var_name.'_ORDER_BY'; |
|
| 188 | + $this->var_offset = $this->var_name.'_offset'; |
|
| 189 | 189 | $timestamp = sugar_microtime(); |
| 190 | 190 | $this->stamp = $timestamp; |
| 191 | 191 | |
| 192 | - $_SESSION[$module .'2_QUERY_QUERY'] = $where; |
|
| 192 | + $_SESSION[$module.'2_QUERY_QUERY'] = $where; |
|
| 193 | 193 | |
| 194 | - $_SESSION[strtoupper($baseName) . "_FROM_LIST_VIEW"] = $timestamp; |
|
| 195 | - $_SESSION[strtoupper($baseName) . "_DETAIL_NAV_HISTORY"] = false; |
|
| 194 | + $_SESSION[strtoupper($baseName)."_FROM_LIST_VIEW"] = $timestamp; |
|
| 195 | + $_SESSION[strtoupper($baseName)."_DETAIL_NAV_HISTORY"] = false; |
|
| 196 | 196 | } |
| 197 | 197 | |
| 198 | - function getTotalCount($main_query){ |
|
| 199 | - if(!empty($this->count_query)){ |
|
| 198 | + function getTotalCount($main_query) { |
|
| 199 | + if (!empty($this->count_query)) { |
|
| 200 | 200 | $count_query = $this->count_query; |
| 201 | - }else{ |
|
| 201 | + } else { |
|
| 202 | 202 | $count_query = $this->seed->create_list_count_query($main_query); |
| 203 | 203 | } |
| 204 | 204 | $result = $this->db->query($count_query); |
| 205 | - if($row = $this->db->fetchByAssoc($result)){ |
|
| 205 | + if ($row = $this->db->fetchByAssoc($result)) { |
|
| 206 | 206 | return $row['c']; |
| 207 | 207 | } |
| 208 | 208 | return 0; |
@@ -244,13 +244,13 @@ discard block |
||
| 244 | 244 | * @param string:'id' $id_field |
| 245 | 245 | * @return array('data'=> row data, 'pageData' => page data information, 'query' => original query string) |
| 246 | 246 | */ |
| 247 | - function getListViewData($seed, $where, $offset=-1, $limit = -1, $filter_fields=array(),$params=array(),$id_field = 'id',$singleSelect=true) { |
|
| 247 | + function getListViewData($seed, $where, $offset = -1, $limit = -1, $filter_fields = array(), $params = array(), $id_field = 'id', $singleSelect = true) { |
|
| 248 | 248 | global $current_user; |
| 249 | 249 | SugarVCR::erase($seed->module_dir); |
| 250 | - $this->seed =& $seed; |
|
| 250 | + $this->seed = & $seed; |
|
| 251 | 251 | $totalCounted = empty($GLOBALS['sugar_config']['disable_count_query']); |
| 252 | 252 | $_SESSION['MAILMERGE_MODULE_FROM_LISTVIEW'] = $seed->module_dir; |
| 253 | - if(empty($_REQUEST['action']) || $_REQUEST['action'] != 'Popup'){ |
|
| 253 | + if (empty($_REQUEST['action']) || $_REQUEST['action'] != 'Popup') { |
|
| 254 | 254 | $_SESSION['MAILMERGE_MODULE'] = $seed->module_dir; |
| 255 | 255 | } |
| 256 | 256 | |
@@ -259,7 +259,7 @@ discard block |
||
| 259 | 259 | $this->seed->id = '[SELECT_ID_LIST]'; |
| 260 | 260 | |
| 261 | 261 | // if $params tell us to override all ordering |
| 262 | - if(!empty($params['overrideOrder']) && !empty($params['orderBy'])) { |
|
| 262 | + if (!empty($params['overrideOrder']) && !empty($params['orderBy'])) { |
|
| 263 | 263 | $order = $this->getOrderBy(strtolower($params['orderBy']), (empty($params['sortOrder']) ? '' : $params['sortOrder'])); // retreive from $_REQUEST |
| 264 | 264 | } |
| 265 | 265 | else { |
@@ -267,17 +267,17 @@ discard block |
||
| 267 | 267 | } |
| 268 | 268 | |
| 269 | 269 | // still empty? try to use settings passed in $param |
| 270 | - if(empty($order['orderBy']) && !empty($params['orderBy'])) { |
|
| 270 | + if (empty($order['orderBy']) && !empty($params['orderBy'])) { |
|
| 271 | 271 | $order['orderBy'] = $params['orderBy']; |
| 272 | - $order['sortOrder'] = (empty($params['sortOrder']) ? '' : $params['sortOrder']); |
|
| 272 | + $order['sortOrder'] = (empty($params['sortOrder']) ? '' : $params['sortOrder']); |
|
| 273 | 273 | } |
| 274 | 274 | |
| 275 | 275 | //rrs - bug: 21788. Do not use Order by stmts with fields that are not in the query. |
| 276 | 276 | // Bug 22740 - Tweak this check to strip off the table name off the order by parameter. |
| 277 | 277 | // Samir Gandhi : Do not remove the report_cache.date_modified condition as the report list view is broken |
| 278 | 278 | $orderby = $order['orderBy']; |
| 279 | - if (strpos($order['orderBy'],'.') && ($order['orderBy'] != "report_cache.date_modified")) { |
|
| 280 | - $orderby = substr($order['orderBy'],strpos($order['orderBy'],'.')+1); |
|
| 279 | + if (strpos($order['orderBy'], '.') && ($order['orderBy'] != "report_cache.date_modified")) { |
|
| 280 | + $orderby = substr($order['orderBy'], strpos($order['orderBy'], '.') + 1); |
|
| 281 | 281 | } |
| 282 | 282 | if ($orderby != 'date_entered' && !in_array($orderby, array_keys($filter_fields))) { |
| 283 | 283 | $order['orderBy'] = ''; |
@@ -287,10 +287,10 @@ discard block |
||
| 287 | 287 | if (empty($order['orderBy'])) { |
| 288 | 288 | $orderBy = ''; |
| 289 | 289 | } else { |
| 290 | - $orderBy = $order['orderBy'] . ' ' . $order['sortOrder']; |
|
| 290 | + $orderBy = $order['orderBy'].' '.$order['sortOrder']; |
|
| 291 | 291 | //wdong, Bug 25476, fix the sorting problem of Oracle. |
| 292 | 292 | if (isset($params['custom_order_by_override']['ori_code']) && $order['orderBy'] == $params['custom_order_by_override']['ori_code']) |
| 293 | - $orderBy = $params['custom_order_by_override']['custom_code'] . ' ' . $order['sortOrder']; |
|
| 293 | + $orderBy = $params['custom_order_by_override']['custom_code'].' '.$order['sortOrder']; |
|
| 294 | 294 | } |
| 295 | 295 | |
| 296 | 296 | if (empty($params['skipOrderSave'])) { // don't save preferences if told so |
@@ -305,34 +305,34 @@ discard block |
||
| 305 | 305 | $ret_array = $seed->create_new_list_query($orderBy, $where, $filter_fields, $params, 0, '', true, $seed, $singleSelect); |
| 306 | 306 | $ret_array['inner_join'] = ''; |
| 307 | 307 | if (!empty($this->seed->listview_inner_join)) { |
| 308 | - $ret_array['inner_join'] = ' ' . implode(' ', $this->seed->listview_inner_join) . ' '; |
|
| 308 | + $ret_array['inner_join'] = ' '.implode(' ', $this->seed->listview_inner_join).' '; |
|
| 309 | 309 | } |
| 310 | 310 | |
| 311 | - if(!is_array($params)) $params = array(); |
|
| 312 | - if(!isset($params['custom_select'])) $params['custom_select'] = ''; |
|
| 313 | - if(!isset($params['custom_from'])) $params['custom_from'] = ''; |
|
| 314 | - if(!isset($params['custom_where'])) $params['custom_where'] = ''; |
|
| 315 | - if(!isset($params['custom_order_by'])) $params['custom_order_by'] = ''; |
|
| 316 | - $main_query = $ret_array['select'] . $params['custom_select'] . $ret_array['from'] . $params['custom_from'] . $ret_array['inner_join']. $ret_array['where'] . $params['custom_where'] . $ret_array['order_by'] . $params['custom_order_by']; |
|
| 311 | + if (!is_array($params)) $params = array(); |
|
| 312 | + if (!isset($params['custom_select'])) $params['custom_select'] = ''; |
|
| 313 | + if (!isset($params['custom_from'])) $params['custom_from'] = ''; |
|
| 314 | + if (!isset($params['custom_where'])) $params['custom_where'] = ''; |
|
| 315 | + if (!isset($params['custom_order_by'])) $params['custom_order_by'] = ''; |
|
| 316 | + $main_query = $ret_array['select'].$params['custom_select'].$ret_array['from'].$params['custom_from'].$ret_array['inner_join'].$ret_array['where'].$params['custom_where'].$ret_array['order_by'].$params['custom_order_by']; |
|
| 317 | 317 | //C.L. - Fix for 23461 |
| 318 | - if(empty($_REQUEST['action']) || $_REQUEST['action'] != 'Popup') { |
|
| 318 | + if (empty($_REQUEST['action']) || $_REQUEST['action'] != 'Popup') { |
|
| 319 | 319 | $_SESSION['export_where'] = $ret_array['where']; |
| 320 | 320 | } |
| 321 | - if($limit < -1) { |
|
| 321 | + if ($limit < -1) { |
|
| 322 | 322 | $result = $this->db->query($main_query); |
| 323 | 323 | } |
| 324 | 324 | else { |
| 325 | - if($limit == -1) { |
|
| 325 | + if ($limit == -1) { |
|
| 326 | 326 | $limit = $this->getLimit(); |
| 327 | 327 | } |
| 328 | 328 | $dyn_offset = $this->getOffset(); |
| 329 | - if($dyn_offset > 0 || !is_int($dyn_offset))$offset = $dyn_offset; |
|
| 329 | + if ($dyn_offset > 0 || !is_int($dyn_offset))$offset = $dyn_offset; |
|
| 330 | 330 | |
| 331 | - if(strcmp($offset, 'end') == 0){ |
|
| 331 | + if (strcmp($offset, 'end') == 0) { |
|
| 332 | 332 | $totalCount = $this->getTotalCount($main_query); |
| 333 | - $offset = (floor(($totalCount -1) / $limit)) * $limit; |
|
| 333 | + $offset = (floor(($totalCount - 1) / $limit)) * $limit; |
|
| 334 | 334 | } |
| 335 | - if($this->seed->ACLAccess('ListView')) { |
|
| 335 | + if ($this->seed->ACLAccess('ListView')) { |
|
| 336 | 336 | $result = $this->db->limitQuery($main_query, $offset, $limit + 1); |
| 337 | 337 | } |
| 338 | 338 | else { |
@@ -350,9 +350,9 @@ discard block |
||
| 350 | 350 | $idIndex = array(); |
| 351 | 351 | $id_list = ''; |
| 352 | 352 | |
| 353 | - while(($row = $this->db->fetchByAssoc($result)) != null) |
|
| 353 | + while (($row = $this->db->fetchByAssoc($result)) != null) |
|
| 354 | 354 | { |
| 355 | - if($count < $limit) |
|
| 355 | + if ($count < $limit) |
|
| 356 | 356 | { |
| 357 | 357 | $id_list .= ',\''.$row[$id_field].'\''; |
| 358 | 358 | $idIndex[$row[$id_field]][] = count($rows); |
@@ -366,51 +366,51 @@ discard block |
||
| 366 | 366 | $id_list = '('.substr($id_list, 1).')'; |
| 367 | 367 | } |
| 368 | 368 | |
| 369 | - SugarVCR::store($this->seed->module_dir, $main_query); |
|
| 370 | - if($count != 0) { |
|
| 369 | + SugarVCR::store($this->seed->module_dir, $main_query); |
|
| 370 | + if ($count != 0) { |
|
| 371 | 371 | //NOW HANDLE SECONDARY QUERIES |
| 372 | - if(!empty($ret_array['secondary_select'])) { |
|
| 373 | - $secondary_query = $ret_array['secondary_select'] . $ret_array['secondary_from'] . ' WHERE '.$this->seed->table_name.'.id IN ' .$id_list; |
|
| 374 | - if(isset($ret_array['order_by'])) |
|
| 372 | + if (!empty($ret_array['secondary_select'])) { |
|
| 373 | + $secondary_query = $ret_array['secondary_select'].$ret_array['secondary_from'].' WHERE '.$this->seed->table_name.'.id IN '.$id_list; |
|
| 374 | + if (isset($ret_array['order_by'])) |
|
| 375 | 375 | { |
| 376 | - $secondary_query .= ' ' . $ret_array['order_by']; |
|
| 376 | + $secondary_query .= ' '.$ret_array['order_by']; |
|
| 377 | 377 | } |
| 378 | 378 | |
| 379 | 379 | $secondary_result = $this->db->query($secondary_query); |
| 380 | 380 | |
| 381 | 381 | $ref_id_count = array(); |
| 382 | - while($row = $this->db->fetchByAssoc($secondary_result)) { |
|
| 382 | + while ($row = $this->db->fetchByAssoc($secondary_result)) { |
|
| 383 | 383 | |
| 384 | 384 | $ref_id_count[$row['ref_id']][] = true; |
| 385 | - foreach($row as $name=>$value) { |
|
| 385 | + foreach ($row as $name=>$value) { |
|
| 386 | 386 | //add it to every row with the given id |
| 387 | - foreach($idIndex[$row['ref_id']] as $index){ |
|
| 388 | - $rows[$index][$name]=$value; |
|
| 387 | + foreach ($idIndex[$row['ref_id']] as $index) { |
|
| 388 | + $rows[$index][$name] = $value; |
|
| 389 | 389 | } |
| 390 | 390 | } |
| 391 | 391 | } |
| 392 | 392 | |
| 393 | 393 | $rows_keys = array_keys($rows); |
| 394 | - foreach($rows_keys as $key) |
|
| 394 | + foreach ($rows_keys as $key) |
|
| 395 | 395 | { |
| 396 | 396 | $rows[$key]['secondary_select_count'] = count($ref_id_count[$rows[$key]['ref_id']]); |
| 397 | 397 | } |
| 398 | 398 | } |
| 399 | 399 | |
| 400 | 400 | // retrieve parent names |
| 401 | - if(!empty($filter_fields['parent_name']) && !empty($filter_fields['parent_id']) && !empty($filter_fields['parent_type'])) { |
|
| 402 | - foreach($idIndex as $id => $rowIndex) { |
|
| 403 | - if(!isset($post_retrieve[$rows[$rowIndex[0]]['parent_type']])) { |
|
| 401 | + if (!empty($filter_fields['parent_name']) && !empty($filter_fields['parent_id']) && !empty($filter_fields['parent_type'])) { |
|
| 402 | + foreach ($idIndex as $id => $rowIndex) { |
|
| 403 | + if (!isset($post_retrieve[$rows[$rowIndex[0]]['parent_type']])) { |
|
| 404 | 404 | $post_retrieve[$rows[$rowIndex[0]]['parent_type']] = array(); |
| 405 | 405 | } |
| 406 | - if(!empty($rows[$rowIndex[0]]['parent_id'])) $post_retrieve[$rows[$rowIndex[0]]['parent_type']][] = array('child_id' => $id , 'parent_id'=> $rows[$rowIndex[0]]['parent_id'], 'parent_type' => $rows[$rowIndex[0]]['parent_type'], 'type' => 'parent'); |
|
| 406 | + if (!empty($rows[$rowIndex[0]]['parent_id'])) $post_retrieve[$rows[$rowIndex[0]]['parent_type']][] = array('child_id' => $id, 'parent_id'=> $rows[$rowIndex[0]]['parent_id'], 'parent_type' => $rows[$rowIndex[0]]['parent_type'], 'type' => 'parent'); |
|
| 407 | 407 | } |
| 408 | - if(isset($post_retrieve)) { |
|
| 408 | + if (isset($post_retrieve)) { |
|
| 409 | 409 | $parent_fields = $seed->retrieve_parent_fields($post_retrieve); |
| 410 | - foreach($parent_fields as $child_id => $parent_data) { |
|
| 410 | + foreach ($parent_fields as $child_id => $parent_data) { |
|
| 411 | 411 | //add it to every row with the given id |
| 412 | - foreach($idIndex[$child_id] as $index){ |
|
| 413 | - $rows[$index]['parent_name']= $parent_data['parent_name']; |
|
| 412 | + foreach ($idIndex[$child_id] as $index) { |
|
| 413 | + $rows[$index]['parent_name'] = $parent_data['parent_name']; |
|
| 414 | 414 | } |
| 415 | 415 | } |
| 416 | 416 | } |
@@ -419,7 +419,7 @@ discard block |
||
| 419 | 419 | $pageData = array(); |
| 420 | 420 | |
| 421 | 421 | reset($rows); |
| 422 | - while($row = current($rows)){ |
|
| 422 | + while ($row = current($rows)) { |
|
| 423 | 423 | |
| 424 | 424 | $temp = clone $seed; |
| 425 | 425 | $dataIndex = count($data); |
@@ -429,9 +429,9 @@ discard block |
||
| 429 | 429 | if (empty($this->seed->assigned_user_id) && !empty($temp->assigned_user_id)) { |
| 430 | 430 | $this->seed->assigned_user_id = $temp->assigned_user_id; |
| 431 | 431 | } |
| 432 | - if($idIndex[$row[$id_field]][0] == $dataIndex){ |
|
| 432 | + if ($idIndex[$row[$id_field]][0] == $dataIndex) { |
|
| 433 | 433 | $pageData['tag'][$dataIndex] = $temp->listviewACLHelper(); |
| 434 | - }else{ |
|
| 434 | + } else { |
|
| 435 | 435 | $pageData['tag'][$dataIndex] = $pageData['tag'][$idIndex[$row[$id_field]][0]]; |
| 436 | 436 | } |
| 437 | 437 | $data[$dataIndex] = $temp->get_list_view_data($filter_fields); |
@@ -439,21 +439,21 @@ discard block |
||
| 439 | 439 | $editViewAccess = $temp->ACLAccess('EditView'); |
| 440 | 440 | $pageData['rowAccess'][$dataIndex] = array('view' => $detailViewAccess, 'edit' => $editViewAccess); |
| 441 | 441 | $additionalDetailsAllow = $this->additionalDetails && $detailViewAccess && (file_exists( |
| 442 | - 'modules/' . $temp->module_dir . '/metadata/additionalDetails.php' |
|
| 443 | - ) || file_exists('custom/modules/' . $temp->module_dir . '/metadata/additionalDetails.php')); |
|
| 442 | + 'modules/'.$temp->module_dir.'/metadata/additionalDetails.php' |
|
| 443 | + ) || file_exists('custom/modules/'.$temp->module_dir.'/metadata/additionalDetails.php')); |
|
| 444 | 444 | $additionalDetailsEdit = $editViewAccess; |
| 445 | - if($additionalDetailsAllow) { |
|
| 446 | - if($this->additionalDetailsAjax) { |
|
| 445 | + if ($additionalDetailsAllow) { |
|
| 446 | + if ($this->additionalDetailsAjax) { |
|
| 447 | 447 | $ar = $this->getAdditionalDetailsAjax($data[$dataIndex]['ID']); |
| 448 | 448 | } |
| 449 | 449 | else { |
| 450 | - $additionalDetailsFile = 'modules/' . $this->seed->module_dir . '/metadata/additionalDetails.php'; |
|
| 451 | - if(file_exists('custom/modules/' . $this->seed->module_dir . '/metadata/additionalDetails.php')){ |
|
| 452 | - $additionalDetailsFile = 'custom/modules/' . $this->seed->module_dir . '/metadata/additionalDetails.php'; |
|
| 450 | + $additionalDetailsFile = 'modules/'.$this->seed->module_dir.'/metadata/additionalDetails.php'; |
|
| 451 | + if (file_exists('custom/modules/'.$this->seed->module_dir.'/metadata/additionalDetails.php')) { |
|
| 452 | + $additionalDetailsFile = 'custom/modules/'.$this->seed->module_dir.'/metadata/additionalDetails.php'; |
|
| 453 | 453 | } |
| 454 | 454 | require_once($additionalDetailsFile); |
| 455 | 455 | $ar = $this->getAdditionalDetails($data[$dataIndex], |
| 456 | - (empty($this->additionalDetailsFunction) ? 'additionalDetails' : $this->additionalDetailsFunction) . $this->seed->object_name, |
|
| 456 | + (empty($this->additionalDetailsFunction) ? 'additionalDetails' : $this->additionalDetailsFunction).$this->seed->object_name, |
|
| 457 | 457 | $additionalDetailsEdit); |
| 458 | 458 | } |
| 459 | 459 | $pageData['additionalDetails'][$dataIndex] = $ar['string']; |
@@ -465,18 +465,18 @@ discard block |
||
| 465 | 465 | $nextOffset = -1; |
| 466 | 466 | $prevOffset = -1; |
| 467 | 467 | $endOffset = -1; |
| 468 | - if($count > $limit) { |
|
| 468 | + if ($count > $limit) { |
|
| 469 | 469 | $nextOffset = $offset + $limit; |
| 470 | 470 | } |
| 471 | 471 | |
| 472 | - if($offset > 0) { |
|
| 472 | + if ($offset > 0) { |
|
| 473 | 473 | $prevOffset = $offset - $limit; |
| 474 | - if($prevOffset < 0)$prevOffset = 0; |
|
| 474 | + if ($prevOffset < 0)$prevOffset = 0; |
|
| 475 | 475 | } |
| 476 | 476 | $totalCount = $count + $offset; |
| 477 | 477 | |
| 478 | - if( $count >= $limit && $totalCounted){ |
|
| 479 | - $totalCount = $this->getTotalCount($main_query); |
|
| 478 | + if ($count >= $limit && $totalCounted) { |
|
| 479 | + $totalCount = $this->getTotalCount($main_query); |
|
| 480 | 480 | } |
| 481 | 481 | SugarVCR::recordIDs($this->seed->module_dir, array_keys($idIndex), $offset, $totalCount); |
| 482 | 482 | $module_names = array( |
@@ -486,21 +486,21 @@ discard block |
||
| 486 | 486 | $pageData['ordering'] = $order; |
| 487 | 487 | $pageData['ordering']['sortOrder'] = $this->getReverseSortOrder($pageData['ordering']['sortOrder']); |
| 488 | 488 | //get url parameters as an array |
| 489 | - $pageData['queries'] = $this->generateQueries($pageData['ordering']['sortOrder'], $offset, $prevOffset, $nextOffset, $endOffset, $totalCounted); |
|
| 489 | + $pageData['queries'] = $this->generateQueries($pageData['ordering']['sortOrder'], $offset, $prevOffset, $nextOffset, $endOffset, $totalCounted); |
|
| 490 | 490 | //join url parameters from array to a string |
| 491 | 491 | $pageData['urls'] = $this->generateURLS($pageData['queries']); |
| 492 | - $pageData['offsets'] = array( 'current'=>$offset, 'next'=>$nextOffset, 'prev'=>$prevOffset, 'end'=>$endOffset, 'total'=>$totalCount, 'totalCounted'=>$totalCounted); |
|
| 492 | + $pageData['offsets'] = array('current'=>$offset, 'next'=>$nextOffset, 'prev'=>$prevOffset, 'end'=>$endOffset, 'total'=>$totalCount, 'totalCounted'=>$totalCounted); |
|
| 493 | 493 | $pageData['bean'] = array('objectName' => $seed->object_name, 'moduleDir' => $seed->module_dir, 'moduleName' => strtr($seed->module_dir, $module_names)); |
| 494 | 494 | $pageData['stamp'] = $this->stamp; |
| 495 | 495 | $pageData['access'] = array('view' => $this->seed->ACLAccess('DetailView'), 'edit' => $this->seed->ACLAccess('EditView')); |
| 496 | 496 | $pageData['idIndex'] = $idIndex; |
| 497 | - if(!$this->seed->ACLAccess('ListView')) { |
|
| 497 | + if (!$this->seed->ACLAccess('ListView')) { |
|
| 498 | 498 | $pageData['error'] = 'ACL restricted access'; |
| 499 | 499 | } |
| 500 | 500 | |
| 501 | 501 | $queryString = ''; |
| 502 | 502 | |
| 503 | - if( isset($_REQUEST["searchFormTab"]) && $_REQUEST["searchFormTab"] == "advanced_search" || |
|
| 503 | + if (isset($_REQUEST["searchFormTab"]) && $_REQUEST["searchFormTab"] == "advanced_search" || |
|
| 504 | 504 | isset($_REQUEST["type_basic"]) && (count($_REQUEST["type_basic"] > 1) || $_REQUEST["type_basic"][0] != "") || |
| 505 | 505 | isset($_REQUEST["module"]) && $_REQUEST["module"] == "MergeRecords") |
| 506 | 506 | { |
@@ -508,19 +508,19 @@ discard block |
||
| 508 | 508 | } |
| 509 | 509 | else if (isset($_REQUEST["searchFormTab"]) && $_REQUEST["searchFormTab"] == "basic_search") |
| 510 | 510 | { |
| 511 | - if($seed->module_dir == "Reports") $searchMetaData = SearchFormReports::retrieveReportsSearchDefs(); |
|
| 511 | + if ($seed->module_dir == "Reports") $searchMetaData = SearchFormReports::retrieveReportsSearchDefs(); |
|
| 512 | 512 | else $searchMetaData = SearchForm::retrieveSearchDefs($seed->module_dir); |
| 513 | 513 | |
| 514 | 514 | $basicSearchFields = array(); |
| 515 | 515 | |
| 516 | - if( isset($searchMetaData['searchdefs']) && isset($searchMetaData['searchdefs'][$seed->module_dir]['layout']['basic_search']) ) |
|
| 516 | + if (isset($searchMetaData['searchdefs']) && isset($searchMetaData['searchdefs'][$seed->module_dir]['layout']['basic_search'])) |
|
| 517 | 517 | $basicSearchFields = $searchMetaData['searchdefs'][$seed->module_dir]['layout']['basic_search']; |
| 518 | 518 | |
| 519 | - foreach( $basicSearchFields as $basicSearchField) |
|
| 519 | + foreach ($basicSearchFields as $basicSearchField) |
|
| 520 | 520 | { |
| 521 | 521 | $field_name = (is_array($basicSearchField) && isset($basicSearchField['name'])) ? $basicSearchField['name'] : $basicSearchField; |
| 522 | 522 | $field_name .= "_basic"; |
| 523 | - if( isset($_REQUEST[$field_name]) && ( !is_array($basicSearchField) || !isset($basicSearchField['type']) || $basicSearchField['type'] == 'text' || $basicSearchField['type'] == 'name') ) |
|
| 523 | + if (isset($_REQUEST[$field_name]) && (!is_array($basicSearchField) || !isset($basicSearchField['type']) || $basicSearchField['type'] == 'text' || $basicSearchField['type'] == 'name')) |
|
| 524 | 524 | { |
| 525 | 525 | // Ensure the encoding is UTF-8 |
| 526 | 526 | $queryString = htmlentities($_REQUEST[$field_name], null, 'UTF-8'); |
@@ -529,7 +529,7 @@ discard block |
||
| 529 | 529 | } |
| 530 | 530 | } |
| 531 | 531 | |
| 532 | - return array('data'=>$data , 'pageData'=>$pageData, 'query' => $queryString); |
|
| 532 | + return array('data'=>$data, 'pageData'=>$pageData, 'query' => $queryString); |
|
| 533 | 533 | } |
| 534 | 534 | |
| 535 | 535 | |
@@ -543,7 +543,7 @@ discard block |
||
| 543 | 543 | { |
| 544 | 544 | foreach ($queries as $name => $value) |
| 545 | 545 | { |
| 546 | - $queries[$name] = 'index.php?' . http_build_query($value); |
|
| 546 | + $queries[$name] = 'index.php?'.http_build_query($value); |
|
| 547 | 547 | } |
| 548 | 548 | $this->base_url = $queries['baseURL']; |
| 549 | 549 | return $queries; |
@@ -569,22 +569,22 @@ discard block |
||
| 569 | 569 | $queries['orderBy'] = $queries['baseURL']; |
| 570 | 570 | $queries['orderBy'][$this->var_order_by] = ''; |
| 571 | 571 | |
| 572 | - if($nextOffset > -1) |
|
| 572 | + if ($nextOffset > -1) |
|
| 573 | 573 | { |
| 574 | 574 | $queries['nextPage'] = $queries['baseURL']; |
| 575 | 575 | $queries['nextPage'][$this->var_offset] = $nextOffset; |
| 576 | 576 | } |
| 577 | - if($offset > 0) |
|
| 577 | + if ($offset > 0) |
|
| 578 | 578 | { |
| 579 | 579 | $queries['startPage'] = $queries['baseURL']; |
| 580 | 580 | $queries['startPage'][$this->var_offset] = 0; |
| 581 | 581 | } |
| 582 | - if($prevOffset > -1) |
|
| 582 | + if ($prevOffset > -1) |
|
| 583 | 583 | { |
| 584 | 584 | $queries['prevPage'] = $queries['baseURL']; |
| 585 | 585 | $queries['prevPage'][$this->var_offset] = $prevOffset; |
| 586 | 586 | } |
| 587 | - if($totalCounted) |
|
| 587 | + if ($totalCounted) |
|
| 588 | 588 | { |
| 589 | 589 | $queries['endPage'] = $queries['baseURL']; |
| 590 | 590 | $queries['endPage'][$this->var_offset] = $endOffset; |
@@ -609,7 +609,7 @@ discard block |
||
| 609 | 609 | |
| 610 | 610 | $jscalendarImage = SugarThemeRegistry::current()->getImageURL('info_inline.gif'); |
| 611 | 611 | |
| 612 | - $extra = "<span id='adspan_" . $id . "' " |
|
| 612 | + $extra = "<span id='adspan_".$id."' " |
|
| 613 | 613 | . "onclick=\"lvg_dtails('$id')\" " |
| 614 | 614 | . " style='position: relative;'><!--not_in_theme!--><img vertical-align='middle' class='info' border='0' alt='".$app_strings['LBL_ADDITIONAL_DETAILS']."' src='$jscalendarImage'></span>"; |
| 615 | 615 | |
@@ -633,27 +633,27 @@ discard block |
||
| 633 | 633 | |
| 634 | 634 | $results['string'] = str_replace(array("'", "'"), '\'', $results['string']); // no xss! |
| 635 | 635 | |
| 636 | - if(trim($results['string']) == '') |
|
| 636 | + if (trim($results['string']) == '') |
|
| 637 | 637 | { |
| 638 | 638 | $results['string'] = $app_strings['LBL_NONE']; |
| 639 | 639 | } |
| 640 | 640 | $close = false; |
| 641 | 641 | $extra = "<img alt='{$app_strings['LBL_INFOINLINE']}' style='padding: 0px 5px 0px 2px' border='0' onclick=\"SUGAR.util.getStaticAdditionalDetails(this,'"; |
| 642 | 642 | |
| 643 | - $extra .= str_replace(array("\rn", "\r", "\n"), array('','','<br />'), $results['string']) ; |
|
| 643 | + $extra .= str_replace(array("\rn", "\r", "\n"), array('', '', '<br />'), $results['string']); |
|
| 644 | 644 | $extra .= "','<div style=\'float:left\'>{$app_strings['LBL_ADDITIONAL_DETAILS']}</div><div style=\'float: right\'>"; |
| 645 | 645 | |
| 646 | - if($editAccess && !empty($results['editLink'])) |
|
| 646 | + if ($editAccess && !empty($results['editLink'])) |
|
| 647 | 647 | { |
| 648 | - $extra .= "<a title=\'{$app_strings['LBL_EDIT_BUTTON']}\' href={$results['editLink']}><img style=\'margin-left: 2px;\' border=\'0\' src=\'".SugarThemeRegistry::current()->getImageURL('edit_inline.png')."\'></a>"; |
|
| 648 | + $extra .= "<a title=\'{$app_strings['LBL_EDIT_BUTTON']}\' href={$results['editLink']}><img style=\'margin-left: 2px;\' border=\'0\' src=\'".SugarThemeRegistry::current()->getImageURL('edit_inline.png')."\'></a>"; |
|
| 649 | 649 | $close = true; |
| 650 | 650 | } |
| 651 | 651 | $close = (!empty($results['viewLink'])) ? true : $close; |
| 652 | 652 | $extra .= (!empty($results['viewLink']) ? "<a title=\'{$app_strings['LBL_VIEW_BUTTON']}\' href={$results['viewLink']}><img style=\'margin-left: 2px;\' border=\'0\' src=".SugarThemeRegistry::current()->getImageURL('view_inline.png')."></a>" : ''); |
| 653 | 653 | |
| 654 | - if($close == true) { |
|
| 654 | + if ($close == true) { |
|
| 655 | 655 | $closeVal = "true"; |
| 656 | - $extra .= "<a title=\'{$app_strings['LBL_ADDITIONAL_DETAILS_CLOSE_TITLE']}\' href=\'javascript: SUGAR.util.closeStaticAdditionalDetails();\'><img style=\'margin-left: 2px;\' border=\'0\' src=\'".SugarThemeRegistry::current()->getImageURL('close.png')."\'></a>"; |
|
| 656 | + $extra .= "<a title=\'{$app_strings['LBL_ADDITIONAL_DETAILS_CLOSE_TITLE']}\' href=\'javascript: SUGAR.util.closeStaticAdditionalDetails();\'><img style=\'margin-left: 2px;\' border=\'0\' src=\'".SugarThemeRegistry::current()->getImageURL('close.png')."\'></a>"; |
|
| 657 | 657 | } else { |
| 658 | 658 | $closeVal = "false"; |
| 659 | 659 | } |
@@ -1,5 +1,7 @@ discard block |
||
| 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. |
@@ -75,8 +77,7 @@ discard block |
||
| 75 | 77 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 76 | 78 | if(isset($GLOBALS['log'])) { |
| 77 | 79 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 78 | - } |
|
| 79 | - else { |
|
| 80 | + } else { |
|
| 80 | 81 | trigger_error($deprecatedMessage, E_USER_DEPRECATED); |
| 81 | 82 | } |
| 82 | 83 | self::__construct(); |
@@ -99,8 +100,7 @@ discard block |
||
| 99 | 100 | } |
| 100 | 101 | $_SESSION[$this->var_order_by] = array('orderBy'=>$orderBy, 'direction'=> $direction); |
| 101 | 102 | $_SESSION['lvd']['last_ob'] = $orderBy; |
| 102 | - } |
|
| 103 | - else { |
|
| 103 | + } else { |
|
| 104 | 104 | $userPreferenceOrder = $GLOBALS['current_user']->getPreference('listviewOrder', $this->var_name); |
| 105 | 105 | if(!empty($_SESSION[$this->var_order_by])) { |
| 106 | 106 | $orderBy = $_SESSION[$this->var_order_by]['orderBy']; |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | function getTotalCount($main_query){ |
| 199 | 199 | if(!empty($this->count_query)){ |
| 200 | 200 | $count_query = $this->count_query; |
| 201 | - }else{ |
|
| 201 | + } else{ |
|
| 202 | 202 | $count_query = $this->seed->create_list_count_query($main_query); |
| 203 | 203 | } |
| 204 | 204 | $result = $this->db->query($count_query); |
@@ -261,8 +261,7 @@ discard block |
||
| 261 | 261 | // if $params tell us to override all ordering |
| 262 | 262 | if(!empty($params['overrideOrder']) && !empty($params['orderBy'])) { |
| 263 | 263 | $order = $this->getOrderBy(strtolower($params['orderBy']), (empty($params['sortOrder']) ? '' : $params['sortOrder'])); // retreive from $_REQUEST |
| 264 | - } |
|
| 265 | - else { |
|
| 264 | + } else { |
|
| 266 | 265 | $order = $this->getOrderBy(); // retreive from $_REQUEST |
| 267 | 266 | } |
| 268 | 267 | |
@@ -289,8 +288,9 @@ discard block |
||
| 289 | 288 | } else { |
| 290 | 289 | $orderBy = $order['orderBy'] . ' ' . $order['sortOrder']; |
| 291 | 290 | //wdong, Bug 25476, fix the sorting problem of Oracle. |
| 292 | - if (isset($params['custom_order_by_override']['ori_code']) && $order['orderBy'] == $params['custom_order_by_override']['ori_code']) |
|
| 293 | - $orderBy = $params['custom_order_by_override']['custom_code'] . ' ' . $order['sortOrder']; |
|
| 291 | + if (isset($params['custom_order_by_override']['ori_code']) && $order['orderBy'] == $params['custom_order_by_override']['ori_code']) { |
|
| 292 | + $orderBy = $params['custom_order_by_override']['custom_code'] . ' ' . $order['sortOrder']; |
|
| 293 | + } |
|
| 294 | 294 | } |
| 295 | 295 | |
| 296 | 296 | if (empty($params['skipOrderSave'])) { // don't save preferences if told so |
@@ -308,11 +308,21 @@ discard block |
||
| 308 | 308 | $ret_array['inner_join'] = ' ' . implode(' ', $this->seed->listview_inner_join) . ' '; |
| 309 | 309 | } |
| 310 | 310 | |
| 311 | - if(!is_array($params)) $params = array(); |
|
| 312 | - if(!isset($params['custom_select'])) $params['custom_select'] = ''; |
|
| 313 | - if(!isset($params['custom_from'])) $params['custom_from'] = ''; |
|
| 314 | - if(!isset($params['custom_where'])) $params['custom_where'] = ''; |
|
| 315 | - if(!isset($params['custom_order_by'])) $params['custom_order_by'] = ''; |
|
| 311 | + if(!is_array($params)) { |
|
| 312 | + $params = array(); |
|
| 313 | + } |
|
| 314 | + if(!isset($params['custom_select'])) { |
|
| 315 | + $params['custom_select'] = ''; |
|
| 316 | + } |
|
| 317 | + if(!isset($params['custom_from'])) { |
|
| 318 | + $params['custom_from'] = ''; |
|
| 319 | + } |
|
| 320 | + if(!isset($params['custom_where'])) { |
|
| 321 | + $params['custom_where'] = ''; |
|
| 322 | + } |
|
| 323 | + if(!isset($params['custom_order_by'])) { |
|
| 324 | + $params['custom_order_by'] = ''; |
|
| 325 | + } |
|
| 316 | 326 | $main_query = $ret_array['select'] . $params['custom_select'] . $ret_array['from'] . $params['custom_from'] . $ret_array['inner_join']. $ret_array['where'] . $params['custom_where'] . $ret_array['order_by'] . $params['custom_order_by']; |
| 317 | 327 | //C.L. - Fix for 23461 |
| 318 | 328 | if(empty($_REQUEST['action']) || $_REQUEST['action'] != 'Popup') { |
@@ -320,13 +330,14 @@ discard block |
||
| 320 | 330 | } |
| 321 | 331 | if($limit < -1) { |
| 322 | 332 | $result = $this->db->query($main_query); |
| 323 | - } |
|
| 324 | - else { |
|
| 333 | + } else { |
|
| 325 | 334 | if($limit == -1) { |
| 326 | 335 | $limit = $this->getLimit(); |
| 327 | 336 | } |
| 328 | 337 | $dyn_offset = $this->getOffset(); |
| 329 | - if($dyn_offset > 0 || !is_int($dyn_offset))$offset = $dyn_offset; |
|
| 338 | + if($dyn_offset > 0 || !is_int($dyn_offset)) { |
|
| 339 | + $offset = $dyn_offset; |
|
| 340 | + } |
|
| 330 | 341 | |
| 331 | 342 | if(strcmp($offset, 'end') == 0){ |
| 332 | 343 | $totalCount = $this->getTotalCount($main_query); |
@@ -334,8 +345,7 @@ discard block |
||
| 334 | 345 | } |
| 335 | 346 | if($this->seed->ACLAccess('ListView')) { |
| 336 | 347 | $result = $this->db->limitQuery($main_query, $offset, $limit + 1); |
| 337 | - } |
|
| 338 | - else { |
|
| 348 | + } else { |
|
| 339 | 349 | $result = array(); |
| 340 | 350 | } |
| 341 | 351 | |
@@ -403,7 +413,9 @@ discard block |
||
| 403 | 413 | if(!isset($post_retrieve[$rows[$rowIndex[0]]['parent_type']])) { |
| 404 | 414 | $post_retrieve[$rows[$rowIndex[0]]['parent_type']] = array(); |
| 405 | 415 | } |
| 406 | - if(!empty($rows[$rowIndex[0]]['parent_id'])) $post_retrieve[$rows[$rowIndex[0]]['parent_type']][] = array('child_id' => $id , 'parent_id'=> $rows[$rowIndex[0]]['parent_id'], 'parent_type' => $rows[$rowIndex[0]]['parent_type'], 'type' => 'parent'); |
|
| 416 | + if(!empty($rows[$rowIndex[0]]['parent_id'])) { |
|
| 417 | + $post_retrieve[$rows[$rowIndex[0]]['parent_type']][] = array('child_id' => $id , 'parent_id'=> $rows[$rowIndex[0]]['parent_id'], 'parent_type' => $rows[$rowIndex[0]]['parent_type'], 'type' => 'parent'); |
|
| 418 | + } |
|
| 407 | 419 | } |
| 408 | 420 | if(isset($post_retrieve)) { |
| 409 | 421 | $parent_fields = $seed->retrieve_parent_fields($post_retrieve); |
@@ -431,7 +443,7 @@ discard block |
||
| 431 | 443 | } |
| 432 | 444 | if($idIndex[$row[$id_field]][0] == $dataIndex){ |
| 433 | 445 | $pageData['tag'][$dataIndex] = $temp->listviewACLHelper(); |
| 434 | - }else{ |
|
| 446 | + } else{ |
|
| 435 | 447 | $pageData['tag'][$dataIndex] = $pageData['tag'][$idIndex[$row[$id_field]][0]]; |
| 436 | 448 | } |
| 437 | 449 | $data[$dataIndex] = $temp->get_list_view_data($filter_fields); |
@@ -445,8 +457,7 @@ discard block |
||
| 445 | 457 | if($additionalDetailsAllow) { |
| 446 | 458 | if($this->additionalDetailsAjax) { |
| 447 | 459 | $ar = $this->getAdditionalDetailsAjax($data[$dataIndex]['ID']); |
| 448 | - } |
|
| 449 | - else { |
|
| 460 | + } else { |
|
| 450 | 461 | $additionalDetailsFile = 'modules/' . $this->seed->module_dir . '/metadata/additionalDetails.php'; |
| 451 | 462 | if(file_exists('custom/modules/' . $this->seed->module_dir . '/metadata/additionalDetails.php')){ |
| 452 | 463 | $additionalDetailsFile = 'custom/modules/' . $this->seed->module_dir . '/metadata/additionalDetails.php'; |
@@ -471,7 +482,9 @@ discard block |
||
| 471 | 482 | |
| 472 | 483 | if($offset > 0) { |
| 473 | 484 | $prevOffset = $offset - $limit; |
| 474 | - if($prevOffset < 0)$prevOffset = 0; |
|
| 485 | + if($prevOffset < 0) { |
|
| 486 | + $prevOffset = 0; |
|
| 487 | + } |
|
| 475 | 488 | } |
| 476 | 489 | $totalCount = $count + $offset; |
| 477 | 490 | |
@@ -505,16 +518,19 @@ discard block |
||
| 505 | 518 | isset($_REQUEST["module"]) && $_REQUEST["module"] == "MergeRecords") |
| 506 | 519 | { |
| 507 | 520 | $queryString = "-advanced_search"; |
| 508 | - } |
|
| 509 | - else if (isset($_REQUEST["searchFormTab"]) && $_REQUEST["searchFormTab"] == "basic_search") |
|
| 521 | + } else if (isset($_REQUEST["searchFormTab"]) && $_REQUEST["searchFormTab"] == "basic_search") |
|
| 510 | 522 | { |
| 511 | - if($seed->module_dir == "Reports") $searchMetaData = SearchFormReports::retrieveReportsSearchDefs(); |
|
| 512 | - else $searchMetaData = SearchForm::retrieveSearchDefs($seed->module_dir); |
|
| 523 | + if($seed->module_dir == "Reports") { |
|
| 524 | + $searchMetaData = SearchFormReports::retrieveReportsSearchDefs(); |
|
| 525 | + } else { |
|
| 526 | + $searchMetaData = SearchForm::retrieveSearchDefs($seed->module_dir); |
|
| 527 | + } |
|
| 513 | 528 | |
| 514 | 529 | $basicSearchFields = array(); |
| 515 | 530 | |
| 516 | - if( isset($searchMetaData['searchdefs']) && isset($searchMetaData['searchdefs'][$seed->module_dir]['layout']['basic_search']) ) |
|
| 517 | - $basicSearchFields = $searchMetaData['searchdefs'][$seed->module_dir]['layout']['basic_search']; |
|
| 531 | + if( isset($searchMetaData['searchdefs']) && isset($searchMetaData['searchdefs'][$seed->module_dir]['layout']['basic_search']) ) { |
|
| 532 | + $basicSearchFields = $searchMetaData['searchdefs'][$seed->module_dir]['layout']['basic_search']; |
|
| 533 | + } |
|
| 518 | 534 | |
| 519 | 535 | foreach( $basicSearchFields as $basicSearchField) |
| 520 | 536 | { |
@@ -588,8 +604,7 @@ discard block |
||
| 588 | 604 | { |
| 589 | 605 | $queries['endPage'] = $queries['baseURL']; |
| 590 | 606 | $queries['endPage'][$this->var_offset] = $endOffset; |
| 591 | - } |
|
| 592 | - else |
|
| 607 | + } else |
|
| 593 | 608 | { |
| 594 | 609 | $queries['endPage'] = $queries['baseURL']; |
| 595 | 610 | $queries['endPage'][$this->var_offset] = 'end'; |
@@ -1,5 +1,5 @@ discard block |
||
| 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,8 +45,8 @@ discard block |
||
| 45 | 45 | */ |
| 46 | 46 | class ListView |
| 47 | 47 | { |
| 48 | - var $local_theme= null; |
|
| 49 | - var $local_app_strings= null; |
|
| 48 | + var $local_theme = null; |
|
| 49 | + var $local_app_strings = null; |
|
| 50 | 50 | var $local_image_path = null; |
| 51 | 51 | var $local_current_module = null; |
| 52 | 52 | var $local_mod_strings = null; |
@@ -81,12 +81,12 @@ discard block |
||
| 81 | 81 | var $child_focus = ''; |
| 82 | 82 | var $layout_manager = null; |
| 83 | 83 | var $process_for_popups = false; |
| 84 | - var $multi_select_popup=false; |
|
| 84 | + var $multi_select_popup = false; |
|
| 85 | 85 | var $_additionalDetails = false; |
| 86 | 86 | var $additionalDetailsFunction = null; |
| 87 | 87 | var $sort_order = ''; |
| 88 | - var $force_mass_update=false; |
|
| 89 | - var $keep_mass_update_form_open=false; |
|
| 88 | + var $force_mass_update = false; |
|
| 89 | + var $keep_mass_update_form_open = false; |
|
| 90 | 90 | var $ignorePopulateOnly = false; |
| 91 | 91 | |
| 92 | 92 | function setDataArray($value) { |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | echo "<form name='MassUpdate' method='post' action='index.php'>"; |
| 101 | 101 | $this->processListViewTwo($seed, $xTemplateSection, $html_varName); |
| 102 | 102 | |
| 103 | - echo "<a href='javascript:" . ((!$this->multi_select_popup) ? 'sListView.' : ''). "check_all(document.MassUpdate, \"mass[]\", true)'>".translate('LBL_CHECKALL')."</a> - <a href='javascript:sListView.check_all(document.MassUpdate, \"mass[]\", false);'>".translate('LBL_CLEARALL')."</a>"; |
|
| 103 | + echo "<a href='javascript:".((!$this->multi_select_popup) ? 'sListView.' : '')."check_all(document.MassUpdate, \"mass[]\", true)'>".translate('LBL_CHECKALL')."</a> - <a href='javascript:sListView.check_all(document.MassUpdate, \"mass[]\", false);'>".translate('LBL_CLEARALL')."</a>"; |
|
| 104 | 104 | echo '<br><br>'; |
| 105 | 105 | } |
| 106 | 106 | |
@@ -110,109 +110,109 @@ discard block |
||
| 110 | 110 | global $sugar_config; |
| 111 | 111 | |
| 112 | 112 | $populateOnly = $this->ignorePopulateOnly ? FALSE : (!empty($sugar_config['save_query']) && $sugar_config['save_query'] == 'populate_only'); |
| 113 | - if(isset($seed->module_dir) && $populateOnly) { |
|
| 114 | - if(empty($GLOBALS['displayListView']) && strcmp(strtolower($_REQUEST['action']), 'popup') != 0 && (!empty($_REQUEST['clear_query']) || $_REQUEST['module'] == $seed->module_dir && ((empty($_REQUEST['query']) || $_REQUEST['query'] == 'MSI')&& (empty($_SESSION['last_search_mod']) || $_SESSION['last_search_mod'] != $seed->module_dir)))) { |
|
| 115 | - $_SESSION['last_search_mod'] = $_REQUEST['module'] ; |
|
| 113 | + if (isset($seed->module_dir) && $populateOnly) { |
|
| 114 | + if (empty($GLOBALS['displayListView']) && strcmp(strtolower($_REQUEST['action']), 'popup') != 0 && (!empty($_REQUEST['clear_query']) || $_REQUEST['module'] == $seed->module_dir && ((empty($_REQUEST['query']) || $_REQUEST['query'] == 'MSI') && (empty($_SESSION['last_search_mod']) || $_SESSION['last_search_mod'] != $seed->module_dir)))) { |
|
| 115 | + $_SESSION['last_search_mod'] = $_REQUEST['module']; |
|
| 116 | 116 | return; |
| 117 | 117 | } |
| 118 | 118 | } |
| 119 | - if(strcmp(strtolower($_REQUEST['action']), 'popup') != 0){ |
|
| 120 | - $_SESSION['last_search_mod'] = $_REQUEST['module'] ; |
|
| 119 | + if (strcmp(strtolower($_REQUEST['action']), 'popup') != 0) { |
|
| 120 | + $_SESSION['last_search_mod'] = $_REQUEST['module']; |
|
| 121 | 121 | } |
| 122 | 122 | //following session variable will track the detail view navigation history. |
| 123 | 123 | //needs to the reset after each search. |
| 124 | - $this->setLocalSessionVariable($html_varName,"DETAIL_NAV_HISTORY",false); |
|
| 124 | + $this->setLocalSessionVariable($html_varName, "DETAIL_NAV_HISTORY", false); |
|
| 125 | 125 | |
| 126 | 126 | require_once('include/MassUpdate.php'); |
| 127 | 127 | $mass = new MassUpdate(); |
| 128 | 128 | $add_acl_javascript = false; |
| 129 | - if(!isset($_REQUEST['action'])) { |
|
| 130 | - $this->shouldProcess=false; |
|
| 129 | + if (!isset($_REQUEST['action'])) { |
|
| 130 | + $this->shouldProcess = false; |
|
| 131 | 131 | } else { |
| 132 | 132 | $this->shouldProcess = is_subclass_of($seed, "SugarBean") |
| 133 | - && (($_REQUEST['action'] == 'index') || ('ListView' == substr($_REQUEST['action'],0,8)) /* cn: to include all ListViewXXX.php type views */) |
|
| 133 | + && (($_REQUEST['action'] == 'index') || ('ListView' == substr($_REQUEST['action'], 0, 8)) /* cn: to include all ListViewXXX.php type views */) |
|
| 134 | 134 | && ($_REQUEST['module'] == $seed->module_dir); |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | //when processing a multi-select popup. |
| 138 | - if($this->process_for_popups && $this->multi_select_popup) $this->shouldProcess =true; |
|
| 138 | + if ($this->process_for_popups && $this->multi_select_popup) $this->shouldProcess = true; |
|
| 139 | 139 | //mass update turned off? |
| 140 | - if(!$this->show_mass_update) $this->shouldProcess = false; |
|
| 141 | - if(is_subclass_of($seed, "SugarBean")) { |
|
| 142 | - if($seed->bean_implements('ACL')) { |
|
| 143 | - if(!ACLController::checkAccess($seed->module_dir,'list',true)) { |
|
| 144 | - if($_REQUEST['module'] != 'Home') { |
|
| 140 | + if (!$this->show_mass_update) $this->shouldProcess = false; |
|
| 141 | + if (is_subclass_of($seed, "SugarBean")) { |
|
| 142 | + if ($seed->bean_implements('ACL')) { |
|
| 143 | + if (!ACLController::checkAccess($seed->module_dir, 'list', true)) { |
|
| 144 | + if ($_REQUEST['module'] != 'Home') { |
|
| 145 | 145 | ACLController::displayNoAccess(); |
| 146 | 146 | } |
| 147 | 147 | return; |
| 148 | 148 | } |
| 149 | - if(!ACLController::checkAccess($seed->module_dir,'export',true)) { |
|
| 150 | - $sugar_config['disable_export']= true; |
|
| 149 | + if (!ACLController::checkAccess($seed->module_dir, 'export', true)) { |
|
| 150 | + $sugar_config['disable_export'] = true; |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | } |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | //force mass update form if requested. |
| 157 | - if($this->force_mass_update) { |
|
| 157 | + if ($this->force_mass_update) { |
|
| 158 | 158 | $this->shouldProcess = true; |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | - if($this->shouldProcess) { |
|
| 161 | + if ($this->shouldProcess) { |
|
| 162 | 162 | echo $mass->getDisplayMassUpdateForm(true, $this->multi_select_popup); |
| 163 | 163 | echo $mass->getMassUpdateFormHeader($this->multi_select_popup); |
| 164 | 164 | $mass->setSugarBean($seed); |
| 165 | 165 | |
| 166 | 166 | //C.L. Fix for 10048, do not process handleMassUpdate for multi select popups |
| 167 | - if(!$this->multi_select_popup) { |
|
| 167 | + if (!$this->multi_select_popup) { |
|
| 168 | 168 | $mass->handleMassUpdate(); |
| 169 | 169 | } |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | - $this->processListViewTwo($seed,$xTemplateSection, $html_varName); |
|
| 172 | + $this->processListViewTwo($seed, $xTemplateSection, $html_varName); |
|
| 173 | 173 | |
| 174 | - if($this->shouldProcess && empty($this->process_for_popups)) { |
|
| 174 | + if ($this->shouldProcess && empty($this->process_for_popups)) { |
|
| 175 | 175 | //echo "<a href='javascript:sListView.clear_all(document.MassUpdate, \"mass[]\");'>".translate('LBL_CLEARALL')."</a>"; |
| 176 | 176 | // cn: preserves current functionality, exception is InboundEmail |
| 177 | - if($this->show_mass_update_form) { |
|
| 177 | + if ($this->show_mass_update_form) { |
|
| 178 | 178 | echo $mass->getMassUpdateForm(); |
| 179 | 179 | } |
| 180 | - if(!$this->keep_mass_update_form_open) { |
|
| 180 | + if (!$this->keep_mass_update_form_open) { |
|
| 181 | 181 | echo $mass->endMassUpdateForm(); |
| 182 | 182 | } |
| 183 | 183 | } |
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | |
| 187 | -function process_dynamic_listview($source_module, $sugarbean,$subpanel_def) |
|
| 187 | +function process_dynamic_listview($source_module, $sugarbean, $subpanel_def) |
|
| 188 | 188 | { |
| 189 | 189 | $this->source_module = $source_module; |
| 190 | 190 | $this->subpanel_module = $subpanel_def->name; |
| 191 | - if(!isset($this->xTemplate)) |
|
| 191 | + if (!isset($this->xTemplate)) |
|
| 192 | 192 | $this->createXTemplate(); |
| 193 | 193 | |
| 194 | - $html_var = $this->subpanel_module . "_CELL"; |
|
| 194 | + $html_var = $this->subpanel_module."_CELL"; |
|
| 195 | 195 | |
| 196 | - $list_data = $this->processUnionBeans($sugarbean,$subpanel_def, $html_var); |
|
| 196 | + $list_data = $this->processUnionBeans($sugarbean, $subpanel_def, $html_var); |
|
| 197 | 197 | |
| 198 | 198 | $list = $list_data['list']; |
| 199 | 199 | $parent_data = $list_data['parent_data']; |
| 200 | 200 | |
| 201 | - if($subpanel_def->isCollection()) { |
|
| 202 | - $thepanel=$subpanel_def->get_header_panel_def(); |
|
| 201 | + if ($subpanel_def->isCollection()) { |
|
| 202 | + $thepanel = $subpanel_def->get_header_panel_def(); |
|
| 203 | 203 | } else { |
| 204 | - $thepanel=$subpanel_def; |
|
| 204 | + $thepanel = $subpanel_def; |
|
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | |
| 208 | 208 | |
| 209 | 209 | $this->process_dynamic_listview_header($thepanel->get_module_name(), $thepanel, $html_var); |
| 210 | - $this->process_dynamic_listview_rows($list,$parent_data, 'dyn_list_view', $html_var,$subpanel_def); |
|
| 210 | + $this->process_dynamic_listview_rows($list, $parent_data, 'dyn_list_view', $html_var, $subpanel_def); |
|
| 211 | 211 | |
| 212 | - if($this->display_header_and_footer) |
|
| 212 | + if ($this->display_header_and_footer) |
|
| 213 | 213 | { |
| 214 | 214 | $this->getAdditionalHeader(); |
| 215 | - if(!empty($this->header_title)) |
|
| 215 | + if (!empty($this->header_title)) |
|
| 216 | 216 | { |
| 217 | 217 | echo get_form_header($this->header_title, $this->header_text, false); |
| 218 | 218 | } |
@@ -220,11 +220,11 @@ discard block |
||
| 220 | 220 | |
| 221 | 221 | $this->xTemplate->out('dyn_list_view'); |
| 222 | 222 | |
| 223 | - if(isset($_SESSION['validation'])) |
|
| 223 | + if (isset($_SESSION['validation'])) |
|
| 224 | 224 | { |
| 225 | 225 | print base64_decode('PGEgaHJlZj0naHR0cDovL3d3dy5zdWdhcmNybS5jb20nPlBPV0VSRUQmbmJzcDtCWSZuYnNwO1NVR0FSQ1JNPC9hPg=='); |
| 226 | 226 | } |
| 227 | - if(isset($list_data['query'])) { |
|
| 227 | + if (isset($list_data['query'])) { |
|
| 228 | 228 | return ($list_data['query']); |
| 229 | 229 | } |
| 230 | 230 | } |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | * @param unknown $html_varName |
| 237 | 237 | * @desc INTERNAL FUNCTION handles the rows |
| 238 | 238 | */ |
| 239 | - function process_dynamic_listview_rows($data,$parent_data, $xtemplateSection, $html_varName, $subpanel_def) |
|
| 239 | + function process_dynamic_listview_rows($data, $parent_data, $xtemplateSection, $html_varName, $subpanel_def) |
|
| 240 | 240 | { |
| 241 | 241 | global $subpanel_item_count; |
| 242 | 242 | global $odd_bg; |
@@ -261,37 +261,37 @@ discard block |
||
| 261 | 261 | //Either retrieve the is_fill_in_additional_fields property from the lone |
| 262 | 262 | //subpanel or visit each subpanel's subpanels to retrieve the is_fill_in_addition_fields |
| 263 | 263 | //property |
| 264 | - $subpanel_list=array(); |
|
| 265 | - if($subpanel_def->isCollection()) { |
|
| 266 | - $subpanel_list=$subpanel_def->sub_subpanels; |
|
| 264 | + $subpanel_list = array(); |
|
| 265 | + if ($subpanel_def->isCollection()) { |
|
| 266 | + $subpanel_list = $subpanel_def->sub_subpanels; |
|
| 267 | 267 | } else { |
| 268 | - $subpanel_list[]= $subpanel_def; |
|
| 268 | + $subpanel_list[] = $subpanel_def; |
|
| 269 | 269 | } |
| 270 | 270 | |
| 271 | - foreach($subpanel_list as $this_subpanel) |
|
| 271 | + foreach ($subpanel_list as $this_subpanel) |
|
| 272 | 272 | { |
| 273 | - if($this_subpanel->is_fill_in_additional_fields()) |
|
| 273 | + if ($this_subpanel->is_fill_in_additional_fields()) |
|
| 274 | 274 | { |
| 275 | 275 | $fill_additional_fields[] = $this_subpanel->bean_name; |
| 276 | 276 | $fill_additional_fields[$this_subpanel->bean_name] = true; |
| 277 | 277 | } |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | - if ( empty($data) ) { |
|
| 280 | + if (empty($data)) { |
|
| 281 | 281 | $this->xTemplate->assign("ROW_COLOR", 'oddListRow'); |
| 282 | - $thepanel=$subpanel_def; |
|
| 283 | - if($subpanel_def->isCollection()) |
|
| 284 | - $thepanel=$subpanel_def->get_header_panel_def(); |
|
| 282 | + $thepanel = $subpanel_def; |
|
| 283 | + if ($subpanel_def->isCollection()) |
|
| 284 | + $thepanel = $subpanel_def->get_header_panel_def(); |
|
| 285 | 285 | $this->xTemplate->assign("COL_COUNT", count($thepanel->get_list_fields())); |
| 286 | 286 | $this->xTemplate->parse($xtemplateSection.".nodata"); |
| 287 | 287 | } |
| 288 | - while(list($aVal, $aItem) = each($data)) |
|
| 288 | + while (list($aVal, $aItem) = each($data)) |
|
| 289 | 289 | { |
| 290 | 290 | $subpanel_item_count++; |
| 291 | 291 | $aItem->check_date_relationships_load(); |
| 292 | 292 | // TODO: expensive and needs to be removed and done better elsewhere |
| 293 | 293 | |
| 294 | - if(!empty($fill_additional_fields[$aItem->object_name]) |
|
| 294 | + if (!empty($fill_additional_fields[$aItem->object_name]) |
|
| 295 | 295 | || ($aItem->object_name == 'Case' && !empty($fill_additional_fields['aCase'])) |
| 296 | 296 | ) |
| 297 | 297 | { |
@@ -301,15 +301,15 @@ discard block |
||
| 301 | 301 | //rrs bug: 25343 |
| 302 | 302 | $aItem->call_custom_logic("process_record"); |
| 303 | 303 | |
| 304 | - if(isset($parent_data[$aItem->id])) { |
|
| 304 | + if (isset($parent_data[$aItem->id])) { |
|
| 305 | 305 | |
| 306 | 306 | $aItem->parent_name = $parent_data[$aItem->id]['parent_name']; |
| 307 | - if(!empty($parent_data[$aItem->id]['parent_name_owner'])) { |
|
| 308 | - $aItem->parent_name_owner = $parent_data[$aItem->id]['parent_name_owner']; |
|
| 309 | - $aItem->parent_name_mod = $parent_data[$aItem->id]['parent_name_mod']; |
|
| 307 | + if (!empty($parent_data[$aItem->id]['parent_name_owner'])) { |
|
| 308 | + $aItem->parent_name_owner = $parent_data[$aItem->id]['parent_name_owner']; |
|
| 309 | + $aItem->parent_name_mod = $parent_data[$aItem->id]['parent_name_mod']; |
|
| 310 | 310 | }} |
| 311 | 311 | $fields = $aItem->get_list_view_data(); |
| 312 | - if(isset($processed_ids[$aItem->id])) { |
|
| 312 | + if (isset($processed_ids[$aItem->id])) { |
|
| 313 | 313 | continue; |
| 314 | 314 | |
| 315 | 315 | } else { |
@@ -320,50 +320,50 @@ discard block |
||
| 320 | 320 | //ADD OFFSET TO ARRAY |
| 321 | 321 | $fields['OFFSET'] = ($offset + $count + 1); |
| 322 | 322 | |
| 323 | - if($this->shouldProcess) { |
|
| 324 | - if($aItem->ACLAccess('EditView')) { |
|
| 325 | - $this->xTemplate->assign('PREROW', "<input type='checkbox' class='checkbox' name='mass[]' value='". $fields['ID']. "' />"); |
|
| 323 | + if ($this->shouldProcess) { |
|
| 324 | + if ($aItem->ACLAccess('EditView')) { |
|
| 325 | + $this->xTemplate->assign('PREROW', "<input type='checkbox' class='checkbox' name='mass[]' value='".$fields['ID']."' />"); |
|
| 326 | 326 | } else { |
| 327 | 327 | $this->xTemplate->assign('PREROW', ''); |
| 328 | 328 | |
| 329 | 329 | } |
| 330 | - if($aItem->ACLAccess('DetailView')) { |
|
| 331 | - $this->xTemplate->assign('TAG_NAME','a'); |
|
| 330 | + if ($aItem->ACLAccess('DetailView')) { |
|
| 331 | + $this->xTemplate->assign('TAG_NAME', 'a'); |
|
| 332 | 332 | } else { |
| 333 | - $this->xTemplate->assign('TAG_NAME','span'); |
|
| 333 | + $this->xTemplate->assign('TAG_NAME', 'span'); |
|
| 334 | 334 | } |
| 335 | 335 | $this->xTemplate->assign('CHECKALL', "<input type='checkbox' title='".$GLOBALS['app_strings']['LBL_SELECT_ALL_TITLE']."' class='checkbox' name='massall' id='massall' value='' onclick='sListView.check_all(document.MassUpdate, \"mass[]\", this.checked);' />"); |
| 336 | 336 | } |
| 337 | 337 | |
| 338 | - if($oddRow) |
|
| 338 | + if ($oddRow) |
|
| 339 | 339 | { |
| 340 | 340 | $ROW_COLOR = 'oddListRow'; |
| 341 | - $BG_COLOR = $odd_bg; |
|
| 341 | + $BG_COLOR = $odd_bg; |
|
| 342 | 342 | } |
| 343 | 343 | else |
| 344 | 344 | { |
| 345 | 345 | $ROW_COLOR = 'evenListRow'; |
| 346 | - $BG_COLOR = $even_bg; |
|
| 346 | + $BG_COLOR = $even_bg; |
|
| 347 | 347 | } |
| 348 | 348 | $oddRow = !$oddRow; |
| 349 | 349 | $button_contents = array(); |
| 350 | 350 | $this->xTemplate->assign("ROW_COLOR", $ROW_COLOR); |
| 351 | 351 | $this->xTemplate->assign("BG_COLOR", $BG_COLOR); |
| 352 | 352 | $layout_manager = $this->getLayoutManager(); |
| 353 | - $layout_manager->setAttribute('context','List'); |
|
| 354 | - $layout_manager->setAttribute('image_path',$this->local_image_path); |
|
| 353 | + $layout_manager->setAttribute('context', 'List'); |
|
| 354 | + $layout_manager->setAttribute('image_path', $this->local_image_path); |
|
| 355 | 355 | $layout_manager->setAttribute('module_name', $subpanel_def->_instance_properties['module']); |
| 356 | - if(!empty($this->child_focus)) |
|
| 357 | - $layout_manager->setAttribute('related_module_name',$this->child_focus->module_dir); |
|
| 356 | + if (!empty($this->child_focus)) |
|
| 357 | + $layout_manager->setAttribute('related_module_name', $this->child_focus->module_dir); |
|
| 358 | 358 | |
| 359 | 359 | //AG$subpanel_data = $this->list_field_defs; |
| 360 | 360 | //$bla = array_pop($subpanel_data); |
| 361 | 361 | //select which sub-panel to display here, the decision will be made based on the type of |
| 362 | 362 | //the sub-panel and panel in the bean being processed. |
| 363 | - if($subpanel_def->isCollection()) { |
|
| 364 | - $thepanel=$subpanel_def->sub_subpanels[$aItem->panel_name]; |
|
| 363 | + if ($subpanel_def->isCollection()) { |
|
| 364 | + $thepanel = $subpanel_def->sub_subpanels[$aItem->panel_name]; |
|
| 365 | 365 | } else { |
| 366 | - $thepanel=$subpanel_def; |
|
| 366 | + $thepanel = $subpanel_def; |
|
| 367 | 367 | } |
| 368 | 368 | |
| 369 | 369 | /* BEGIN - SECURITY GROUPS */ |
@@ -374,22 +374,22 @@ discard block |
||
| 374 | 374 | $aclaccess_in_group = false; |
| 375 | 375 | |
| 376 | 376 | global $current_user; |
| 377 | - if(is_admin($current_user)) { |
|
| 377 | + if (is_admin($current_user)) { |
|
| 378 | 378 | $aclaccess_is_owner = true; |
| 379 | 379 | } else { |
| 380 | 380 | $aclaccess_is_owner = $aItem->isOwner($current_user->id); |
| 381 | 381 | } |
| 382 | 382 | |
| 383 | 383 | require_once("modules/SecurityGroups/SecurityGroup.php"); |
| 384 | - $aclaccess_in_group = SecurityGroup::groupHasAccess($aItem->module_dir,$aItem->id); |
|
| 384 | + $aclaccess_in_group = SecurityGroup::groupHasAccess($aItem->module_dir, $aItem->id); |
|
| 385 | 385 | |
| 386 | 386 | /* END - SECURITY GROUPS */ |
| 387 | 387 | |
| 388 | 388 | //get data source name |
| 389 | - $linked_field=$thepanel->get_data_source_name(); |
|
| 390 | - $linked_field_set=$thepanel->get_data_source_name(true); |
|
| 389 | + $linked_field = $thepanel->get_data_source_name(); |
|
| 390 | + $linked_field_set = $thepanel->get_data_source_name(true); |
|
| 391 | 391 | static $count; |
| 392 | - if(!isset($count))$count = 0; |
|
| 392 | + if (!isset($count))$count = 0; |
|
| 393 | 393 | /* BEGIN - SECURITY GROUPS */ |
| 394 | 394 | /** |
| 395 | 395 | $field_acl['DetailView'] = $aItem->ACLAccess('DetailView'); |
@@ -398,19 +398,19 @@ discard block |
||
| 398 | 398 | $field_acl['Delete'] = $aItem->ACLAccess('Delete'); |
| 399 | 399 | */ |
| 400 | 400 | //pass is_owner, in_group...vars defined above |
| 401 | - $field_acl['DetailView'] = $aItem->ACLAccess('DetailView',$aclaccess_is_owner,$aclaccess_in_group); |
|
| 402 | - $field_acl['ListView'] = $aItem->ACLAccess('ListView',$aclaccess_is_owner,$aclaccess_in_group); |
|
| 403 | - $field_acl['EditView'] = $aItem->ACLAccess('EditView',$aclaccess_is_owner,$aclaccess_in_group); |
|
| 404 | - $field_acl['Delete'] = $aItem->ACLAccess('Delete',$aclaccess_is_owner,$aclaccess_in_group); |
|
| 401 | + $field_acl['DetailView'] = $aItem->ACLAccess('DetailView', $aclaccess_is_owner, $aclaccess_in_group); |
|
| 402 | + $field_acl['ListView'] = $aItem->ACLAccess('ListView', $aclaccess_is_owner, $aclaccess_in_group); |
|
| 403 | + $field_acl['EditView'] = $aItem->ACLAccess('EditView', $aclaccess_is_owner, $aclaccess_in_group); |
|
| 404 | + $field_acl['Delete'] = $aItem->ACLAccess('Delete', $aclaccess_is_owner, $aclaccess_in_group); |
|
| 405 | 405 | /* END - SECURITY GROUPS */ |
| 406 | - foreach($thepanel->get_list_fields() as $field_name=>$list_field) |
|
| 406 | + foreach ($thepanel->get_list_fields() as $field_name=>$list_field) |
|
| 407 | 407 | { |
| 408 | 408 | //add linked field attribute to the array. |
| 409 | - $list_field['linked_field']=$linked_field; |
|
| 410 | - $list_field['linked_field_set']=$linked_field_set; |
|
| 409 | + $list_field['linked_field'] = $linked_field; |
|
| 410 | + $list_field['linked_field_set'] = $linked_field_set; |
|
| 411 | 411 | |
| 412 | 412 | $usage = empty($list_field['usage']) ? '' : $list_field['usage']; |
| 413 | - if($usage == 'query_only' && !empty($list_field['force_query_only_display'])){ |
|
| 413 | + if ($usage == 'query_only' && !empty($list_field['force_query_only_display'])) { |
|
| 414 | 414 | //if you are here you have column that is query only but needs to be displayed as blank. This is helpful |
| 415 | 415 | //for collections such as Activities where you have a field in only one object and wish to show it in the subpanel list |
| 416 | 416 | $count++; |
@@ -420,13 +420,13 @@ discard block |
||
| 420 | 420 | $this->xTemplate->assign('CELL', $widget_contents); |
| 421 | 421 | $this->xTemplate->parse($xtemplateSection.".row.cell"); |
| 422 | 422 | |
| 423 | - }else if($usage != 'query_only') |
|
| 423 | + } else if ($usage != 'query_only') |
|
| 424 | 424 | { |
| 425 | - $list_field['name']=$field_name; |
|
| 425 | + $list_field['name'] = $field_name; |
|
| 426 | 426 | |
| 427 | 427 | $module_field = $field_name.'_mod'; |
| 428 | 428 | $owner_field = $field_name.'_owner'; |
| 429 | - if(!empty($aItem->$module_field)) { |
|
| 429 | + if (!empty($aItem->$module_field)) { |
|
| 430 | 430 | |
| 431 | 431 | $list_field['owner_id'] = $aItem->$owner_field; |
| 432 | 432 | $list_field['owner_module'] = $aItem->$module_field; |
@@ -435,71 +435,71 @@ discard block |
||
| 435 | 435 | $list_field['owner_id'] = false; |
| 436 | 436 | $list_field['owner_module'] = false; |
| 437 | 437 | } |
| 438 | - if(isset($list_field['alias'])) $list_field['name'] = $list_field['alias']; |
|
| 439 | - else $list_field['name']=$field_name; |
|
| 438 | + if (isset($list_field['alias'])) $list_field['name'] = $list_field['alias']; |
|
| 439 | + else $list_field['name'] = $field_name; |
|
| 440 | 440 | $list_field['fields'] = $fields; |
| 441 | 441 | $list_field['module'] = $aItem->module_dir; |
| 442 | 442 | $list_field['start_link_wrapper'] = $this->start_link_wrapper; |
| 443 | 443 | $list_field['end_link_wrapper'] = $this->end_link_wrapper; |
| 444 | 444 | $list_field['subpanel_id'] = $this->subpanel_id; |
| 445 | 445 | $list_field += $field_acl; |
| 446 | - if ( isset($aItem->field_defs[strtolower($list_field['name'])])) { |
|
| 446 | + if (isset($aItem->field_defs[strtolower($list_field['name'])])) { |
|
| 447 | 447 | require_once('include/SugarFields/SugarFieldHandler.php'); |
| 448 | 448 | // We need to see if a sugar field exists for this field type first, |
| 449 | 449 | // if it doesn't, toss it at the old sugarWidgets. This is for |
| 450 | 450 | // backwards compatibility and will be removed in a future release |
| 451 | 451 | $vardef = $aItem->field_defs[strtolower($list_field['name'])]; |
| 452 | - if ( isset($vardef['type']) ) { |
|
| 453 | - $fieldType = isset($vardef['custom_type'])?$vardef['custom_type']:$vardef['type']; |
|
| 454 | - $tmpField = SugarFieldHandler::getSugarField($fieldType,true); |
|
| 452 | + if (isset($vardef['type'])) { |
|
| 453 | + $fieldType = isset($vardef['custom_type']) ? $vardef['custom_type'] : $vardef['type']; |
|
| 454 | + $tmpField = SugarFieldHandler::getSugarField($fieldType, true); |
|
| 455 | 455 | } else { |
| 456 | 456 | $tmpField = NULL; |
| 457 | 457 | } |
| 458 | 458 | |
| 459 | - if ( $tmpField != NULL ) { |
|
| 460 | - $widget_contents = SugarFieldHandler::displaySmarty($list_field['fields'],$vardef,'ListView',$list_field); |
|
| 459 | + if ($tmpField != NULL) { |
|
| 460 | + $widget_contents = SugarFieldHandler::displaySmarty($list_field['fields'], $vardef, 'ListView', $list_field); |
|
| 461 | 461 | } else { |
| 462 | 462 | // No SugarField for this particular type |
| 463 | 463 | // Use the old, icky, SugarWidget for now |
| 464 | 464 | $widget_contents = $layout_manager->widgetDisplay($list_field); |
| 465 | 465 | } |
| 466 | 466 | |
| 467 | - if ( isset($list_field['widget_class']) && $list_field['widget_class'] == 'SubPanelDetailViewLink' ) { |
|
| 467 | + if (isset($list_field['widget_class']) && $list_field['widget_class'] == 'SubPanelDetailViewLink') { |
|
| 468 | 468 | // We need to call into the old SugarWidgets for the time being, so it can generate a proper link with all the various corner-cases handled |
| 469 | 469 | // So we'll populate the field data with the pre-rendered display for the field |
| 470 | 470 | $list_field['fields'][$field_name] = $widget_contents; |
| 471 | - if('full_name' == $field_name){//bug #32465 |
|
| 471 | + if ('full_name' == $field_name) {//bug #32465 |
|
| 472 | 472 | $list_field['fields'][strtoupper($field_name)] = $widget_contents; |
| 473 | 473 | } |
| 474 | 474 | |
| 475 | 475 | //vardef source is non db, assign the field name to varname for processing of column. |
| 476 | - if(!empty($vardef['source']) && $vardef['source']=='non-db'){ |
|
| 476 | + if (!empty($vardef['source']) && $vardef['source'] == 'non-db') { |
|
| 477 | 477 | $list_field['varname'] = $field_name; |
| 478 | 478 | |
| 479 | 479 | } |
| 480 | 480 | $widget_contents = $layout_manager->widgetDisplay($list_field); |
| 481 | - } else if(isset($list_field['widget_class']) && $list_field['widget_class'] == 'SubPanelEmailLink' ) { |
|
| 481 | + } else if (isset($list_field['widget_class']) && $list_field['widget_class'] == 'SubPanelEmailLink') { |
|
| 482 | 482 | $widget_contents = $layout_manager->widgetDisplay($list_field); |
| 483 | 483 | } |
| 484 | 484 | |
| 485 | 485 | $count++; |
| 486 | 486 | $this->xTemplate->assign('CELL_COUNT', $count); |
| 487 | 487 | $this->xTemplate->assign('CLASS', ""); |
| 488 | - if ( empty($widget_contents) ) $widget_contents = ' '; |
|
| 488 | + if (empty($widget_contents)) $widget_contents = ' '; |
|
| 489 | 489 | $this->xTemplate->assign('CELL', $widget_contents); |
| 490 | 490 | $this->xTemplate->parse($xtemplateSection.".row.cell"); |
| 491 | 491 | } else { |
| 492 | 492 | // This handles the edit and remove buttons and icon widget |
| 493 | - if( isset($list_field['widget_class']) && $list_field['widget_class'] == "SubPanelIcon") { |
|
| 493 | + if (isset($list_field['widget_class']) && $list_field['widget_class'] == "SubPanelIcon") { |
|
| 494 | 494 | $count++; |
| 495 | 495 | $widget_contents = $layout_manager->widgetDisplay($list_field); |
| 496 | 496 | $this->xTemplate->assign('CELL_COUNT', $count); |
| 497 | 497 | $this->xTemplate->assign('CLASS', ""); |
| 498 | - if ( empty($widget_contents) ) $widget_contents = ' '; |
|
| 498 | + if (empty($widget_contents)) $widget_contents = ' '; |
|
| 499 | 499 | $this->xTemplate->assign('CELL', $widget_contents); |
| 500 | 500 | $this->xTemplate->parse($xtemplateSection.".row.cell"); |
| 501 | 501 | } elseif (preg_match("/button/i", $list_field['name'])) { |
| 502 | - if ((($list_field['name'] === 'edit_button' && $field_acl['EditView']) || ($list_field['name'] === 'close_button' && $field_acl['EditView']) || ($list_field['name'] === 'remove_button' && $field_acl['Delete'])) && '' != ($_content = $layout_manager->widgetDisplay($list_field)) ) |
|
| 502 | + if ((($list_field['name'] === 'edit_button' && $field_acl['EditView']) || ($list_field['name'] === 'close_button' && $field_acl['EditView']) || ($list_field['name'] === 'remove_button' && $field_acl['Delete'])) && '' != ($_content = $layout_manager->widgetDisplay($list_field))) |
|
| 503 | 503 | { |
| 504 | 504 | $button_contents[] = $_content; |
| 505 | 505 | unset($_content); |
@@ -513,7 +513,7 @@ discard block |
||
| 513 | 513 | $this->xTemplate->assign('CLASS', ""); |
| 514 | 514 | $widget_contents = $layout_manager->widgetDisplay($list_field); |
| 515 | 515 | $this->xTemplate->assign('CELL_COUNT', $count); |
| 516 | - if ( empty($widget_contents) ) $widget_contents = ' '; |
|
| 516 | + if (empty($widget_contents)) $widget_contents = ' '; |
|
| 517 | 517 | $this->xTemplate->assign('CELL', $widget_contents); |
| 518 | 518 | $this->xTemplate->parse($xtemplateSection.".row.cell"); |
| 519 | 519 | } |
@@ -525,7 +525,7 @@ discard block |
||
| 525 | 525 | |
| 526 | 526 | // Make sure we have at least one button before rendering a column for |
| 527 | 527 | // the action buttons in a list view. Relevant bugs: #51647 and #51640. |
| 528 | - if(!empty($button_contents)) |
|
| 528 | + if (!empty($button_contents)) |
|
| 529 | 529 | { |
| 530 | 530 | $button_contents = array_filter($button_contents); |
| 531 | 531 | if (!empty($button_contents)) |
@@ -534,7 +534,7 @@ discard block |
||
| 534 | 534 | // bug#51275: smarty widget to help provide the action menu functionality as it is currently sprinkled throughout the app with html |
| 535 | 535 | require_once('include/Smarty/plugins/function.sugar_action_menu.php'); |
| 536 | 536 | $tempid = create_guid(); |
| 537 | - array_unshift($button_contents, "<div style='display: inline' id='$tempid'>" . array_shift($button_contents) . "</div>"); |
|
| 537 | + array_unshift($button_contents, "<div style='display: inline' id='$tempid'>".array_shift($button_contents)."</div>"); |
|
| 538 | 538 | $action_button = smarty_function_sugar_action_menu(array( |
| 539 | 539 | 'id' => $tempid, |
| 540 | 540 | 'buttons' => $button_contents, |
@@ -550,7 +550,7 @@ discard block |
||
| 550 | 550 | $this->xTemplate->assign('CELL_COUNT', ++$count); |
| 551 | 551 | //Bug#51275 for beta3 pre_script is not required any more |
| 552 | 552 | $this->xTemplate->assign('CELL', $action_button); |
| 553 | - $this->xTemplate->parse($xtemplateSection . ".row.cell"); |
|
| 553 | + $this->xTemplate->parse($xtemplateSection.".row.cell"); |
|
| 554 | 554 | } |
| 555 | 555 | |
| 556 | 556 | |
@@ -582,13 +582,13 @@ discard block |
||
| 582 | 582 | function __construct() { |
| 583 | 583 | |
| 584 | 584 | |
| 585 | - if(!$this->initialized) { |
|
| 585 | + if (!$this->initialized) { |
|
| 586 | 586 | global $sugar_config; |
| 587 | 587 | $this->records_per_page = $sugar_config['list_max_entries_per_page'] + 0; |
| 588 | 588 | $this->initialized = true; |
| 589 | 589 | global $app_strings, $currentModule; |
| 590 | 590 | $this->local_theme = SugarThemeRegistry::current()->__toString(); |
| 591 | - $this->local_app_strings =$app_strings; |
|
| 591 | + $this->local_app_strings = $app_strings; |
|
| 592 | 592 | $this->local_image_path = SugarThemeRegistry::current()->getImagePath(); |
| 593 | 593 | $this->local_current_module = $currentModule; |
| 594 | 594 | } |
@@ -598,9 +598,9 @@ discard block |
||
| 598 | 598 | /** |
| 599 | 599 | * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead |
| 600 | 600 | */ |
| 601 | - function ListView(){ |
|
| 601 | + function ListView() { |
|
| 602 | 602 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 603 | - if(isset($GLOBALS['log'])) { |
|
| 603 | + if (isset($GLOBALS['log'])) { |
|
| 604 | 604 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 605 | 605 | } |
| 606 | 606 | else { |
@@ -635,7 +635,7 @@ discard block |
||
| 635 | 635 | * Contributor(s): ______________________________________. |
| 636 | 636 | */ |
| 637 | 637 | function setXTemplatePath($value) { |
| 638 | - $this->xTemplatePath= $value; |
|
| 638 | + $this->xTemplatePath = $value; |
|
| 639 | 639 | } |
| 640 | 640 | |
| 641 | 641 | /**this is a helper function for allowing ListView to create a new XTemplate it groups parameters that should be set into a single function |
@@ -645,22 +645,22 @@ discard block |
||
| 645 | 645 | */ |
| 646 | 646 | function initNewXTemplate($XTemplatePath, $modString, $imagePath = null) { |
| 647 | 647 | $this->setXTemplatePath($XTemplatePath); |
| 648 | - if(isset($modString)) |
|
| 648 | + if (isset($modString)) |
|
| 649 | 649 | $this->setModStrings($modString); |
| 650 | - if(isset($imagePath)) |
|
| 650 | + if (isset($imagePath)) |
|
| 651 | 651 | $this->setImagePath($imagePath); |
| 652 | 652 | } |
| 653 | 653 | |
| 654 | 654 | |
| 655 | -function getOrderBy($varName, $defaultOrderBy='', $force_sortorder='') { |
|
| 656 | - $sortBy = $this->getSessionVariable($varName, "ORDER_BY") ; |
|
| 655 | +function getOrderBy($varName, $defaultOrderBy = '', $force_sortorder = '') { |
|
| 656 | + $sortBy = $this->getSessionVariable($varName, "ORDER_BY"); |
|
| 657 | 657 | |
| 658 | 658 | $orderByDirection = $this->getSessionVariableName($varName, "order_by_direction"); |
| 659 | 659 | $orderByColumn = $this->getSessionVariableName($varName, "ORDER_BY"); |
| 660 | 660 | $lastEqualsSortBy = false; |
| 661 | 661 | $defaultOrder = false; //ascending |
| 662 | 662 | |
| 663 | - if(empty($sortBy)) { |
|
| 663 | + if (empty($sortBy)) { |
|
| 664 | 664 | $this->setUserVariable($varName, "ORDER_BY", $defaultOrderBy); |
| 665 | 665 | $sortBy = $defaultOrderBy; |
| 666 | 666 | } else { |
@@ -698,7 +698,7 @@ discard block |
||
| 698 | 698 | } |
| 699 | 699 | $desc = $orderByValue == 'desc'; |
| 700 | 700 | $orderByDirectionValue = false; |
| 701 | - $this->setSessionVariable($varName, $sortBy . "S", $desc); |
|
| 701 | + $this->setSessionVariable($varName, $sortBy."S", $desc); |
|
| 702 | 702 | if (!empty($sortBy)) |
| 703 | 703 | { |
| 704 | 704 | if (empty($force_sortorder)) |
@@ -709,11 +709,11 @@ discard block |
||
| 709 | 709 | { |
| 710 | 710 | $orderByDirectionValue = $desc ? 'asc' : 'desc'; |
| 711 | 711 | } |
| 712 | - $this->query_orderby = $sortBy . ' ' . $orderByValue; |
|
| 712 | + $this->query_orderby = $sortBy.' '.$orderByValue; |
|
| 713 | 713 | } |
| 714 | 714 | } else |
| 715 | 715 | { |
| 716 | - $this->query_orderby = $sortBy . ' ' . $force_sortorder; |
|
| 716 | + $this->query_orderby = $sortBy.' '.$force_sortorder; |
|
| 717 | 717 | } |
| 718 | 718 | if (!isset($this->appendToBaseUrl)) |
| 719 | 719 | { |
@@ -730,7 +730,7 @@ discard block |
||
| 730 | 730 | } |
| 731 | 731 | //Just clear from url... |
| 732 | 732 | $this->appendToBaseUrl[$orderByColumn] = false; |
| 733 | - }else { |
|
| 733 | + } else { |
|
| 734 | 734 | $this->query_orderby = ""; |
| 735 | 735 | } |
| 736 | 736 | $this->sortby = $sortBy; |
@@ -744,15 +744,15 @@ discard block |
||
| 744 | 744 | * All Rights Reserved. |
| 745 | 745 | * Contributor(s): ______________________________________. |
| 746 | 746 | */ |
| 747 | - function setQuery($where, $limit, $orderBy, $varName, $allowOrderByOveride=true) { |
|
| 747 | + function setQuery($where, $limit, $orderBy, $varName, $allowOrderByOveride = true) { |
|
| 748 | 748 | $this->query_where = $where; |
| 749 | - if($this->getSessionVariable("query", "where") != $where) { |
|
| 749 | + if ($this->getSessionVariable("query", "where") != $where) { |
|
| 750 | 750 | $this->query_where_has_changed = true; |
| 751 | 751 | $this->setSessionVariable("query", "where", $where); |
| 752 | 752 | } |
| 753 | 753 | |
| 754 | 754 | $this->query_limit = $limit; |
| 755 | - if(!$allowOrderByOveride) { |
|
| 755 | + if (!$allowOrderByOveride) { |
|
| 756 | 756 | $this->query_orderby = $orderBy; |
| 757 | 757 | return; |
| 758 | 758 | } |
@@ -775,7 +775,7 @@ discard block |
||
| 775 | 775 | */ |
| 776 | 776 | function setTheme($theme) { |
| 777 | 777 | $this->local_theme = $theme; |
| 778 | - if(isset($this->xTemplate))$this->xTemplate->assign("THEME", $this->local_theme); |
|
| 778 | + if (isset($this->xTemplate))$this->xTemplate->assign("THEME", $this->local_theme); |
|
| 779 | 779 | } |
| 780 | 780 | |
| 781 | 781 | /**sets the AppStrings used only use if it is different from the global |
@@ -786,7 +786,7 @@ discard block |
||
| 786 | 786 | function setAppStrings($app_strings) { |
| 787 | 787 | unset($this->local_app_strings); |
| 788 | 788 | $this->local_app_strings = $app_strings; |
| 789 | - if(isset($this->xTemplate))$this->xTemplate->assign("APP", $this->local_app_strings); |
|
| 789 | + if (isset($this->xTemplate))$this->xTemplate->assign("APP", $this->local_app_strings); |
|
| 790 | 790 | } |
| 791 | 791 | |
| 792 | 792 | /**sets the ModStrings used |
@@ -797,7 +797,7 @@ discard block |
||
| 797 | 797 | function setModStrings($mod_strings) { |
| 798 | 798 | unset($this->local_module_strings); |
| 799 | 799 | $this->local_mod_strings = $mod_strings; |
| 800 | - if(isset($this->xTemplate))$this->xTemplate->assign("MOD", $this->local_mod_strings); |
|
| 800 | + if (isset($this->xTemplate))$this->xTemplate->assign("MOD", $this->local_mod_strings); |
|
| 801 | 801 | } |
| 802 | 802 | |
| 803 | 803 | /**sets the ImagePath used |
@@ -807,10 +807,10 @@ discard block |
||
| 807 | 807 | */ |
| 808 | 808 | function setImagePath($image_path) { |
| 809 | 809 | $this->local_image_path = $image_path; |
| 810 | - if(empty($this->local_image_path)) { |
|
| 810 | + if (empty($this->local_image_path)) { |
|
| 811 | 811 | $this->local_image_path = SugarThemeRegistry::get($this->local_theme)->getImagePath(); |
| 812 | 812 | } |
| 813 | - if(isset($this->xTemplate))$this->xTemplate->assign("IMAGE_PATH", $this->local_image_path); |
|
| 813 | + if (isset($this->xTemplate))$this->xTemplate->assign("IMAGE_PATH", $this->local_image_path); |
|
| 814 | 814 | } |
| 815 | 815 | |
| 816 | 816 | /**sets the currentModule only use if this is different from the global |
@@ -821,7 +821,7 @@ discard block |
||
| 821 | 821 | function setCurrentModule($currentModule) { |
| 822 | 822 | unset($this->local_current_module); |
| 823 | 823 | $this->local_current_module = $currentModule; |
| 824 | - if(isset($this->xTemplate))$this->xTemplate->assign("MODULE_NAME", $this->local_current_module); |
|
| 824 | + if (isset($this->xTemplate))$this->xTemplate->assign("MODULE_NAME", $this->local_current_module); |
|
| 825 | 825 | } |
| 826 | 826 | |
| 827 | 827 | /**INTERNAL FUNCTION creates an XTemplate DO NOT CALL THIS THIS IS AN INTERNAL FUNCTION |
@@ -830,12 +830,12 @@ discard block |
||
| 830 | 830 | * Contributor(s): ______________________________________. |
| 831 | 831 | */ |
| 832 | 832 | function createXTemplate() { |
| 833 | - if(!isset($this->xTemplate)) { |
|
| 834 | - if(isset($this->xTemplatePath)) { |
|
| 833 | + if (!isset($this->xTemplate)) { |
|
| 834 | + if (isset($this->xTemplatePath)) { |
|
| 835 | 835 | |
| 836 | 836 | $this->xTemplate = new XTemplate($this->xTemplatePath); |
| 837 | 837 | $this->xTemplate->assign("APP", $this->local_app_strings); |
| 838 | - if(isset($this->local_mod_strings))$this->xTemplate->assign("MOD", $this->local_mod_strings); |
|
| 838 | + if (isset($this->local_mod_strings))$this->xTemplate->assign("MOD", $this->local_mod_strings); |
|
| 839 | 839 | $this->xTemplate->assign("THEME", $this->local_theme); |
| 840 | 840 | $this->xTemplate->assign("IMAGE_PATH", $this->local_image_path); |
| 841 | 841 | $this->xTemplate->assign("MODULE_NAME", $this->local_current_module); |
@@ -870,7 +870,7 @@ discard block |
||
| 870 | 870 | */ |
| 871 | 871 | function xTemplateAssign($name, $value) { |
| 872 | 872 | |
| 873 | - if(!isset($this->xTemplate)) { |
|
| 873 | + if (!isset($this->xTemplate)) { |
|
| 874 | 874 | $this->createXTemplate(); |
| 875 | 875 | } |
| 876 | 876 | $this->xTemplate->assign($name, $value); |
@@ -883,11 +883,11 @@ discard block |
||
| 883 | 883 | * Contributor(s): ______________________________________. |
| 884 | 884 | */ |
| 885 | 885 | function getOffset($localVarName) { |
| 886 | - if($this->query_where_has_changed || isset($GLOBALS['record_has_changed'])) { |
|
| 887 | - $this->setSessionVariable($localVarName,"offset", 0); |
|
| 886 | + if ($this->query_where_has_changed || isset($GLOBALS['record_has_changed'])) { |
|
| 887 | + $this->setSessionVariable($localVarName, "offset", 0); |
|
| 888 | 888 | } |
| 889 | - $offset = $this->getSessionVariable($localVarName,"offset"); |
|
| 890 | - if(isset($offset)) { |
|
| 889 | + $offset = $this->getSessionVariable($localVarName, "offset"); |
|
| 890 | + if (isset($offset)) { |
|
| 891 | 891 | return $offset; |
| 892 | 892 | } |
| 893 | 893 | return 0; |
@@ -907,12 +907,12 @@ discard block |
||
| 907 | 907 | * All Rights Reserved. |
| 908 | 908 | * Contributor(s): ______________________________________. |
| 909 | 909 | */ |
| 910 | - function setSessionVariable($localVarName,$varName, $value) { |
|
| 910 | + function setSessionVariable($localVarName, $varName, $value) { |
|
| 911 | 911 | $_SESSION[$this->local_current_module."_".$localVarName."_".$varName] = $value; |
| 912 | 912 | } |
| 913 | 913 | |
| 914 | -function setUserVariable($localVarName,$varName, $value) { |
|
| 915 | - if($this->is_dynamic || $localVarName == 'CELL')return; |
|
| 914 | +function setUserVariable($localVarName, $varName, $value) { |
|
| 915 | + if ($this->is_dynamic || $localVarName == 'CELL')return; |
|
| 916 | 916 | global $current_user; |
| 917 | 917 | $current_user->setPreference($this->local_current_module."_".$localVarName."_".$varName, $value); |
| 918 | 918 | } |
@@ -922,13 +922,13 @@ discard block |
||
| 922 | 922 | * All Rights Reserved. |
| 923 | 923 | * Contributor(s): ______________________________________. |
| 924 | 924 | */ |
| 925 | - function getSessionVariable($localVarName,$varName) { |
|
| 925 | + function getSessionVariable($localVarName, $varName) { |
|
| 926 | 926 | //Set any variables pass in through request first |
| 927 | - if(isset($_REQUEST[$this->getSessionVariableName($localVarName, $varName)])) { |
|
| 928 | - $this->setSessionVariable($localVarName,$varName,$_REQUEST[$this->getSessionVariableName($localVarName, $varName)]); |
|
| 927 | + if (isset($_REQUEST[$this->getSessionVariableName($localVarName, $varName)])) { |
|
| 928 | + $this->setSessionVariable($localVarName, $varName, $_REQUEST[$this->getSessionVariableName($localVarName, $varName)]); |
|
| 929 | 929 | } |
| 930 | 930 | |
| 931 | - if(isset($_SESSION[$this->getSessionVariableName($localVarName, $varName)])) { |
|
| 931 | + if (isset($_SESSION[$this->getSessionVariableName($localVarName, $varName)])) { |
|
| 932 | 932 | return $_SESSION[$this->getSessionVariableName($localVarName, $varName)]; |
| 933 | 933 | } |
| 934 | 934 | return ""; |
@@ -936,10 +936,10 @@ discard block |
||
| 936 | 936 | |
| 937 | 937 | function getUserVariable($localVarName, $varName) { |
| 938 | 938 | global $current_user; |
| 939 | - if($this->is_dynamic || $localVarName == 'CELL')return; |
|
| 940 | - if(isset($_REQUEST[$this->getSessionVariableName($localVarName, $varName)])) { |
|
| 939 | + if ($this->is_dynamic || $localVarName == 'CELL')return; |
|
| 940 | + if (isset($_REQUEST[$this->getSessionVariableName($localVarName, $varName)])) { |
|
| 941 | 941 | |
| 942 | - $this->setUserVariable($localVarName,$varName,$_REQUEST[$this->getSessionVariableName($localVarName, $varName)]); |
|
| 942 | + $this->setUserVariable($localVarName, $varName, $_REQUEST[$this->getSessionVariableName($localVarName, $varName)]); |
|
| 943 | 943 | } |
| 944 | 944 | return $current_user->getPreference($this->getSessionVariableName($localVarName, $varName)); |
| 945 | 945 | } |
@@ -963,7 +963,7 @@ discard block |
||
| 963 | 963 | 'default', |
| 964 | 964 | ); |
| 965 | 965 | |
| 966 | - foreach($priority_map as $p) { |
|
| 966 | + foreach ($priority_map as $p) { |
|
| 967 | 967 | if (key_exists($p, $sortOrderList)) { |
| 968 | 968 | $order = strtolower($sortOrderList[$p]); |
| 969 | 969 | if (in_array($order, array('asc', 'desc'))) { |
@@ -985,7 +985,7 @@ discard block |
||
| 985 | 985 | * All Rights Reserved. |
| 986 | 986 | * Contributor(s): ______________________________________.. |
| 987 | 987 | */ |
| 988 | - function getSessionVariableName($localVarName,$varName) { |
|
| 988 | + function getSessionVariableName($localVarName, $varName) { |
|
| 989 | 989 | return $this->local_current_module."_".$localVarName."_".$varName; |
| 990 | 990 | } |
| 991 | 991 | |
@@ -1013,22 +1013,22 @@ discard block |
||
| 1013 | 1013 | SugarVCR::erase($seed->module_dir); |
| 1014 | 1014 | $params = array(); |
| 1015 | 1015 | //$filter = array('id', 'full_name'); |
| 1016 | - $filter=array(); |
|
| 1016 | + $filter = array(); |
|
| 1017 | 1017 | $ret_array = $seed->create_new_list_query($this->query_orderby, $this->query_where, $filter, $params, 0, '', true, $seed, true); |
| 1018 | - if(!is_array($params)) $params = array(); |
|
| 1019 | - if(!isset($params['custom_select'])) $params['custom_select'] = ''; |
|
| 1020 | - if(!isset($params['custom_from'])) $params['custom_from'] = ''; |
|
| 1021 | - if(!isset($params['custom_where'])) $params['custom_where'] = ''; |
|
| 1022 | - if(!isset($params['custom_order_by'])) $params['custom_order_by'] = ''; |
|
| 1023 | - $main_query = $ret_array['select'] . $params['custom_select'] . $ret_array['from'] . $params['custom_from'] . $ret_array['where'] . $params['custom_where'] . $ret_array['order_by'] . $params['custom_order_by']; |
|
| 1024 | - SugarVCR::store($seed->module_dir, $main_query); |
|
| 1018 | + if (!is_array($params)) $params = array(); |
|
| 1019 | + if (!isset($params['custom_select'])) $params['custom_select'] = ''; |
|
| 1020 | + if (!isset($params['custom_from'])) $params['custom_from'] = ''; |
|
| 1021 | + if (!isset($params['custom_where'])) $params['custom_where'] = ''; |
|
| 1022 | + if (!isset($params['custom_order_by'])) $params['custom_order_by'] = ''; |
|
| 1023 | + $main_query = $ret_array['select'].$params['custom_select'].$ret_array['from'].$params['custom_from'].$ret_array['where'].$params['custom_where'].$ret_array['order_by'].$params['custom_order_by']; |
|
| 1024 | + SugarVCR::store($seed->module_dir, $main_query); |
|
| 1025 | 1025 | //ADDING VCR CONTROL |
| 1026 | 1026 | |
| 1027 | - if(empty($this->related_field_name)) { |
|
| 1027 | + if (empty($this->related_field_name)) { |
|
| 1028 | 1028 | $response = $seed->get_list($this->query_orderby, $this->query_where, $current_offset, $this->query_limit); |
| 1029 | 1029 | } else { |
| 1030 | 1030 | $related_field_name = $this->related_field_name; |
| 1031 | - $response = $seed->get_related_list($this->child_focus,$related_field_name, $this->query_orderby, |
|
| 1031 | + $response = $seed->get_related_list($this->child_focus, $related_field_name, $this->query_orderby, |
|
| 1032 | 1032 | $this->query_where, $current_offset, $this->query_limit); |
| 1033 | 1033 | } |
| 1034 | 1034 | |
@@ -1037,12 +1037,12 @@ discard block |
||
| 1037 | 1037 | $next_offset = $response['next_offset']; |
| 1038 | 1038 | $previous_offset = $response['previous_offset']; |
| 1039 | 1039 | |
| 1040 | - if(!empty($response['current_offset'])) { |
|
| 1040 | + if (!empty($response['current_offset'])) { |
|
| 1041 | 1041 | $current_offset = $response['current_offset']; |
| 1042 | 1042 | } |
| 1043 | 1043 | |
| 1044 | 1044 | $list_view_row_count = $row_count; |
| 1045 | - $this->processListNavigation($xtemplateSection,$html_varName, $current_offset, $next_offset, $previous_offset, $row_count, null, null, empty($seed->column_fields) ? null : count($seed->column_fields)); |
|
| 1045 | + $this->processListNavigation($xtemplateSection, $html_varName, $current_offset, $next_offset, $previous_offset, $row_count, null, null, empty($seed->column_fields) ? null : count($seed->column_fields)); |
|
| 1046 | 1046 | |
| 1047 | 1047 | return $list; |
| 1048 | 1048 | } |
@@ -1052,7 +1052,7 @@ discard block |
||
| 1052 | 1052 | function processUnionBeans($sugarbean, $subpanel_def, $html_var = 'CELL') { |
| 1053 | 1053 | |
| 1054 | 1054 | $last_detailview_record = $this->getSessionVariable("detailview", "record"); |
| 1055 | - if(!empty($last_detailview_record) && $last_detailview_record != $sugarbean->id){ |
|
| 1055 | + if (!empty($last_detailview_record) && $last_detailview_record != $sugarbean->id) { |
|
| 1056 | 1056 | $GLOBALS['record_has_changed'] = true; |
| 1057 | 1057 | } |
| 1058 | 1058 | $this->setSessionVariable("detailview", "record", $sugarbean->id); |
@@ -1069,14 +1069,14 @@ discard block |
||
| 1069 | 1069 | $sort_order['request'] = isset($_REQUEST['sort_order']) ? $_REQUEST['sort_order'] : null; |
| 1070 | 1070 | |
| 1071 | 1071 | // see if the session data has a sort order |
| 1072 | - if (isset($_SESSION['last_sub' . $this->subpanel_module . '_order'])) |
|
| 1072 | + if (isset($_SESSION['last_sub'.$this->subpanel_module.'_order'])) |
|
| 1073 | 1073 | { |
| 1074 | - $sort_order['session'] = $_SESSION['last_sub' . $this->subpanel_module . '_order']; |
|
| 1074 | + $sort_order['session'] = $_SESSION['last_sub'.$this->subpanel_module.'_order']; |
|
| 1075 | 1075 | |
| 1076 | 1076 | // We swap the order when the request contains an offset (indicating a column sort issued); |
| 1077 | 1077 | // otherwise we do not sort. If we don't make this check, then the subpanel listview will |
| 1078 | 1078 | // swap ordering each time a new record is entered via quick create forms |
| 1079 | - if (isset($_REQUEST[$module . '_' . $html_var . '_offset'])) |
|
| 1079 | + if (isset($_REQUEST[$module.'_'.$html_var.'_offset'])) |
|
| 1080 | 1080 | { |
| 1081 | 1081 | $sort_order['session'] = $sort_order['session'] == 'asc' ? 'desc' : 'asc'; |
| 1082 | 1082 | } |
@@ -1099,10 +1099,10 @@ discard block |
||
| 1099 | 1099 | $this->query_orderby = 'id'; |
| 1100 | 1100 | } |
| 1101 | 1101 | |
| 1102 | - $this->getOrderBy($html_var,$this->query_orderby, $this->sort_order); |
|
| 1102 | + $this->getOrderBy($html_var, $this->query_orderby, $this->sort_order); |
|
| 1103 | 1103 | |
| 1104 | - $_SESSION['last_sub' .$this->subpanel_module. '_order'] = $this->sort_order; |
|
| 1105 | - $_SESSION['last_sub' .$this->subpanel_module. '_url'] = $this->getBaseURL($html_var); |
|
| 1104 | + $_SESSION['last_sub'.$this->subpanel_module.'_order'] = $this->sort_order; |
|
| 1105 | + $_SESSION['last_sub'.$this->subpanel_module.'_url'] = $this->getBaseURL($html_var); |
|
| 1106 | 1106 | |
| 1107 | 1107 | // Bug 8139 - Correct Subpanel sorting on 'name', when subpanel sorting default is 'last_name, first_name' |
| 1108 | 1108 | if (($this->sortby == 'name' || $this->sortby == 'last_name') && |
@@ -1110,21 +1110,21 @@ discard block |
||
| 1110 | 1110 | $this->sortby = 'last_name '.$this->sort_order.', first_name '; |
| 1111 | 1111 | } |
| 1112 | 1112 | |
| 1113 | - if(!empty($this->response)){ |
|
| 1114 | - $response =& $this->response; |
|
| 1113 | + if (!empty($this->response)) { |
|
| 1114 | + $response = & $this->response; |
|
| 1115 | 1115 | echo 'cached'; |
| 1116 | - }else{ |
|
| 1117 | - $response = SugarBean::get_union_related_list($sugarbean,$this->sortby, $this->sort_order, $this->query_where, $current_offset, -1, $this->records_per_page,$this->query_limit,$subpanel_def); |
|
| 1118 | - $this->response =& $response; |
|
| 1116 | + } else { |
|
| 1117 | + $response = SugarBean::get_union_related_list($sugarbean, $this->sortby, $this->sort_order, $this->query_where, $current_offset, -1, $this->records_per_page, $this->query_limit, $subpanel_def); |
|
| 1118 | + $this->response = & $response; |
|
| 1119 | 1119 | } |
| 1120 | 1120 | $list = $response['list']; |
| 1121 | 1121 | $row_count = $response['row_count']; |
| 1122 | 1122 | $next_offset = $response['next_offset']; |
| 1123 | 1123 | $previous_offset = $response['previous_offset']; |
| 1124 | - if(!empty($response['current_offset']))$current_offset = $response['current_offset']; |
|
| 1124 | + if (!empty($response['current_offset']))$current_offset = $response['current_offset']; |
|
| 1125 | 1125 | global $list_view_row_count; |
| 1126 | 1126 | $list_view_row_count = $row_count; |
| 1127 | - $this->processListNavigation('dyn_list_view', $html_var, $current_offset, $next_offset, $previous_offset, $row_count, $sugarbean,$subpanel_def); |
|
| 1127 | + $this->processListNavigation('dyn_list_view', $html_var, $current_offset, $next_offset, $previous_offset, $row_count, $sugarbean, $subpanel_def); |
|
| 1128 | 1128 | |
| 1129 | 1129 | return array('list'=>$list, 'parent_data'=>$response['parent_data'], 'query'=>$response['query']); |
| 1130 | 1130 | } |
@@ -1132,34 +1132,34 @@ discard block |
||
| 1132 | 1132 | function getBaseURL($html_varName) { |
| 1133 | 1133 | static $cache = array(); |
| 1134 | 1134 | |
| 1135 | - if(!empty($cache[$html_varName]))return $cache[$html_varName]; |
|
| 1136 | - $blockVariables = array('mass', 'uid', 'massupdate', 'delete', 'merge', 'selectCount','current_query_by_page'); |
|
| 1137 | - if(!empty($this->base_URL)) { |
|
| 1135 | + if (!empty($cache[$html_varName]))return $cache[$html_varName]; |
|
| 1136 | + $blockVariables = array('mass', 'uid', 'massupdate', 'delete', 'merge', 'selectCount', 'current_query_by_page'); |
|
| 1137 | + if (!empty($this->base_URL)) { |
|
| 1138 | 1138 | return $this->base_URL; |
| 1139 | 1139 | } |
| 1140 | 1140 | |
| 1141 | 1141 | $baseurl = $_SERVER['PHP_SELF']; |
| 1142 | - if(empty($baseurl)) { |
|
| 1142 | + if (empty($baseurl)) { |
|
| 1143 | 1143 | $baseurl = 'index.php'; |
| 1144 | 1144 | } |
| 1145 | 1145 | |
| 1146 | 1146 | /*fixes an issue with deletes when doing a search*/ |
| 1147 | - foreach(array_merge($_GET, $_POST) as $name=>$value) { |
|
| 1147 | + foreach (array_merge($_GET, $_POST) as $name=>$value) { |
|
| 1148 | 1148 | //echo ("$name = $value <br/>"); |
| 1149 | - if(!empty($value) && $name != 'sort_order' //&& $name != ListView::getSessionVariableName($html_varName,"ORDER_BY") |
|
| 1150 | - && $name != ListView::getSessionVariableName($html_varName,"offset") |
|
| 1149 | + if (!empty($value) && $name != 'sort_order' //&& $name != ListView::getSessionVariableName($html_varName,"ORDER_BY") |
|
| 1150 | + && $name != ListView::getSessionVariableName($html_varName, "offset") |
|
| 1151 | 1151 | /*&& substr_count($name, "ORDER_BY")==0*/ && !in_array($name, $blockVariables)) |
| 1152 | 1152 | { |
| 1153 | - if(is_array($value)) { |
|
| 1154 | - foreach($value as $valuename=>$valuevalue) { |
|
| 1155 | - if(substr_count($baseurl, '?') > 0) |
|
| 1153 | + if (is_array($value)) { |
|
| 1154 | + foreach ($value as $valuename=>$valuevalue) { |
|
| 1155 | + if (substr_count($baseurl, '?') > 0) |
|
| 1156 | 1156 | $baseurl .= "&{$name}[]=".$valuevalue; |
| 1157 | 1157 | else |
| 1158 | 1158 | $baseurl .= "?{$name}[]=".$valuevalue; |
| 1159 | 1159 | } |
| 1160 | 1160 | } else { |
| 1161 | 1161 | $value = urlencode($value); |
| 1162 | - if(substr_count($baseurl, '?') > 0) { |
|
| 1162 | + if (substr_count($baseurl, '?') > 0) { |
|
| 1163 | 1163 | $baseurl .= "&$name=$value"; |
| 1164 | 1164 | } else { |
| 1165 | 1165 | $baseurl .= "?$name=$value"; |
@@ -1169,17 +1169,17 @@ discard block |
||
| 1169 | 1169 | } |
| 1170 | 1170 | |
| 1171 | 1171 | |
| 1172 | - if($_SERVER['REQUEST_METHOD'] == 'POST') { |
|
| 1172 | + if ($_SERVER['REQUEST_METHOD'] == 'POST') { |
|
| 1173 | 1173 | // at this point it is possible that the above foreach already executed resulting in double ?'s in the url |
| 1174 | - if(substr_count($baseurl, '?') == 0) { |
|
| 1174 | + if (substr_count($baseurl, '?') == 0) { |
|
| 1175 | 1175 | $baseurl .= '?'; |
| 1176 | 1176 | } |
| 1177 | - if(isset($_REQUEST['action'])) $baseurl.= '&action='.$_REQUEST['action']; |
|
| 1178 | - if(isset($_REQUEST['record'])) $baseurl .= '&record='.$_REQUEST['record']; |
|
| 1179 | - if(isset($_REQUEST['module'])) $baseurl .= '&module='.$_REQUEST['module']; |
|
| 1177 | + if (isset($_REQUEST['action'])) $baseurl .= '&action='.$_REQUEST['action']; |
|
| 1178 | + if (isset($_REQUEST['record'])) $baseurl .= '&record='.$_REQUEST['record']; |
|
| 1179 | + if (isset($_REQUEST['module'])) $baseurl .= '&module='.$_REQUEST['module']; |
|
| 1180 | 1180 | } |
| 1181 | 1181 | |
| 1182 | - $baseurl .= "&".ListView::getSessionVariableName($html_varName,"offset")."="; |
|
| 1182 | + $baseurl .= "&".ListView::getSessionVariableName($html_varName, "offset")."="; |
|
| 1183 | 1183 | $cache[$html_varName] = $baseurl; |
| 1184 | 1184 | return $baseurl; |
| 1185 | 1185 | } |
@@ -1193,7 +1193,7 @@ discard block |
||
| 1193 | 1193 | * All Rights Reserved. |
| 1194 | 1194 | * Contributor(s): ______________________________________.. |
| 1195 | 1195 | */ |
| 1196 | - function processListNavigation($xtemplateSection, $html_varName, $current_offset, $next_offset, $previous_offset, $row_count, $sugarbean=null, $subpanel_def=null, $col_count = 20) { |
|
| 1196 | + function processListNavigation($xtemplateSection, $html_varName, $current_offset, $next_offset, $previous_offset, $row_count, $sugarbean = null, $subpanel_def = null, $col_count = 20) { |
|
| 1197 | 1197 | |
| 1198 | 1198 | global $export_module; |
| 1199 | 1199 | global $sugar_config; |
@@ -1203,40 +1203,40 @@ discard block |
||
| 1203 | 1203 | |
| 1204 | 1204 | $start_record = $current_offset + 1; |
| 1205 | 1205 | |
| 1206 | - if(!is_numeric($col_count)) |
|
| 1206 | + if (!is_numeric($col_count)) |
|
| 1207 | 1207 | $col_count = 20; |
| 1208 | 1208 | |
| 1209 | - if($row_count == 0) |
|
| 1209 | + if ($row_count == 0) |
|
| 1210 | 1210 | $start_record = 0; |
| 1211 | 1211 | |
| 1212 | 1212 | $end_record = $start_record + $this->records_per_page; |
| 1213 | 1213 | // back up the the last page. |
| 1214 | - if($end_record > $row_count+1) { |
|
| 1215 | - $end_record = $row_count+1; |
|
| 1214 | + if ($end_record > $row_count + 1) { |
|
| 1215 | + $end_record = $row_count + 1; |
|
| 1216 | 1216 | } |
| 1217 | 1217 | // Determine the start location of the last page |
| 1218 | - if($row_count == 0) |
|
| 1218 | + if ($row_count == 0) |
|
| 1219 | 1219 | $number_pages = 0; |
| 1220 | 1220 | else |
| 1221 | 1221 | $number_pages = floor(($row_count - 1) / $this->records_per_page); |
| 1222 | 1222 | |
| 1223 | 1223 | $last_offset = $number_pages * $this->records_per_page; |
| 1224 | 1224 | |
| 1225 | - if(empty($this->query_limit) || $this->query_limit > $this->records_per_page) { |
|
| 1225 | + if (empty($this->query_limit) || $this->query_limit > $this->records_per_page) { |
|
| 1226 | 1226 | $this->base_URL = $this->getBaseURL($html_varName); |
| 1227 | 1227 | $dynamic_url = ''; |
| 1228 | 1228 | |
| 1229 | - if($this->is_dynamic) { |
|
| 1230 | - $dynamic_url .='&'. $this->getSessionVariableName($html_varName,'ORDER_BY') . '='. $this->getSessionVariable($html_varName,'ORDER_BY').'&sort_order='.$this->sort_order.'&to_pdf=true&action=SubPanelViewer&subpanel=' . $this->subpanel_module; |
|
| 1229 | + if ($this->is_dynamic) { |
|
| 1230 | + $dynamic_url .= '&'.$this->getSessionVariableName($html_varName, 'ORDER_BY').'='.$this->getSessionVariable($html_varName, 'ORDER_BY').'&sort_order='.$this->sort_order.'&to_pdf=true&action=SubPanelViewer&subpanel='.$this->subpanel_module; |
|
| 1231 | 1231 | } |
| 1232 | 1232 | |
| 1233 | 1233 | $current_URL = htmlentities($this->base_URL.$current_offset.$dynamic_url); |
| 1234 | 1234 | $start_URL = htmlentities($this->base_URL."0".$dynamic_url); |
| 1235 | - $previous_URL = htmlentities($this->base_URL.$previous_offset.$dynamic_url); |
|
| 1235 | + $previous_URL = htmlentities($this->base_URL.$previous_offset.$dynamic_url); |
|
| 1236 | 1236 | $next_URL = htmlentities($this->base_URL.$next_offset.$dynamic_url); |
| 1237 | - $end_URL = htmlentities($this->base_URL.'end'.$dynamic_url); |
|
| 1237 | + $end_URL = htmlentities($this->base_URL.'end'.$dynamic_url); |
|
| 1238 | 1238 | |
| 1239 | - if(!empty($this->start_link_wrapper)) { |
|
| 1239 | + if (!empty($this->start_link_wrapper)) { |
|
| 1240 | 1240 | $current_URL = $this->start_link_wrapper.$current_URL.$this->end_link_wrapper; |
| 1241 | 1241 | $start_URL = $this->start_link_wrapper.$start_URL.$this->end_link_wrapper; |
| 1242 | 1242 | $previous_URL = $this->start_link_wrapper.$previous_URL.$this->end_link_wrapper; |
@@ -1246,7 +1246,7 @@ discard block |
||
| 1246 | 1246 | |
| 1247 | 1247 | $moduleString = htmlspecialchars("{$currentModule}_{$html_varName}_offset"); |
| 1248 | 1248 | $moduleStringOrder = htmlspecialchars("{$currentModule}_{$html_varName}_ORDER_BY"); |
| 1249 | - if($this->shouldProcess && !$this->multi_select_popup) { |
|
| 1249 | + if ($this->shouldProcess && !$this->multi_select_popup) { |
|
| 1250 | 1250 | // check the checkboxes onload |
| 1251 | 1251 | echo "<script>YAHOO.util.Event.addListener(window, \"load\", sListView.check_boxes);</script>\n"; |
| 1252 | 1252 | |
@@ -1254,7 +1254,7 @@ discard block |
||
| 1254 | 1254 | $uids = empty($_REQUEST['uid']) || $massUpdateRun ? '' : $_REQUEST['uid']; |
| 1255 | 1255 | $select_entire_list = ($massUpdateRun) ? 0 : (isset($_POST['select_entire_list']) ? $_POST['select_entire_list'] : (isset($_REQUEST['select_entire_list']) ? htmlspecialchars($_REQUEST['select_entire_list']) : 0)); |
| 1256 | 1256 | |
| 1257 | - echo "<textarea style='display: none' name='uid'>{$uids}</textarea>\n" . |
|
| 1257 | + echo "<textarea style='display: none' name='uid'>{$uids}</textarea>\n". |
|
| 1258 | 1258 | "<input type='hidden' name='select_entire_list' value='{$select_entire_list}'>\n". |
| 1259 | 1259 | "<input type='hidden' name='{$moduleString}' value='0'>\n". |
| 1260 | 1260 | "<input type='hidden' name='{$moduleStringOrder}' value='0'>\n"; |
@@ -1264,64 +1264,64 @@ discard block |
||
| 1264 | 1264 | |
| 1265 | 1265 | $GLOBALS['log']->debug("Offsets: (start, previous, next, last)(0, $previous_offset, $next_offset, $last_offset)"); |
| 1266 | 1266 | |
| 1267 | - if(0 == $current_offset) { |
|
| 1268 | - $start_link = "<button type='button' name='listViewStartButton' title='{$this->local_app_strings['LNK_LIST_START']}' class='button' disabled>".SugarThemeRegistry::current()->getImage("start_off","aborder='0' align='absmiddle'",null,null,'.gif',$this->local_app_strings['LNK_LIST_START'])."</button>"; |
|
| 1269 | - $previous_link = "<button type='button' name='listViewPrevButton' title='{$this->local_app_strings['LNK_LIST_PREVIOUS']}' class='button' disabled>".SugarThemeRegistry::current()->getImage("previous_off","border='0' align='absmiddle'",null,null,'.gif',$this->local_app_strings['LNK_LIST_PREVIOUS'])."</button>"; |
|
| 1267 | + if (0 == $current_offset) { |
|
| 1268 | + $start_link = "<button type='button' name='listViewStartButton' title='{$this->local_app_strings['LNK_LIST_START']}' class='button' disabled>".SugarThemeRegistry::current()->getImage("start_off", "aborder='0' align='absmiddle'", null, null, '.gif', $this->local_app_strings['LNK_LIST_START'])."</button>"; |
|
| 1269 | + $previous_link = "<button type='button' name='listViewPrevButton' title='{$this->local_app_strings['LNK_LIST_PREVIOUS']}' class='button' disabled>".SugarThemeRegistry::current()->getImage("previous_off", "border='0' align='absmiddle'", null, null, '.gif', $this->local_app_strings['LNK_LIST_PREVIOUS'])."</button>"; |
|
| 1270 | 1270 | } else { |
| 1271 | - if($this->multi_select_popup) {// nav links for multiselect popup, submit form to save checks. |
|
| 1272 | - $start_link = "<button type='button' class='button' name='listViewStartButton' title='{$this->local_app_strings['LNK_LIST_START']}' onClick='javascript:save_checks(0, \"{$moduleString}\");'>".SugarThemeRegistry::current()->getImage("start","border='0' align='absmiddle'",null,null,'.gif',$this->local_app_strings['LNK_LIST_START'])."</button>"; |
|
| 1273 | - $previous_link = "<button type='button' class='button' name='listViewPrevButton' title='{$this->local_app_strings['LNK_LIST_PREVIOUS']}' onClick='javascript:save_checks($previous_offset, \"{$moduleString}\");'>".SugarThemeRegistry::current()->getImage("previous","border='0' align='absmiddle'",null,null,'.gif',$this->local_app_strings['LNK_LIST_PREVIOUS'])."</button>"; |
|
| 1274 | - } elseif($this->shouldProcess) { |
|
| 1275 | - $start_link = "<button type='button' class='button' name='listViewStartButton' title='{$this->local_app_strings['LNK_LIST_START']}' onClick='location.href=\"$start_URL\"; sListView.save_checks(0, \"{$moduleString}\");'>".SugarThemeRegistry::current()->getImage("start","border='0' align='absmiddle'",null,null,'.gif',$this->local_app_strings['LNK_LIST_START'])."</button>"; |
|
| 1276 | - $previous_link = "<button type='button' class='button' name='listViewPrevButton' title='{$this->local_app_strings['LNK_LIST_PREVIOUS']}' onClick='location.href=\"$previous_URL\"; sListView.save_checks($previous_offset, \"{$moduleString}\");'>".SugarThemeRegistry::current()->getImage("previous","border='0' align='absmiddle'",null,null,'.gif',$this->local_app_strings['LNK_LIST_PREVIOUS'])."</button>"; |
|
| 1271 | + if ($this->multi_select_popup) {// nav links for multiselect popup, submit form to save checks. |
|
| 1272 | + $start_link = "<button type='button' class='button' name='listViewStartButton' title='{$this->local_app_strings['LNK_LIST_START']}' onClick='javascript:save_checks(0, \"{$moduleString}\");'>".SugarThemeRegistry::current()->getImage("start", "border='0' align='absmiddle'", null, null, '.gif', $this->local_app_strings['LNK_LIST_START'])."</button>"; |
|
| 1273 | + $previous_link = "<button type='button' class='button' name='listViewPrevButton' title='{$this->local_app_strings['LNK_LIST_PREVIOUS']}' onClick='javascript:save_checks($previous_offset, \"{$moduleString}\");'>".SugarThemeRegistry::current()->getImage("previous", "border='0' align='absmiddle'", null, null, '.gif', $this->local_app_strings['LNK_LIST_PREVIOUS'])."</button>"; |
|
| 1274 | + } elseif ($this->shouldProcess) { |
|
| 1275 | + $start_link = "<button type='button' class='button' name='listViewStartButton' title='{$this->local_app_strings['LNK_LIST_START']}' onClick='location.href=\"$start_URL\"; sListView.save_checks(0, \"{$moduleString}\");'>".SugarThemeRegistry::current()->getImage("start", "border='0' align='absmiddle'", null, null, '.gif', $this->local_app_strings['LNK_LIST_START'])."</button>"; |
|
| 1276 | + $previous_link = "<button type='button' class='button' name='listViewPrevButton' title='{$this->local_app_strings['LNK_LIST_PREVIOUS']}' onClick='location.href=\"$previous_URL\"; sListView.save_checks($previous_offset, \"{$moduleString}\");'>".SugarThemeRegistry::current()->getImage("previous", "border='0' align='absmiddle'", null, null, '.gif', $this->local_app_strings['LNK_LIST_PREVIOUS'])."</button>"; |
|
| 1277 | 1277 | } else { |
| 1278 | 1278 | $onClick = ''; |
| 1279 | - if(0 != preg_match('/javascript.*/', $start_URL)){ |
|
| 1279 | + if (0 != preg_match('/javascript.*/', $start_URL)) { |
|
| 1280 | 1280 | $onClick = "\"$start_URL;\""; |
| 1281 | - }else{ |
|
| 1282 | - $onClick ="'location.href=\"$start_URL\";'"; |
|
| 1281 | + } else { |
|
| 1282 | + $onClick = "'location.href=\"$start_URL\";'"; |
|
| 1283 | 1283 | } |
| 1284 | - $start_link = "<button type='button' class='button' name='listViewStartButton' title='{$this->local_app_strings['LNK_LIST_START']}' onClick=".$onClick.">".SugarThemeRegistry::current()->getImage("start","border='0' align='absmiddle'",null,null,'.gif',$this->local_app_strings['LNK_LIST_START'])."</button>"; |
|
| 1284 | + $start_link = "<button type='button' class='button' name='listViewStartButton' title='{$this->local_app_strings['LNK_LIST_START']}' onClick=".$onClick.">".SugarThemeRegistry::current()->getImage("start", "border='0' align='absmiddle'", null, null, '.gif', $this->local_app_strings['LNK_LIST_START'])."</button>"; |
|
| 1285 | 1285 | |
| 1286 | 1286 | $onClick = ''; |
| 1287 | - if(0 != preg_match('/javascript.*/', $previous_URL)){ |
|
| 1287 | + if (0 != preg_match('/javascript.*/', $previous_URL)) { |
|
| 1288 | 1288 | $onClick = "\"$previous_URL;\""; |
| 1289 | - }else{ |
|
| 1289 | + } else { |
|
| 1290 | 1290 | $onClick = "'location.href=\"$previous_URL\";'"; |
| 1291 | 1291 | } |
| 1292 | - $previous_link = "<button type='button' class='button' name='listViewPrevButton' title='{$this->local_app_strings['LNK_LIST_PREVIOUS']}' onClick=".$onClick.">".SugarThemeRegistry::current()->getImage("previous","border='0' align='absmiddle'",null,null,'.gif',$this->local_app_strings['LNK_LIST_PREVIOUS'])."</button>"; |
|
| 1292 | + $previous_link = "<button type='button' class='button' name='listViewPrevButton' title='{$this->local_app_strings['LNK_LIST_PREVIOUS']}' onClick=".$onClick.">".SugarThemeRegistry::current()->getImage("previous", "border='0' align='absmiddle'", null, null, '.gif', $this->local_app_strings['LNK_LIST_PREVIOUS'])."</button>"; |
|
| 1293 | 1293 | } |
| 1294 | 1294 | } |
| 1295 | 1295 | |
| 1296 | - if($last_offset <= $current_offset) { |
|
| 1297 | - $end_link = "<button type='button' name='listViewEndButton' title='{$this->local_app_strings['LNK_LIST_END']}' class='button' disabled>".SugarThemeRegistry::current()->getImage("end_off","border='0' align='absmiddle'",null,null,'.gif',$this->local_app_strings['LNK_LIST_END'])."</button>"; |
|
| 1298 | - $next_link = "<button type='button' name='listViewNextButton' title='{$this->local_app_strings['LNK_LIST_NEXT']}' class='button' disabled>".SugarThemeRegistry::current()->getImage("next_off","aborder='0' align='absmiddle'",null,null,'.gif',$this->local_app_strings['LNK_LIST_NEXT'])."</button>"; |
|
| 1296 | + if ($last_offset <= $current_offset) { |
|
| 1297 | + $end_link = "<button type='button' name='listViewEndButton' title='{$this->local_app_strings['LNK_LIST_END']}' class='button' disabled>".SugarThemeRegistry::current()->getImage("end_off", "border='0' align='absmiddle'", null, null, '.gif', $this->local_app_strings['LNK_LIST_END'])."</button>"; |
|
| 1298 | + $next_link = "<button type='button' name='listViewNextButton' title='{$this->local_app_strings['LNK_LIST_NEXT']}' class='button' disabled>".SugarThemeRegistry::current()->getImage("next_off", "aborder='0' align='absmiddle'", null, null, '.gif', $this->local_app_strings['LNK_LIST_NEXT'])."</button>"; |
|
| 1299 | 1299 | } else { |
| 1300 | - if($this->multi_select_popup) { // nav links for multiselect popup, submit form to save checks. |
|
| 1301 | - $end_link = "<button type='button' name='listViewEndButton' class='button' title='{$this->local_app_strings['LNK_LIST_END']}' onClick='javascript:save_checks($last_offset, \"{$moduleString}\");'>".SugarThemeRegistry::current()->getImage("end","border='0' align='absmiddle'",null,null,'.gif',$this->local_app_strings['LNK_LIST_END'])."</button>"; |
|
| 1302 | - if(!empty($sugar_config['disable_count_query'])) { |
|
| 1300 | + if ($this->multi_select_popup) { // nav links for multiselect popup, submit form to save checks. |
|
| 1301 | + $end_link = "<button type='button' name='listViewEndButton' class='button' title='{$this->local_app_strings['LNK_LIST_END']}' onClick='javascript:save_checks($last_offset, \"{$moduleString}\");'>".SugarThemeRegistry::current()->getImage("end", "border='0' align='absmiddle'", null, null, '.gif', $this->local_app_strings['LNK_LIST_END'])."</button>"; |
|
| 1302 | + if (!empty($sugar_config['disable_count_query'])) { |
|
| 1303 | 1303 | $end_link = ''; |
| 1304 | 1304 | } |
| 1305 | - $next_link = "<button type='button' name='listViewNextButton' title='{$this->local_app_strings['LNK_LIST_NEXT']}' class='button' onClick='javascript:save_checks($next_offset, \"{$moduleString}\");'>".SugarThemeRegistry::current()->getImage("next","border='0' align='absmiddle'",null,null,'.gif',$this->local_app_strings['LNK_LIST_NEXT'])."</button>"; |
|
| 1306 | - } elseif($this->shouldProcess) { |
|
| 1307 | - $end_link = "<button type='button' name='listViewEndButton' class='button' title='{$this->local_app_strings['LNK_LIST_END']}' onClick='location.href=\"$end_URL\"; sListView.save_checks(\"end\", \"{$moduleString}\");'>".SugarThemeRegistry::current()->getImage("end","border='0' align='absmiddle'",null,null,'.gif',$this->local_app_strings['LNK_LIST_END'])."</button>"; |
|
| 1308 | - $next_link = "<button type='button' name='listViewNextButton' class='button' title='{$this->local_app_strings['LNK_LIST_NEXT']}' onClick='location.href=\"$next_URL\"; sListView.save_checks($next_offset, \"{$moduleString}\");'>".SugarThemeRegistry::current()->getImage("next","border='0' align='absmiddle'",null,null,'.gif',$this->local_app_strings['LNK_LIST_NEXT'])."</button>"; |
|
| 1305 | + $next_link = "<button type='button' name='listViewNextButton' title='{$this->local_app_strings['LNK_LIST_NEXT']}' class='button' onClick='javascript:save_checks($next_offset, \"{$moduleString}\");'>".SugarThemeRegistry::current()->getImage("next", "border='0' align='absmiddle'", null, null, '.gif', $this->local_app_strings['LNK_LIST_NEXT'])."</button>"; |
|
| 1306 | + } elseif ($this->shouldProcess) { |
|
| 1307 | + $end_link = "<button type='button' name='listViewEndButton' class='button' title='{$this->local_app_strings['LNK_LIST_END']}' onClick='location.href=\"$end_URL\"; sListView.save_checks(\"end\", \"{$moduleString}\");'>".SugarThemeRegistry::current()->getImage("end", "border='0' align='absmiddle'", null, null, '.gif', $this->local_app_strings['LNK_LIST_END'])."</button>"; |
|
| 1308 | + $next_link = "<button type='button' name='listViewNextButton' class='button' title='{$this->local_app_strings['LNK_LIST_NEXT']}' onClick='location.href=\"$next_URL\"; sListView.save_checks($next_offset, \"{$moduleString}\");'>".SugarThemeRegistry::current()->getImage("next", "border='0' align='absmiddle'", null, null, '.gif', $this->local_app_strings['LNK_LIST_NEXT'])."</button>"; |
|
| 1309 | 1309 | } else { |
| 1310 | 1310 | $onClick = ''; |
| 1311 | - if(0 != preg_match('/javascript.*/', $next_URL)){ |
|
| 1311 | + if (0 != preg_match('/javascript.*/', $next_URL)) { |
|
| 1312 | 1312 | $onClick = "\"$next_URL;\""; |
| 1313 | - }else{ |
|
| 1314 | - $onClick ="'location.href=\"$next_URL\";'"; |
|
| 1313 | + } else { |
|
| 1314 | + $onClick = "'location.href=\"$next_URL\";'"; |
|
| 1315 | 1315 | } |
| 1316 | - $next_link = "<button type='button' name='listViewNextButton' class='button' title='{$this->local_app_strings['LNK_LIST_NEXT']}' onClick=".$onClick.">".SugarThemeRegistry::current()->getImage("next","border='0' align='absmiddle'",null,null,'.gif',$this->local_app_strings['LNK_LIST_NEXT'])."</button>"; |
|
| 1316 | + $next_link = "<button type='button' name='listViewNextButton' class='button' title='{$this->local_app_strings['LNK_LIST_NEXT']}' onClick=".$onClick.">".SugarThemeRegistry::current()->getImage("next", "border='0' align='absmiddle'", null, null, '.gif', $this->local_app_strings['LNK_LIST_NEXT'])."</button>"; |
|
| 1317 | 1317 | |
| 1318 | 1318 | $onClick = ''; |
| 1319 | - if(0 != preg_match('/javascript.*/', $end_URL)){ |
|
| 1319 | + if (0 != preg_match('/javascript.*/', $end_URL)) { |
|
| 1320 | 1320 | $onClick = "\"$end_URL;\""; |
| 1321 | - }else{ |
|
| 1321 | + } else { |
|
| 1322 | 1322 | $onClick = "'location.href=\"$end_URL\";'"; |
| 1323 | 1323 | } |
| 1324 | - $end_link = "<button type='button' name='listViewEndButton' class='button' title='{$this->local_app_strings['LNK_LIST_END']}' onClick=".$onClick.">".SugarThemeRegistry::current()->getImage("end","border='0' align='absmiddle'",null,null,'.gif',$this->local_app_strings['LNK_LIST_END'])."</button>"; |
|
| 1324 | + $end_link = "<button type='button' name='listViewEndButton' class='button' title='{$this->local_app_strings['LNK_LIST_END']}' onClick=".$onClick.">".SugarThemeRegistry::current()->getImage("end", "border='0' align='absmiddle'", null, null, '.gif', $this->local_app_strings['LNK_LIST_END'])."</button>"; |
|
| 1325 | 1325 | |
| 1326 | 1326 | } |
| 1327 | 1327 | } |
@@ -1329,7 +1329,7 @@ discard block |
||
| 1329 | 1329 | $GLOBALS['log']->info("Offset (next, current, prev)($next_offset, $current_offset, $previous_offset)"); |
| 1330 | 1330 | $GLOBALS['log']->info("Start/end records ($start_record, $end_record)"); |
| 1331 | 1331 | |
| 1332 | - $end_record = $end_record-1; |
|
| 1332 | + $end_record = $end_record - 1; |
|
| 1333 | 1333 | |
| 1334 | 1334 | $script_href = "<a style=\'width: 150px\' name=\"thispage\" class=\'menuItem\' onmouseover=\'hiliteItem(this,\"yes\");\' onmouseout=\'unhiliteItem(this);\' onclick=\'if (document.MassUpdate.select_entire_list.value==1){document.MassUpdate.select_entire_list.value=0;sListView.check_all(document.MassUpdate, \"mass[]\", true, $this->records_per_page)}else {sListView.check_all(document.MassUpdate, \"mass[]\", true)};\' href=\'#\'>{$this->local_app_strings['LBL_LISTVIEW_OPTION_CURRENT']} ({$this->records_per_page})‎</a>" |
| 1335 | 1335 | . "<a style=\'width: 150px\' name=\"selectall\" class=\'menuItem\' onmouseover=\'hiliteItem(this,\"yes\");\' onmouseout=\'unhiliteItem(this);\' onclick=\'sListView.check_entire_list(document.MassUpdate, \"mass[]\",true,{$row_count});\' href=\'#\'>{$this->local_app_strings['LBL_LISTVIEW_OPTION_ENTIRE']} ({$row_count})‎</a>" |
@@ -1352,14 +1352,14 @@ discard block |
||
| 1352 | 1352 | } |
| 1353 | 1353 | </script>"; |
| 1354 | 1354 | |
| 1355 | - if($this->show_select_menu) |
|
| 1355 | + if ($this->show_select_menu) |
|
| 1356 | 1356 | { |
| 1357 | 1357 | $total_label = ""; |
| 1358 | 1358 | $total = $row_count; |
| 1359 | 1359 | $pageTotal = ($row_count > 0) ? $end_record - $start_record + 1 : 0; |
| 1360 | 1360 | if (!empty($GLOBALS['sugar_config']['disable_count_query']) && $GLOBALS['sugar_config']['disable_count_query'] === true && $total > $pageTotal) { |
| 1361 | 1361 | $this->show_plus = true; |
| 1362 | - $total = $pageTotal; |
|
| 1362 | + $total = $pageTotal; |
|
| 1363 | 1363 | $total_label = $total.'+'; |
| 1364 | 1364 | } else { |
| 1365 | 1365 | $this->show_plus = false; |
@@ -1381,16 +1381,16 @@ discard block |
||
| 1381 | 1381 | 'id' => 'selectLink', |
| 1382 | 1382 | 'buttons' => $menuItems, |
| 1383 | 1383 | 'flat' => false, |
| 1384 | - ),$this->xTemplate); |
|
| 1384 | + ), $this->xTemplate); |
|
| 1385 | 1385 | |
| 1386 | 1386 | } else { |
| 1387 | 1387 | $select_link = " "; |
| 1388 | 1388 | } |
| 1389 | 1389 | |
| 1390 | - $export_link = '<input class="button" type="button" value="'.$this->local_app_strings['LBL_EXPORT'].'" ' . |
|
| 1390 | + $export_link = '<input class="button" type="button" value="'.$this->local_app_strings['LBL_EXPORT'].'" '. |
|
| 1391 | 1391 | 'onclick="return sListView.send_form(true, \''.$_REQUEST['module'].'\', \'index.php?entryPoint=export\',\''.$this->local_app_strings['LBL_LISTVIEW_NO_SELECTED'].'\')">'; |
| 1392 | 1392 | |
| 1393 | - if($this->show_delete_button) { |
|
| 1393 | + if ($this->show_delete_button) { |
|
| 1394 | 1394 | $delete_link = '<input class="button" type="button" id="delete_button" name="Delete" value="'.$this->local_app_strings['LBL_DELETE_BUTTON_LABEL'].'" onclick="return sListView.send_mass_update(\'selected\',\''.$this->local_app_strings['LBL_LISTVIEW_NO_SELECTED'].'\', 1)">'; |
| 1395 | 1395 | } else { |
| 1396 | 1396 | $delete_link = ' '; |
@@ -1400,7 +1400,7 @@ discard block |
||
| 1400 | 1400 | $admin->retrieveSettings('system'); |
| 1401 | 1401 | |
| 1402 | 1402 | $user_merge = $current_user->getPreference('mailmerge_on'); |
| 1403 | - if($user_merge == 'on' && isset($admin->settings['system_mailmerge_on']) && $admin->settings['system_mailmerge_on']) { |
|
| 1403 | + if ($user_merge == 'on' && isset($admin->settings['system_mailmerge_on']) && $admin->settings['system_mailmerge_on']) { |
|
| 1404 | 1404 | echo "<script> |
| 1405 | 1405 | function mailmerge_dialog(el) { |
| 1406 | 1406 | var \$dialog = \$('<div></div>') |
@@ -1409,7 +1409,7 @@ discard block |
||
| 1409 | 1409 | . "<a style=\'width: 150px\' class=\'menuItem\' onmouseover=\'hiliteItem(this,\"yes\");\' onmouseout=\'unhiliteItem(this);\' href=\'index.php?action=index&module=MailMerge&entire=true\'>{$this->local_app_strings['LBL_LISTVIEW_OPTION_ENTIRE']}</a>') |
| 1410 | 1410 | .dialog({ |
| 1411 | 1411 | autoOpen: false, |
| 1412 | - title: '". $this->local_app_strings['LBL_MAILMERGE']."', |
|
| 1412 | + title: '".$this->local_app_strings['LBL_MAILMERGE']."', |
|
| 1413 | 1413 | width: 150, |
| 1414 | 1414 | position: { |
| 1415 | 1415 | my: myPos, |
@@ -1425,16 +1425,16 @@ discard block |
||
| 1425 | 1425 | $merge_link = " "; |
| 1426 | 1426 | } |
| 1427 | 1427 | |
| 1428 | - $selected_objects_span = " | {$this->local_app_strings['LBL_LISTVIEW_SELECTED_OBJECTS']}<input style='border: 0px; background: transparent; font-size: inherit; color: inherit' type='text' readonly name='selectCount[]' value='" . ((isset($_POST['mass'])) ? count($_POST['mass']): 0) . "' />"; |
|
| 1428 | + $selected_objects_span = " | {$this->local_app_strings['LBL_LISTVIEW_SELECTED_OBJECTS']}<input style='border: 0px; background: transparent; font-size: inherit; color: inherit' type='text' readonly name='selectCount[]' value='".((isset($_POST['mass'])) ? count($_POST['mass']) : 0)."' />"; |
|
| 1429 | 1429 | |
| 1430 | - if($_REQUEST['module'] == 'Home' || $this->local_current_module == 'Import' |
|
| 1430 | + if ($_REQUEST['module'] == 'Home' || $this->local_current_module == 'Import' |
|
| 1431 | 1431 | || $this->show_export_button == false |
| 1432 | 1432 | || (!empty($sugar_config['disable_export'])) |
| 1433 | 1433 | || (!empty($sugar_config['admin_export_only']) |
| 1434 | 1434 | && !( |
| 1435 | 1435 | is_admin($current_user) |
| 1436 | 1436 | || (ACLController::moduleSupportsACL($_REQUEST['module']) |
| 1437 | - && ACLAction::getUserAccessLevel($current_user->id,$_REQUEST['module'], 'access') == ACL_ALLOW_ENABLED |
|
| 1437 | + && ACLAction::getUserAccessLevel($current_user->id, $_REQUEST['module'], 'access') == ACL_ALLOW_ENABLED |
|
| 1438 | 1438 | && (ACLAction::getUserAccessLevel($current_user->id, $_REQUEST['module'], 'admin') == ACL_ALLOW_ADMIN || |
| 1439 | 1439 | ACLAction::getUserAccessLevel($current_user->id, $_REQUEST['module'], 'admin') == ACL_ALLOW_ADMIN_DEV))))) |
| 1440 | 1440 | { |
@@ -1443,13 +1443,13 @@ discard block |
||
| 1443 | 1443 | } |
| 1444 | 1444 | $export_link = " "; |
| 1445 | 1445 | $merge_link = " "; |
| 1446 | - } elseif($_REQUEST['module'] != "Accounts" && $_REQUEST['module'] != "Cases" && $_REQUEST['module'] != "Contacts" && $_REQUEST['module'] != "Leads" && $_REQUEST['module'] != "Opportunities") { |
|
| 1446 | + } elseif ($_REQUEST['module'] != "Accounts" && $_REQUEST['module'] != "Cases" && $_REQUEST['module'] != "Contacts" && $_REQUEST['module'] != "Leads" && $_REQUEST['module'] != "Opportunities") { |
|
| 1447 | 1447 | $merge_link = " "; |
| 1448 | 1448 | } |
| 1449 | 1449 | |
| 1450 | - if($this->show_paging == true) { |
|
| 1451 | - if(!empty($sugar_config['disable_count_query'])) { |
|
| 1452 | - if($row_count > $end_record) { |
|
| 1450 | + if ($this->show_paging == true) { |
|
| 1451 | + if (!empty($sugar_config['disable_count_query'])) { |
|
| 1452 | + if ($row_count > $end_record) { |
|
| 1453 | 1453 | $row_count .= '+'; |
| 1454 | 1454 | } |
| 1455 | 1455 | } |
@@ -1465,16 +1465,16 @@ discard block |
||
| 1465 | 1465 | $html_text .= "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\"><tr><td align=\"left\" >"; |
| 1466 | 1466 | |
| 1467 | 1467 | //attempt to get the query to recreate this subpanel |
| 1468 | - if(!empty($this->response)){ |
|
| 1469 | - $response =& $this->response; |
|
| 1470 | - }else{ |
|
| 1471 | - $response = SugarBean::get_union_related_list($sugarbean,$this->sortby, $this->sort_order, $this->query_where, $current_offset, -1, $this->records_per_page,$this->query_limit,$subpanel_def); |
|
| 1468 | + if (!empty($this->response)) { |
|
| 1469 | + $response = & $this->response; |
|
| 1470 | + } else { |
|
| 1471 | + $response = SugarBean::get_union_related_list($sugarbean, $this->sortby, $this->sort_order, $this->query_where, $current_offset, -1, $this->records_per_page, $this->query_limit, $subpanel_def); |
|
| 1472 | 1472 | $this->response = $response; |
| 1473 | 1473 | } |
| 1474 | 1474 | //if query is present, then pass it in as parameter |
| 1475 | - if (isset($response['query']) && !empty($response['query'])){ |
|
| 1475 | + if (isset($response['query']) && !empty($response['query'])) { |
|
| 1476 | 1476 | $html_text .= $subpanelTiles->get_buttons($subpanel_def, $response['query']); |
| 1477 | - }else{ |
|
| 1477 | + } else { |
|
| 1478 | 1478 | $html_text .= $subpanelTiles->get_buttons($subpanel_def); |
| 1479 | 1479 | } |
| 1480 | 1480 | } |
@@ -1484,11 +1484,11 @@ discard block |
||
| 1484 | 1484 | $html_text .= "</td>\n<td nowrap align=\"right\">".$start_link." ".$previous_link." <span class='pageNumbers'>(".$start_record." - ".$end_record." ".$this->local_app_strings['LBL_LIST_OF']." ".$row_count.")</span> ".$next_link." ".$end_link."</td></tr></table>\n"; |
| 1485 | 1485 | $html_text .= "</td>\n"; |
| 1486 | 1486 | $html_text .= "</tr>\n"; |
| 1487 | - $this->xTemplate->assign("PAGINATION",$html_text); |
|
| 1487 | + $this->xTemplate->assign("PAGINATION", $html_text); |
|
| 1488 | 1488 | } |
| 1489 | 1489 | |
| 1490 | 1490 | //C.L. - Fix for 23461 |
| 1491 | - if(empty($_REQUEST['action']) || $_REQUEST['action'] != 'Popup') { |
|
| 1491 | + if (empty($_REQUEST['action']) || $_REQUEST['action'] != 'Popup') { |
|
| 1492 | 1492 | $_SESSION['export_where'] = $this->query_where; |
| 1493 | 1493 | } |
| 1494 | 1494 | $this->xTemplate->parse($xtemplateSection.".list_nav_row"); |
@@ -1497,24 +1497,24 @@ discard block |
||
| 1497 | 1497 | |
| 1498 | 1498 | function processOrderBy($html_varName) { |
| 1499 | 1499 | |
| 1500 | - if(!isset($this->base_URL)) { |
|
| 1500 | + if (!isset($this->base_URL)) { |
|
| 1501 | 1501 | $this->base_URL = $_SERVER['PHP_SELF']; |
| 1502 | 1502 | |
| 1503 | - if(isset($_SERVER['QUERY_STRING'])) { |
|
| 1504 | - $this->base_URL = preg_replace("/\&".$this->getSessionVariableName($html_varName,"ORDER_BY")."=[0-9a-zA-Z\_\.]*/","",$this->base_URL .'?'.$_SERVER['QUERY_STRING']); |
|
| 1505 | - $this->base_URL = preg_replace("/\&".$this->getSessionVariableName($html_varName,"offset")."=[0-9]*/","",$this->base_URL); |
|
| 1503 | + if (isset($_SERVER['QUERY_STRING'])) { |
|
| 1504 | + $this->base_URL = preg_replace("/\&".$this->getSessionVariableName($html_varName, "ORDER_BY")."=[0-9a-zA-Z\_\.]*/", "", $this->base_URL.'?'.$_SERVER['QUERY_STRING']); |
|
| 1505 | + $this->base_URL = preg_replace("/\&".$this->getSessionVariableName($html_varName, "offset")."=[0-9]*/", "", $this->base_URL); |
|
| 1506 | 1506 | } |
| 1507 | - if($_SERVER['REQUEST_METHOD'] == 'POST') { |
|
| 1507 | + if ($_SERVER['REQUEST_METHOD'] == 'POST') { |
|
| 1508 | 1508 | $this->base_URL .= '?'; |
| 1509 | - if(isset($_REQUEST['action'])) $this->base_URL .= '&action='.$_REQUEST['action']; |
|
| 1510 | - if(isset($_REQUEST['record'])) $this->base_URL .= '&record='.$_REQUEST['record']; |
|
| 1511 | - if(isset($_REQUEST['module'])) $this->base_URL .= '&module='.$_REQUEST['module']; |
|
| 1509 | + if (isset($_REQUEST['action'])) $this->base_URL .= '&action='.$_REQUEST['action']; |
|
| 1510 | + if (isset($_REQUEST['record'])) $this->base_URL .= '&record='.$_REQUEST['record']; |
|
| 1511 | + if (isset($_REQUEST['module'])) $this->base_URL .= '&module='.$_REQUEST['module']; |
|
| 1512 | 1512 | } |
| 1513 | - $this->base_URL .= "&".$this->getSessionVariableName($html_varName,"offset")."="; |
|
| 1513 | + $this->base_URL .= "&".$this->getSessionVariableName($html_varName, "offset")."="; |
|
| 1514 | 1514 | } |
| 1515 | 1515 | |
| 1516 | - if($this->is_dynamic) { |
|
| 1517 | - $this->base_URL.='&to_pdf=true&action=SubPanelViewer&subpanel=' . $this->source_module; |
|
| 1516 | + if ($this->is_dynamic) { |
|
| 1517 | + $this->base_URL .= '&to_pdf=true&action=SubPanelViewer&subpanel='.$this->source_module; |
|
| 1518 | 1518 | } |
| 1519 | 1519 | |
| 1520 | 1520 | //bug43465 start |
@@ -1522,19 +1522,19 @@ discard block |
||
| 1522 | 1522 | { |
| 1523 | 1523 | foreach ($this->appendToBaseUrl as $key => $value) |
| 1524 | 1524 | { |
| 1525 | - $fullRequestString = $key . '=' . $value; |
|
| 1525 | + $fullRequestString = $key.'='.$value; |
|
| 1526 | 1526 | |
| 1527 | 1527 | if ($this->base_URL == "/index.php") |
| 1528 | 1528 | { |
| 1529 | 1529 | $this->base_URL .= "?"; |
| 1530 | 1530 | } else |
| 1531 | 1531 | { |
| 1532 | - if ($fullRequestString == substr($this->baseURL, '-' . strlen($fullRequestString))) |
|
| 1532 | + if ($fullRequestString == substr($this->baseURL, '-'.strlen($fullRequestString))) |
|
| 1533 | 1533 | { |
| 1534 | - $this->base_URL = preg_replace("/&" . $key . "\=.*/", "", $this->base_URL); |
|
| 1534 | + $this->base_URL = preg_replace("/&".$key."\=.*/", "", $this->base_URL); |
|
| 1535 | 1535 | } else |
| 1536 | 1536 | { |
| 1537 | - $this->base_URL = preg_replace("/&" . $key . "\=.*?&/", "&", $this->base_URL); |
|
| 1537 | + $this->base_URL = preg_replace("/&".$key."\=.*?&/", "&", $this->base_URL); |
|
| 1538 | 1538 | } |
| 1539 | 1539 | $this->base_URL .= "&"; |
| 1540 | 1540 | } |
@@ -1546,9 +1546,9 @@ discard block |
||
| 1546 | 1546 | } |
| 1547 | 1547 | //bug43465 end |
| 1548 | 1548 | |
| 1549 | - $sort_URL_base = $this->base_URL. "&".$this->getSessionVariableName($html_varName,"ORDER_BY")."="; |
|
| 1549 | + $sort_URL_base = $this->base_URL."&".$this->getSessionVariableName($html_varName, "ORDER_BY")."="; |
|
| 1550 | 1550 | |
| 1551 | - if($sort_URL_base !== "") |
|
| 1551 | + if ($sort_URL_base !== "") |
|
| 1552 | 1552 | { |
| 1553 | 1553 | $this->xTemplate->assign("ORDER_BY", $sort_URL_base); |
| 1554 | 1554 | return $sort_URL_base; |
@@ -1599,19 +1599,19 @@ discard block |
||
| 1599 | 1599 | $mergeList = array(); |
| 1600 | 1600 | $module = ''; |
| 1601 | 1601 | //todo what is this? It is using an array as a boolean |
| 1602 | - while(list($aVal, $aItem) = each($data)) |
|
| 1602 | + while (list($aVal, $aItem) = each($data)) |
|
| 1603 | 1603 | { |
| 1604 | - if(isset($this->data_array)) { |
|
| 1604 | + if (isset($this->data_array)) { |
|
| 1605 | 1605 | $fields = $this->data_array; |
| 1606 | 1606 | } else { |
| 1607 | 1607 | $aItem->check_date_relationships_load(); |
| 1608 | 1608 | $fields = $aItem->get_list_view_data(); |
| 1609 | 1609 | } |
| 1610 | 1610 | |
| 1611 | - if(is_object($aItem)) { // cn: bug 5349 |
|
| 1611 | + if (is_object($aItem)) { // cn: bug 5349 |
|
| 1612 | 1612 | //add item id to merge list, if the button is clicked |
| 1613 | 1613 | $mergeList[] = $aItem->id; |
| 1614 | - if(empty($module)) { |
|
| 1614 | + if (empty($module)) { |
|
| 1615 | 1615 | $module = $aItem->module_dir; |
| 1616 | 1616 | } |
| 1617 | 1617 | } |
@@ -1620,37 +1620,37 @@ discard block |
||
| 1620 | 1620 | $fields['OFFSET'] = ($offset + $count + 1); |
| 1621 | 1621 | |
| 1622 | 1622 | $fields['STAMP'] = $timeStamp; |
| 1623 | - if($this->shouldProcess) { |
|
| 1623 | + if ($this->shouldProcess) { |
|
| 1624 | 1624 | |
| 1625 | 1625 | $prerow = ''; |
| 1626 | - if(!isset($this->data_array)) { |
|
| 1627 | - $prerow .= "<input onclick='sListView.check_item(this, document.MassUpdate)' type='checkbox' class='checkbox' name='mass[]' value='". $fields['ID']. "'>"; |
|
| 1626 | + if (!isset($this->data_array)) { |
|
| 1627 | + $prerow .= "<input onclick='sListView.check_item(this, document.MassUpdate)' type='checkbox' class='checkbox' name='mass[]' value='".$fields['ID']."'>"; |
|
| 1628 | 1628 | } |
| 1629 | 1629 | $this->xTemplate->assign('PREROW', $prerow); |
| 1630 | 1630 | |
| 1631 | 1631 | $this->xTemplate->assign('CHECKALL', "<input type='checkbox' class='checkbox' title='".$GLOBALS['app_strings']['LBL_SELECT_ALL_TITLE']."' name='massall' id='massall' value='' onclick='sListView.check_all(document.MassUpdate, \"mass[]\", this.checked)'>"); |
| 1632 | 1632 | } |
| 1633 | - if(!isset($this->data_array)) { |
|
| 1633 | + if (!isset($this->data_array)) { |
|
| 1634 | 1634 | $tag = $aItem->listviewACLHelper(); |
| 1635 | - $this->xTemplate->assign('TAG',$tag) ; |
|
| 1635 | + $this->xTemplate->assign('TAG', $tag); |
|
| 1636 | 1636 | } |
| 1637 | 1637 | |
| 1638 | - if($oddRow) |
|
| 1638 | + if ($oddRow) |
|
| 1639 | 1639 | { |
| 1640 | 1640 | $ROW_COLOR = 'oddListRow'; |
| 1641 | - $BG_COLOR = $odd_bg; |
|
| 1641 | + $BG_COLOR = $odd_bg; |
|
| 1642 | 1642 | } |
| 1643 | 1643 | else |
| 1644 | 1644 | { |
| 1645 | 1645 | $ROW_COLOR = 'evenListRow'; |
| 1646 | - $BG_COLOR = $even_bg; |
|
| 1646 | + $BG_COLOR = $even_bg; |
|
| 1647 | 1647 | } |
| 1648 | 1648 | $oddRow = !$oddRow; |
| 1649 | 1649 | |
| 1650 | 1650 | $this->xTemplate->assign('ROW_COLOR', $ROW_COLOR); |
| 1651 | 1651 | $this->xTemplate->assign('BG_COLOR', $BG_COLOR); |
| 1652 | 1652 | |
| 1653 | - if(isset($this->data_array)) |
|
| 1653 | + if (isset($this->data_array)) |
|
| 1654 | 1654 | { |
| 1655 | 1655 | $this->xTemplate->assign('KEY', $aVal); |
| 1656 | 1656 | $this->xTemplate->assign('VALUE', $aItem); |
@@ -1661,23 +1661,23 @@ discard block |
||
| 1661 | 1661 | { |
| 1662 | 1662 | //AED -- some modules do not have their additionalDetails.php established. Add a check to ensure require_once does not fail |
| 1663 | 1663 | // Bug #2786 |
| 1664 | - if($this->_additionalDetails && $aItem->ACLAccess('DetailView') && (file_exists('modules/' . $aItem->module_dir . '/metadata/additionalDetails.php') || file_exists('custom/modules/' . $aItem->module_dir . '/metadata/additionalDetails.php'))) { |
|
| 1664 | + if ($this->_additionalDetails && $aItem->ACLAccess('DetailView') && (file_exists('modules/'.$aItem->module_dir.'/metadata/additionalDetails.php') || file_exists('custom/modules/'.$aItem->module_dir.'/metadata/additionalDetails.php'))) { |
|
| 1665 | 1665 | |
| 1666 | - $additionalDetailsFile = 'modules/' . $aItem->module_dir . '/metadata/additionalDetails.php'; |
|
| 1667 | - if(file_exists('custom/modules/' . $aItem->module_dir . '/metadata/additionalDetails.php')){ |
|
| 1668 | - $additionalDetailsFile = 'custom/modules/' . $aItem->module_dir . '/metadata/additionalDetails.php'; |
|
| 1666 | + $additionalDetailsFile = 'modules/'.$aItem->module_dir.'/metadata/additionalDetails.php'; |
|
| 1667 | + if (file_exists('custom/modules/'.$aItem->module_dir.'/metadata/additionalDetails.php')) { |
|
| 1668 | + $additionalDetailsFile = 'custom/modules/'.$aItem->module_dir.'/metadata/additionalDetails.php'; |
|
| 1669 | 1669 | } |
| 1670 | 1670 | |
| 1671 | 1671 | require_once($additionalDetailsFile); |
| 1672 | - $ad_function = (empty($this->additionalDetailsFunction) ? 'additionalDetails' : $this->additionalDetailsFunction) . $aItem->object_name; |
|
| 1672 | + $ad_function = (empty($this->additionalDetailsFunction) ? 'additionalDetails' : $this->additionalDetailsFunction).$aItem->object_name; |
|
| 1673 | 1673 | $results = $ad_function($fields); |
| 1674 | 1674 | $results['string'] = str_replace(array("'", "'"), '\'', $results['string']); // no xss! |
| 1675 | 1675 | |
| 1676 | - if(trim($results['string']) == '') $results['string'] = $app_strings['LBL_NONE']; |
|
| 1676 | + if (trim($results['string']) == '') $results['string'] = $app_strings['LBL_NONE']; |
|
| 1677 | 1677 | $fields[$results['fieldToAddTo']] = $fields[$results['fieldToAddTo']].'</a>'; |
| 1678 | 1678 | } |
| 1679 | 1679 | |
| 1680 | - if($aItem->ACLAccess('Delete')) { |
|
| 1680 | + if ($aItem->ACLAccess('Delete')) { |
|
| 1681 | 1681 | $delete = '<a class="listViewTdToolsS1" onclick="return confirm(\''.$this->local_app_strings['NTC_DELETE_CONFIRMATION'].'\')" href="'.'index.php?action=Delete&module='.$aItem->module_dir.'&record='.$fields['ID'].'&return_module='.$aItem->module_dir.'&return_action=index&return_id=">'.$this->local_app_strings['LBL_DELETE_INLINE'].'</a>'; |
| 1682 | 1682 | require_once('include/Smarty/plugins/function.sugar_action_menu.php'); |
| 1683 | 1683 | $fields['DELETE_BUTTON'] = smarty_function_sugar_action_menu(array( |
@@ -1691,26 +1691,26 @@ discard block |
||
| 1691 | 1691 | $aItem->setupCustomFields($aItem->module_dir); |
| 1692 | 1692 | $aItem->custom_fields->populateAllXTPL($this->xTemplate, 'detail', $html_varName, $fields); |
| 1693 | 1693 | } |
| 1694 | - if(!isset($this->data_array) && $aItem->ACLAccess('DetailView')) { |
|
| 1694 | + if (!isset($this->data_array) && $aItem->ACLAccess('DetailView')) { |
|
| 1695 | 1695 | $count++; |
| 1696 | 1696 | } |
| 1697 | - if(isset($this->data_array)) { |
|
| 1697 | + if (isset($this->data_array)) { |
|
| 1698 | 1698 | $count++; |
| 1699 | 1699 | } |
| 1700 | - if(!isset($this->data_array)) { |
|
| 1700 | + if (!isset($this->data_array)) { |
|
| 1701 | 1701 | $aItem->list_view_parse_additional_sections($this->xTemplate, $xtemplateSection); |
| 1702 | 1702 | |
| 1703 | - if($this->xTemplate->exists($xtemplateSection.'.row.pro')) { |
|
| 1703 | + if ($this->xTemplate->exists($xtemplateSection.'.row.pro')) { |
|
| 1704 | 1704 | $this->xTemplate->parse($xtemplateSection.'.row.pro'); |
| 1705 | 1705 | } |
| 1706 | 1706 | } |
| 1707 | - $this->xTemplate->parse($xtemplateSection . '.row'); |
|
| 1707 | + $this->xTemplate->parse($xtemplateSection.'.row'); |
|
| 1708 | 1708 | |
| 1709 | - if(isset($fields['ID'])) { |
|
| 1709 | + if (isset($fields['ID'])) { |
|
| 1710 | 1710 | $associated_row_data[$fields['ID']] = $fields; |
| 1711 | 1711 | // Bug 38908: cleanup data for JS to avoid having shuffled around |
| 1712 | - foreach($fields as $key => $value) { |
|
| 1713 | - if($value == ' ') { |
|
| 1712 | + foreach ($fields as $key => $value) { |
|
| 1713 | + if ($value == ' ') { |
|
| 1714 | 1714 | $associated_row_data[$fields['ID']][$key] = ''; |
| 1715 | 1715 | } |
| 1716 | 1716 | } |
@@ -1719,21 +1719,21 @@ discard block |
||
| 1719 | 1719 | |
| 1720 | 1720 | $_SESSION['MAILMERGE_RECORDS'] = $mergeList; |
| 1721 | 1721 | $_SESSION['MAILMERGE_MODULE_FROM_LISTVIEW'] = $module; |
| 1722 | - if(empty($_REQUEST['action']) || $_REQUEST['action'] != 'Popup') { |
|
| 1722 | + if (empty($_REQUEST['action']) || $_REQUEST['action'] != 'Popup') { |
|
| 1723 | 1723 | $_SESSION['MAILMERGE_MODULE'] = $module; |
| 1724 | 1724 | } |
| 1725 | 1725 | |
| 1726 | - if($this->process_for_popups) |
|
| 1726 | + if ($this->process_for_popups) |
|
| 1727 | 1727 | { |
| 1728 | 1728 | $json = getJSONobj(); |
| 1729 | 1729 | $is_show_fullname = showFullName() ? 1 : 0; |
| 1730 | - $associated_javascript_data = '<script type="text/javascript">' . "\n" |
|
| 1730 | + $associated_javascript_data = '<script type="text/javascript">'."\n" |
|
| 1731 | 1731 | //. '<!-- // associated javascript data generated by ListView' . "\n" |
| 1732 | 1732 | . 'var associated_javascript_data = ' |
| 1733 | - . $json->encode($associated_row_data) . ";\n" |
|
| 1733 | + . $json->encode($associated_row_data).";\n" |
|
| 1734 | 1734 | //. '-->' . "\n" |
| 1735 | 1735 | . 'var is_show_fullname = ' |
| 1736 | - . $is_show_fullname . ";\n" |
|
| 1736 | + . $is_show_fullname.";\n" |
|
| 1737 | 1737 | . '</script>'; |
| 1738 | 1738 | $this->xTemplate->assign('ASSOCIATED_JAVASCRIPT_DATA', $associated_javascript_data); |
| 1739 | 1739 | } |
@@ -1745,7 +1745,7 @@ discard block |
||
| 1745 | 1745 | function getLayoutManager() |
| 1746 | 1746 | { |
| 1747 | 1747 | require_once('include/generic/LayoutManager.php'); |
| 1748 | - if($this->layout_manager == null) |
|
| 1748 | + if ($this->layout_manager == null) |
|
| 1749 | 1749 | { |
| 1750 | 1750 | $this->layout_manager = new LayoutManager(); |
| 1751 | 1751 | } |
@@ -1758,36 +1758,36 @@ discard block |
||
| 1758 | 1758 | |
| 1759 | 1759 | |
| 1760 | 1760 | $layout_manager = $this->getLayoutManager(); |
| 1761 | - $layout_manager->setAttribute('order_by_link',$this->processOrderBy($html_var)); |
|
| 1762 | - $layout_manager->setAttribute('context','HeaderCell'); |
|
| 1763 | - $layout_manager->setAttribute('image_path',$this->local_image_path); |
|
| 1764 | - $layout_manager->setAttribute('html_varName',$html_var); |
|
| 1761 | + $layout_manager->setAttribute('order_by_link', $this->processOrderBy($html_var)); |
|
| 1762 | + $layout_manager->setAttribute('context', 'HeaderCell'); |
|
| 1763 | + $layout_manager->setAttribute('image_path', $this->local_image_path); |
|
| 1764 | + $layout_manager->setAttribute('html_varName', $html_var); |
|
| 1765 | 1765 | $layout_manager->setAttribute('module_name', $source_module); |
| 1766 | - list($orderBy,$desc) = $this->getOrderByInfo($html_var); |
|
| 1766 | + list($orderBy, $desc) = $this->getOrderByInfo($html_var); |
|
| 1767 | 1767 | |
| 1768 | - if($orderBy == 'amount*1') |
|
| 1768 | + if ($orderBy == 'amount*1') |
|
| 1769 | 1769 | { |
| 1770 | - $orderBy= 'amount'; |
|
| 1770 | + $orderBy = 'amount'; |
|
| 1771 | 1771 | } |
| 1772 | 1772 | $buttons = false; |
| 1773 | 1773 | $col_count = 0; |
| 1774 | - foreach($subpanel_def->get_list_fields() as $column_name=>$widget_args) |
|
| 1774 | + foreach ($subpanel_def->get_list_fields() as $column_name=>$widget_args) |
|
| 1775 | 1775 | { |
| 1776 | 1776 | $usage = empty($widget_args['usage']) ? '' : $widget_args['usage']; |
| 1777 | - if($usage != 'query_only' || !empty($widget_args['force_query_only_display'])) |
|
| 1777 | + if ($usage != 'query_only' || !empty($widget_args['force_query_only_display'])) |
|
| 1778 | 1778 | { |
| 1779 | 1779 | $imgArrow = ''; |
| 1780 | 1780 | |
| 1781 | - if($orderBy == $column_name || (isset($widget_args['sort_by']) && str_replace('.','_',$widget_args['sort_by']) == $orderBy)) |
|
| 1781 | + if ($orderBy == $column_name || (isset($widget_args['sort_by']) && str_replace('.', '_', $widget_args['sort_by']) == $orderBy)) |
|
| 1782 | 1782 | { |
| 1783 | 1783 | $imgArrow = "_down"; |
| 1784 | - if($this->sort_order == 'asc') { |
|
| 1784 | + if ($this->sort_order == 'asc') { |
|
| 1785 | 1785 | $imgArrow = "_up"; |
| 1786 | 1786 | } |
| 1787 | 1787 | } |
| 1788 | 1788 | |
| 1789 | 1789 | if (!preg_match("/_button/i", $column_name)) { |
| 1790 | - $widget_args['name']=$column_name; |
|
| 1790 | + $widget_args['name'] = $column_name; |
|
| 1791 | 1791 | $widget_args['sort'] = $imgArrow; |
| 1792 | 1792 | $widget_args['start_link_wrapper'] = $this->start_link_wrapper; |
| 1793 | 1793 | $widget_args['end_link_wrapper'] = $this->end_link_wrapper; |
@@ -1797,8 +1797,8 @@ discard block |
||
| 1797 | 1797 | $cell_width = empty($widget_args['width']) ? '' : $widget_args['width']; |
| 1798 | 1798 | $this->xTemplate->assign('HEADER_CELL', $widget_contents); |
| 1799 | 1799 | static $count; |
| 1800 | - if(!isset($count))$count = 0; else $count++; |
|
| 1801 | - if($col_count == 0 || $column_name == 'name') $footable = 'data-toggle="true"'; |
|
| 1800 | + if (!isset($count))$count = 0; else $count++; |
|
| 1801 | + if ($col_count == 0 || $column_name == 'name') $footable = 'data-toggle="true"'; |
|
| 1802 | 1802 | else { |
| 1803 | 1803 | $footable = 'data-hide="phone"'; |
| 1804 | 1804 | if ($col_count > 2) $footable = 'data-hide="phone,phonelandscape"'; |
@@ -1815,7 +1815,7 @@ discard block |
||
| 1815 | 1815 | ++$col_count; |
| 1816 | 1816 | } |
| 1817 | 1817 | |
| 1818 | - if($buttons) { |
|
| 1818 | + if ($buttons) { |
|
| 1819 | 1819 | $this->xTemplate->assign('FOOTABLE', ''); |
| 1820 | 1820 | $this->xTemplate->assign('HEADER_CELL', " "); |
| 1821 | 1821 | $this->xTemplate->assign('CELL_COUNT', $count); |
@@ -1843,37 +1843,37 @@ discard block |
||
| 1843 | 1843 | |
| 1844 | 1844 | function processListViewTwo($seed, $xTemplateSection, $html_varName) { |
| 1845 | 1845 | global $current_user; |
| 1846 | - if(!isset($this->xTemplate)) { |
|
| 1846 | + if (!isset($this->xTemplate)) { |
|
| 1847 | 1847 | $this->createXTemplate(); |
| 1848 | 1848 | } |
| 1849 | 1849 | |
| 1850 | 1850 | $isSugarBean = is_subclass_of($seed, "SugarBean"); |
| 1851 | 1851 | $list = null; |
| 1852 | 1852 | |
| 1853 | - if($isSugarBean) { |
|
| 1853 | + if ($isSugarBean) { |
|
| 1854 | 1854 | $list = $this->processSugarBean($xTemplateSection, $html_varName, $seed); |
| 1855 | 1855 | } else { |
| 1856 | 1856 | $list = $seed; |
| 1857 | 1857 | } |
| 1858 | 1858 | |
| 1859 | 1859 | if (is_object($seed) && isset($seed->object_name) && $seed->object_name == 'WorkFlow') { |
| 1860 | - $tab=array(); |
|
| 1860 | + $tab = array(); |
|
| 1861 | 1861 | $access = get_workflow_admin_modules_for_user($current_user); |
| 1862 | 1862 | for ($i = 0; $i < count($list); $i++) { |
| 1863 | - if(!empty($access[$list[$i]->base_module])){ |
|
| 1864 | - $tab[]=$list[$i]; |
|
| 1863 | + if (!empty($access[$list[$i]->base_module])) { |
|
| 1864 | + $tab[] = $list[$i]; |
|
| 1865 | 1865 | } |
| 1866 | 1866 | } |
| 1867 | 1867 | $list = $tab; |
| 1868 | 1868 | } |
| 1869 | 1869 | |
| 1870 | - if($this->is_dynamic) { |
|
| 1871 | - $this->processHeaderDynamic($xTemplateSection,$html_varName); |
|
| 1872 | - $this->processListRows($list,$xTemplateSection, $html_varName); |
|
| 1870 | + if ($this->is_dynamic) { |
|
| 1871 | + $this->processHeaderDynamic($xTemplateSection, $html_varName); |
|
| 1872 | + $this->processListRows($list, $xTemplateSection, $html_varName); |
|
| 1873 | 1873 | } else { |
| 1874 | 1874 | $this->processSortArrows($html_varName); |
| 1875 | 1875 | |
| 1876 | - if($isSugarBean) { |
|
| 1876 | + if ($isSugarBean) { |
|
| 1877 | 1877 | $seed->parse_additional_headers($this->xTemplate, $xTemplateSection); |
| 1878 | 1878 | } |
| 1879 | 1879 | $this->xTemplateAssign('CHECKALL', SugarThemeRegistry::current()->getImage('blank', '', 1, 1, ".gif", '')); |
@@ -1882,19 +1882,19 @@ discard block |
||
| 1882 | 1882 | $this->processOrderBy($html_varName); |
| 1883 | 1883 | |
| 1884 | 1884 | |
| 1885 | - $this->processListRows($list,$xTemplateSection, $html_varName); |
|
| 1885 | + $this->processListRows($list, $xTemplateSection, $html_varName); |
|
| 1886 | 1886 | } |
| 1887 | 1887 | |
| 1888 | - if($this->display_header_and_footer) { |
|
| 1888 | + if ($this->display_header_and_footer) { |
|
| 1889 | 1889 | $this->getAdditionalHeader(); |
| 1890 | - if(!empty($this->header_title)) { |
|
| 1890 | + if (!empty($this->header_title)) { |
|
| 1891 | 1891 | echo get_form_header($this->header_title, $this->header_text, false); |
| 1892 | 1892 | } |
| 1893 | 1893 | } |
| 1894 | 1894 | |
| 1895 | 1895 | $this->xTemplate->out($xTemplateSection); |
| 1896 | 1896 | |
| 1897 | - if(isset($_SESSION['validation'])) { |
|
| 1897 | + if (isset($_SESSION['validation'])) { |
|
| 1898 | 1898 | print base64_decode('PGEgaHJlZj0naHR0cDovL3d3dy5zdWdhcmNybS5jb20nPlBPV0VSRUQmbmJzcDtCWSZuYnNwO1NVR0FSQ1JNPC9hPg=='); |
| 1899 | 1899 | } |
| 1900 | 1900 | } |
@@ -1906,7 +1906,7 @@ discard block |
||
| 1906 | 1906 | } |
| 1907 | 1907 | |
| 1908 | 1908 | function getArrowUpDownStart($upDown) { |
| 1909 | - $ext = ( SugarThemeRegistry::current()->pngSupport ? "png" : "gif" ); |
|
| 1909 | + $ext = (SugarThemeRegistry::current()->pngSupport ? "png" : "gif"); |
|
| 1910 | 1910 | |
| 1911 | 1911 | if (!isset($upDown) || empty($upDown)) { |
| 1912 | 1912 | $upDown = ""; |
@@ -1917,7 +1917,7 @@ discard block |
||
| 1917 | 1917 | function getArrowEnd() { |
| 1918 | 1918 | $imgFileParts = pathinfo(SugarThemeRegistry::current()->getImageURL("arrow.gif")); |
| 1919 | 1919 | |
| 1920 | - list($width,$height) = ListView::getArrowImageSize(); |
|
| 1920 | + list($width, $height) = ListView::getArrowImageSize(); |
|
| 1921 | 1921 | |
| 1922 | 1922 | return '.'.$imgFileParts['extension']."' width='$width' height='$height' align='absmiddle' alt=".translate('LBL_SORT').">"; |
| 1923 | 1923 | } |
@@ -1928,13 +1928,13 @@ discard block |
||
| 1928 | 1928 | } |
| 1929 | 1929 | $imgFileParts = pathinfo(SugarThemeRegistry::current()->getImageURL("arrow{$upDown}.gif")); |
| 1930 | 1930 | |
| 1931 | - list($width,$height) = ListView::getArrowUpDownImageSize($upDown); |
|
| 1931 | + list($width, $height) = ListView::getArrowUpDownImageSize($upDown); |
|
| 1932 | 1932 | |
| 1933 | 1933 | //get the right alt tag for the sort |
| 1934 | 1934 | $sortStr = translate('LBL_ALT_SORT'); |
| 1935 | - if($upDown == '_down'){ |
|
| 1935 | + if ($upDown == '_down') { |
|
| 1936 | 1936 | $sortStr = translate('LBL_ALT_SORT_DESC'); |
| 1937 | - }elseif($upDown == '_up'){ |
|
| 1937 | + }elseif ($upDown == '_up') { |
|
| 1938 | 1938 | $sortStr = translate('LBL_ALT_SORT_ASC'); |
| 1939 | 1939 | } |
| 1940 | 1940 | return " width='$width' height='$height' align='absmiddle' alt='$sortStr'>"; |
@@ -1942,13 +1942,13 @@ discard block |
||
| 1942 | 1942 | |
| 1943 | 1943 | function getArrowImageSize() { |
| 1944 | 1944 | // jbasicChartDashletsExpColust get the non-sort image's size.. the up and down have be the same. |
| 1945 | - $image = SugarThemeRegistry::current()->getImageURL("arrow.gif",false); |
|
| 1945 | + $image = SugarThemeRegistry::current()->getImageURL("arrow.gif", false); |
|
| 1946 | 1946 | |
| 1947 | 1947 | $cache_key = 'arrow_size.'.$image; |
| 1948 | 1948 | |
| 1949 | 1949 | // Check the cache |
| 1950 | 1950 | $result = sugar_cache_retrieve($cache_key); |
| 1951 | - if(!empty($result)) |
|
| 1951 | + if (!empty($result)) |
|
| 1952 | 1952 | return $result; |
| 1953 | 1953 | |
| 1954 | 1954 | // No cache hit. Calculate the value and return. |
@@ -1959,13 +1959,13 @@ discard block |
||
| 1959 | 1959 | |
| 1960 | 1960 | function getArrowUpDownImageSize($upDown) { |
| 1961 | 1961 | // just get the non-sort image's size.. the up and down have be the same. |
| 1962 | - $image = SugarThemeRegistry::current()->getImageURL("arrow{$upDown}.gif",false); |
|
| 1962 | + $image = SugarThemeRegistry::current()->getImageURL("arrow{$upDown}.gif", false); |
|
| 1963 | 1963 | |
| 1964 | 1964 | $cache_key = 'arrowupdown_size.'.$image; |
| 1965 | 1965 | |
| 1966 | 1966 | // Check the cache |
| 1967 | 1967 | $result = sugar_cache_retrieve($cache_key); |
| 1968 | - if(!empty($result)) |
|
| 1968 | + if (!empty($result)) |
|
| 1969 | 1969 | return $result; |
| 1970 | 1970 | |
| 1971 | 1971 | // No cache hit. Calculate the value and return. |
@@ -1979,7 +1979,7 @@ discard block |
||
| 1979 | 1979 | $orderBy = $this->getSessionVariable($html_varName, "OBL"); |
| 1980 | 1980 | $desc = $this->getSessionVariable($html_varName, $orderBy.'S'); |
| 1981 | 1981 | $orderBy = str_replace('.', '_', $orderBy); |
| 1982 | - return array($orderBy,$desc); |
|
| 1982 | + return array($orderBy, $desc); |
|
| 1983 | 1983 | } |
| 1984 | 1984 | |
| 1985 | 1985 | function processSortArrows($html_varName) |
@@ -1987,20 +1987,20 @@ discard block |
||
| 1987 | 1987 | |
| 1988 | 1988 | $this->xTemplateAssign("arrow_start", $this->getArrowStart()); |
| 1989 | 1989 | |
| 1990 | - list($orderBy,$desc) = $this->getOrderByInfo($html_varName); |
|
| 1990 | + list($orderBy, $desc) = $this->getOrderByInfo($html_varName); |
|
| 1991 | 1991 | |
| 1992 | 1992 | $imgArrow = "_up"; |
| 1993 | - if($desc) { |
|
| 1993 | + if ($desc) { |
|
| 1994 | 1994 | $imgArrow = "_down"; |
| 1995 | 1995 | } |
| 1996 | 1996 | /** |
| 1997 | 1997 | * @deprecated only used by legacy opportunites listview, nothing current. Leaving for BC |
| 1998 | 1998 | */ |
| 1999 | - if($orderBy == 'amount') |
|
| 1999 | + if ($orderBy == 'amount') |
|
| 2000 | 2000 | { |
| 2001 | 2001 | $this->xTemplateAssign('amount_arrow', $imgArrow); |
| 2002 | 2002 | } |
| 2003 | - else if($orderBy == 'amount_usdollar') |
|
| 2003 | + else if ($orderBy == 'amount_usdollar') |
|
| 2004 | 2004 | { |
| 2005 | 2005 | $this->xTemplateAssign('amount_usdollar_arrow', $imgArrow); |
| 2006 | 2006 | } |
@@ -2013,31 +2013,31 @@ discard block |
||
| 2013 | 2013 | } |
| 2014 | 2014 | |
| 2015 | 2015 | // this is where translation happens for dynamic list views |
| 2016 | - function loadListFieldDefs(&$subpanel_fields,&$child_focus) |
|
| 2016 | + function loadListFieldDefs(&$subpanel_fields, &$child_focus) |
|
| 2017 | 2017 | { |
| 2018 | 2018 | $this->list_field_defs = $subpanel_fields; |
| 2019 | 2019 | |
| 2020 | - for($i=0;$i < count($this->list_field_defs);$i++) |
|
| 2020 | + for ($i = 0; $i < count($this->list_field_defs); $i++) |
|
| 2021 | 2021 | { |
| 2022 | 2022 | $list_field = $this->list_field_defs[$i]; |
| 2023 | 2023 | $field_def = null; |
| 2024 | 2024 | $key = ''; |
| 2025 | - if(!empty($list_field['vname'])) |
|
| 2025 | + if (!empty($list_field['vname'])) |
|
| 2026 | 2026 | { |
| 2027 | 2027 | $key = $list_field['vname']; |
| 2028 | - } else if(isset($list_field['name']) && isset($child_focus->field_defs[$list_field['name']])) |
|
| 2028 | + } else if (isset($list_field['name']) && isset($child_focus->field_defs[$list_field['name']])) |
|
| 2029 | 2029 | { |
| 2030 | 2030 | $field_def = $child_focus->field_defs[$list_field['name']]; |
| 2031 | 2031 | $key = $field_def['vname']; |
| 2032 | 2032 | } |
| 2033 | - if(!empty($key)) |
|
| 2033 | + if (!empty($key)) |
|
| 2034 | 2034 | { |
| 2035 | - $list_field['label'] = translate($key,$child_focus->module_dir); |
|
| 2036 | - $this->list_field_defs[$i]['label'] = preg_replace('/:$/','',$list_field['label']); |
|
| 2035 | + $list_field['label'] = translate($key, $child_focus->module_dir); |
|
| 2036 | + $this->list_field_defs[$i]['label'] = preg_replace('/:$/', '', $list_field['label']); |
|
| 2037 | 2037 | } |
| 2038 | 2038 | else |
| 2039 | 2039 | { |
| 2040 | - $this->list_field_defs[$i]['label'] =' '; |
|
| 2040 | + $this->list_field_defs[$i]['label'] = ' '; |
|
| 2041 | 2041 | } |
| 2042 | 2042 | } |
| 2043 | 2043 | } |
@@ -2052,7 +2052,7 @@ discard block |
||
| 2052 | 2052 | * All Rights Reserved. |
| 2053 | 2053 | * Contributor(s): ______________________________________. |
| 2054 | 2054 | */ |
| 2055 | - function setLocalSessionVariable($localVarName,$varName, $value) { |
|
| 2055 | + function setLocalSessionVariable($localVarName, $varName, $value) { |
|
| 2056 | 2056 | $_SESSION[$localVarName."_".$varName] = $value; |
| 2057 | 2057 | } |
| 2058 | 2058 | |
@@ -2062,11 +2062,11 @@ discard block |
||
| 2062 | 2062 | * All Rights Reserved. |
| 2063 | 2063 | * Contributor(s): ______________________________________. |
| 2064 | 2064 | */ |
| 2065 | - function getLocalSessionVariable($localVarName,$varName) { |
|
| 2066 | - if(isset($_SESSION[$localVarName."_".$varName])) { |
|
| 2065 | + function getLocalSessionVariable($localVarName, $varName) { |
|
| 2066 | + if (isset($_SESSION[$localVarName."_".$varName])) { |
|
| 2067 | 2067 | return $_SESSION[$localVarName."_".$varName]; |
| 2068 | 2068 | } |
| 2069 | - else{ |
|
| 2069 | + else { |
|
| 2070 | 2070 | return ""; |
| 2071 | 2071 | } |
| 2072 | 2072 | } |
@@ -2074,7 +2074,7 @@ discard block |
||
| 2074 | 2074 | /* Set to true if you want Additional Details to appear in the listview |
| 2075 | 2075 | */ |
| 2076 | 2076 | function setAdditionalDetails($value = true, $function = '') { |
| 2077 | - if(!empty($function)) $this->additionalDetailsFunction = $function; |
|
| 2077 | + if (!empty($function)) $this->additionalDetailsFunction = $function; |
|
| 2078 | 2078 | $this->_additionalDetails = $value; |
| 2079 | 2079 | } |
| 2080 | 2080 | |
@@ -1,5 +1,7 @@ discard block |
||
| 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. |
@@ -135,9 +137,13 @@ discard block |
||
| 135 | 137 | } |
| 136 | 138 | |
| 137 | 139 | //when processing a multi-select popup. |
| 138 | - if($this->process_for_popups && $this->multi_select_popup) $this->shouldProcess =true; |
|
| 140 | + if($this->process_for_popups && $this->multi_select_popup) { |
|
| 141 | + $this->shouldProcess =true; |
|
| 142 | + } |
|
| 139 | 143 | //mass update turned off? |
| 140 | - if(!$this->show_mass_update) $this->shouldProcess = false; |
|
| 144 | + if(!$this->show_mass_update) { |
|
| 145 | + $this->shouldProcess = false; |
|
| 146 | + } |
|
| 141 | 147 | if(is_subclass_of($seed, "SugarBean")) { |
| 142 | 148 | if($seed->bean_implements('ACL')) { |
| 143 | 149 | if(!ACLController::checkAccess($seed->module_dir,'list',true)) { |
@@ -188,8 +194,9 @@ discard block |
||
| 188 | 194 | { |
| 189 | 195 | $this->source_module = $source_module; |
| 190 | 196 | $this->subpanel_module = $subpanel_def->name; |
| 191 | - if(!isset($this->xTemplate)) |
|
| 192 | - $this->createXTemplate(); |
|
| 197 | + if(!isset($this->xTemplate)) { |
|
| 198 | + $this->createXTemplate(); |
|
| 199 | + } |
|
| 193 | 200 | |
| 194 | 201 | $html_var = $this->subpanel_module . "_CELL"; |
| 195 | 202 | |
@@ -280,8 +287,9 @@ discard block |
||
| 280 | 287 | if ( empty($data) ) { |
| 281 | 288 | $this->xTemplate->assign("ROW_COLOR", 'oddListRow'); |
| 282 | 289 | $thepanel=$subpanel_def; |
| 283 | - if($subpanel_def->isCollection()) |
|
| 284 | - $thepanel=$subpanel_def->get_header_panel_def(); |
|
| 290 | + if($subpanel_def->isCollection()) { |
|
| 291 | + $thepanel=$subpanel_def->get_header_panel_def(); |
|
| 292 | + } |
|
| 285 | 293 | $this->xTemplate->assign("COL_COUNT", count($thepanel->get_list_fields())); |
| 286 | 294 | $this->xTemplate->parse($xtemplateSection.".nodata"); |
| 287 | 295 | } |
@@ -339,8 +347,7 @@ discard block |
||
| 339 | 347 | { |
| 340 | 348 | $ROW_COLOR = 'oddListRow'; |
| 341 | 349 | $BG_COLOR = $odd_bg; |
| 342 | - } |
|
| 343 | - else |
|
| 350 | + } else |
|
| 344 | 351 | { |
| 345 | 352 | $ROW_COLOR = 'evenListRow'; |
| 346 | 353 | $BG_COLOR = $even_bg; |
@@ -353,8 +360,9 @@ discard block |
||
| 353 | 360 | $layout_manager->setAttribute('context','List'); |
| 354 | 361 | $layout_manager->setAttribute('image_path',$this->local_image_path); |
| 355 | 362 | $layout_manager->setAttribute('module_name', $subpanel_def->_instance_properties['module']); |
| 356 | - if(!empty($this->child_focus)) |
|
| 357 | - $layout_manager->setAttribute('related_module_name',$this->child_focus->module_dir); |
|
| 363 | + if(!empty($this->child_focus)) { |
|
| 364 | + $layout_manager->setAttribute('related_module_name',$this->child_focus->module_dir); |
|
| 365 | + } |
|
| 358 | 366 | |
| 359 | 367 | //AG$subpanel_data = $this->list_field_defs; |
| 360 | 368 | //$bla = array_pop($subpanel_data); |
@@ -389,7 +397,9 @@ discard block |
||
| 389 | 397 | $linked_field=$thepanel->get_data_source_name(); |
| 390 | 398 | $linked_field_set=$thepanel->get_data_source_name(true); |
| 391 | 399 | static $count; |
| 392 | - if(!isset($count))$count = 0; |
|
| 400 | + if(!isset($count)) { |
|
| 401 | + $count = 0; |
|
| 402 | + } |
|
| 393 | 403 | /* BEGIN - SECURITY GROUPS */ |
| 394 | 404 | /** |
| 395 | 405 | $field_acl['DetailView'] = $aItem->ACLAccess('DetailView'); |
@@ -420,7 +430,7 @@ discard block |
||
| 420 | 430 | $this->xTemplate->assign('CELL', $widget_contents); |
| 421 | 431 | $this->xTemplate->parse($xtemplateSection.".row.cell"); |
| 422 | 432 | |
| 423 | - }else if($usage != 'query_only') |
|
| 433 | + } else if($usage != 'query_only') |
|
| 424 | 434 | { |
| 425 | 435 | $list_field['name']=$field_name; |
| 426 | 436 | |
@@ -435,8 +445,11 @@ discard block |
||
| 435 | 445 | $list_field['owner_id'] = false; |
| 436 | 446 | $list_field['owner_module'] = false; |
| 437 | 447 | } |
| 438 | - if(isset($list_field['alias'])) $list_field['name'] = $list_field['alias']; |
|
| 439 | - else $list_field['name']=$field_name; |
|
| 448 | + if(isset($list_field['alias'])) { |
|
| 449 | + $list_field['name'] = $list_field['alias']; |
|
| 450 | + } else { |
|
| 451 | + $list_field['name']=$field_name; |
|
| 452 | + } |
|
| 440 | 453 | $list_field['fields'] = $fields; |
| 441 | 454 | $list_field['module'] = $aItem->module_dir; |
| 442 | 455 | $list_field['start_link_wrapper'] = $this->start_link_wrapper; |
@@ -485,7 +498,9 @@ discard block |
||
| 485 | 498 | $count++; |
| 486 | 499 | $this->xTemplate->assign('CELL_COUNT', $count); |
| 487 | 500 | $this->xTemplate->assign('CLASS', ""); |
| 488 | - if ( empty($widget_contents) ) $widget_contents = ' '; |
|
| 501 | + if ( empty($widget_contents) ) { |
|
| 502 | + $widget_contents = ' '; |
|
| 503 | + } |
|
| 489 | 504 | $this->xTemplate->assign('CELL', $widget_contents); |
| 490 | 505 | $this->xTemplate->parse($xtemplateSection.".row.cell"); |
| 491 | 506 | } else { |
@@ -495,7 +510,9 @@ discard block |
||
| 495 | 510 | $widget_contents = $layout_manager->widgetDisplay($list_field); |
| 496 | 511 | $this->xTemplate->assign('CELL_COUNT', $count); |
| 497 | 512 | $this->xTemplate->assign('CLASS', ""); |
| 498 | - if ( empty($widget_contents) ) $widget_contents = ' '; |
|
| 513 | + if ( empty($widget_contents) ) { |
|
| 514 | + $widget_contents = ' '; |
|
| 515 | + } |
|
| 499 | 516 | $this->xTemplate->assign('CELL', $widget_contents); |
| 500 | 517 | $this->xTemplate->parse($xtemplateSection.".row.cell"); |
| 501 | 518 | } elseif (preg_match("/button/i", $list_field['name'])) { |
@@ -503,8 +520,7 @@ discard block |
||
| 503 | 520 | { |
| 504 | 521 | $button_contents[] = $_content; |
| 505 | 522 | unset($_content); |
| 506 | - } |
|
| 507 | - else |
|
| 523 | + } else |
|
| 508 | 524 | { |
| 509 | 525 | $button_contents[] = ''; |
| 510 | 526 | } |
@@ -513,7 +529,9 @@ discard block |
||
| 513 | 529 | $this->xTemplate->assign('CLASS', ""); |
| 514 | 530 | $widget_contents = $layout_manager->widgetDisplay($list_field); |
| 515 | 531 | $this->xTemplate->assign('CELL_COUNT', $count); |
| 516 | - if ( empty($widget_contents) ) $widget_contents = ' '; |
|
| 532 | + if ( empty($widget_contents) ) { |
|
| 533 | + $widget_contents = ' '; |
|
| 534 | + } |
|
| 517 | 535 | $this->xTemplate->assign('CELL', $widget_contents); |
| 518 | 536 | $this->xTemplate->parse($xtemplateSection.".row.cell"); |
| 519 | 537 | } |
@@ -541,8 +559,7 @@ discard block |
||
| 541 | 559 | 'class' => 'clickMenu subpanel records fancymenu button', |
| 542 | 560 | 'flat' => false //assign flat value as false to display dropdown menu at any other preferences. |
| 543 | 561 | ), $this->xTemplate); |
| 544 | - } |
|
| 545 | - else |
|
| 562 | + } else |
|
| 546 | 563 | { |
| 547 | 564 | $action_button = ''; |
| 548 | 565 | } |
@@ -602,8 +619,7 @@ discard block |
||
| 602 | 619 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 603 | 620 | if(isset($GLOBALS['log'])) { |
| 604 | 621 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 605 | - } |
|
| 606 | - else { |
|
| 622 | + } else { |
|
| 607 | 623 | trigger_error($deprecatedMessage, E_USER_DEPRECATED); |
| 608 | 624 | } |
| 609 | 625 | self::__construct(); |
@@ -645,11 +661,13 @@ discard block |
||
| 645 | 661 | */ |
| 646 | 662 | function initNewXTemplate($XTemplatePath, $modString, $imagePath = null) { |
| 647 | 663 | $this->setXTemplatePath($XTemplatePath); |
| 648 | - if(isset($modString)) |
|
| 649 | - $this->setModStrings($modString); |
|
| 650 | - if(isset($imagePath)) |
|
| 651 | - $this->setImagePath($imagePath); |
|
| 652 | -} |
|
| 664 | + if(isset($modString)) { |
|
| 665 | + $this->setModStrings($modString); |
|
| 666 | + } |
|
| 667 | + if(isset($imagePath)) { |
|
| 668 | + $this->setImagePath($imagePath); |
|
| 669 | + } |
|
| 670 | + } |
|
| 653 | 671 | |
| 654 | 672 | |
| 655 | 673 | function getOrderBy($varName, $defaultOrderBy='', $force_sortorder='') { |
@@ -730,7 +748,7 @@ discard block |
||
| 730 | 748 | } |
| 731 | 749 | //Just clear from url... |
| 732 | 750 | $this->appendToBaseUrl[$orderByColumn] = false; |
| 733 | - }else { |
|
| 751 | + } else { |
|
| 734 | 752 | $this->query_orderby = ""; |
| 735 | 753 | } |
| 736 | 754 | $this->sortby = $sortBy; |
@@ -775,8 +793,10 @@ discard block |
||
| 775 | 793 | */ |
| 776 | 794 | function setTheme($theme) { |
| 777 | 795 | $this->local_theme = $theme; |
| 778 | - if(isset($this->xTemplate))$this->xTemplate->assign("THEME", $this->local_theme); |
|
| 779 | -} |
|
| 796 | + if(isset($this->xTemplate)) { |
|
| 797 | + $this->xTemplate->assign("THEME", $this->local_theme); |
|
| 798 | + } |
|
| 799 | + } |
|
| 780 | 800 | |
| 781 | 801 | /**sets the AppStrings used only use if it is different from the global |
| 782 | 802 | * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc. |
@@ -786,8 +806,10 @@ discard block |
||
| 786 | 806 | function setAppStrings($app_strings) { |
| 787 | 807 | unset($this->local_app_strings); |
| 788 | 808 | $this->local_app_strings = $app_strings; |
| 789 | - if(isset($this->xTemplate))$this->xTemplate->assign("APP", $this->local_app_strings); |
|
| 790 | -} |
|
| 809 | + if(isset($this->xTemplate)) { |
|
| 810 | + $this->xTemplate->assign("APP", $this->local_app_strings); |
|
| 811 | + } |
|
| 812 | + } |
|
| 791 | 813 | |
| 792 | 814 | /**sets the ModStrings used |
| 793 | 815 | * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc. |
@@ -797,8 +819,10 @@ discard block |
||
| 797 | 819 | function setModStrings($mod_strings) { |
| 798 | 820 | unset($this->local_module_strings); |
| 799 | 821 | $this->local_mod_strings = $mod_strings; |
| 800 | - if(isset($this->xTemplate))$this->xTemplate->assign("MOD", $this->local_mod_strings); |
|
| 801 | -} |
|
| 822 | + if(isset($this->xTemplate)) { |
|
| 823 | + $this->xTemplate->assign("MOD", $this->local_mod_strings); |
|
| 824 | + } |
|
| 825 | + } |
|
| 802 | 826 | |
| 803 | 827 | /**sets the ImagePath used |
| 804 | 828 | * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc. |
@@ -810,8 +834,10 @@ discard block |
||
| 810 | 834 | if(empty($this->local_image_path)) { |
| 811 | 835 | $this->local_image_path = SugarThemeRegistry::get($this->local_theme)->getImagePath(); |
| 812 | 836 | } |
| 813 | - if(isset($this->xTemplate))$this->xTemplate->assign("IMAGE_PATH", $this->local_image_path); |
|
| 814 | -} |
|
| 837 | + if(isset($this->xTemplate)) { |
|
| 838 | + $this->xTemplate->assign("IMAGE_PATH", $this->local_image_path); |
|
| 839 | + } |
|
| 840 | + } |
|
| 815 | 841 | |
| 816 | 842 | /**sets the currentModule only use if this is different from the global |
| 817 | 843 | * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc. |
@@ -821,8 +847,10 @@ discard block |
||
| 821 | 847 | function setCurrentModule($currentModule) { |
| 822 | 848 | unset($this->local_current_module); |
| 823 | 849 | $this->local_current_module = $currentModule; |
| 824 | - if(isset($this->xTemplate))$this->xTemplate->assign("MODULE_NAME", $this->local_current_module); |
|
| 825 | -} |
|
| 850 | + if(isset($this->xTemplate)) { |
|
| 851 | + $this->xTemplate->assign("MODULE_NAME", $this->local_current_module); |
|
| 852 | + } |
|
| 853 | + } |
|
| 826 | 854 | |
| 827 | 855 | /**INTERNAL FUNCTION creates an XTemplate DO NOT CALL THIS THIS IS AN INTERNAL FUNCTION |
| 828 | 856 | * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc. |
@@ -835,7 +863,9 @@ discard block |
||
| 835 | 863 | |
| 836 | 864 | $this->xTemplate = new XTemplate($this->xTemplatePath); |
| 837 | 865 | $this->xTemplate->assign("APP", $this->local_app_strings); |
| 838 | - if(isset($this->local_mod_strings))$this->xTemplate->assign("MOD", $this->local_mod_strings); |
|
| 866 | + if(isset($this->local_mod_strings)) { |
|
| 867 | + $this->xTemplate->assign("MOD", $this->local_mod_strings); |
|
| 868 | + } |
|
| 839 | 869 | $this->xTemplate->assign("THEME", $this->local_theme); |
| 840 | 870 | $this->xTemplate->assign("IMAGE_PATH", $this->local_image_path); |
| 841 | 871 | $this->xTemplate->assign("MODULE_NAME", $this->local_current_module); |
@@ -912,7 +942,9 @@ discard block |
||
| 912 | 942 | } |
| 913 | 943 | |
| 914 | 944 | function setUserVariable($localVarName,$varName, $value) { |
| 915 | - if($this->is_dynamic || $localVarName == 'CELL')return; |
|
| 945 | + if($this->is_dynamic || $localVarName == 'CELL') { |
|
| 946 | + return; |
|
| 947 | + } |
|
| 916 | 948 | global $current_user; |
| 917 | 949 | $current_user->setPreference($this->local_current_module."_".$localVarName."_".$varName, $value); |
| 918 | 950 | } |
@@ -936,7 +968,9 @@ discard block |
||
| 936 | 968 | |
| 937 | 969 | function getUserVariable($localVarName, $varName) { |
| 938 | 970 | global $current_user; |
| 939 | - if($this->is_dynamic || $localVarName == 'CELL')return; |
|
| 971 | + if($this->is_dynamic || $localVarName == 'CELL') { |
|
| 972 | + return; |
|
| 973 | + } |
|
| 940 | 974 | if(isset($_REQUEST[$this->getSessionVariableName($localVarName, $varName)])) { |
| 941 | 975 | |
| 942 | 976 | $this->setUserVariable($localVarName,$varName,$_REQUEST[$this->getSessionVariableName($localVarName, $varName)]); |
@@ -1015,11 +1049,21 @@ discard block |
||
| 1015 | 1049 | //$filter = array('id', 'full_name'); |
| 1016 | 1050 | $filter=array(); |
| 1017 | 1051 | $ret_array = $seed->create_new_list_query($this->query_orderby, $this->query_where, $filter, $params, 0, '', true, $seed, true); |
| 1018 | - if(!is_array($params)) $params = array(); |
|
| 1019 | - if(!isset($params['custom_select'])) $params['custom_select'] = ''; |
|
| 1020 | - if(!isset($params['custom_from'])) $params['custom_from'] = ''; |
|
| 1021 | - if(!isset($params['custom_where'])) $params['custom_where'] = ''; |
|
| 1022 | - if(!isset($params['custom_order_by'])) $params['custom_order_by'] = ''; |
|
| 1052 | + if(!is_array($params)) { |
|
| 1053 | + $params = array(); |
|
| 1054 | + } |
|
| 1055 | + if(!isset($params['custom_select'])) { |
|
| 1056 | + $params['custom_select'] = ''; |
|
| 1057 | + } |
|
| 1058 | + if(!isset($params['custom_from'])) { |
|
| 1059 | + $params['custom_from'] = ''; |
|
| 1060 | + } |
|
| 1061 | + if(!isset($params['custom_where'])) { |
|
| 1062 | + $params['custom_where'] = ''; |
|
| 1063 | + } |
|
| 1064 | + if(!isset($params['custom_order_by'])) { |
|
| 1065 | + $params['custom_order_by'] = ''; |
|
| 1066 | + } |
|
| 1023 | 1067 | $main_query = $ret_array['select'] . $params['custom_select'] . $ret_array['from'] . $params['custom_from'] . $ret_array['where'] . $params['custom_where'] . $ret_array['order_by'] . $params['custom_order_by']; |
| 1024 | 1068 | SugarVCR::store($seed->module_dir, $main_query); |
| 1025 | 1069 | //ADDING VCR CONTROL |
@@ -1080,8 +1124,7 @@ discard block |
||
| 1080 | 1124 | { |
| 1081 | 1125 | $sort_order['session'] = $sort_order['session'] == 'asc' ? 'desc' : 'asc'; |
| 1082 | 1126 | } |
| 1083 | - } |
|
| 1084 | - else |
|
| 1127 | + } else |
|
| 1085 | 1128 | { |
| 1086 | 1129 | $sort_order['session'] = null; |
| 1087 | 1130 | } |
@@ -1113,7 +1156,7 @@ discard block |
||
| 1113 | 1156 | if(!empty($this->response)){ |
| 1114 | 1157 | $response =& $this->response; |
| 1115 | 1158 | echo 'cached'; |
| 1116 | - }else{ |
|
| 1159 | + } else{ |
|
| 1117 | 1160 | $response = SugarBean::get_union_related_list($sugarbean,$this->sortby, $this->sort_order, $this->query_where, $current_offset, -1, $this->records_per_page,$this->query_limit,$subpanel_def); |
| 1118 | 1161 | $this->response =& $response; |
| 1119 | 1162 | } |
@@ -1121,7 +1164,9 @@ discard block |
||
| 1121 | 1164 | $row_count = $response['row_count']; |
| 1122 | 1165 | $next_offset = $response['next_offset']; |
| 1123 | 1166 | $previous_offset = $response['previous_offset']; |
| 1124 | - if(!empty($response['current_offset']))$current_offset = $response['current_offset']; |
|
| 1167 | + if(!empty($response['current_offset'])) { |
|
| 1168 | + $current_offset = $response['current_offset']; |
|
| 1169 | + } |
|
| 1125 | 1170 | global $list_view_row_count; |
| 1126 | 1171 | $list_view_row_count = $row_count; |
| 1127 | 1172 | $this->processListNavigation('dyn_list_view', $html_var, $current_offset, $next_offset, $previous_offset, $row_count, $sugarbean,$subpanel_def); |
@@ -1132,7 +1177,9 @@ discard block |
||
| 1132 | 1177 | function getBaseURL($html_varName) { |
| 1133 | 1178 | static $cache = array(); |
| 1134 | 1179 | |
| 1135 | - if(!empty($cache[$html_varName]))return $cache[$html_varName]; |
|
| 1180 | + if(!empty($cache[$html_varName])) { |
|
| 1181 | + return $cache[$html_varName]; |
|
| 1182 | + } |
|
| 1136 | 1183 | $blockVariables = array('mass', 'uid', 'massupdate', 'delete', 'merge', 'selectCount','current_query_by_page'); |
| 1137 | 1184 | if(!empty($this->base_URL)) { |
| 1138 | 1185 | return $this->base_URL; |
@@ -1152,10 +1199,11 @@ discard block |
||
| 1152 | 1199 | { |
| 1153 | 1200 | if(is_array($value)) { |
| 1154 | 1201 | foreach($value as $valuename=>$valuevalue) { |
| 1155 | - if(substr_count($baseurl, '?') > 0) |
|
| 1156 | - $baseurl .= "&{$name}[]=".$valuevalue; |
|
| 1157 | - else |
|
| 1158 | - $baseurl .= "?{$name}[]=".$valuevalue; |
|
| 1202 | + if(substr_count($baseurl, '?') > 0) { |
|
| 1203 | + $baseurl .= "&{$name}[]=".$valuevalue; |
|
| 1204 | + } else { |
|
| 1205 | + $baseurl .= "?{$name}[]=".$valuevalue; |
|
| 1206 | + } |
|
| 1159 | 1207 | } |
| 1160 | 1208 | } else { |
| 1161 | 1209 | $value = urlencode($value); |
@@ -1174,9 +1222,15 @@ discard block |
||
| 1174 | 1222 | if(substr_count($baseurl, '?') == 0) { |
| 1175 | 1223 | $baseurl .= '?'; |
| 1176 | 1224 | } |
| 1177 | - if(isset($_REQUEST['action'])) $baseurl.= '&action='.$_REQUEST['action']; |
|
| 1178 | - if(isset($_REQUEST['record'])) $baseurl .= '&record='.$_REQUEST['record']; |
|
| 1179 | - if(isset($_REQUEST['module'])) $baseurl .= '&module='.$_REQUEST['module']; |
|
| 1225 | + if(isset($_REQUEST['action'])) { |
|
| 1226 | + $baseurl.= '&action='.$_REQUEST['action']; |
|
| 1227 | + } |
|
| 1228 | + if(isset($_REQUEST['record'])) { |
|
| 1229 | + $baseurl .= '&record='.$_REQUEST['record']; |
|
| 1230 | + } |
|
| 1231 | + if(isset($_REQUEST['module'])) { |
|
| 1232 | + $baseurl .= '&module='.$_REQUEST['module']; |
|
| 1233 | + } |
|
| 1180 | 1234 | } |
| 1181 | 1235 | |
| 1182 | 1236 | $baseurl .= "&".ListView::getSessionVariableName($html_varName,"offset")."="; |
@@ -1203,11 +1257,13 @@ discard block |
||
| 1203 | 1257 | |
| 1204 | 1258 | $start_record = $current_offset + 1; |
| 1205 | 1259 | |
| 1206 | - if(!is_numeric($col_count)) |
|
| 1207 | - $col_count = 20; |
|
| 1260 | + if(!is_numeric($col_count)) { |
|
| 1261 | + $col_count = 20; |
|
| 1262 | + } |
|
| 1208 | 1263 | |
| 1209 | - if($row_count == 0) |
|
| 1210 | - $start_record = 0; |
|
| 1264 | + if($row_count == 0) { |
|
| 1265 | + $start_record = 0; |
|
| 1266 | + } |
|
| 1211 | 1267 | |
| 1212 | 1268 | $end_record = $start_record + $this->records_per_page; |
| 1213 | 1269 | // back up the the last page. |
@@ -1215,10 +1271,11 @@ discard block |
||
| 1215 | 1271 | $end_record = $row_count+1; |
| 1216 | 1272 | } |
| 1217 | 1273 | // Determine the start location of the last page |
| 1218 | - if($row_count == 0) |
|
| 1219 | - $number_pages = 0; |
|
| 1220 | - else |
|
| 1221 | - $number_pages = floor(($row_count - 1) / $this->records_per_page); |
|
| 1274 | + if($row_count == 0) { |
|
| 1275 | + $number_pages = 0; |
|
| 1276 | + } else { |
|
| 1277 | + $number_pages = floor(($row_count - 1) / $this->records_per_page); |
|
| 1278 | + } |
|
| 1222 | 1279 | |
| 1223 | 1280 | $last_offset = $number_pages * $this->records_per_page; |
| 1224 | 1281 | |
@@ -1278,7 +1335,7 @@ discard block |
||
| 1278 | 1335 | $onClick = ''; |
| 1279 | 1336 | if(0 != preg_match('/javascript.*/', $start_URL)){ |
| 1280 | 1337 | $onClick = "\"$start_URL;\""; |
| 1281 | - }else{ |
|
| 1338 | + } else{ |
|
| 1282 | 1339 | $onClick ="'location.href=\"$start_URL\";'"; |
| 1283 | 1340 | } |
| 1284 | 1341 | $start_link = "<button type='button' class='button' name='listViewStartButton' title='{$this->local_app_strings['LNK_LIST_START']}' onClick=".$onClick.">".SugarThemeRegistry::current()->getImage("start","border='0' align='absmiddle'",null,null,'.gif',$this->local_app_strings['LNK_LIST_START'])."</button>"; |
@@ -1286,7 +1343,7 @@ discard block |
||
| 1286 | 1343 | $onClick = ''; |
| 1287 | 1344 | if(0 != preg_match('/javascript.*/', $previous_URL)){ |
| 1288 | 1345 | $onClick = "\"$previous_URL;\""; |
| 1289 | - }else{ |
|
| 1346 | + } else{ |
|
| 1290 | 1347 | $onClick = "'location.href=\"$previous_URL\";'"; |
| 1291 | 1348 | } |
| 1292 | 1349 | $previous_link = "<button type='button' class='button' name='listViewPrevButton' title='{$this->local_app_strings['LNK_LIST_PREVIOUS']}' onClick=".$onClick.">".SugarThemeRegistry::current()->getImage("previous","border='0' align='absmiddle'",null,null,'.gif',$this->local_app_strings['LNK_LIST_PREVIOUS'])."</button>"; |
@@ -1310,7 +1367,7 @@ discard block |
||
| 1310 | 1367 | $onClick = ''; |
| 1311 | 1368 | if(0 != preg_match('/javascript.*/', $next_URL)){ |
| 1312 | 1369 | $onClick = "\"$next_URL;\""; |
| 1313 | - }else{ |
|
| 1370 | + } else{ |
|
| 1314 | 1371 | $onClick ="'location.href=\"$next_URL\";'"; |
| 1315 | 1372 | } |
| 1316 | 1373 | $next_link = "<button type='button' name='listViewNextButton' class='button' title='{$this->local_app_strings['LNK_LIST_NEXT']}' onClick=".$onClick.">".SugarThemeRegistry::current()->getImage("next","border='0' align='absmiddle'",null,null,'.gif',$this->local_app_strings['LNK_LIST_NEXT'])."</button>"; |
@@ -1318,7 +1375,7 @@ discard block |
||
| 1318 | 1375 | $onClick = ''; |
| 1319 | 1376 | if(0 != preg_match('/javascript.*/', $end_URL)){ |
| 1320 | 1377 | $onClick = "\"$end_URL;\""; |
| 1321 | - }else{ |
|
| 1378 | + } else{ |
|
| 1322 | 1379 | $onClick = "'location.href=\"$end_URL\";'"; |
| 1323 | 1380 | } |
| 1324 | 1381 | $end_link = "<button type='button' name='listViewEndButton' class='button' title='{$this->local_app_strings['LNK_LIST_END']}' onClick=".$onClick.">".SugarThemeRegistry::current()->getImage("end","border='0' align='absmiddle'",null,null,'.gif',$this->local_app_strings['LNK_LIST_END'])."</button>"; |
@@ -1467,18 +1524,17 @@ discard block |
||
| 1467 | 1524 | //attempt to get the query to recreate this subpanel |
| 1468 | 1525 | if(!empty($this->response)){ |
| 1469 | 1526 | $response =& $this->response; |
| 1470 | - }else{ |
|
| 1527 | + } else{ |
|
| 1471 | 1528 | $response = SugarBean::get_union_related_list($sugarbean,$this->sortby, $this->sort_order, $this->query_where, $current_offset, -1, $this->records_per_page,$this->query_limit,$subpanel_def); |
| 1472 | 1529 | $this->response = $response; |
| 1473 | 1530 | } |
| 1474 | 1531 | //if query is present, then pass it in as parameter |
| 1475 | 1532 | if (isset($response['query']) && !empty($response['query'])){ |
| 1476 | 1533 | $html_text .= $subpanelTiles->get_buttons($subpanel_def, $response['query']); |
| 1477 | - }else{ |
|
| 1534 | + } else{ |
|
| 1478 | 1535 | $html_text .= $subpanelTiles->get_buttons($subpanel_def); |
| 1479 | 1536 | } |
| 1480 | - } |
|
| 1481 | - else { |
|
| 1537 | + } else { |
|
| 1482 | 1538 | $html_text .= "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\"><tr><td align=\"left\" nowrap>$select_link $export_link $delete_link $selected_objects_span"; |
| 1483 | 1539 | } |
| 1484 | 1540 | $html_text .= "</td>\n<td nowrap align=\"right\">".$start_link." ".$previous_link." <span class='pageNumbers'>(".$start_record." - ".$end_record." ".$this->local_app_strings['LBL_LIST_OF']." ".$row_count.")</span> ".$next_link." ".$end_link."</td></tr></table>\n"; |
@@ -1506,9 +1562,15 @@ discard block |
||
| 1506 | 1562 | } |
| 1507 | 1563 | if($_SERVER['REQUEST_METHOD'] == 'POST') { |
| 1508 | 1564 | $this->base_URL .= '?'; |
| 1509 | - if(isset($_REQUEST['action'])) $this->base_URL .= '&action='.$_REQUEST['action']; |
|
| 1510 | - if(isset($_REQUEST['record'])) $this->base_URL .= '&record='.$_REQUEST['record']; |
|
| 1511 | - if(isset($_REQUEST['module'])) $this->base_URL .= '&module='.$_REQUEST['module']; |
|
| 1565 | + if(isset($_REQUEST['action'])) { |
|
| 1566 | + $this->base_URL .= '&action='.$_REQUEST['action']; |
|
| 1567 | + } |
|
| 1568 | + if(isset($_REQUEST['record'])) { |
|
| 1569 | + $this->base_URL .= '&record='.$_REQUEST['record']; |
|
| 1570 | + } |
|
| 1571 | + if(isset($_REQUEST['module'])) { |
|
| 1572 | + $this->base_URL .= '&module='.$_REQUEST['module']; |
|
| 1573 | + } |
|
| 1512 | 1574 | } |
| 1513 | 1575 | $this->base_URL .= "&".$this->getSessionVariableName($html_varName,"offset")."="; |
| 1514 | 1576 | } |
@@ -1639,8 +1701,7 @@ discard block |
||
| 1639 | 1701 | { |
| 1640 | 1702 | $ROW_COLOR = 'oddListRow'; |
| 1641 | 1703 | $BG_COLOR = $odd_bg; |
| 1642 | - } |
|
| 1643 | - else |
|
| 1704 | + } else |
|
| 1644 | 1705 | { |
| 1645 | 1706 | $ROW_COLOR = 'evenListRow'; |
| 1646 | 1707 | $BG_COLOR = $even_bg; |
@@ -1656,8 +1717,7 @@ discard block |
||
| 1656 | 1717 | $this->xTemplate->assign('VALUE', $aItem); |
| 1657 | 1718 | $this->xTemplate->assign('INDEX', $count); |
| 1658 | 1719 | |
| 1659 | - } |
|
| 1660 | - else |
|
| 1720 | + } else |
|
| 1661 | 1721 | { |
| 1662 | 1722 | //AED -- some modules do not have their additionalDetails.php established. Add a check to ensure require_once does not fail |
| 1663 | 1723 | // Bug #2786 |
@@ -1673,7 +1733,9 @@ discard block |
||
| 1673 | 1733 | $results = $ad_function($fields); |
| 1674 | 1734 | $results['string'] = str_replace(array("'", "'"), '\'', $results['string']); // no xss! |
| 1675 | 1735 | |
| 1676 | - if(trim($results['string']) == '') $results['string'] = $app_strings['LBL_NONE']; |
|
| 1736 | + if(trim($results['string']) == '') { |
|
| 1737 | + $results['string'] = $app_strings['LBL_NONE']; |
|
| 1738 | + } |
|
| 1677 | 1739 | $fields[$results['fieldToAddTo']] = $fields[$results['fieldToAddTo']].'</a>'; |
| 1678 | 1740 | } |
| 1679 | 1741 | |
@@ -1797,12 +1859,21 @@ discard block |
||
| 1797 | 1859 | $cell_width = empty($widget_args['width']) ? '' : $widget_args['width']; |
| 1798 | 1860 | $this->xTemplate->assign('HEADER_CELL', $widget_contents); |
| 1799 | 1861 | static $count; |
| 1800 | - if(!isset($count))$count = 0; else $count++; |
|
| 1801 | - if($col_count == 0 || $column_name == 'name') $footable = 'data-toggle="true"'; |
|
| 1802 | - else { |
|
| 1862 | + if(!isset($count)) { |
|
| 1863 | + $count = 0; |
|
| 1864 | + } else { |
|
| 1865 | + $count++; |
|
| 1866 | + } |
|
| 1867 | + if($col_count == 0 || $column_name == 'name') { |
|
| 1868 | + $footable = 'data-toggle="true"'; |
|
| 1869 | + } else { |
|
| 1803 | 1870 | $footable = 'data-hide="phone"'; |
| 1804 | - if ($col_count > 2) $footable = 'data-hide="phone,phonelandscape"'; |
|
| 1805 | - if ($col_count > 4) $footable = 'data-hide="phone,phonelandscape,tablet"'; |
|
| 1871 | + if ($col_count > 2) { |
|
| 1872 | + $footable = 'data-hide="phone,phonelandscape"'; |
|
| 1873 | + } |
|
| 1874 | + if ($col_count > 4) { |
|
| 1875 | + $footable = 'data-hide="phone,phonelandscape,tablet"'; |
|
| 1876 | + } |
|
| 1806 | 1877 | } |
| 1807 | 1878 | $this->xTemplate->assign('FOOTABLE', $footable); |
| 1808 | 1879 | $this->xTemplate->assign('CELL_COUNT', $count); |
@@ -1934,7 +2005,7 @@ discard block |
||
| 1934 | 2005 | $sortStr = translate('LBL_ALT_SORT'); |
| 1935 | 2006 | if($upDown == '_down'){ |
| 1936 | 2007 | $sortStr = translate('LBL_ALT_SORT_DESC'); |
| 1937 | - }elseif($upDown == '_up'){ |
|
| 2008 | + } elseif($upDown == '_up'){ |
|
| 1938 | 2009 | $sortStr = translate('LBL_ALT_SORT_ASC'); |
| 1939 | 2010 | } |
| 1940 | 2011 | return " width='$width' height='$height' align='absmiddle' alt='$sortStr'>"; |
@@ -1948,8 +2019,9 @@ discard block |
||
| 1948 | 2019 | |
| 1949 | 2020 | // Check the cache |
| 1950 | 2021 | $result = sugar_cache_retrieve($cache_key); |
| 1951 | - if(!empty($result)) |
|
| 1952 | - return $result; |
|
| 2022 | + if(!empty($result)) { |
|
| 2023 | + return $result; |
|
| 2024 | + } |
|
| 1953 | 2025 | |
| 1954 | 2026 | // No cache hit. Calculate the value and return. |
| 1955 | 2027 | $result = getimagesize($image); |
@@ -1965,8 +2037,9 @@ discard block |
||
| 1965 | 2037 | |
| 1966 | 2038 | // Check the cache |
| 1967 | 2039 | $result = sugar_cache_retrieve($cache_key); |
| 1968 | - if(!empty($result)) |
|
| 1969 | - return $result; |
|
| 2040 | + if(!empty($result)) { |
|
| 2041 | + return $result; |
|
| 2042 | + } |
|
| 1970 | 2043 | |
| 1971 | 2044 | // No cache hit. Calculate the value and return. |
| 1972 | 2045 | $result = getimagesize($image); |
@@ -1999,12 +2072,10 @@ discard block |
||
| 1999 | 2072 | if($orderBy == 'amount') |
| 2000 | 2073 | { |
| 2001 | 2074 | $this->xTemplateAssign('amount_arrow', $imgArrow); |
| 2002 | - } |
|
| 2003 | - else if($orderBy == 'amount_usdollar') |
|
| 2075 | + } else if($orderBy == 'amount_usdollar') |
|
| 2004 | 2076 | { |
| 2005 | 2077 | $this->xTemplateAssign('amount_usdollar_arrow', $imgArrow); |
| 2006 | - } |
|
| 2007 | - else |
|
| 2078 | + } else |
|
| 2008 | 2079 | { |
| 2009 | 2080 | $this->xTemplateAssign($orderBy.'_arrow', $imgArrow); |
| 2010 | 2081 | } |
@@ -2034,8 +2105,7 @@ discard block |
||
| 2034 | 2105 | { |
| 2035 | 2106 | $list_field['label'] = translate($key,$child_focus->module_dir); |
| 2036 | 2107 | $this->list_field_defs[$i]['label'] = preg_replace('/:$/','',$list_field['label']); |
| 2037 | - } |
|
| 2038 | - else |
|
| 2108 | + } else |
|
| 2039 | 2109 | { |
| 2040 | 2110 | $this->list_field_defs[$i]['label'] =' '; |
| 2041 | 2111 | } |
@@ -2065,8 +2135,7 @@ discard block |
||
| 2065 | 2135 | function getLocalSessionVariable($localVarName,$varName) { |
| 2066 | 2136 | if(isset($_SESSION[$localVarName."_".$varName])) { |
| 2067 | 2137 | return $_SESSION[$localVarName."_".$varName]; |
| 2068 | - } |
|
| 2069 | - else{ |
|
| 2138 | + } else{ |
|
| 2070 | 2139 | return ""; |
| 2071 | 2140 | } |
| 2072 | 2141 | } |
@@ -2074,7 +2143,9 @@ discard block |
||
| 2074 | 2143 | /* Set to true if you want Additional Details to appear in the listview |
| 2075 | 2144 | */ |
| 2076 | 2145 | function setAdditionalDetails($value = true, $function = '') { |
| 2077 | - if(!empty($function)) $this->additionalDetailsFunction = $function; |
|
| 2146 | + if(!empty($function)) { |
|
| 2147 | + $this->additionalDetailsFunction = $function; |
|
| 2148 | + } |
|
| 2078 | 2149 | $this->_additionalDetails = $value; |
| 2079 | 2150 | } |
| 2080 | 2151 | |
@@ -1,5 +1,5 @@ discard block |
||
| 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. |
@@ -60,9 +60,9 @@ discard block |
||
| 60 | 60 | /** |
| 61 | 61 | * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead |
| 62 | 62 | */ |
| 63 | - function MetaParser(){ |
|
| 63 | + function MetaParser() { |
|
| 64 | 64 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 65 | - if(isset($GLOBALS['log'])) { |
|
| 65 | + if (isset($GLOBALS['log'])) { |
|
| 66 | 66 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 67 | 67 | } |
| 68 | 68 | else { |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | * Parses for contents enclosed within <form>...</form> tags |
| 82 | 82 | */ |
| 83 | 83 | function getFormContents($contents, $all = true) { |
| 84 | - if($all) { |
|
| 84 | + if ($all) { |
|
| 85 | 85 | preg_match_all("'(<form[^>]*?>)(.*?)(</form[^>]*?>)'si", $contents, $matches); |
| 86 | 86 | return $matches; |
| 87 | 87 | } |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | function getFormElements($contents) { |
| 102 | 102 | preg_match_all("'(<[ ]*?)(textarea|input|select)([^>]*?)(>)'si", $contents, $matches, PREG_PATTERN_ORDER); |
| 103 | 103 | $elems = array(); |
| 104 | - foreach($matches[3] as $match) { |
|
| 104 | + foreach ($matches[3] as $match) { |
|
| 105 | 105 | $elems[] = $match; |
| 106 | 106 | } |
| 107 | 107 | return $elems; |
@@ -133,13 +133,13 @@ discard block |
||
| 133 | 133 | |
| 134 | 134 | $exp = "'".$name."[\s]*?=[\s]*?[\'\"]([^\'^\"]*?)[\'\"]'si"; |
| 135 | 135 | preg_match_all($exp, $contents, $matches, PREG_SET_ORDER); |
| 136 | - if(empty($filter)) { |
|
| 136 | + if (empty($filter)) { |
|
| 137 | 137 | return !empty($matches[0][1]) ? $matches[0][1] : ''; |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | $filtered = array(); |
| 141 | - foreach($matches as $tag) { |
|
| 142 | - if(preg_match($filter, $tag[1])) { |
|
| 141 | + foreach ($matches as $tag) { |
|
| 142 | + if (preg_match($filter, $tag[1])) { |
|
| 143 | 143 | $filtered[] = $tag; |
| 144 | 144 | } |
| 145 | 145 | } |
@@ -156,13 +156,13 @@ discard block |
||
| 156 | 156 | */ |
| 157 | 157 | function getTables($tableClass = null, $contents) { |
| 158 | 158 | preg_match_all("'(<table[^>]*?>)(.*?)(</table[^>]*?>)'si", $contents, $matches, PREG_SET_ORDER); |
| 159 | - if($tableClass == null) { |
|
| 159 | + if ($tableClass == null) { |
|
| 160 | 160 | return $matches; |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | $tables = array(); |
| 164 | - foreach($matches as $key => $table) { |
|
| 165 | - if(strpos($table[1], $tableClass) > 0) { |
|
| 164 | + foreach ($matches as $key => $table) { |
|
| 165 | + if (strpos($table[1], $tableClass) > 0) { |
|
| 166 | 166 | $tables[] = $table; |
| 167 | 167 | } |
| 168 | 168 | } |
@@ -185,27 +185,27 @@ discard block |
||
| 185 | 185 | $x = strlen($contents); |
| 186 | 186 | $mark = 0; |
| 187 | 187 | $count = 0; |
| 188 | - $stag1 = "<" . trim($type, " <>") . '>'; |
|
| 189 | - $stag2 = "<" . trim($type, " <>") . ' '; |
|
| 188 | + $stag1 = "<".trim($type, " <>").'>'; |
|
| 189 | + $stag2 = "<".trim($type, " <>").' '; |
|
| 190 | 190 | $etag = "</".$type.">"; |
| 191 | 191 | $sincrement = strlen($stag1); |
| 192 | 192 | $eincrement = strlen($etag); |
| 193 | 193 | $sarr = array(); |
| 194 | 194 | $values = array(); |
| 195 | 195 | |
| 196 | - while($count < $x) { |
|
| 196 | + while ($count < $x) { |
|
| 197 | 197 | $stok = substr($contents, $count, $sincrement); |
| 198 | 198 | $etok = substr($contents, $count, $eincrement); |
| 199 | - if($stok == $stag1 || $stok == $stag2) { |
|
| 199 | + if ($stok == $stag1 || $stok == $stag2) { |
|
| 200 | 200 | //Reset mark; |
| 201 | - if(count($sarr) == 0) { |
|
| 201 | + if (count($sarr) == 0) { |
|
| 202 | 202 | $mark = $count; |
| 203 | 203 | } |
| 204 | 204 | $sarr[] = $count; |
| 205 | 205 | |
| 206 | - } else if($etok == $etag) { |
|
| 206 | + } else if ($etok == $etag) { |
|
| 207 | 207 | array_shift($sarr); |
| 208 | - if(count($sarr) == 0) { |
|
| 208 | + if (count($sarr) == 0) { |
|
| 209 | 209 | $val = substr($contents, $mark, ($count - $mark) + $eincrement); |
| 210 | 210 | $values[] = $val; |
| 211 | 211 | $mark = $count; |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | function stripFlavorTags($contents) { |
| 247 | 247 | $flavor = isset($GLOBALS['sugar_flavor']) ? $GLOBALS['sugar_flavor'] : 'PRO'; |
| 248 | 248 | $isPro = ($flavor == 'ENT' || $flavor == 'PRO') ? true : false; |
| 249 | - if($isPro) { |
|
| 249 | + if ($isPro) { |
|
| 250 | 250 | $contents = preg_replace('/<!-- BEGIN: open_source -->.*?<!-- END: open_source -->/', '', $contents); |
| 251 | 251 | } else { |
| 252 | 252 | $contents = preg_replace('/<!-- BEGIN: pro -->.*?<!-- END: pro -->/', '', $contents); |
@@ -264,9 +264,9 @@ discard block |
||
| 264 | 264 | function getMaxColumns($contents, $filter) { |
| 265 | 265 | preg_match_all("'(<tr[^>]*?>)(.*?)(</tr[^>]*?>)'si", $contents, $matches, PREG_SET_ORDER); |
| 266 | 266 | $max = 0; |
| 267 | - foreach($matches as $tableRows) { |
|
| 267 | + foreach ($matches as $tableRows) { |
|
| 268 | 268 | $count = substr_count($tableRows[2], $filter); |
| 269 | - if($count > $max) { |
|
| 269 | + if ($count > $max) { |
|
| 270 | 270 | $max = $count; |
| 271 | 271 | } |
| 272 | 272 | } |
@@ -278,9 +278,9 @@ discard block |
||
| 278 | 278 | |
| 279 | 279 | $elements = array(); |
| 280 | 280 | |
| 281 | - foreach($matches as $data) { |
|
| 281 | + foreach ($matches as $data) { |
|
| 282 | 282 | // We need 4 because the 1,2,3 indexes make up start,body,end |
| 283 | - if(count($data) == 4) { |
|
| 283 | + if (count($data) == 4) { |
|
| 284 | 284 | $element = array(); |
| 285 | 285 | $element['start'] = $data[1]; |
| 286 | 286 | $element['body'] = $data[2]; |
@@ -321,12 +321,12 @@ discard block |
||
| 321 | 321 | |
| 322 | 322 | //Check if there are Javascript blocks of code to process |
| 323 | 323 | preg_match_all("'(<script[^>]*?>)(.*?)(</script[^>]*?>)'si", $contents, $matches, PREG_PATTERN_ORDER); |
| 324 | -if(empty($matches)) { |
|
| 324 | +if (empty($matches)) { |
|
| 325 | 325 | return $javascript; |
| 326 | 326 | } |
| 327 | 327 | |
| 328 | -foreach($matches[0] as $scriptBlock) { |
|
| 329 | - $javascript .= "\n" . $scriptBlock; |
|
| 328 | +foreach ($matches[0] as $scriptBlock) { |
|
| 329 | + $javascript .= "\n".$scriptBlock; |
|
| 330 | 330 | } //foreach |
| 331 | 331 | |
| 332 | 332 | $javascript = substr($javascript, 1); |
@@ -337,11 +337,11 @@ discard block |
||
| 337 | 337 | |
| 338 | 338 | //Find all blocks that may need to be replaced with Smarty syntax |
| 339 | 339 | preg_match_all("'([\{])([a-zA-Z0-9_]*?)([\}])'si", $javascript, $matches, PREG_PATTERN_ORDER); |
| 340 | -if(!empty($matches)) { |
|
| 340 | +if (!empty($matches)) { |
|
| 341 | 341 | $replace = array(); |
| 342 | 342 | |
| 343 | - foreach($matches[0] as $xTemplateCode) { |
|
| 344 | - if(!isset($replace[$xTemplateCode])) { |
|
| 343 | + foreach ($matches[0] as $xTemplateCode) { |
|
| 344 | + if (!isset($replace[$xTemplateCode])) { |
|
| 345 | 345 | $replace[$xTemplateCode] = str_replace("{", "{\$", $xTemplateCode); |
| 346 | 346 | } //if |
| 347 | 347 | } //foreach |
@@ -349,7 +349,7 @@ discard block |
||
| 349 | 349 | $javascript = str_replace(array_keys($replace), array_values($replace), $javascript); |
| 350 | 350 | } //if |
| 351 | 351 | |
| 352 | -if(!$addLiterals) { |
|
| 352 | +if (!$addLiterals) { |
|
| 353 | 353 | return $javascript; |
| 354 | 354 | } |
| 355 | 355 | |
@@ -363,12 +363,12 @@ discard block |
||
| 363 | 363 | $count = 0; |
| 364 | 364 | $inSmartyVariable = false; |
| 365 | 365 | |
| 366 | - while($count < $scriptLength) { |
|
| 366 | + while ($count < $scriptLength) { |
|
| 367 | 367 | |
| 368 | - if($inSmartyVariable) { |
|
| 368 | + if ($inSmartyVariable) { |
|
| 369 | 369 | $start = $count; |
| 370 | 370 | $numOfChars = 1; |
| 371 | - while(isset($javascript[$count]) && $javascript[$count] != '}') { |
|
| 371 | + while (isset($javascript[$count]) && $javascript[$count] != '}') { |
|
| 372 | 372 | $count++; |
| 373 | 373 | $numOfChars++; |
| 374 | 374 | } |
@@ -381,12 +381,12 @@ discard block |
||
| 381 | 381 | $char = $javascript[$count]; |
| 382 | 382 | $nextChar = ($count + 1 >= $scriptLength) ? '' : $javascript[$count + 1]; |
| 383 | 383 | |
| 384 | - if($char == "{" && $nextChar == "$") { |
|
| 384 | + if ($char == "{" && $nextChar == "$") { |
|
| 385 | 385 | $inSmartyVariable = true; |
| 386 | 386 | $newJavascript .= $javascript[$count]; |
| 387 | - } else if($char == "{") { |
|
| 388 | - $newJavascript .= " {ldelim} "; |
|
| 389 | - } else if($char == "}") { |
|
| 387 | + } else if ($char == "{") { |
|
| 388 | + $newJavascript .= " {ldelim} "; |
|
| 389 | + } else if ($char == "}") { |
|
| 390 | 390 | $newJavascript .= " {rdelim} "; |
| 391 | 391 | } else { |
| 392 | 392 | $newJavascript .= $javascript[$count]; |
@@ -412,32 +412,32 @@ discard block |
||
| 412 | 412 | */ |
| 413 | 413 | function findAssignedVariableName($name, $filePath) { |
| 414 | 414 | |
| 415 | - if($this->mPHPFile == "INVALID") { |
|
| 415 | + if ($this->mPHPFile == "INVALID") { |
|
| 416 | 416 | return $name; |
| 417 | 417 | } |
| 418 | 418 | |
| 419 | - if(!isset($this->mPHPFile)) { |
|
| 420 | - if(preg_match('/(.*?)(DetailView).html$/', $filePath, $matches)) { |
|
| 419 | + if (!isset($this->mPHPFile)) { |
|
| 420 | + if (preg_match('/(.*?)(DetailView).html$/', $filePath, $matches)) { |
|
| 421 | 421 | $dir = $matches[1]; |
| 422 | - } else if(preg_match('/(.*?)(EditView).html$/', $filePath, $matches)) { |
|
| 422 | + } else if (preg_match('/(.*?)(EditView).html$/', $filePath, $matches)) { |
|
| 423 | 423 | $dir = $matches[1]; |
| 424 | 424 | } |
| 425 | 425 | |
| 426 | - if(!isset($dir) || !is_dir($dir)) { |
|
| 426 | + if (!isset($dir) || !is_dir($dir)) { |
|
| 427 | 427 | $this->mPHPFile = "INVALID"; |
| 428 | 428 | return $name; |
| 429 | 429 | } |
| 430 | 430 | |
| 431 | 431 | $filesInDir = $this->dirList($dir); |
| 432 | 432 | $phpFile = $matches[2].'.*?[\.]php'; |
| 433 | - foreach($filesInDir as $file) { |
|
| 434 | - if(preg_match("/$phpFile/", $file)) { |
|
| 435 | - $this->mPHPFile = $matches[1] . $file; |
|
| 433 | + foreach ($filesInDir as $file) { |
|
| 434 | + if (preg_match("/$phpFile/", $file)) { |
|
| 435 | + $this->mPHPFile = $matches[1].$file; |
|
| 436 | 436 | break; |
| 437 | 437 | } |
| 438 | 438 | } |
| 439 | 439 | |
| 440 | - if(!isset($this->mPHPFile) || !file_exists($this->mPHPFile)) { |
|
| 440 | + if (!isset($this->mPHPFile) || !file_exists($this->mPHPFile)) { |
|
| 441 | 441 | $this->mPHPFile = "INVALID"; |
| 442 | 442 | return $name; |
| 443 | 443 | } |
@@ -445,7 +445,7 @@ discard block |
||
| 445 | 445 | |
| 446 | 446 | $phpContents = file_get_contents($this->mPHPFile); |
| 447 | 447 | $uname = strtoupper($name); |
| 448 | - if(preg_match("/xtpl->assign[\(][\"\']".$uname."[\"\'][\s]*?,[\s]*?[\$]focus->(.*?)[\)]/si", $phpContents, $matches)) { |
|
| 448 | + if (preg_match("/xtpl->assign[\(][\"\']".$uname."[\"\'][\s]*?,[\s]*?[\$]focus->(.*?)[\)]/si", $phpContents, $matches)) { |
|
| 449 | 449 | return $matches[1]; |
| 450 | 450 | } |
| 451 | 451 | return $name; |
@@ -459,7 +459,7 @@ discard block |
||
| 459 | 459 | * @param $directory The directory to scan |
| 460 | 460 | * @return $results The files in the directory that were found |
| 461 | 461 | */ |
| 462 | -function dirList ($directory) { |
|
| 462 | +function dirList($directory) { |
|
| 463 | 463 | |
| 464 | 464 | // create an array to hold directory list |
| 465 | 465 | $results = array(); |
@@ -491,19 +491,19 @@ discard block |
||
| 491 | 491 | */ |
| 492 | 492 | function getCustomField($elementNames) { |
| 493 | 493 | |
| 494 | - if(!isset($elementNames) || (!is_string($elementNames) && !is_array($elementNames))) { |
|
| 494 | + if (!isset($elementNames) || (!is_string($elementNames) && !is_array($elementNames))) { |
|
| 495 | 495 | return null; |
| 496 | 496 | } |
| 497 | 497 | |
| 498 | - if(is_string($elementNames)) { |
|
| 499 | - if(preg_match('/(.+_c)(_basic)?(\[\])?$/', $elementNames, $matches)) { |
|
| 498 | + if (is_string($elementNames)) { |
|
| 499 | + if (preg_match('/(.+_c)(_basic)?(\[\])?$/', $elementNames, $matches)) { |
|
| 500 | 500 | return count($matches) == 1 ? $matches[0] : $matches[1]; |
| 501 | 501 | } |
| 502 | 502 | return null; |
| 503 | 503 | } |
| 504 | 504 | |
| 505 | - foreach($elementNames as $name) { |
|
| 506 | - if(preg_match('/(.+_c)(_basic)?(\[\])?$/', $name, $matches)) { |
|
| 505 | + foreach ($elementNames as $name) { |
|
| 506 | + if (preg_match('/(.+_c)(_basic)?(\[\])?$/', $name, $matches)) { |
|
| 507 | 507 | return count($matches) == 1 ? $matches[0] : $matches[1]; |
| 508 | 508 | } |
| 509 | 509 | } |
@@ -512,7 +512,7 @@ discard block |
||
| 512 | 512 | } |
| 513 | 513 | |
| 514 | 514 | function applyPreRules($moduleDir, $panels) { |
| 515 | - if(file_exists("include/SugarFields/Parsers/Rules/".$moduleDir."ParseRule.php")) { |
|
| 515 | + if (file_exists("include/SugarFields/Parsers/Rules/".$moduleDir."ParseRule.php")) { |
|
| 516 | 516 | require_once("include/SugarFields/Parsers/Rules/".$moduleDir."ParseRule.php"); |
| 517 | 517 | $class = $moduleDir."ParseRule"; |
| 518 | 518 | $parseRule = new $class(); |
@@ -527,7 +527,7 @@ discard block |
||
| 527 | 527 | |
| 528 | 528 | function applyPostRules($moduleDir, $panels) { |
| 529 | 529 | //Run module specific rules |
| 530 | - if(file_exists("include/SugarFields/Parsers/Rules/".$moduleDir."ParseRule.php")) { |
|
| 530 | + if (file_exists("include/SugarFields/Parsers/Rules/".$moduleDir."ParseRule.php")) { |
|
| 531 | 531 | require_once("include/SugarFields/Parsers/Rules/".$moduleDir."ParseRule.php"); |
| 532 | 532 | $class = $moduleDir."ParseRule"; |
| 533 | 533 | $parseRule = new $class(); |
@@ -538,9 +538,9 @@ discard block |
||
| 538 | 538 | require_once("include/SugarFields/Parsers/Rules/ParseRules.php"); |
| 539 | 539 | $rules = ParseRules::getRules(); |
| 540 | 540 | |
| 541 | - foreach($rules as $rule) { |
|
| 542 | - if(!file_exists($rule['file'])) { |
|
| 543 | - $GLOBALS['log']->error("Cannot run rule for " . $rule['file']); |
|
| 541 | + foreach ($rules as $rule) { |
|
| 542 | + if (!file_exists($rule['file'])) { |
|
| 543 | + $GLOBALS['log']->error("Cannot run rule for ".$rule['file']); |
|
| 544 | 544 | continue; |
| 545 | 545 | } //if |
| 546 | 546 | require_once($rule['file']); |
@@ -552,11 +552,11 @@ discard block |
||
| 552 | 552 | return $panels; |
| 553 | 553 | } |
| 554 | 554 | |
| 555 | -function createFileContents($moduleDir, $panels, $templateMeta=array(), $htmlFilePath) { |
|
| 555 | +function createFileContents($moduleDir, $panels, $templateMeta = array(), $htmlFilePath) { |
|
| 556 | 556 | |
| 557 | 557 | $header = "<?php\n\n"; |
| 558 | 558 | |
| 559 | -if(empty($templateMeta)) { |
|
| 559 | +if (empty($templateMeta)) { |
|
| 560 | 560 | $header .= "\$viewdefs['$moduleDir']['$this->mView'] = array( |
| 561 | 561 | 'templateMeta' => array('maxColumns' => '2', |
| 562 | 562 | 'widths' => array( |
@@ -566,7 +566,7 @@ discard block |
||
| 566 | 566 | ),"; |
| 567 | 567 | } else { |
| 568 | 568 | $header .= "\$viewdefs['$moduleDir']['$this->mView'] = array( |
| 569 | - 'templateMeta' =>" . var_export($templateMeta, true) . ","; |
|
| 569 | + 'templateMeta' =>".var_export($templateMeta, true).","; |
|
| 570 | 570 | } |
| 571 | 571 | |
| 572 | 572 | //Replace all the @sq (single quote tags that may have been inserted) |
@@ -591,8 +591,8 @@ discard block |
||
| 591 | 591 | |
| 592 | 592 | $metadata = ''; |
| 593 | 593 | $body = var_export($panels, true); |
| 594 | - $metadata = $header . $body . $footer; |
|
| 595 | - $metadata = preg_replace('/(\d+)[\s]=>[\s]?/',"",$metadata); |
|
| 594 | + $metadata = $header.$body.$footer; |
|
| 595 | + $metadata = preg_replace('/(\d+)[\s]=>[\s]?/', "", $metadata); |
|
| 596 | 596 | return $metadata; |
| 597 | 597 | |
| 598 | 598 | } |
@@ -611,10 +611,10 @@ discard block |
||
| 611 | 611 | $masterpanels = $viewdefs[$moduleDir][$this->mView]['panels']; |
| 612 | 612 | $hasMultiplePanels = $this->hasMultiplePanels($masterpanels); |
| 613 | 613 | |
| 614 | - if(!$hasMultiplePanels) { |
|
| 614 | + if (!$hasMultiplePanels) { |
|
| 615 | 615 | $keys = array_keys($viewdefs[$moduleDir][$this->mView]['panels']); |
| 616 | - if(!empty($keys) && count($keys) == 1) { |
|
| 617 | - if(strtolower($keys[0]) == 'default') { |
|
| 616 | + if (!empty($keys) && count($keys) == 1) { |
|
| 617 | + if (strtolower($keys[0]) == 'default') { |
|
| 618 | 618 | $masterpanels = array('default'=>$viewdefs[$moduleDir][$this->mView]['panels'][$keys[0]]); |
| 619 | 619 | } else { |
| 620 | 620 | $firstPanel = array_values($viewdefs[$moduleDir][$this->mView]['panels']); |
@@ -624,18 +624,18 @@ discard block |
||
| 624 | 624 | $masterpanels = array('default'=>$viewdefs[$moduleDir][$this->mView]['panels']); |
| 625 | 625 | } |
| 626 | 626 | } |
| 627 | - foreach($masterpanels as $name=>$masterpanel) { |
|
| 628 | - if(isset($panels[$name])) { |
|
| 627 | + foreach ($masterpanels as $name=>$masterpanel) { |
|
| 628 | + if (isset($panels[$name])) { |
|
| 629 | 629 | // Get all the names in the panel |
| 630 | 630 | $existingElements = array(); |
| 631 | 631 | $existingLocation = array(); |
| 632 | 632 | |
| 633 | - foreach($panels[$name] as $rowKey=>$row) { |
|
| 634 | - foreach($row as $colKey=>$column) { |
|
| 635 | - if(is_array($column) && !empty($column['name'])) { |
|
| 633 | + foreach ($panels[$name] as $rowKey=>$row) { |
|
| 634 | + foreach ($row as $colKey=>$column) { |
|
| 635 | + if (is_array($column) && !empty($column['name'])) { |
|
| 636 | 636 | $existingElements[$column['name']] = $column['name']; |
| 637 | 637 | $existingLocation[$column['name']] = array("panel"=>$name, "row"=>$rowKey, "col"=>$colKey); |
| 638 | - } else if(!is_array($column) && !empty($column)) { |
|
| 638 | + } else if (!is_array($column) && !empty($column)) { |
|
| 639 | 639 | $existingElements[$column] = $column; |
| 640 | 640 | $existingLocation[$column] = array("panel"=>$name, "row"=>$rowKey, "col"=>$colKey); |
| 641 | 641 | } |
@@ -643,23 +643,23 @@ discard block |
||
| 643 | 643 | } //foreach |
| 644 | 644 | |
| 645 | 645 | // Now check against the $masterCopy |
| 646 | - foreach($masterpanel as $rowKey=>$row) { |
|
| 646 | + foreach ($masterpanel as $rowKey=>$row) { |
|
| 647 | 647 | |
| 648 | 648 | $addRow = array(); |
| 649 | 649 | |
| 650 | - foreach($row as $colKey=>$column) { |
|
| 651 | - if(is_array($column) && isset($column['name'])) { |
|
| 650 | + foreach ($row as $colKey=>$column) { |
|
| 651 | + if (is_array($column) && isset($column['name'])) { |
|
| 652 | 652 | $id = $column['name']; |
| 653 | - } else if(!is_array($column) && !empty($column)) { |
|
| 653 | + } else if (!is_array($column) && !empty($column)) { |
|
| 654 | 654 | $id = $column; |
| 655 | 655 | } else { |
| 656 | 656 | continue; |
| 657 | 657 | } |
| 658 | - if(empty($existingElements[$id])) { |
|
| 658 | + if (empty($existingElements[$id])) { |
|
| 659 | 659 | //Only add if |
| 660 | 660 | // 1) if it is a required field (as defined in metadata) |
| 661 | 661 | // 2) or if it has a customLabel and customCode (a very deep customization) |
| 662 | - if((is_array($column) && !empty($column['displayParams']['required'])) || |
|
| 662 | + if ((is_array($column) && !empty($column['displayParams']['required'])) || |
|
| 663 | 663 | (is_array($column) && !empty($column['customCode']) && !empty($column['customLabel']))) { |
| 664 | 664 | $addRow[] = $column; |
| 665 | 665 | } |
@@ -670,7 +670,7 @@ discard block |
||
| 670 | 670 | } //foreach |
| 671 | 671 | |
| 672 | 672 | // Add it to the $panels |
| 673 | - if(!empty($addRow)) { |
|
| 673 | + if (!empty($addRow)) { |
|
| 674 | 674 | $panels[$name][] = $addRow; |
| 675 | 675 | } |
| 676 | 676 | } //foreach |
@@ -682,8 +682,8 @@ discard block |
||
| 682 | 682 | |
| 683 | 683 | // We're not done yet... go through the $panels Array now and try to remove duplicate |
| 684 | 684 | // or empty panels |
| 685 | - foreach($panels as $name=>$panel) { |
|
| 686 | - if(count($panel) == 0 || !isset($masterpanels[$name])) { |
|
| 685 | + foreach ($panels as $name=>$panel) { |
|
| 686 | + if (count($panel) == 0 || !isset($masterpanels[$name])) { |
|
| 687 | 687 | unset($panels[$name]); |
| 688 | 688 | } |
| 689 | 689 | } //foreach |
@@ -703,7 +703,7 @@ discard block |
||
| 703 | 703 | require($masterCopy); |
| 704 | 704 | $masterTemplateMeta = $viewdefs[$moduleDir][$this->mView]['templateMeta']; |
| 705 | 705 | |
| 706 | - if(isset($masterTemplateMeta['javascript'])) { |
|
| 706 | + if (isset($masterTemplateMeta['javascript'])) { |
|
| 707 | 707 | //Insert the getJSPath code back into src value |
| 708 | 708 | $masterTemplateMeta['javascript'] = preg_replace('/src\s*=\s*[\'\"].*?(modules\/|include\/)([^\.]*?\.js)([^\'\"]*?)[\'\"]/i', 'src="@sq . getJSPath(@sq${1}${2}@sq) . @sq"', $masterTemplateMeta['javascript']); |
| 709 | 709 | } |
@@ -712,7 +712,7 @@ discard block |
||
| 712 | 712 | } |
| 713 | 713 | |
| 714 | 714 | function hasRequiredSpanLabel($html) { |
| 715 | - if(empty($html)) { |
|
| 715 | + if (empty($html)) { |
|
| 716 | 716 | return false; |
| 717 | 717 | } |
| 718 | 718 | |
@@ -721,20 +721,20 @@ discard block |
||
| 721 | 721 | |
| 722 | 722 | function hasMultiplePanels($panels) { |
| 723 | 723 | |
| 724 | - if(!isset($panels) || empty($panels) || !is_array($panels)) { |
|
| 724 | + if (!isset($panels) || empty($panels) || !is_array($panels)) { |
|
| 725 | 725 | return false; |
| 726 | 726 | } |
| 727 | 727 | |
| 728 | - if(is_array($panels) && (count($panels) == 0 || count($panels) == 1)) { |
|
| 728 | + if (is_array($panels) && (count($panels) == 0 || count($panels) == 1)) { |
|
| 729 | 729 | return false; |
| 730 | 730 | } |
| 731 | 731 | |
| 732 | - foreach($panels as $panel) { |
|
| 733 | - if(!empty($panel) && !is_array($panel)) { |
|
| 732 | + foreach ($panels as $panel) { |
|
| 733 | + if (!empty($panel) && !is_array($panel)) { |
|
| 734 | 734 | return false; |
| 735 | 735 | } else { |
| 736 | - foreach($panel as $row) { |
|
| 737 | - if(!empty($row) && !is_array($row)) { |
|
| 736 | + foreach ($panel as $row) { |
|
| 737 | + if (!empty($row) && !is_array($row)) { |
|
| 738 | 738 | return false; |
| 739 | 739 | } //if |
| 740 | 740 | } //foreach |
@@ -744,16 +744,16 @@ discard block |
||
| 744 | 744 | return true; |
| 745 | 745 | } |
| 746 | 746 | |
| 747 | -function getRelateFieldName($mixed='') { |
|
| 748 | - if(!is_array($mixed)) { |
|
| 747 | +function getRelateFieldName($mixed = '') { |
|
| 748 | + if (!is_array($mixed)) { |
|
| 749 | 749 | return ''; |
| 750 | - } else if(count($mixed) == 2){ |
|
| 750 | + } else if (count($mixed) == 2) { |
|
| 751 | 751 | $id = ''; |
| 752 | 752 | $name = ''; |
| 753 | - foreach($mixed as $el) { |
|
| 754 | - if(preg_match('/_id$/', $el)) { |
|
| 753 | + foreach ($mixed as $el) { |
|
| 754 | + if (preg_match('/_id$/', $el)) { |
|
| 755 | 755 | $id = $el; |
| 756 | - } else if(preg_match('/_name$/', $el)) { |
|
| 756 | + } else if (preg_match('/_name$/', $el)) { |
|
| 757 | 757 | $name = $el; |
| 758 | 758 | } |
| 759 | 759 | } |
@@ -774,7 +774,7 @@ discard block |
||
| 774 | 774 | * |
| 775 | 775 | */ |
| 776 | 776 | function fixTablesWithMissingTr($tableContents) { |
| 777 | - if(preg_match('/(<table[^>]*?[\/]?>\s*?<td)/i', $tableContents, $matches)) { |
|
| 777 | + if (preg_match('/(<table[^>]*?[\/]?>\s*?<td)/i', $tableContents, $matches)) { |
|
| 778 | 778 | return preg_replace('/(<table[^>]*?[\/]?>\s*?<td)/i', '<table><tr><td', $tableContents); |
| 779 | 779 | } |
| 780 | 780 | return $tableContents; |
@@ -785,7 +785,7 @@ discard block |
||
| 785 | 785 | * This is a very crude function to fix instances where files have an </tr> tag immediately followed by a <td> tag |
| 786 | 786 | */ |
| 787 | 787 | function fixRowsWithMissingTr($tableContents) { |
| 788 | - if(preg_match('/(<\/tr[^>]*?[\/]?>\s*?<td)/i', $tableContents, $matches)) { |
|
| 788 | + if (preg_match('/(<\/tr[^>]*?[\/]?>\s*?<td)/i', $tableContents, $matches)) { |
|
| 789 | 789 | return preg_replace('/(<\/tr[^>]*?[\/]?>\s*?<td)/i', '</tr><tr><td', $tableContents); |
| 790 | 790 | } |
| 791 | 791 | return $tableContents; |
@@ -796,7 +796,7 @@ discard block |
||
| 796 | 796 | * This is a very crude function to fix instances where files have two consecutive <tr> tags |
| 797 | 797 | */ |
| 798 | 798 | function fixDuplicateTrTags($tableContents) { |
| 799 | - if(preg_match('/(<tr[^>]*?[\/]?>\s*?<tr)/i', $tableContents, $matches)) { |
|
| 799 | + if (preg_match('/(<tr[^>]*?[\/]?>\s*?<tr)/i', $tableContents, $matches)) { |
|
| 800 | 800 | return preg_replace('/(<tr[^>]*?[\/]?>\s*?<tr)/i', '<tr', $tableContents); |
| 801 | 801 | } |
| 802 | 802 | return $tableContents; |
@@ -807,14 +807,14 @@ discard block |
||
| 807 | 807 | * Scans array of form elements to see if just one is a vardef element and, if so, |
| 808 | 808 | * return that vardef name |
| 809 | 809 | */ |
| 810 | -function findSingleVardefElement($formElements=array(), $vardefs=array()) { |
|
| 811 | - if(empty($formElements) || !is_array($formElements)) { |
|
| 810 | +function findSingleVardefElement($formElements = array(), $vardefs = array()) { |
|
| 811 | + if (empty($formElements) || !is_array($formElements)) { |
|
| 812 | 812 | return ''; |
| 813 | 813 | } |
| 814 | 814 | |
| 815 | 815 | $found = array(); |
| 816 | - foreach($formElements as $el) { |
|
| 817 | - if(isset($vardefs[$el])) { |
|
| 816 | + foreach ($formElements as $el) { |
|
| 817 | + if (isset($vardefs[$el])) { |
|
| 818 | 818 | $found[] = $el; |
| 819 | 819 | } |
| 820 | 820 | } |
@@ -1,5 +1,7 @@ discard block |
||
| 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. |
@@ -64,8 +66,7 @@ discard block |
||
| 64 | 66 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 65 | 67 | if(isset($GLOBALS['log'])) { |
| 66 | 68 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 67 | - } |
|
| 68 | - else { |
|
| 69 | + } else { |
|
| 69 | 70 | trigger_error($deprecatedMessage, E_USER_DEPRECATED); |
| 70 | 71 | } |
| 71 | 72 | self::__construct(); |
@@ -471,8 +472,9 @@ discard block |
||
| 471 | 472 | while ($file = readdir($handler)) { |
| 472 | 473 | // if $file isn't this directory or its parent, |
| 473 | 474 | // add it to the results array |
| 474 | - if ($file != '.' && $file != '..') |
|
| 475 | - $results[] = $file; |
|
| 475 | + if ($file != '.' && $file != '..') { |
|
| 476 | + $results[] = $file; |
|
| 477 | + } |
|
| 476 | 478 | } |
| 477 | 479 | |
| 478 | 480 | // tidy up: close the handler |
@@ -1,5 +1,5 @@ discard block |
||
| 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. |
@@ -58,9 +58,9 @@ discard block |
||
| 58 | 58 | /** |
| 59 | 59 | * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead |
| 60 | 60 | */ |
| 61 | - function EditViewMetaParser(){ |
|
| 61 | + function EditViewMetaParser() { |
|
| 62 | 62 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 63 | - if(isset($GLOBALS['log'])) { |
|
| 63 | + if (isset($GLOBALS['log'])) { |
|
| 64 | 64 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 65 | 65 | } |
| 66 | 66 | else { |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | * @param $masterCopy The file path of the mater copy of the metadata file to merge against |
| 81 | 81 | * @return String format of metadata contents |
| 82 | 82 | **/ |
| 83 | -function parse($filePath, $vardefs = array(), $moduleDir = '', $merge=false, $masterCopy=null) { |
|
| 83 | +function parse($filePath, $vardefs = array(), $moduleDir = '', $merge = false, $masterCopy = null) { |
|
| 84 | 84 | |
| 85 | 85 | global $app_strings; |
| 86 | 86 | $contents = file_get_contents($filePath); |
@@ -94,9 +94,9 @@ discard block |
||
| 94 | 94 | $tables = $this->getElementsByType("table", $contents); |
| 95 | 95 | $formElements = $this->getFormElements($tables[0]); |
| 96 | 96 | $hiddenInputs = array(); |
| 97 | - foreach($formElements as $elem) { |
|
| 97 | + foreach ($formElements as $elem) { |
|
| 98 | 98 | $type = $this->getTagAttribute("type", $elem); |
| 99 | - if(preg_match('/hidden/si',$type)) { |
|
| 99 | + if (preg_match('/hidden/si', $type)) { |
|
| 100 | 100 | $name = $this->getTagAttribute("name", $elem); |
| 101 | 101 | $value = $this->getTagAttribute("value", $elem); |
| 102 | 102 | $hiddenInputs[$name] = $value; |
@@ -110,22 +110,22 @@ discard block |
||
| 110 | 110 | $addedElements = array(); |
| 111 | 111 | $maxTableCountNum = 0; |
| 112 | 112 | $tableCount = 0; |
| 113 | - foreach($tables as $table) { |
|
| 113 | + foreach ($tables as $table) { |
|
| 114 | 114 | $table = $this->fixTablesWithMissingTr($table); |
| 115 | 115 | $toptr = $this->getElementsByType("tr", $table); |
| 116 | - foreach($toptr as $tr) { |
|
| 116 | + foreach ($toptr as $tr) { |
|
| 117 | 117 | $tabledata = $this->getElementsByType("table", $tr); |
| 118 | 118 | $data = array(); |
| 119 | 119 | $panelKey = $tableCount == 0 ? "default" : ''; |
| 120 | - foreach($tabledata as $t) { |
|
| 120 | + foreach ($tabledata as $t) { |
|
| 121 | 121 | $vals = array_values($this->getElementsByType("tr", $t)); |
| 122 | - if(preg_match_all('/<h4[^>]*?>.*?(\{MOD\.|\{APP\.)(LBL_[^\}]*?)[\}].*?<\/h4>/s', $vals[0], $matches, PREG_SET_ORDER)) { |
|
| 122 | + if (preg_match_all('/<h4[^>]*?>.*?(\{MOD\.|\{APP\.)(LBL_[^\}]*?)[\}].*?<\/h4>/s', $vals[0], $matches, PREG_SET_ORDER)) { |
|
| 123 | 123 | array_shift($vals); |
| 124 | 124 | $panelKey = count($matches[0]) == 3 ? strtolower($matches[0][2]) : $panelKey; |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | //If $panelKey is empty use the maxTableCountNum value |
| 128 | - if(empty($panelKey)) { |
|
| 128 | + if (empty($panelKey)) { |
|
| 129 | 129 | $panels[$maxTableCountNum++] = $vals; |
| 130 | 130 | } else { |
| 131 | 131 | $panels[$panelKey] = $vals; |
@@ -135,37 +135,37 @@ discard block |
||
| 135 | 135 | } //foreach; |
| 136 | 136 | } //foreach |
| 137 | 137 | |
| 138 | - foreach($panels as $id=>$tablerows) { |
|
| 138 | + foreach ($panels as $id=>$tablerows) { |
|
| 139 | 139 | |
| 140 | 140 | $metarow = array(); |
| 141 | 141 | |
| 142 | - foreach($tablerows as $trow) { |
|
| 142 | + foreach ($tablerows as $trow) { |
|
| 143 | 143 | |
| 144 | 144 | $emptyCount = 0; |
| 145 | 145 | $tablecolumns = $this->getElementsByType("td", $trow); |
| 146 | 146 | $col = array(); |
| 147 | 147 | $slot = 0; |
| 148 | 148 | |
| 149 | - foreach($tablecolumns as $tcols) { |
|
| 149 | + foreach ($tablecolumns as $tcols) { |
|
| 150 | 150 | $hasRequiredLabel = false; |
| 151 | 151 | |
| 152 | 152 | //Get the sugar attribute value in the span elements of each table row |
| 153 | 153 | $sugarAttrLabel = $this->getTagAttribute("sugar", $tcols, "'^slot[^b]+$'"); |
| 154 | 154 | |
| 155 | 155 | //If there was no sugar attribute, try id (some versions of EditView.html used this instead) |
| 156 | - if(empty($sugarAttrLabel)) { |
|
| 156 | + if (empty($sugarAttrLabel)) { |
|
| 157 | 157 | $sugarAttrLabel = $this->getTagAttribute("id", $tcols, "'^slot[^b]+$'"); |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | //Check if this field is required |
| 161 | - if(!empty($sugarAttrLabel)) { |
|
| 161 | + if (!empty($sugarAttrLabel)) { |
|
| 162 | 162 | $hasRequiredLabel = $this->hasRequiredSpanLabel($tcols); |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | $sugarAttrValue = $this->getTagAttribute("sugar", $tcols, "'slot[0-9]+b$'"); |
| 166 | 166 | |
| 167 | 167 | //If there was no sugar attribute, try id (some versions of EditView.html used this instead) |
| 168 | - if(empty($sugarAttrValue)) { |
|
| 168 | + if (empty($sugarAttrValue)) { |
|
| 169 | 169 | $sugarAttrValue = $this->getTagAttribute("id", $tcols, "'slot[0-9]+b$'"); |
| 170 | 170 | } |
| 171 | 171 | |
@@ -174,15 +174,15 @@ discard block |
||
| 174 | 174 | $sugarAttrValue = count($sugarAttrValue) != 0 ? $sugarAttrValue : ($slot % 2 == 1) ? true : false; |
| 175 | 175 | $slot++; |
| 176 | 176 | |
| 177 | - if($sugarAttrValue) { |
|
| 177 | + if ($sugarAttrValue) { |
|
| 178 | 178 | |
| 179 | 179 | $spanValue = $this->getElementValue("span", $tcols); |
| 180 | 180 | |
| 181 | - if(empty($spanValue)) { |
|
| 181 | + if (empty($spanValue)) { |
|
| 182 | 182 | $spanValue = $this->getElementValue("slot", $tcols); |
| 183 | 183 | } |
| 184 | 184 | |
| 185 | - if(empty($spanValue)) { |
|
| 185 | + if (empty($spanValue)) { |
|
| 186 | 186 | $spanValue = $this->getElementValue("td", $tcols); |
| 187 | 187 | } |
| 188 | 188 | |
@@ -194,25 +194,25 @@ discard block |
||
| 194 | 194 | $fields = null; |
| 195 | 195 | $customCode = null; |
| 196 | 196 | |
| 197 | - if(!empty($customField)) { |
|
| 197 | + if (!empty($customField)) { |
|
| 198 | 198 | // If it's a custom field we just set the name |
| 199 | 199 | $name = $customField; |
| 200 | 200 | |
| 201 | - } else if(empty($formElementNames) && preg_match_all('/[\{]([^\}]*?)[\}]/s', $spanValue, $matches, PREG_SET_ORDER)) { |
|
| 201 | + } else if (empty($formElementNames) && preg_match_all('/[\{]([^\}]*?)[\}]/s', $spanValue, $matches, PREG_SET_ORDER)) { |
|
| 202 | 202 | // We are here if the $spanValue did not contain a form element for editing. |
| 203 | 203 | // We will assume that it is read only (since there were no edit form elements) |
| 204 | 204 | |
| 205 | 205 | |
| 206 | 206 | // If there is more than one matching {} value then try to find the right one to key off |
| 207 | 207 | // based on vardefs.php file. Also, use the entire spanValue as customCode |
| 208 | - if(count($matches) > 1) { |
|
| 208 | + if (count($matches) > 1) { |
|
| 209 | 209 | $name = $matches[0][1]; |
| 210 | 210 | $customCode = $spanValue; |
| 211 | - foreach($matches as $pair) { |
|
| 212 | - if(preg_match("/^(mod[\.]|app[\.]).*?/i", $pair[1])) { |
|
| 211 | + foreach ($matches as $pair) { |
|
| 212 | + if (preg_match("/^(mod[\.]|app[\.]).*?/i", $pair[1])) { |
|
| 213 | 213 | $customCode = str_replace($pair[1], '$'.strtoupper($pair[1]), $customCode); |
| 214 | 214 | } else { |
| 215 | - if(!empty($vardefs[$pair[1]])) { |
|
| 215 | + if (!empty($vardefs[$pair[1]])) { |
|
| 216 | 216 | $name = $pair[1]; |
| 217 | 217 | $customCode = str_replace($pair[1], '$fields.'.strtolower($pair[1]).'.value', $customCode); |
| 218 | 218 | } else { |
@@ -223,24 +223,24 @@ discard block |
||
| 223 | 223 | } //foreach |
| 224 | 224 | } else { |
| 225 | 225 | //If it is only a label, skip |
| 226 | - if(preg_match("/^(mod[\.]|app[\.]).*?/i", $matches[0][1])) { |
|
| 226 | + if (preg_match("/^(mod[\.]|app[\.]).*?/i", $matches[0][1])) { |
|
| 227 | 227 | continue; |
| 228 | 228 | } |
| 229 | 229 | $name = strtolower($matches[0][1]); |
| 230 | 230 | } |
| 231 | 231 | |
| 232 | - } else if(is_array($formElementNames)) { |
|
| 232 | + } else if (is_array($formElementNames)) { |
|
| 233 | 233 | |
| 234 | - if(count($formElementNames) == 1) { |
|
| 234 | + if (count($formElementNames) == 1) { |
|
| 235 | 235 | |
| 236 | - if(!empty($vardefs[$formElementNames[0]])) { |
|
| 236 | + if (!empty($vardefs[$formElementNames[0]])) { |
|
| 237 | 237 | $name = $formElementNames[0]; |
| 238 | 238 | } else { |
| 239 | 239 | // Try to use the EdtiView.php file to find author's intent |
| 240 | 240 | $name = $this->findAssignedVariableName($formElementNames[0], $filePath); |
| 241 | 241 | |
| 242 | 242 | //If it's still empty, just use the entire block as customCode |
| 243 | - if(empty($vardefs[$name])) { |
|
| 243 | + if (empty($vardefs[$name])) { |
|
| 244 | 244 | //Replace any { characters just in case |
| 245 | 245 | $customCode = str_replace('{', '{$', $spanValue); |
| 246 | 246 | } |
@@ -248,16 +248,16 @@ discard block |
||
| 248 | 248 | } else { |
| 249 | 249 | //If it is an Array of form elements, it is likely the _id and _name relate field combo |
| 250 | 250 | $relateName = $this->getRelateFieldName($formElementNames); |
| 251 | - if(!empty($relateName)) { |
|
| 251 | + if (!empty($relateName)) { |
|
| 252 | 252 | $name = $relateName; |
| 253 | 253 | } else { |
| 254 | 254 | //One last attempt to scan $formElementNames for one vardef field only |
| 255 | 255 | $name = $this->findSingleVardefElement($formElementNames, $vardefs); |
| 256 | - if(empty($name)) { |
|
| 256 | + if (empty($name)) { |
|
| 257 | 257 | $fields = array(); |
| 258 | 258 | $name = $formElementNames[0]; |
| 259 | - foreach($formElementNames as $elementName) { |
|
| 260 | - if(isset($vardefs[$elementName])) { |
|
| 259 | + foreach ($formElementNames as $elementName) { |
|
| 260 | + if (isset($vardefs[$elementName])) { |
|
| 261 | 261 | $fields[] = $elementName; |
| 262 | 262 | } else { |
| 263 | 263 | $fields[] = $this->findAssignedVariableName($elementName, $filePath); |
@@ -269,13 +269,13 @@ discard block |
||
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | // Build the entry |
| 272 | - if(preg_match("/<textarea/si", $spanValue)) { |
|
| 272 | + if (preg_match("/<textarea/si", $spanValue)) { |
|
| 273 | 273 | //special case for textarea form elements (add the displayParams) |
| 274 | 274 | $displayParams = array(); |
| 275 | 275 | $displayParams['rows'] = $this->getTagAttribute("rows", $spanValue); |
| 276 | 276 | $displayParams['cols'] = $this->getTagAttribute("cols", $spanValue); |
| 277 | 277 | |
| 278 | - if(!empty($displayParams['rows']) && !empty($displayParams['cols'])) { |
|
| 278 | + if (!empty($displayParams['rows']) && !empty($displayParams['cols'])) { |
|
| 279 | 279 | $field = array(); |
| 280 | 280 | $field['name'] = $name; |
| 281 | 281 | $field['displayParams'] = $displayParams; |
@@ -284,13 +284,13 @@ discard block |
||
| 284 | 284 | } |
| 285 | 285 | } else { |
| 286 | 286 | |
| 287 | - if(isset($fields) || isset($customCode)) { |
|
| 287 | + if (isset($fields) || isset($customCode)) { |
|
| 288 | 288 | $field = array(); |
| 289 | 289 | $field['name'] = $name; |
| 290 | - if(isset($fields)) { |
|
| 290 | + if (isset($fields)) { |
|
| 291 | 291 | $field['fields'] = $fields; |
| 292 | 292 | } |
| 293 | - if(isset($customCode)) { |
|
| 293 | + if (isset($customCode)) { |
|
| 294 | 294 | $field['customCode'] = $customCode; |
| 295 | 295 | $field['description'] = 'This field was auto generated'; |
| 296 | 296 | } |
@@ -301,12 +301,12 @@ discard block |
||
| 301 | 301 | } //if-else if-else block |
| 302 | 302 | |
| 303 | 303 | $addedField = is_array($field) ? $field['name'] : $field; |
| 304 | - if(empty($addedField) || empty($addedElements[$addedField])) { |
|
| 304 | + if (empty($addedField) || empty($addedElements[$addedField])) { |
|
| 305 | 305 | //Add the meta-data definition for required fields |
| 306 | - if($hasRequiredLabel) { |
|
| 307 | - if(is_array($field)) { |
|
| 308 | - if(isset($field['displayParams']) && is_array($field['displayParams'])) { |
|
| 309 | - $field['displayParams']['required']=true; |
|
| 306 | + if ($hasRequiredLabel) { |
|
| 307 | + if (is_array($field)) { |
|
| 308 | + if (isset($field['displayParams']) && is_array($field['displayParams'])) { |
|
| 309 | + $field['displayParams']['required'] = true; |
|
| 310 | 310 | } else { |
| 311 | 311 | $field['displayParams'] = array('required'=>true); |
| 312 | 312 | } |
@@ -321,14 +321,14 @@ discard block |
||
| 321 | 321 | } //foreach |
| 322 | 322 | |
| 323 | 323 | // One last final check. If $emptyCount does not equal Array $col count, don't add |
| 324 | - if($emptyCount != count($col)) { |
|
| 324 | + if ($emptyCount != count($col)) { |
|
| 325 | 325 | |
| 326 | - if($hasRequiredLabel) { |
|
| 327 | - if(is_array($col)) { |
|
| 328 | - if(isset($col['displayParams'])) { |
|
| 329 | - $col['displayParams']['required']=true; |
|
| 326 | + if ($hasRequiredLabel) { |
|
| 327 | + if (is_array($col)) { |
|
| 328 | + if (isset($col['displayParams'])) { |
|
| 329 | + $col['displayParams']['required'] = true; |
|
| 330 | 330 | } else { |
| 331 | - $col['displayParams']=array('required'=>true); |
|
| 331 | + $col['displayParams'] = array('required'=>true); |
|
| 332 | 332 | } |
| 333 | 333 | } else { |
| 334 | 334 | $col = array('name'=>strtolower($col), 'displayParams'=>array('required'=>true)); |
@@ -347,7 +347,7 @@ discard block |
||
| 347 | 347 | $panels = $this->applyPreRules($moduleDir, $panels); |
| 348 | 348 | |
| 349 | 349 | $templateMeta = array(); |
| 350 | - if($merge && !empty($masterCopy) && file_exists($masterCopy)) { |
|
| 350 | + if ($merge && !empty($masterCopy) && file_exists($masterCopy)) { |
|
| 351 | 351 | $panels = $this->mergePanels($panels, $vardefs, $moduleDir, $masterCopy); |
| 352 | 352 | $templateMeta = $this->mergeTemplateMeta($templateMeta, $moduleDir, $masterCopy); |
| 353 | 353 | } |
@@ -43,7 +43,9 @@ discard block |
||
| 43 | 43 | * Date: 06/03/15 |
| 44 | 44 | * Comments |
| 45 | 45 | */ |
| 46 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
| 46 | +if(!defined('sugarEntry') || !sugarEntry) { |
|
| 47 | + die('Not A Valid Entry Point'); |
|
| 48 | +} |
|
| 47 | 49 | |
| 48 | 50 | class CasesController extends SugarController { |
| 49 | 51 | |
@@ -90,8 +92,7 @@ discard block |
||
| 90 | 92 | $count++; |
| 91 | 93 | } |
| 92 | 94 | echo '</table>'; |
| 93 | - } |
|
| 94 | - else { |
|
| 95 | + } else { |
|
| 95 | 96 | echo $mod_strings['LBL_NO_SUGGESTIONS']; |
| 96 | 97 | } |
| 97 | 98 | die(); |
@@ -48,9 +48,9 @@ discard block |
||
| 48 | 48 | /** |
| 49 | 49 | * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead |
| 50 | 50 | */ |
| 51 | - function SearchFormMetaParser(){ |
|
| 51 | + function SearchFormMetaParser() { |
|
| 52 | 52 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 53 | - if(isset($GLOBALS['log'])) { |
|
| 53 | + if (isset($GLOBALS['log'])) { |
|
| 54 | 54 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 55 | 55 | } |
| 56 | 56 | else { |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | * @param $mixed |
| 66 | 66 | * @return $obj A MetaDataBean instance |
| 67 | 67 | **/ |
| 68 | -function parse($filePath, $vardefs = array(), $moduleDir = '', $merge=false, $masterCopy=null) { |
|
| 68 | +function parse($filePath, $vardefs = array(), $moduleDir = '', $merge = false, $masterCopy = null) { |
|
| 69 | 69 | |
| 70 | 70 | $contents = file_get_contents($filePath); |
| 71 | 71 | $contents = $this->trimHTML($contents); |
@@ -75,16 +75,16 @@ discard block |
||
| 75 | 75 | //basic search table |
| 76 | 76 | $basicSection = $this->processSection("basic", $tables[0], $filePath, $vardefs); |
| 77 | 77 | $advancedSection = $this->processSection("advanced", $tables[1], $filePath, $vardefs); |
| 78 | - if(file_exists($masterCopy)) { |
|
| 78 | + if (file_exists($masterCopy)) { |
|
| 79 | 79 | require($masterCopy); |
| 80 | 80 | $layouts = $searchdefs[$moduleDir]['layout']; |
| 81 | 81 | |
| 82 | - if(isset($layouts['basic_search'])) { |
|
| 82 | + if (isset($layouts['basic_search'])) { |
|
| 83 | 83 | $basicSection = $this->mergeSection($basicSection, $layouts['basic_search']); |
| 84 | 84 | $basicSection = $this->applyRules($moduleDir, $basicSection); |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | - if(isset($layouts['advanced_search'])) { |
|
| 87 | + if (isset($layouts['advanced_search'])) { |
|
| 88 | 88 | $advancedSection = $this->mergeSection($advancedSection, $layouts['advanced_search']); |
| 89 | 89 | $advancedSection = $this->applyRules($moduleDir, $advancedSection); |
| 90 | 90 | } |
@@ -95,15 +95,15 @@ discard block |
||
| 95 | 95 | 'templateMeta' => array('maxColumns' => '3', 'widths' => array('label' => '10', 'field' => '30')), |
| 96 | 96 | 'layout' => array( |
| 97 | 97 | \n\t'basic_search' =>"; |
| 98 | -$header .= "\t" . var_export($basicSection, true); |
|
| 98 | +$header .= "\t".var_export($basicSection, true); |
|
| 99 | 99 | $header .= "\n\t,'advanced_search' =>"; |
| 100 | -$header .= "\t" . var_export($advancedSection, true); |
|
| 100 | +$header .= "\t".var_export($advancedSection, true); |
|
| 101 | 101 | $header .= " |
| 102 | 102 | ),\n |
| 103 | 103 | ); |
| 104 | 104 | ?>"; |
| 105 | 105 | |
| 106 | -$header = preg_replace('/(\d+)[\s]=>[\s]?/',"",$header); |
|
| 106 | +$header = preg_replace('/(\d+)[\s]=>[\s]?/', "", $header); |
|
| 107 | 107 | return $header; |
| 108 | 108 | |
| 109 | 109 | } |
@@ -114,18 +114,18 @@ discard block |
||
| 114 | 114 | $existingElements = array(); |
| 115 | 115 | $existingLocation = array(); |
| 116 | 116 | |
| 117 | - foreach($section as $rowKey=>$row) { |
|
| 118 | - if(is_array($row) && !empty($row['name'])) { |
|
| 117 | + foreach ($section as $rowKey=>$row) { |
|
| 118 | + if (is_array($row) && !empty($row['name'])) { |
|
| 119 | 119 | $existingElements[$row['name']] = $row['name']; |
| 120 | 120 | $existingLocation[$row['name']] = array("row"=>$rowKey); |
| 121 | - } else if(!is_array($row) && !empty($row)) { |
|
| 121 | + } else if (!is_array($row) && !empty($row)) { |
|
| 122 | 122 | $existingElements[$row] = $row; |
| 123 | 123 | $existingLocation[$row] = array("row"=>$rowKey); |
| 124 | 124 | } |
| 125 | 125 | } //foreach |
| 126 | 126 | |
| 127 | 127 | // Now check against the $masterCopy |
| 128 | - foreach($masterSection as $row) { |
|
| 128 | + foreach ($masterSection as $row) { |
|
| 129 | 129 | |
| 130 | 130 | $addEntry = ''; |
| 131 | 131 | $id = is_array($row) ? $row['name'] : $row; |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | } |
| 137 | 137 | */ |
| 138 | 138 | |
| 139 | - if(isset($existingElements[$id])) { |
|
| 139 | + if (isset($existingElements[$id])) { |
|
| 140 | 140 | //Use master copy instead |
| 141 | 141 | $section[$existingLocation[$id]['row']] = $row; |
| 142 | 142 | } |
@@ -152,11 +152,11 @@ discard block |
||
| 152 | 152 | return $section; |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | -function processSection($section, $table, $filePath, $vardefs=array()) { |
|
| 155 | +function processSection($section, $table, $filePath, $vardefs = array()) { |
|
| 156 | 156 | |
| 157 | 157 | $toptr = $this->getElementsByType("tr", $table); |
| 158 | 158 | |
| 159 | - if(!is_array($toptr) || empty($toptr)) { |
|
| 159 | + if (!is_array($toptr) || empty($toptr)) { |
|
| 160 | 160 | $GLOBALS['log']->error("Could not process top row (<tr>) for $section section"); |
| 161 | 161 | $GLOBALS['log']->error($table); |
| 162 | 162 | return array(); |
@@ -164,31 +164,31 @@ discard block |
||
| 164 | 164 | |
| 165 | 165 | $tabledata = $this->getElementsByType("table", $toptr[0]); |
| 166 | 166 | |
| 167 | - if(empty($tabledata)) { |
|
| 167 | + if (empty($tabledata)) { |
|
| 168 | 168 | $GLOBALS['log']->error("Error: HTML format for SearchForm.html not as expected, results may not be accurate"); |
| 169 | 169 | $GLOBALS['log']->error($toptr[0]); |
| 170 | 170 | $tabledata[0] = "<table>{$table}</table>"; |
| 171 | 171 | } |
| 172 | 172 | |
| 173 | - if(is_array($tabledata) && !empty($tabledata[0])) { |
|
| 173 | + if (is_array($tabledata) && !empty($tabledata[0])) { |
|
| 174 | 174 | $rows = $this->getElementsByType("tr", $tabledata[0]); |
| 175 | 175 | } else { |
| 176 | 176 | $rows = $toptr[0]; |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | - if(!is_array($rows)) { |
|
| 179 | + if (!is_array($rows)) { |
|
| 180 | 180 | return array(); |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | $metarow = array(); |
| 184 | - foreach($rows as $trow) { |
|
| 184 | + foreach ($rows as $trow) { |
|
| 185 | 185 | $tablecolumns = $this->getElementsByType("td", $trow); |
| 186 | 186 | |
| 187 | 187 | $emptyCount = 0; |
| 188 | 188 | $metacolumn = array(); |
| 189 | 189 | $col = null; |
| 190 | 190 | |
| 191 | - foreach($tablecolumns as $tcols) { |
|
| 191 | + foreach ($tablecolumns as $tcols) { |
|
| 192 | 192 | |
| 193 | 193 | $spanValue = strtolower($this->getElementValue("span", $tcols)); |
| 194 | 194 | $spanValue2 = strtolower($this->getElementValue("slot", $tcols)); |
@@ -204,27 +204,27 @@ discard block |
||
| 204 | 204 | $fields = null; |
| 205 | 205 | $customCode = null; |
| 206 | 206 | |
| 207 | - if(!empty($customField)) { |
|
| 207 | + if (!empty($customField)) { |
|
| 208 | 208 | // If it's a custom field we just set the name |
| 209 | 209 | $name = $customField; |
| 210 | - } else if(is_array($formElementNames) && count($formElementNames) == 1 |
|
| 210 | + } else if (is_array($formElementNames) && count($formElementNames) == 1 |
|
| 211 | 211 | && (isset($vardefs[$formElementNames[0]]) || $formElementNames[0] == 'current_user_only')) { |
| 212 | 212 | $name = $formElementNames[0]; |
| 213 | 213 | } |
| 214 | 214 | |
| 215 | 215 | //Skip and continue if $name is empty |
| 216 | - if(empty($name)) { |
|
| 216 | + if (empty($name)) { |
|
| 217 | 217 | continue; |
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | // Build the entry |
| 221 | - if(preg_match("/<textarea/si", $spanValue)) { |
|
| 221 | + if (preg_match("/<textarea/si", $spanValue)) { |
|
| 222 | 222 | //special case for textarea form elements (add the displayParams) |
| 223 | 223 | $displayParams = array(); |
| 224 | 224 | $displayParams['rows'] = $this->getTagAttribute("rows", $spanValue); |
| 225 | 225 | $displayParams['cols'] = $this->getTagAttribute("cols", $spanValue); |
| 226 | 226 | |
| 227 | - if(!empty($displayParams['rows']) && !empty($displayParams['cols'])) { |
|
| 227 | + if (!empty($displayParams['rows']) && !empty($displayParams['cols'])) { |
|
| 228 | 228 | $field = array(); |
| 229 | 229 | $field['name'] = $name; |
| 230 | 230 | $field['displayParams'] = $displayParams; |
@@ -236,14 +236,14 @@ discard block |
||
| 236 | 236 | |
| 237 | 237 | } else { |
| 238 | 238 | |
| 239 | - if(isset($fields)) { |
|
| 239 | + if (isset($fields)) { |
|
| 240 | 240 | $field = array(); |
| 241 | 241 | $field['name'] = $name; |
| 242 | - if(isset($fields)) { |
|
| 242 | + if (isset($fields)) { |
|
| 243 | 243 | $field['fields'] = $fields; |
| 244 | 244 | } |
| 245 | 245 | |
| 246 | - if(!empty($customCode)) { |
|
| 246 | + if (!empty($customCode)) { |
|
| 247 | 247 | $field['customCode'] = $customCode; |
| 248 | 248 | } |
| 249 | 249 | |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | } //foreach |
| 258 | 258 | |
| 259 | 259 | // One last final check. If $emptyCount does not equal Array $col count, don't add |
| 260 | - if($emptyCount != count($col)) { |
|
| 260 | + if ($emptyCount != count($col)) { |
|
| 261 | 261 | //$metarow[] = $col; |
| 262 | 262 | } //if |
| 263 | 263 | |
@@ -266,17 +266,17 @@ discard block |
||
| 266 | 266 | return $metarow; |
| 267 | 267 | } |
| 268 | 268 | |
| 269 | -function applyRules($moduleDir, $section=array()) { |
|
| 269 | +function applyRules($moduleDir, $section = array()) { |
|
| 270 | 270 | require_once('include/SugarFields/Parsers/Rules/BaseRule.php'); |
| 271 | 271 | $baseRule = new BaseRule(); |
| 272 | - if(!is_array($section)) { |
|
| 272 | + if (!is_array($section)) { |
|
| 273 | 273 | $GLOBALS['log']->error("Error: SearchFormMetaParser->applyRules expects Array"); |
| 274 | 274 | return $section; |
| 275 | 275 | } |
| 276 | 276 | |
| 277 | - foreach($section as $key=>$row) { |
|
| 277 | + foreach ($section as $key=>$row) { |
|
| 278 | 278 | //Override email1 fields |
| 279 | - if($baseRule->matches($row, '/^email1$/si')) { |
|
| 279 | + if ($baseRule->matches($row, '/^email1$/si')) { |
|
| 280 | 280 | $section[$key] = array('name' => 'email', 'label' =>'LBL_ANY_EMAIL', 'type' => 'name'); |
| 281 | 281 | } |
| 282 | 282 | } |
@@ -23,8 +23,7 @@ |
||
| 23 | 23 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 24 | 24 | if(isset($GLOBALS['log'])) { |
| 25 | 25 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 26 | - } |
|
| 27 | - else { |
|
| 26 | + } else { |
|
| 28 | 27 | trigger_error($deprecatedMessage, E_USER_DEPRECATED); |
| 29 | 28 | } |
| 30 | 29 | self::__construct($seed, $module, $subPanel, $options); |
@@ -1,5 +1,5 @@ discard block |
||
| 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. |
@@ -58,9 +58,9 @@ discard block |
||
| 58 | 58 | /** |
| 59 | 59 | * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead |
| 60 | 60 | */ |
| 61 | - function QuickCreateMetaParser(){ |
|
| 61 | + function QuickCreateMetaParser() { |
|
| 62 | 62 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 63 | - if(isset($GLOBALS['log'])) { |
|
| 63 | + if (isset($GLOBALS['log'])) { |
|
| 64 | 64 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 65 | 65 | } |
| 66 | 66 | else { |
@@ -80,29 +80,29 @@ discard block |
||
| 80 | 80 | * @param $masterCopy The file path of the mater copy of the metadata file to merge against |
| 81 | 81 | * @return String format of metadata contents |
| 82 | 82 | **/ |
| 83 | -function parse($filePath, $vardefs = array(), $moduleDir = '', $merge=false, $masterCopy=null) { |
|
| 83 | +function parse($filePath, $vardefs = array(), $moduleDir = '', $merge = false, $masterCopy = null) { |
|
| 84 | 84 | |
| 85 | 85 | global $app_strings; |
| 86 | 86 | $contents = file_get_contents($filePath); |
| 87 | 87 | |
| 88 | 88 | // The contents are not well formed so we add this section to make it easier to parse |
| 89 | - $contents = $this->trimHTML($contents) . '</td></tr></table>'; |
|
| 89 | + $contents = $this->trimHTML($contents).'</td></tr></table>'; |
|
| 90 | 90 | $moduleName = ''; |
| 91 | 91 | |
| 92 | 92 | $forms = $this->getElementsByType("form", $contents); |
| 93 | - $tables = $this->getElementsByType("table", $forms[0] . "</td></tr></table>"); |
|
| 93 | + $tables = $this->getElementsByType("table", $forms[0]."</td></tr></table>"); |
|
| 94 | 94 | $mainrow = $this->getElementsByType("tr", $tables[1]); |
| 95 | 95 | $rows = substr($mainrow[0], strpos($mainrow[0], "</tr>")); |
| 96 | 96 | $tablerows = $this->getElementsByType("tr", $rows); |
| 97 | 97 | |
| 98 | - foreach($tablerows as $trow) { |
|
| 98 | + foreach ($tablerows as $trow) { |
|
| 99 | 99 | |
| 100 | 100 | $emptyCount = 0; |
| 101 | 101 | $tablecolumns = $this->getElementsByType("td", $trow); |
| 102 | 102 | $col = array(); |
| 103 | 103 | $slot = 0; |
| 104 | 104 | |
| 105 | - foreach($tablecolumns as $tcols) { |
|
| 105 | + foreach ($tablecolumns as $tcols) { |
|
| 106 | 106 | |
| 107 | 107 | $sugarAttrLabel = $this->getTagAttribute("sugar", $tcols, "'^slot[^b]+$'"); |
| 108 | 108 | $sugarAttrValue = $this->getTagAttribute("sugar", $tcols, "'slot[0-9]+b$'"); |
@@ -113,13 +113,13 @@ discard block |
||
| 113 | 113 | |
| 114 | 114 | $slot++; |
| 115 | 115 | |
| 116 | - if($sugarAttrValue) { |
|
| 116 | + if ($sugarAttrValue) { |
|
| 117 | 117 | |
| 118 | 118 | $spanValue = strtolower($this->getElementValue("span", $tcols)); |
| 119 | - if(empty($spanValue)) { |
|
| 119 | + if (empty($spanValue)) { |
|
| 120 | 120 | $spanValue = strtolower($this->getElementValue("slot", $tcols)); |
| 121 | 121 | } |
| 122 | - if(empty($spanValue)) { |
|
| 122 | + if (empty($spanValue)) { |
|
| 123 | 123 | $spanValue = strtolower($this->getElementValue("td", $tcols)); |
| 124 | 124 | } |
| 125 | 125 | |
@@ -132,56 +132,56 @@ discard block |
||
| 132 | 132 | $fields = null; |
| 133 | 133 | $customCode = null; |
| 134 | 134 | |
| 135 | - if(!empty($customField)) { |
|
| 135 | + if (!empty($customField)) { |
|
| 136 | 136 | // If it's a custom field we just set the name |
| 137 | 137 | $name = $customField; |
| 138 | 138 | |
| 139 | - } else if(empty($formElementNames) && preg_match_all('/[\{]([^\}]*?)[\}]/s', $spanValue, $matches, PREG_SET_ORDER)) { |
|
| 139 | + } else if (empty($formElementNames) && preg_match_all('/[\{]([^\}]*?)[\}]/s', $spanValue, $matches, PREG_SET_ORDER)) { |
|
| 140 | 140 | // We are here if the $spanValue did not contain a form element for editing. |
| 141 | 141 | // We will assume that it is read only (since there were no edit form elements) |
| 142 | 142 | |
| 143 | 143 | |
| 144 | 144 | // If there is more than one matching {} value then try to find the right one to key off |
| 145 | 145 | // based on vardefs.php file. Also, use the entire spanValue as customCode |
| 146 | - if(count($matches) > 1) { |
|
| 146 | + if (count($matches) > 1) { |
|
| 147 | 147 | $name = $matches[0][1]; |
| 148 | 148 | $customCode = $spanValue; |
| 149 | - foreach($matches as $pair) { |
|
| 150 | - if(preg_match("/^(mod[\.]|app[\.]).*?/s", $pair[1])) { |
|
| 149 | + foreach ($matches as $pair) { |
|
| 150 | + if (preg_match("/^(mod[\.]|app[\.]).*?/s", $pair[1])) { |
|
| 151 | 151 | $customCode = str_replace($pair[1], '$'.strtoupper($pair[1]), $customCode); |
| 152 | - } else if(!empty($vardefs[$pair[1]])) { |
|
| 152 | + } else if (!empty($vardefs[$pair[1]])) { |
|
| 153 | 153 | $name = $pair[1]; |
| 154 | 154 | $customCode = str_replace($pair[1], '$fields.'.$pair[1].'.value', $customCode); |
| 155 | 155 | } |
| 156 | 156 | } //foreach |
| 157 | 157 | } else { |
| 158 | 158 | //If it is only a label, skip |
| 159 | - if(preg_match("/^(mod[\.]|app[\.]).*?/s", $matches[0][1])) { |
|
| 159 | + if (preg_match("/^(mod[\.]|app[\.]).*?/s", $matches[0][1])) { |
|
| 160 | 160 | continue; |
| 161 | - } else if(preg_match("/^[\$].*?/s", $matches[0][1])) { |
|
| 162 | - $name = '{' . strtoupper($matches[0][1]) . '}'; |
|
| 161 | + } else if (preg_match("/^[\$].*?/s", $matches[0][1])) { |
|
| 162 | + $name = '{'.strtoupper($matches[0][1]).'}'; |
|
| 163 | 163 | } else { |
| 164 | 164 | $name = $matches[0][1]; |
| 165 | 165 | } |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | $readOnly = true; |
| 169 | - } else if(is_array($formElementNames)) { |
|
| 169 | + } else if (is_array($formElementNames)) { |
|
| 170 | 170 | |
| 171 | - if(count($formElementNames) == 1) { |
|
| 172 | - if(!empty($vardefs[$formElementNames[0]])) { |
|
| 171 | + if (count($formElementNames) == 1) { |
|
| 172 | + if (!empty($vardefs[$formElementNames[0]])) { |
|
| 173 | 173 | $name = $formElementNames[0]; |
| 174 | 174 | } |
| 175 | 175 | } else { |
| 176 | 176 | $fields = array(); |
| 177 | - foreach($formElementNames as $elementName) { |
|
| 177 | + foreach ($formElementNames as $elementName) { |
|
| 178 | 178 | // What we are doing here is saying that we will add all your fields assuming |
| 179 | 179 | // there are none that are of type relate or link. However, if we find such a type |
| 180 | 180 | // we'll take the first one found and assume that is the field you want (the SugarFields |
| 181 | 181 | // library will handle rendering the popup and select and clear buttons for you). |
| 182 | - if(isset($vardefs[$elementName])) { |
|
| 182 | + if (isset($vardefs[$elementName])) { |
|
| 183 | 183 | $type = $vardefs[$elementName]['type']; |
| 184 | - if($type != 'relate' && $type != 'link') { |
|
| 184 | + if ($type != 'relate' && $type != 'link') { |
|
| 185 | 185 | $fields[] = $elementName; |
| 186 | 186 | $name = $elementName; |
| 187 | 187 | } else { |
@@ -195,13 +195,13 @@ discard block |
||
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | // Build the entry |
| 198 | - if(preg_match("/<textarea/si", $spanValue)) { |
|
| 198 | + if (preg_match("/<textarea/si", $spanValue)) { |
|
| 199 | 199 | //special case for textarea form elements (add the displayParams) |
| 200 | 200 | $displayParams = array(); |
| 201 | 201 | $displayParams['rows'] = $this->getTagAttribute("rows", $spanValue); |
| 202 | 202 | $displayParams['cols'] = $this->getTagAttribute("cols", $spanValue); |
| 203 | 203 | |
| 204 | - if(!empty($displayParams['rows']) && !empty($displayParams['cols'])) { |
|
| 204 | + if (!empty($displayParams['rows']) && !empty($displayParams['cols'])) { |
|
| 205 | 205 | $field = array(); |
| 206 | 206 | $field['name'] = $name; |
| 207 | 207 | $field['displayParams'] = $displayParams; |
@@ -209,23 +209,23 @@ discard block |
||
| 209 | 209 | $field = $name; |
| 210 | 210 | } |
| 211 | 211 | $col[] = $field; |
| 212 | - } else if($readOnly) { |
|
| 212 | + } else if ($readOnly) { |
|
| 213 | 213 | $field = array(); |
| 214 | 214 | $field['name'] = $name; |
| 215 | 215 | $field['type'] = 'readonly'; |
| 216 | - if(isset($customCode)) { |
|
| 216 | + if (isset($customCode)) { |
|
| 217 | 217 | $field['customCode'] = $customCode; |
| 218 | 218 | } //if |
| 219 | 219 | $col[] = $field; |
| 220 | 220 | } else { |
| 221 | 221 | |
| 222 | - if(isset($fields) || isset($customCode)) { |
|
| 222 | + if (isset($fields) || isset($customCode)) { |
|
| 223 | 223 | $field = array(); |
| 224 | 224 | $field['name'] = $name; |
| 225 | - if(isset($fields)) { |
|
| 225 | + if (isset($fields)) { |
|
| 226 | 226 | $field['fields'] = $fields; |
| 227 | 227 | } |
| 228 | - if(isset($customCode)) { |
|
| 228 | + if (isset($customCode)) { |
|
| 229 | 229 | $field['customCode'] = $customCode; |
| 230 | 230 | } |
| 231 | 231 | |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | } //foreach |
| 240 | 240 | |
| 241 | 241 | // One last final check. If $emptyCount does not equal Array $col count, don't add |
| 242 | - if($emptyCount != count($col)) { |
|
| 242 | + if ($emptyCount != count($col)) { |
|
| 243 | 243 | $metarow[] = $col; |
| 244 | 244 | } //if |
| 245 | 245 | } //foreach |
@@ -249,26 +249,26 @@ discard block |
||
| 249 | 249 | |
| 250 | 250 | preg_match_all("/(<input[^>]*?)>/si", $tables[0], $matches); |
| 251 | 251 | $buttons = array(); |
| 252 | - foreach($matches[0] as $button) { |
|
| 252 | + foreach ($matches[0] as $button) { |
|
| 253 | 253 | $buttons[] = array('customCode'=>$button); |
| 254 | 254 | } |
| 255 | 255 | $templateMeta['form']['buttons'] = $buttons; |
| 256 | 256 | |
| 257 | 257 | $formElements = $this->getFormElements($contents); |
| 258 | 258 | $hiddenInputs = array(); |
| 259 | - foreach($formElements as $elem) { |
|
| 259 | + foreach ($formElements as $elem) { |
|
| 260 | 260 | $type = $this->getTagAttribute("type", $elem); |
| 261 | - if(preg_match('/hidden/si',$type, $matches)) { |
|
| 261 | + if (preg_match('/hidden/si', $type, $matches)) { |
|
| 262 | 262 | $name = $this->getTagAttribute("name", $elem); |
| 263 | 263 | $value = $this->getTagAttribute("value", $elem); |
| 264 | 264 | $index = stripos($value, '$REQUEST'); |
| 265 | - $value = !empty($index) ? '$smarty.request.' . substr($value, 10) : $value; |
|
| 266 | - $hiddenInputs[] = '<input id="' . $name . '" name="' . $name . '" value="' . $value . '">'; |
|
| 265 | + $value = !empty($index) ? '$smarty.request.'.substr($value, 10) : $value; |
|
| 266 | + $hiddenInputs[] = '<input id="'.$name.'" name="'.$name.'" value="'.$value.'">'; |
|
| 267 | 267 | } |
| 268 | 268 | } //foreach |
| 269 | 269 | |
| 270 | 270 | $templateMeta['form']['hidden'] = $hiddenInputs; |
| 271 | - $templateMeta['widths'] = array(array('label' => '10', 'field' => '30'), array('label' => '10', 'field' => '30')); |
|
| 271 | + $templateMeta['widths'] = array(array('label' => '10', 'field' => '30'), array('label' => '10', 'field' => '30')); |
|
| 272 | 272 | $templateMeta['maxColumns'] = 2; |
| 273 | 273 | |
| 274 | 274 | $panels = array(); |
@@ -43,7 +43,9 @@ discard block |
||
| 43 | 43 | * Date: 06/03/15 |
| 44 | 44 | * Comments |
| 45 | 45 | */ |
| 46 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
| 46 | +if(!defined('sugarEntry') || !sugarEntry) { |
|
| 47 | + die('Not A Valid Entry Point'); |
|
| 48 | +} |
|
| 47 | 49 | |
| 48 | 50 | class CasesController extends SugarController { |
| 49 | 51 | |
@@ -90,8 +92,7 @@ discard block |
||
| 90 | 92 | $count++; |
| 91 | 93 | } |
| 92 | 94 | echo '</table>'; |
| 93 | - } |
|
| 94 | - else { |
|
| 95 | + } else { |
|
| 95 | 96 | echo $mod_strings['LBL_NO_SUGGESTIONS']; |
| 96 | 97 | } |
| 97 | 98 | die(); |
@@ -64,24 +64,24 @@ discard block |
||
| 64 | 64 | |
| 65 | 65 | static function fixupFieldType($field) { |
| 66 | 66 | switch($field) { |
| 67 | - case 'double': |
|
| 67 | + case 'double': |
|
| 68 | 68 | case 'decimal': |
| 69 | 69 | $field = 'float'; |
| 70 | 70 | break; |
| 71 | - case 'uint': |
|
| 71 | + case 'uint': |
|
| 72 | 72 | case 'ulong': |
| 73 | 73 | case 'long': |
| 74 | 74 | case 'short': |
| 75 | 75 | case 'tinyint': |
| 76 | 76 | $field = 'int'; |
| 77 | 77 | break; |
| 78 | - case 'date': |
|
| 78 | + case 'date': |
|
| 79 | 79 | $field = 'datetime'; |
| 80 | 80 | break; |
| 81 | - case 'url': |
|
| 82 | - $field = 'link'; |
|
| 83 | - break; |
|
| 84 | - case 'varchar': |
|
| 81 | + case 'url': |
|
| 82 | + $field = 'link'; |
|
| 83 | + break; |
|
| 84 | + case 'varchar': |
|
| 85 | 85 | $field = 'base'; |
| 86 | 86 | break; |
| 87 | 87 | } |
@@ -101,34 +101,34 @@ discard block |
||
| 101 | 101 | $field = ucfirst($field); |
| 102 | 102 | |
| 103 | 103 | if(!isset($sugarFieldObjects[$field])) { |
| 104 | - //check custom directory |
|
| 105 | - if(file_exists('custom/include/SugarFields/Fields/' . $field . '/SugarField' . $field. '.php')){ |
|
| 106 | - $file = 'custom/include/SugarFields/Fields/' . $field . '/SugarField' . $field. '.php'; |
|
| 104 | + //check custom directory |
|
| 105 | + if(file_exists('custom/include/SugarFields/Fields/' . $field . '/SugarField' . $field. '.php')){ |
|
| 106 | + $file = 'custom/include/SugarFields/Fields/' . $field . '/SugarField' . $field. '.php'; |
|
| 107 | 107 | $type = $field; |
| 108 | - //else check the fields directory |
|
| 109 | - }else if(file_exists('include/SugarFields/Fields/' . $field . '/SugarField' . $field. '.php')){ |
|
| 110 | - $file = 'include/SugarFields/Fields/' . $field . '/SugarField' . $field. '.php'; |
|
| 108 | + //else check the fields directory |
|
| 109 | + }else if(file_exists('include/SugarFields/Fields/' . $field . '/SugarField' . $field. '.php')){ |
|
| 110 | + $file = 'include/SugarFields/Fields/' . $field . '/SugarField' . $field. '.php'; |
|
| 111 | 111 | $type = $field; |
| 112 | - }else{ |
|
| 112 | + }else{ |
|
| 113 | 113 | // No direct class, check the directories to see if they are defined |
| 114 | - if( $returnNullIfBase && |
|
| 114 | + if( $returnNullIfBase && |
|
| 115 | 115 | !is_dir('custom/include/SugarFields/Fields/'.$field) && |
| 116 | 116 | !is_dir('include/SugarFields/Fields/'.$field) ) { |
| 117 | 117 | return null; |
| 118 | 118 | } |
| 119 | - $file = 'include/SugarFields/Fields/Base/SugarFieldBase.php'; |
|
| 119 | + $file = 'include/SugarFields/Fields/Base/SugarFieldBase.php'; |
|
| 120 | 120 | $type = 'Base'; |
| 121 | - } |
|
| 122 | - require_once($file); |
|
| 123 | - |
|
| 124 | - $class = 'SugarField' . $type; |
|
| 125 | - //could be a custom class check it |
|
| 126 | - $customClass = 'Custom' . $class; |
|
| 127 | - if(class_exists($customClass)){ |
|
| 128 | - $sugarFieldObjects[$field] = new $customClass($field); |
|
| 129 | - }else{ |
|
| 130 | - $sugarFieldObjects[$field] = new $class($field); |
|
| 131 | - } |
|
| 121 | + } |
|
| 122 | + require_once($file); |
|
| 123 | + |
|
| 124 | + $class = 'SugarField' . $type; |
|
| 125 | + //could be a custom class check it |
|
| 126 | + $customClass = 'Custom' . $class; |
|
| 127 | + if(class_exists($customClass)){ |
|
| 128 | + $sugarFieldObjects[$field] = new $customClass($field); |
|
| 129 | + }else{ |
|
| 130 | + $sugarFieldObjects[$field] = new $class($field); |
|
| 131 | + } |
|
| 132 | 132 | } |
| 133 | 133 | return $sugarFieldObjects[$field]; |
| 134 | 134 | } |
@@ -149,22 +149,22 @@ discard block |
||
| 149 | 149 | $string = ''; |
| 150 | 150 | $displayTypeFunc = 'get' . $displayType . 'Smarty'; // getDetailViewSmarty, getEditViewSmarty, etc... |
| 151 | 151 | |
| 152 | - // This will handle custom type fields. |
|
| 153 | - // The incoming $vardef Array may have custom_type set. |
|
| 154 | - // If so, set $vardef['type'] to the $vardef['custom_type'] value |
|
| 155 | - if(isset($vardef['custom_type'])) { |
|
| 156 | - $vardef['type'] = $vardef['custom_type']; |
|
| 157 | - } |
|
| 158 | - if(empty($vardef['type'])) { |
|
| 159 | - $vardef['type'] = 'varchar'; |
|
| 160 | - } |
|
| 161 | - |
|
| 162 | - $field = self::getSugarField($vardef['type']); |
|
| 163 | - if ( !empty($vardef['function']) ) { |
|
| 164 | - $string = $field->displayFromFunc($displayType, $parentFieldArray, $vardef, $displayParams, $tabindex); |
|
| 165 | - } else { |
|
| 166 | - $string = $field->$displayTypeFunc($parentFieldArray, $vardef, $displayParams, $tabindex); |
|
| 167 | - } |
|
| 152 | + // This will handle custom type fields. |
|
| 153 | + // The incoming $vardef Array may have custom_type set. |
|
| 154 | + // If so, set $vardef['type'] to the $vardef['custom_type'] value |
|
| 155 | + if(isset($vardef['custom_type'])) { |
|
| 156 | + $vardef['type'] = $vardef['custom_type']; |
|
| 157 | + } |
|
| 158 | + if(empty($vardef['type'])) { |
|
| 159 | + $vardef['type'] = 'varchar'; |
|
| 160 | + } |
|
| 161 | + |
|
| 162 | + $field = self::getSugarField($vardef['type']); |
|
| 163 | + if ( !empty($vardef['function']) ) { |
|
| 164 | + $string = $field->displayFromFunc($displayType, $parentFieldArray, $vardef, $displayParams, $tabindex); |
|
| 165 | + } else { |
|
| 166 | + $string = $field->$displayTypeFunc($parentFieldArray, $vardef, $displayParams, $tabindex); |
|
| 167 | + } |
|
| 168 | 168 | |
| 169 | 169 | return $string; |
| 170 | 170 | } |
@@ -50,9 +50,9 @@ discard block |
||
| 50 | 50 | /** |
| 51 | 51 | * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead |
| 52 | 52 | */ |
| 53 | - function SugarFieldHandler(){ |
|
| 53 | + function SugarFieldHandler() { |
|
| 54 | 54 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 55 | - if(isset($GLOBALS['log'])) { |
|
| 55 | + if (isset($GLOBALS['log'])) { |
|
| 56 | 56 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 57 | 57 | } |
| 58 | 58 | else { |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | |
| 64 | 64 | |
| 65 | 65 | static function fixupFieldType($field) { |
| 66 | - switch($field) { |
|
| 66 | + switch ($field) { |
|
| 67 | 67 | case 'double': |
| 68 | 68 | case 'decimal': |
| 69 | 69 | $field = 'float'; |
@@ -94,26 +94,26 @@ discard block |
||
| 94 | 94 | * |
| 95 | 95 | * @param field string field type |
| 96 | 96 | */ |
| 97 | - static function getSugarField($field, $returnNullIfBase=false) { |
|
| 97 | + static function getSugarField($field, $returnNullIfBase = false) { |
|
| 98 | 98 | static $sugarFieldObjects = array(); |
| 99 | 99 | |
| 100 | 100 | $field = self::fixupFieldType($field); |
| 101 | 101 | $field = ucfirst($field); |
| 102 | 102 | |
| 103 | - if(!isset($sugarFieldObjects[$field])) { |
|
| 103 | + if (!isset($sugarFieldObjects[$field])) { |
|
| 104 | 104 | //check custom directory |
| 105 | - if(file_exists('custom/include/SugarFields/Fields/' . $field . '/SugarField' . $field. '.php')){ |
|
| 106 | - $file = 'custom/include/SugarFields/Fields/' . $field . '/SugarField' . $field. '.php'; |
|
| 105 | + if (file_exists('custom/include/SugarFields/Fields/'.$field.'/SugarField'.$field.'.php')) { |
|
| 106 | + $file = 'custom/include/SugarFields/Fields/'.$field.'/SugarField'.$field.'.php'; |
|
| 107 | 107 | $type = $field; |
| 108 | 108 | //else check the fields directory |
| 109 | - }else if(file_exists('include/SugarFields/Fields/' . $field . '/SugarField' . $field. '.php')){ |
|
| 110 | - $file = 'include/SugarFields/Fields/' . $field . '/SugarField' . $field. '.php'; |
|
| 109 | + } else if (file_exists('include/SugarFields/Fields/'.$field.'/SugarField'.$field.'.php')) { |
|
| 110 | + $file = 'include/SugarFields/Fields/'.$field.'/SugarField'.$field.'.php'; |
|
| 111 | 111 | $type = $field; |
| 112 | - }else{ |
|
| 112 | + } else { |
|
| 113 | 113 | // No direct class, check the directories to see if they are defined |
| 114 | - if( $returnNullIfBase && |
|
| 114 | + if ($returnNullIfBase && |
|
| 115 | 115 | !is_dir('custom/include/SugarFields/Fields/'.$field) && |
| 116 | - !is_dir('include/SugarFields/Fields/'.$field) ) { |
|
| 116 | + !is_dir('include/SugarFields/Fields/'.$field)) { |
|
| 117 | 117 | return null; |
| 118 | 118 | } |
| 119 | 119 | $file = 'include/SugarFields/Fields/Base/SugarFieldBase.php'; |
@@ -121,12 +121,12 @@ discard block |
||
| 121 | 121 | } |
| 122 | 122 | require_once($file); |
| 123 | 123 | |
| 124 | - $class = 'SugarField' . $type; |
|
| 124 | + $class = 'SugarField'.$type; |
|
| 125 | 125 | //could be a custom class check it |
| 126 | - $customClass = 'Custom' . $class; |
|
| 127 | - if(class_exists($customClass)){ |
|
| 126 | + $customClass = 'Custom'.$class; |
|
| 127 | + if (class_exists($customClass)) { |
|
| 128 | 128 | $sugarFieldObjects[$field] = new $customClass($field); |
| 129 | - }else{ |
|
| 129 | + } else { |
|
| 130 | 130 | $sugarFieldObjects[$field] = new $class($field); |
| 131 | 131 | } |
| 132 | 132 | } |
@@ -147,20 +147,20 @@ discard block |
||
| 147 | 147 | */ |
| 148 | 148 | static function displaySmarty($parentFieldArray, $vardef, $displayType, $displayParams = array(), $tabindex = 1) { |
| 149 | 149 | $string = ''; |
| 150 | - $displayTypeFunc = 'get' . $displayType . 'Smarty'; // getDetailViewSmarty, getEditViewSmarty, etc... |
|
| 150 | + $displayTypeFunc = 'get'.$displayType.'Smarty'; // getDetailViewSmarty, getEditViewSmarty, etc... |
|
| 151 | 151 | |
| 152 | 152 | // This will handle custom type fields. |
| 153 | 153 | // The incoming $vardef Array may have custom_type set. |
| 154 | 154 | // If so, set $vardef['type'] to the $vardef['custom_type'] value |
| 155 | - if(isset($vardef['custom_type'])) { |
|
| 155 | + if (isset($vardef['custom_type'])) { |
|
| 156 | 156 | $vardef['type'] = $vardef['custom_type']; |
| 157 | 157 | } |
| 158 | - if(empty($vardef['type'])) { |
|
| 158 | + if (empty($vardef['type'])) { |
|
| 159 | 159 | $vardef['type'] = 'varchar'; |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | $field = self::getSugarField($vardef['type']); |
| 163 | - if ( !empty($vardef['function']) ) { |
|
| 163 | + if (!empty($vardef['function'])) { |
|
| 164 | 164 | $string = $field->displayFromFunc($displayType, $parentFieldArray, $vardef, $displayParams, $tabindex); |
| 165 | 165 | } else { |
| 166 | 166 | $string = $field->$displayTypeFunc($parentFieldArray, $vardef, $displayParams, $tabindex); |
@@ -54,8 +54,7 @@ discard block |
||
| 54 | 54 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 55 | 55 | if(isset($GLOBALS['log'])) { |
| 56 | 56 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 57 | - } |
|
| 58 | - else { |
|
| 57 | + } else { |
|
| 59 | 58 | trigger_error($deprecatedMessage, E_USER_DEPRECATED); |
| 60 | 59 | } |
| 61 | 60 | self::__construct(); |
@@ -106,10 +105,10 @@ discard block |
||
| 106 | 105 | $file = 'custom/include/SugarFields/Fields/' . $field . '/SugarField' . $field. '.php'; |
| 107 | 106 | $type = $field; |
| 108 | 107 | //else check the fields directory |
| 109 | - }else if(file_exists('include/SugarFields/Fields/' . $field . '/SugarField' . $field. '.php')){ |
|
| 108 | + } else if(file_exists('include/SugarFields/Fields/' . $field . '/SugarField' . $field. '.php')){ |
|
| 110 | 109 | $file = 'include/SugarFields/Fields/' . $field . '/SugarField' . $field. '.php'; |
| 111 | 110 | $type = $field; |
| 112 | - }else{ |
|
| 111 | + } else{ |
|
| 113 | 112 | // No direct class, check the directories to see if they are defined |
| 114 | 113 | if( $returnNullIfBase && |
| 115 | 114 | !is_dir('custom/include/SugarFields/Fields/'.$field) && |
@@ -126,7 +125,7 @@ discard block |
||
| 126 | 125 | $customClass = 'Custom' . $class; |
| 127 | 126 | if(class_exists($customClass)){ |
| 128 | 127 | $sugarFieldObjects[$field] = new $customClass($field); |
| 129 | - }else{ |
|
| 128 | + } else{ |
|
| 130 | 129 | $sugarFieldObjects[$field] = new $class($field); |
| 131 | 130 | } |
| 132 | 131 | } |