@@ -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. |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | parent::__construct($id, $def); |
| 54 | 54 | |
| 55 | - if(empty($def['title'])) $this->title = translate('LBL_LIST_MY_TASKS', 'Tasks'); |
|
| 55 | + if (empty($def['title'])) $this->title = translate('LBL_LIST_MY_TASKS', 'Tasks'); |
|
| 56 | 56 | |
| 57 | 57 | $this->searchFields = $dashletData['MyTasksDashlet']['searchFields']; |
| 58 | 58 | $this->columns = $dashletData['MyTasksDashlet']['columns']; |
@@ -63,9 +63,9 @@ discard block |
||
| 63 | 63 | /** |
| 64 | 64 | * @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 |
| 65 | 65 | */ |
| 66 | - function MyTasksDashlet($id, $def = null){ |
|
| 66 | + function MyTasksDashlet($id, $def = null) { |
|
| 67 | 67 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 68 | - if(isset($GLOBALS['log'])) { |
|
| 68 | + if (isset($GLOBALS['log'])) { |
|
| 69 | 69 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 70 | 70 | } |
| 71 | 71 | else { |
@@ -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. |
@@ -52,7 +54,9 @@ discard block |
||
| 52 | 54 | |
| 53 | 55 | parent::__construct($id, $def); |
| 54 | 56 | |
| 55 | - if(empty($def['title'])) $this->title = translate('LBL_LIST_MY_TASKS', 'Tasks'); |
|
| 57 | + if(empty($def['title'])) { |
|
| 58 | + $this->title = translate('LBL_LIST_MY_TASKS', 'Tasks'); |
|
| 59 | + } |
|
| 56 | 60 | |
| 57 | 61 | $this->searchFields = $dashletData['MyTasksDashlet']['searchFields']; |
| 58 | 62 | $this->columns = $dashletData['MyTasksDashlet']['columns']; |
@@ -67,8 +71,7 @@ discard block |
||
| 67 | 71 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 68 | 72 | if(isset($GLOBALS['log'])) { |
| 69 | 73 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 70 | - } |
|
| 71 | - else { |
|
| 74 | + } else { |
|
| 72 | 75 | trigger_error($deprecatedMessage, E_USER_DEPRECATED); |
| 73 | 76 | } |
| 74 | 77 | self::__construct($id, $def); |
@@ -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. |
@@ -92,9 +92,9 @@ discard block |
||
| 92 | 92 | /** |
| 93 | 93 | * @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 |
| 94 | 94 | */ |
| 95 | - public function Task(){ |
|
| 95 | + public function Task() { |
|
| 96 | 96 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 97 | - if(isset($GLOBALS['log'])) { |
|
| 97 | + if (isset($GLOBALS['log'])) { |
|
| 98 | 98 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 99 | 99 | } |
| 100 | 100 | else { |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | |
| 109 | 109 | function save($check_notify = FALSE) |
| 110 | 110 | { |
| 111 | - if (empty($this->status) ) { |
|
| 111 | + if (empty($this->status)) { |
|
| 112 | 112 | $this->status = $this->getDefaultStatus(); |
| 113 | 113 | } |
| 114 | 114 | return parent::save($check_notify); |
@@ -119,12 +119,12 @@ discard block |
||
| 119 | 119 | return "$this->name"; |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | - function create_export_query($order_by, $where, $relate_link_join='') |
|
| 122 | + function create_export_query($order_by, $where, $relate_link_join = '') |
|
| 123 | 123 | { |
| 124 | 124 | $custom_join = $this->getCustomJoin(true, true, $where); |
| 125 | 125 | $custom_join['join'] .= $relate_link_join; |
| 126 | - $contact_required = stristr($where,"contacts"); |
|
| 127 | - if($contact_required) |
|
| 126 | + $contact_required = stristr($where, "contacts"); |
|
| 127 | + if ($contact_required) |
|
| 128 | 128 | { |
| 129 | 129 | $query = "SELECT tasks.*, contacts.first_name, contacts.last_name, users.user_name as assigned_user_name "; |
| 130 | 130 | $query .= $custom_join['select']; |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | $query .= $custom_join['join']; |
| 144 | 144 | $query .= " LEFT JOIN users ON tasks.assigned_user_id=users.id "; |
| 145 | 145 | |
| 146 | - if($where != "") |
|
| 146 | + if ($where != "") |
|
| 147 | 147 | $query .= "where $where AND ".$where_auto; |
| 148 | 148 | else |
| 149 | 149 | $query .= "where ".$where_auto; |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | if (empty($order_by)) { |
| 153 | 153 | $order_by = 'tasks.name'; |
| 154 | 154 | } |
| 155 | - $query .= ' ORDER BY ' . $order_by; |
|
| 155 | + $query .= ' ORDER BY '.$order_by; |
|
| 156 | 156 | |
| 157 | 157 | return $query; |
| 158 | 158 | |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | $contact = new Contact(); |
| 176 | 176 | $contact->retrieve($this->contact_id); |
| 177 | 177 | |
| 178 | - if($contact->id != "") { |
|
| 178 | + if ($contact->id != "") { |
|
| 179 | 179 | $this->contact_name = $contact->full_name; |
| 180 | 180 | $this->contact_name_owner = $contact->assigned_user_id; |
| 181 | 181 | $this->contact_name_mod = 'Contacts'; |
@@ -184,9 +184,9 @@ discard block |
||
| 184 | 184 | } else { |
| 185 | 185 | $this->contact_name_mod = ''; |
| 186 | 186 | $this->contact_name_owner = ''; |
| 187 | - $this->contact_name=''; |
|
| 187 | + $this->contact_name = ''; |
|
| 188 | 188 | $this->contact_email = ''; |
| 189 | - $this->contact_id=''; |
|
| 189 | + $this->contact_id = ''; |
|
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | } |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | |
| 200 | 200 | $this->parent_name = ''; |
| 201 | 201 | global $app_strings, $beanFiles, $beanList, $locale; |
| 202 | - if ( ! isset($beanList[$this->parent_type])) |
|
| 202 | + if (!isset($beanList[$this->parent_type])) |
|
| 203 | 203 | { |
| 204 | 204 | $this->parent_name = ''; |
| 205 | 205 | return; |
@@ -218,19 +218,19 @@ discard block |
||
| 218 | 218 | else { |
| 219 | 219 | |
| 220 | 220 | $query = "SELECT name "; |
| 221 | - if(isset($parent->field_defs['assigned_user_id'])){ |
|
| 221 | + if (isset($parent->field_defs['assigned_user_id'])) { |
|
| 222 | 222 | $query .= " , assigned_user_id parent_name_owner "; |
| 223 | - }else{ |
|
| 223 | + } else { |
|
| 224 | 224 | $query .= " , created_by parent_name_owner "; |
| 225 | 225 | } |
| 226 | 226 | $query .= " from $parent->table_name where id = '$this->parent_id'"; |
| 227 | 227 | } |
| 228 | - $result = $this->db->query($query,true," Error filling in additional detail fields: "); |
|
| 228 | + $result = $this->db->query($query, true, " Error filling in additional detail fields: "); |
|
| 229 | 229 | |
| 230 | 230 | // Get the id and the name. |
| 231 | 231 | $row = $this->db->fetchByAssoc($result); |
| 232 | 232 | |
| 233 | - if ($row && !empty($row['parent_name_owner'])){ |
|
| 233 | + if ($row && !empty($row['parent_name_owner'])) { |
|
| 234 | 234 | $this->parent_name_owner = $row['parent_name_owner']; |
| 235 | 235 | $this->parent_name_mod = $this->parent_type; |
| 236 | 236 | } |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | else if (is_subclass_of($parent, 'File') && $row != null) { |
| 242 | 242 | $this->parent_name = $row['document_name']; |
| 243 | 243 | } |
| 244 | - elseif($row != null) |
|
| 244 | + elseif ($row != null) |
|
| 245 | 245 | { |
| 246 | 246 | $this->parent_name = stripslashes($row['name']); |
| 247 | 247 | } |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | { |
| 256 | 256 | global $timedate; |
| 257 | 257 | |
| 258 | - if(empty($dbtime)) return; |
|
| 258 | + if (empty($dbtime)) return; |
|
| 259 | 259 | |
| 260 | 260 | $today = $timedate->nowDbDate(); |
| 261 | 261 | |
@@ -266,22 +266,22 @@ discard block |
||
| 266 | 266 | |
| 267 | 267 | $dd = $timedate->to_db_date($date_due, false); |
| 268 | 268 | $taskClass = 'futureTask'; |
| 269 | - if ($dd < $today){ |
|
| 269 | + if ($dd < $today) { |
|
| 270 | 270 | $taskClass = 'overdueTask'; |
| 271 | - }else if( $dd == $today ){ |
|
| 271 | + } else if ($dd == $today) { |
|
| 272 | 272 | $taskClass = 'todaysTask'; |
| 273 | 273 | } |
| 274 | - $task_fields['DATE_DUE']= "<font class='$taskClass'>$date_due</font>"; |
|
| 275 | - if($override_date_for_subpanel){ |
|
| 276 | - $task_fields['DATE_START']= "<font class='$taskClass'>$date_due</font>"; |
|
| 274 | + $task_fields['DATE_DUE'] = "<font class='$taskClass'>$date_due</font>"; |
|
| 275 | + if ($override_date_for_subpanel) { |
|
| 276 | + $task_fields['DATE_START'] = "<font class='$taskClass'>$date_due</font>"; |
|
| 277 | 277 | } |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | - function get_list_view_data(){ |
|
| 280 | + function get_list_view_data() { |
|
| 281 | 281 | global $action, $currentModule, $focus, $current_module_strings, $app_list_strings, $timedate; |
| 282 | 282 | |
| 283 | 283 | $override_date_for_subpanel = false; |
| 284 | - if(!empty($_REQUEST['module']) && $_REQUEST['module'] !='Calendar' && $_REQUEST['module'] !='Tasks' && $_REQUEST['module'] !='Home'){ |
|
| 284 | + if (!empty($_REQUEST['module']) && $_REQUEST['module'] != 'Calendar' && $_REQUEST['module'] != 'Tasks' && $_REQUEST['module'] != 'Home') { |
|
| 285 | 285 | //this is a subpanel list view, so override the due date with start date so that collections subpanel works as expected |
| 286 | 286 | $override_date_for_subpanel = true; |
| 287 | 287 | } |
@@ -289,11 +289,11 @@ discard block |
||
| 289 | 289 | $today = $timedate->nowDb(); |
| 290 | 290 | $task_fields = $this->get_list_view_array(); |
| 291 | 291 | $dbtime = $timedate->to_db($task_fields['DATE_DUE']); |
| 292 | - if($override_date_for_subpanel){ |
|
| 292 | + if ($override_date_for_subpanel) { |
|
| 293 | 293 | $dbtime = $timedate->to_db($task_fields['DATE_START']); |
| 294 | 294 | } |
| 295 | 295 | |
| 296 | - if(!empty($dbtime)) |
|
| 296 | + if (!empty($dbtime)) |
|
| 297 | 297 | { |
| 298 | 298 | $task_fields['TIME_DUE'] = $timedate->to_display_time($dbtime); |
| 299 | 299 | $task_fields['DATE_DUE'] = $timedate->to_display_date($dbtime); |
@@ -304,10 +304,10 @@ discard block |
||
| 304 | 304 | $task_fields['PRIORITY'] = $app_list_strings['task_priority_dom'][$this->priority]; |
| 305 | 305 | if (isset($this->parent_type)) |
| 306 | 306 | $task_fields['PARENT_MODULE'] = $this->parent_type; |
| 307 | - if ($this->status != "Completed" && $this->status != "Deferred" ) |
|
| 307 | + if ($this->status != "Completed" && $this->status != "Deferred") |
|
| 308 | 308 | { |
| 309 | 309 | $setCompleteUrl = "<a id='{$this->id}' onclick='SUGAR.util.closeActivityPanel.show(\"{$this->module_dir}\",\"{$this->id}\",\"Completed\",\"listview\",\"1\");'>"; |
| 310 | - $task_fields['SET_COMPLETE'] = $setCompleteUrl . SugarThemeRegistry::current()->getImage("close_inline","title=".translate('LBL_LIST_CLOSE','Tasks')." border='0'",null,null,'.gif',translate('LBL_LIST_CLOSE','Tasks'))."</a>"; |
|
| 310 | + $task_fields['SET_COMPLETE'] = $setCompleteUrl.SugarThemeRegistry::current()->getImage("close_inline", "title=".translate('LBL_LIST_CLOSE', 'Tasks')." border='0'", null, null, '.gif', translate('LBL_LIST_CLOSE', 'Tasks'))."</a>"; |
|
| 311 | 311 | } |
| 312 | 312 | |
| 313 | 313 | // make sure we grab the localized version of the contact name, if a contact is provided |
@@ -323,15 +323,15 @@ discard block |
||
| 323 | 323 | } |
| 324 | 324 | } |
| 325 | 325 | |
| 326 | - $task_fields['CONTACT_NAME']= $this->contact_name; |
|
| 327 | - $task_fields['CONTACT_PHONE']= $this->contact_phone; |
|
| 326 | + $task_fields['CONTACT_NAME'] = $this->contact_name; |
|
| 327 | + $task_fields['CONTACT_PHONE'] = $this->contact_phone; |
|
| 328 | 328 | $task_fields['TITLE'] = ''; |
| 329 | 329 | if (!empty($task_fields['CONTACT_NAME'])) { |
| 330 | 330 | $task_fields['TITLE'] .= $current_module_strings['LBL_LIST_CONTACT'].": ".$task_fields['CONTACT_NAME']; |
| 331 | 331 | } |
| 332 | 332 | if (!empty($this->parent_name)) { |
| 333 | 333 | $task_fields['TITLE'] .= "\n".$app_list_strings['parent_type_display'][$this->parent_type].": ".$this->parent_name; |
| 334 | - $task_fields['PARENT_NAME']=$this->parent_name; |
|
| 334 | + $task_fields['PARENT_NAME'] = $this->parent_name; |
|
| 335 | 335 | } |
| 336 | 336 | |
| 337 | 337 | return $task_fields; |
@@ -345,9 +345,9 @@ discard block |
||
| 345 | 345 | $prefDate = $notifyUser->getUserDateTimePreferences(); |
| 346 | 346 | $xtpl->assign("TASK_SUBJECT", $task->name); |
| 347 | 347 | //MFH #13507 |
| 348 | - $xtpl->assign("TASK_PRIORITY", (isset($task->priority)?$app_list_strings['task_priority_dom'][$task->priority]:"")); |
|
| 348 | + $xtpl->assign("TASK_PRIORITY", (isset($task->priority) ? $app_list_strings['task_priority_dom'][$task->priority] : "")); |
|
| 349 | 349 | |
| 350 | - if(!empty($task->date_due)) |
|
| 350 | + if (!empty($task->date_due)) |
|
| 351 | 351 | { |
| 352 | 352 | $duedate = $timedate->fromDb($task->date_due); |
| 353 | 353 | $xtpl->assign("TASK_DUEDATE", $timedate->asUser($duedate, $notifyUser)." ".TimeDate::userTimezoneSuffix($duedate, $notifyUser)); |
@@ -355,33 +355,33 @@ discard block |
||
| 355 | 355 | $xtpl->assign("TASK_DUEDATE", ''); |
| 356 | 356 | } |
| 357 | 357 | |
| 358 | - $xtpl->assign("TASK_STATUS", (isset($task->status)?$app_list_strings['task_status_dom'][$task->status]:"")); |
|
| 358 | + $xtpl->assign("TASK_STATUS", (isset($task->status) ? $app_list_strings['task_status_dom'][$task->status] : "")); |
|
| 359 | 359 | $xtpl->assign("TASK_DESCRIPTION", $task->description); |
| 360 | 360 | |
| 361 | 361 | return $xtpl; |
| 362 | 362 | } |
| 363 | 363 | |
| 364 | - function bean_implements($interface){ |
|
| 365 | - switch($interface){ |
|
| 364 | + function bean_implements($interface) { |
|
| 365 | + switch ($interface) { |
|
| 366 | 366 | case 'ACL':return true; |
| 367 | 367 | } |
| 368 | 368 | return false; |
| 369 | 369 | } |
| 370 | - function listviewACLHelper(){ |
|
| 370 | + function listviewACLHelper() { |
|
| 371 | 371 | $array_assign = parent::listviewACLHelper(); |
| 372 | 372 | $is_owner = false; |
| 373 | 373 | $in_group = false; //SECURITY GROUPS |
| 374 | - if(!empty($this->parent_name)){ |
|
| 375 | - if(!empty($this->parent_name_owner)){ |
|
| 374 | + if (!empty($this->parent_name)) { |
|
| 375 | + if (!empty($this->parent_name_owner)) { |
|
| 376 | 376 | global $current_user; |
| 377 | 377 | $is_owner = $current_user->id == $this->parent_name_owner; |
| 378 | 378 | } |
| 379 | 379 | /* BEGIN - SECURITY GROUPS */ |
| 380 | 380 | //parent_name_owner not being set for whatever reason so we need to figure this out |
| 381 | - else if(!empty($this->parent_type) && !empty($this->parent_id)) { |
|
| 381 | + else if (!empty($this->parent_type) && !empty($this->parent_id)) { |
|
| 382 | 382 | global $current_user; |
| 383 | - $parent_bean = BeanFactory::getBean($this->parent_type,$this->parent_id); |
|
| 384 | - if($parent_bean !== false) { |
|
| 383 | + $parent_bean = BeanFactory::getBean($this->parent_type, $this->parent_id); |
|
| 384 | + if ($parent_bean !== false) { |
|
| 385 | 385 | $is_owner = $current_user->id == $parent_bean->assigned_user_id; |
| 386 | 386 | } |
| 387 | 387 | } |
@@ -394,16 +394,16 @@ discard block |
||
| 394 | 394 | /** |
| 395 | 395 | if(!ACLController::moduleSupportsACL($this->parent_type) || ACLController::checkAccess($this->parent_type, 'view', $is_owner)){ |
| 396 | 396 | */ |
| 397 | - if(!ACLController::moduleSupportsACL($this->parent_type) || ACLController::checkAccess($this->parent_type, 'view', $is_owner, 'module', $in_group)){ |
|
| 397 | + if (!ACLController::moduleSupportsACL($this->parent_type) || ACLController::checkAccess($this->parent_type, 'view', $is_owner, 'module', $in_group)) { |
|
| 398 | 398 | /* END - SECURITY GROUPS */ |
| 399 | 399 | $array_assign['PARENT'] = 'a'; |
| 400 | - }else{ |
|
| 400 | + } else { |
|
| 401 | 401 | $array_assign['PARENT'] = 'span'; |
| 402 | 402 | } |
| 403 | 403 | $is_owner = false; |
| 404 | 404 | $in_group = false; //SECURITY GROUPS |
| 405 | - if(!empty($this->contact_name)){ |
|
| 406 | - if(!empty($this->contact_name_owner)){ |
|
| 405 | + if (!empty($this->contact_name)) { |
|
| 406 | + if (!empty($this->contact_name_owner)) { |
|
| 407 | 407 | global $current_user; |
| 408 | 408 | $is_owner = $current_user->id == $this->contact_name_owner; |
| 409 | 409 | } |
@@ -411,8 +411,8 @@ discard block |
||
| 411 | 411 | //contact_name_owner not being set for whatever reason so we need to figure this out |
| 412 | 412 | else { |
| 413 | 413 | global $current_user; |
| 414 | - $parent_bean = BeanFactory::getBean('Contacts',$this->contact_id); |
|
| 415 | - if($parent_bean !== false) { |
|
| 414 | + $parent_bean = BeanFactory::getBean('Contacts', $this->contact_id); |
|
| 415 | + if ($parent_bean !== false) { |
|
| 416 | 416 | $is_owner = $current_user->id == $parent_bean->assigned_user_id; |
| 417 | 417 | } |
| 418 | 418 | } |
@@ -425,10 +425,10 @@ discard block |
||
| 425 | 425 | /** |
| 426 | 426 | if( ACLController::checkAccess('Contacts', 'view', $is_owner)){ |
| 427 | 427 | */ |
| 428 | - if( ACLController::checkAccess('Contacts', 'view', $is_owner, 'module', $in_group)) { |
|
| 428 | + if (ACLController::checkAccess('Contacts', 'view', $is_owner, 'module', $in_group)) { |
|
| 429 | 429 | /* END - SECURITY GROUPS */ |
| 430 | 430 | $array_assign['CONTACT'] = 'a'; |
| 431 | - }else{ |
|
| 431 | + } else { |
|
| 432 | 432 | $array_assign['CONTACT'] = 'span'; |
| 433 | 433 | } |
| 434 | 434 | |
@@ -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. |
@@ -96,8 +98,7 @@ discard block |
||
| 96 | 98 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 97 | 99 | if(isset($GLOBALS['log'])) { |
| 98 | 100 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 99 | - } |
|
| 100 | - else { |
|
| 101 | + } else { |
|
| 101 | 102 | trigger_error($deprecatedMessage, E_USER_DEPRECATED); |
| 102 | 103 | } |
| 103 | 104 | self::__construct(); |
@@ -130,8 +131,7 @@ discard block |
||
| 130 | 131 | $query .= $custom_join['select']; |
| 131 | 132 | $query .= " FROM contacts, tasks "; |
| 132 | 133 | $where_auto = "tasks.contact_id = contacts.id AND tasks.deleted=0 AND contacts.deleted=0"; |
| 133 | - } |
|
| 134 | - else |
|
| 134 | + } else |
|
| 135 | 135 | { |
| 136 | 136 | $query = 'SELECT tasks.*, users.user_name as assigned_user_name '; |
| 137 | 137 | $query .= $custom_join['select']; |
@@ -143,10 +143,11 @@ discard block |
||
| 143 | 143 | $query .= $custom_join['join']; |
| 144 | 144 | $query .= " LEFT JOIN users ON tasks.assigned_user_id=users.id "; |
| 145 | 145 | |
| 146 | - if($where != "") |
|
| 147 | - $query .= "where $where AND ".$where_auto; |
|
| 148 | - else |
|
| 149 | - $query .= "where ".$where_auto; |
|
| 146 | + if($where != "") { |
|
| 147 | + $query .= "where $where AND ".$where_auto; |
|
| 148 | + } else { |
|
| 149 | + $query .= "where ".$where_auto; |
|
| 150 | + } |
|
| 150 | 151 | |
| 151 | 152 | $order_by = $this->process_order_by($order_by); |
| 152 | 153 | if (empty($order_by)) { |
@@ -211,16 +212,14 @@ discard block |
||
| 211 | 212 | |
| 212 | 213 | if (is_subclass_of($parent, 'Person')) { |
| 213 | 214 | $query = "SELECT first_name, last_name, assigned_user_id parent_name_owner from $parent->table_name where id = '$this->parent_id'"; |
| 214 | - } |
|
| 215 | - else if (is_subclass_of($parent, 'File')) { |
|
| 215 | + } else if (is_subclass_of($parent, 'File')) { |
|
| 216 | 216 | $query = "SELECT document_name, assigned_user_id parent_name_owner from $parent->table_name where id = '$this->parent_id'"; |
| 217 | - } |
|
| 218 | - else { |
|
| 217 | + } else { |
|
| 219 | 218 | |
| 220 | 219 | $query = "SELECT name "; |
| 221 | 220 | if(isset($parent->field_defs['assigned_user_id'])){ |
| 222 | 221 | $query .= " , assigned_user_id parent_name_owner "; |
| 223 | - }else{ |
|
| 222 | + } else{ |
|
| 224 | 223 | $query .= " , created_by parent_name_owner "; |
| 225 | 224 | } |
| 226 | 225 | $query .= " from $parent->table_name where id = '$this->parent_id'"; |
@@ -237,15 +236,12 @@ discard block |
||
| 237 | 236 | if (is_subclass_of($parent, 'Person') and $row != null) |
| 238 | 237 | { |
| 239 | 238 | $this->parent_name = $locale->getLocaleFormattedName(stripslashes($row['first_name']), stripslashes($row['last_name'])); |
| 240 | - } |
|
| 241 | - else if (is_subclass_of($parent, 'File') && $row != null) { |
|
| 239 | + } else if (is_subclass_of($parent, 'File') && $row != null) { |
|
| 242 | 240 | $this->parent_name = $row['document_name']; |
| 243 | - } |
|
| 244 | - elseif($row != null) |
|
| 241 | + } elseif($row != null) |
|
| 245 | 242 | { |
| 246 | 243 | $this->parent_name = stripslashes($row['name']); |
| 247 | - } |
|
| 248 | - else { |
|
| 244 | + } else { |
|
| 249 | 245 | $this->parent_name = ''; |
| 250 | 246 | } |
| 251 | 247 | } |
@@ -255,7 +251,9 @@ discard block |
||
| 255 | 251 | { |
| 256 | 252 | global $timedate; |
| 257 | 253 | |
| 258 | - if(empty($dbtime)) return; |
|
| 254 | + if(empty($dbtime)) { |
|
| 255 | + return; |
|
| 256 | + } |
|
| 259 | 257 | |
| 260 | 258 | $today = $timedate->nowDbDate(); |
| 261 | 259 | |
@@ -268,7 +266,7 @@ discard block |
||
| 268 | 266 | $taskClass = 'futureTask'; |
| 269 | 267 | if ($dd < $today){ |
| 270 | 268 | $taskClass = 'overdueTask'; |
| 271 | - }else if( $dd == $today ){ |
|
| 269 | + } else if( $dd == $today ){ |
|
| 272 | 270 | $taskClass = 'todaysTask'; |
| 273 | 271 | } |
| 274 | 272 | $task_fields['DATE_DUE']= "<font class='$taskClass'>$date_due</font>"; |
@@ -300,10 +298,12 @@ discard block |
||
| 300 | 298 | $this->formatStartAndDueDates($task_fields, $dbtime, $override_date_for_subpanel); |
| 301 | 299 | } |
| 302 | 300 | |
| 303 | - if (!empty($this->priority)) |
|
| 304 | - $task_fields['PRIORITY'] = $app_list_strings['task_priority_dom'][$this->priority]; |
|
| 305 | - if (isset($this->parent_type)) |
|
| 306 | - $task_fields['PARENT_MODULE'] = $this->parent_type; |
|
| 301 | + if (!empty($this->priority)) { |
|
| 302 | + $task_fields['PRIORITY'] = $app_list_strings['task_priority_dom'][$this->priority]; |
|
| 303 | + } |
|
| 304 | + if (isset($this->parent_type)) { |
|
| 305 | + $task_fields['PARENT_MODULE'] = $this->parent_type; |
|
| 306 | + } |
|
| 307 | 307 | if ($this->status != "Completed" && $this->status != "Deferred" ) |
| 308 | 308 | { |
| 309 | 309 | $setCompleteUrl = "<a id='{$this->id}' onclick='SUGAR.util.closeActivityPanel.show(\"{$this->module_dir}\",\"{$this->id}\",\"Completed\",\"listview\",\"1\");'>"; |
@@ -397,7 +397,7 @@ discard block |
||
| 397 | 397 | if(!ACLController::moduleSupportsACL($this->parent_type) || ACLController::checkAccess($this->parent_type, 'view', $is_owner, 'module', $in_group)){ |
| 398 | 398 | /* END - SECURITY GROUPS */ |
| 399 | 399 | $array_assign['PARENT'] = 'a'; |
| 400 | - }else{ |
|
| 400 | + } else{ |
|
| 401 | 401 | $array_assign['PARENT'] = 'span'; |
| 402 | 402 | } |
| 403 | 403 | $is_owner = false; |
@@ -428,7 +428,7 @@ discard block |
||
| 428 | 428 | if( ACLController::checkAccess('Contacts', 'view', $is_owner, 'module', $in_group)) { |
| 429 | 429 | /* END - SECURITY GROUPS */ |
| 430 | 430 | $array_assign['CONTACT'] = 'a'; |
| 431 | - }else{ |
|
| 431 | + } else{ |
|
| 432 | 432 | $array_assign['CONTACT'] = 'span'; |
| 433 | 433 | } |
| 434 | 434 | |
@@ -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. |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | |
| 54 | 54 | parent::__construct($id, $def); |
| 55 | 55 | |
| 56 | - if(empty($def['title'])) $this->title = translate('LBL_HOMEPAGE_TITLE', 'AM_TaskTemplates'); |
|
| 56 | + if (empty($def['title'])) $this->title = translate('LBL_HOMEPAGE_TITLE', 'AM_TaskTemplates'); |
|
| 57 | 57 | |
| 58 | 58 | $this->searchFields = $dashletData['AM_TaskTemplatesDashlet']['searchFields']; |
| 59 | 59 | $this->columns = $dashletData['AM_TaskTemplatesDashlet']['columns']; |
@@ -64,9 +64,9 @@ discard block |
||
| 64 | 64 | /** |
| 65 | 65 | * @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 |
| 66 | 66 | */ |
| 67 | - function AM_TaskTemplatesDashlet($id, $def = null){ |
|
| 67 | + function AM_TaskTemplatesDashlet($id, $def = null) { |
|
| 68 | 68 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 69 | - if(isset($GLOBALS['log'])) { |
|
| 69 | + if (isset($GLOBALS['log'])) { |
|
| 70 | 70 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 71 | 71 | } |
| 72 | 72 | else { |
@@ -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. |
@@ -53,7 +55,9 @@ discard block |
||
| 53 | 55 | |
| 54 | 56 | parent::__construct($id, $def); |
| 55 | 57 | |
| 56 | - if(empty($def['title'])) $this->title = translate('LBL_HOMEPAGE_TITLE', 'AM_TaskTemplates'); |
|
| 58 | + if(empty($def['title'])) { |
|
| 59 | + $this->title = translate('LBL_HOMEPAGE_TITLE', 'AM_TaskTemplates'); |
|
| 60 | + } |
|
| 57 | 61 | |
| 58 | 62 | $this->searchFields = $dashletData['AM_TaskTemplatesDashlet']['searchFields']; |
| 59 | 63 | $this->columns = $dashletData['AM_TaskTemplatesDashlet']['columns']; |
@@ -68,8 +72,7 @@ discard block |
||
| 68 | 72 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 69 | 73 | if(isset($GLOBALS['log'])) { |
| 70 | 74 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 71 | - } |
|
| 72 | - else { |
|
| 75 | + } else { |
|
| 73 | 76 | trigger_error($deprecatedMessage, E_USER_DEPRECATED); |
| 74 | 77 | } |
| 75 | 78 | self::__construct($id, $def); |
@@ -57,91 +57,91 @@ discard block |
||
| 57 | 57 | |
| 58 | 58 | // Opportunity is used to store customer information. |
| 59 | 59 | class Opportunity extends SugarBean { |
| 60 | - var $field_name_map; |
|
| 61 | - // Stored fields |
|
| 62 | - var $id; |
|
| 63 | - var $lead_source; |
|
| 64 | - var $date_entered; |
|
| 65 | - var $date_modified; |
|
| 66 | - var $modified_user_id; |
|
| 67 | - var $assigned_user_id; |
|
| 68 | - var $created_by; |
|
| 69 | - var $created_by_name; |
|
| 70 | - var $modified_by_name; |
|
| 71 | - var $description; |
|
| 72 | - var $name; |
|
| 73 | - var $opportunity_type; |
|
| 74 | - var $amount; |
|
| 75 | - var $amount_usdollar; |
|
| 76 | - var $currency_id; |
|
| 77 | - var $date_closed; |
|
| 78 | - var $next_step; |
|
| 79 | - var $sales_stage; |
|
| 80 | - var $probability; |
|
| 81 | - var $campaign_id; |
|
| 82 | - |
|
| 83 | - // These are related |
|
| 84 | - var $account_name; |
|
| 85 | - var $account_id; |
|
| 86 | - var $contact_id; |
|
| 87 | - var $task_id; |
|
| 88 | - var $note_id; |
|
| 89 | - var $meeting_id; |
|
| 90 | - var $call_id; |
|
| 91 | - var $email_id; |
|
| 92 | - var $assigned_user_name; |
|
| 93 | - |
|
| 94 | - var $table_name = "opportunities"; |
|
| 95 | - var $rel_account_table = "accounts_opportunities"; |
|
| 96 | - var $rel_contact_table = "opportunities_contacts"; |
|
| 97 | - var $module_dir = "Opportunities"; |
|
| 98 | - |
|
| 99 | - var $importable = true; |
|
| 100 | - var $object_name = "Opportunity"; |
|
| 101 | - |
|
| 102 | - // This is used to retrieve related fields from form posts. |
|
| 103 | - var $additional_column_fields = Array('assigned_user_name', 'assigned_user_id', 'account_name', 'account_id', 'contact_id', 'task_id', 'note_id', 'meeting_id', 'call_id', 'email_id' |
|
| 104 | - ); |
|
| 105 | - |
|
| 106 | - var $relationship_fields = Array('task_id'=>'tasks', 'note_id'=>'notes', 'account_id'=>'accounts', |
|
| 107 | - 'meeting_id'=>'meetings', 'call_id'=>'calls', 'email_id'=>'emails', 'project_id'=>'project', |
|
| 108 | - // Bug 38529 & 40938 |
|
| 109 | - 'currency_id' => 'currencies', |
|
| 110 | - ); |
|
| 60 | + var $field_name_map; |
|
| 61 | + // Stored fields |
|
| 62 | + var $id; |
|
| 63 | + var $lead_source; |
|
| 64 | + var $date_entered; |
|
| 65 | + var $date_modified; |
|
| 66 | + var $modified_user_id; |
|
| 67 | + var $assigned_user_id; |
|
| 68 | + var $created_by; |
|
| 69 | + var $created_by_name; |
|
| 70 | + var $modified_by_name; |
|
| 71 | + var $description; |
|
| 72 | + var $name; |
|
| 73 | + var $opportunity_type; |
|
| 74 | + var $amount; |
|
| 75 | + var $amount_usdollar; |
|
| 76 | + var $currency_id; |
|
| 77 | + var $date_closed; |
|
| 78 | + var $next_step; |
|
| 79 | + var $sales_stage; |
|
| 80 | + var $probability; |
|
| 81 | + var $campaign_id; |
|
| 82 | + |
|
| 83 | + // These are related |
|
| 84 | + var $account_name; |
|
| 85 | + var $account_id; |
|
| 86 | + var $contact_id; |
|
| 87 | + var $task_id; |
|
| 88 | + var $note_id; |
|
| 89 | + var $meeting_id; |
|
| 90 | + var $call_id; |
|
| 91 | + var $email_id; |
|
| 92 | + var $assigned_user_name; |
|
| 93 | + |
|
| 94 | + var $table_name = "opportunities"; |
|
| 95 | + var $rel_account_table = "accounts_opportunities"; |
|
| 96 | + var $rel_contact_table = "opportunities_contacts"; |
|
| 97 | + var $module_dir = "Opportunities"; |
|
| 98 | + |
|
| 99 | + var $importable = true; |
|
| 100 | + var $object_name = "Opportunity"; |
|
| 101 | + |
|
| 102 | + // This is used to retrieve related fields from form posts. |
|
| 103 | + var $additional_column_fields = Array('assigned_user_name', 'assigned_user_id', 'account_name', 'account_id', 'contact_id', 'task_id', 'note_id', 'meeting_id', 'call_id', 'email_id' |
|
| 104 | + ); |
|
| 105 | + |
|
| 106 | + var $relationship_fields = Array('task_id'=>'tasks', 'note_id'=>'notes', 'account_id'=>'accounts', |
|
| 107 | + 'meeting_id'=>'meetings', 'call_id'=>'calls', 'email_id'=>'emails', 'project_id'=>'project', |
|
| 108 | + // Bug 38529 & 40938 |
|
| 109 | + 'currency_id' => 'currencies', |
|
| 110 | + ); |
|
| 111 | 111 | |
| 112 | 112 | public function __construct() { |
| 113 | - parent::__construct(); |
|
| 114 | - global $sugar_config; |
|
| 115 | - if(!$sugar_config['require_accounts']){ |
|
| 116 | - unset($this->required_fields['account_name']); |
|
| 117 | - } |
|
| 118 | - } |
|
| 119 | - |
|
| 120 | - /** |
|
| 121 | - * @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 |
|
| 122 | - */ |
|
| 123 | - function Opportunity(){ |
|
| 124 | - $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
|
| 125 | - if(isset($GLOBALS['log'])) { |
|
| 126 | - $GLOBALS['log']->deprecated($deprecatedMessage); |
|
| 127 | - } |
|
| 128 | - else { |
|
| 129 | - trigger_error($deprecatedMessage, E_USER_DEPRECATED); |
|
| 130 | - } |
|
| 131 | - self::__construct(); |
|
| 132 | - } |
|
| 133 | - |
|
| 134 | - var $new_schema = true; |
|
| 135 | - |
|
| 136 | - |
|
| 137 | - |
|
| 138 | - function get_summary_text() |
|
| 139 | - { |
|
| 140 | - return "$this->name"; |
|
| 141 | - } |
|
| 142 | - |
|
| 143 | - function create_list_query($order_by, $where, $show_deleted = 0) |
|
| 144 | - { |
|
| 113 | + parent::__construct(); |
|
| 114 | + global $sugar_config; |
|
| 115 | + if(!$sugar_config['require_accounts']){ |
|
| 116 | + unset($this->required_fields['account_name']); |
|
| 117 | + } |
|
| 118 | + } |
|
| 119 | + |
|
| 120 | + /** |
|
| 121 | + * @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 |
|
| 122 | + */ |
|
| 123 | + function Opportunity(){ |
|
| 124 | + $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
|
| 125 | + if(isset($GLOBALS['log'])) { |
|
| 126 | + $GLOBALS['log']->deprecated($deprecatedMessage); |
|
| 127 | + } |
|
| 128 | + else { |
|
| 129 | + trigger_error($deprecatedMessage, E_USER_DEPRECATED); |
|
| 130 | + } |
|
| 131 | + self::__construct(); |
|
| 132 | + } |
|
| 133 | + |
|
| 134 | + var $new_schema = true; |
|
| 135 | + |
|
| 136 | + |
|
| 137 | + |
|
| 138 | + function get_summary_text() |
|
| 139 | + { |
|
| 140 | + return "$this->name"; |
|
| 141 | + } |
|
| 142 | + |
|
| 143 | + function create_list_query($order_by, $where, $show_deleted = 0) |
|
| 144 | + { |
|
| 145 | 145 | |
| 146 | 146 | $custom_join = $this->getCustomJoin(); |
| 147 | 147 | $query = "SELECT "; |
@@ -163,28 +163,28 @@ discard block |
||
| 163 | 163 | LEFT JOIN accounts |
| 164 | 164 | ON $this->rel_account_table.account_id=accounts.id "; |
| 165 | 165 | $query .= $custom_join['join']; |
| 166 | - $where_auto = '1=1'; |
|
| 167 | - if($show_deleted == 0){ |
|
| 168 | - $where_auto = " |
|
| 166 | + $where_auto = '1=1'; |
|
| 167 | + if($show_deleted == 0){ |
|
| 168 | + $where_auto = " |
|
| 169 | 169 | ($this->rel_account_table.deleted is null OR $this->rel_account_table.deleted=0) |
| 170 | 170 | AND (accounts.deleted is null OR accounts.deleted=0) |
| 171 | 171 | AND opportunities.deleted=0"; |
| 172 | - }else if($show_deleted == 1){ |
|
| 173 | - $where_auto = " opportunities.deleted=1"; |
|
| 174 | - } |
|
| 172 | + }else if($show_deleted == 1){ |
|
| 173 | + $where_auto = " opportunities.deleted=1"; |
|
| 174 | + } |
|
| 175 | 175 | |
| 176 | - if($where != "") |
|
| 177 | - $query .= "where ($where) AND ".$where_auto; |
|
| 178 | - else |
|
| 179 | - $query .= "where ".$where_auto; |
|
| 176 | + if($where != "") |
|
| 177 | + $query .= "where ($where) AND ".$where_auto; |
|
| 178 | + else |
|
| 179 | + $query .= "where ".$where_auto; |
|
| 180 | 180 | |
| 181 | - if($order_by != "") |
|
| 182 | - $query .= " ORDER BY $order_by"; |
|
| 183 | - else |
|
| 184 | - $query .= " ORDER BY opportunities.name"; |
|
| 181 | + if($order_by != "") |
|
| 182 | + $query .= " ORDER BY $order_by"; |
|
| 183 | + else |
|
| 184 | + $query .= " ORDER BY opportunities.name"; |
|
| 185 | 185 | |
| 186 | - return $query; |
|
| 187 | - } |
|
| 186 | + return $query; |
|
| 187 | + } |
|
| 188 | 188 | |
| 189 | 189 | |
| 190 | 190 | function create_export_query($order_by, $where, $relate_link_join='') |
@@ -196,15 +196,15 @@ discard block |
||
| 196 | 196 | accounts.name as account_name, |
| 197 | 197 | users.user_name as assigned_user_name "; |
| 198 | 198 | $query .= $custom_join['select']; |
| 199 | - $query .= " FROM opportunities "; |
|
| 200 | - $query .= "LEFT JOIN users |
|
| 199 | + $query .= " FROM opportunities "; |
|
| 200 | + $query .= "LEFT JOIN users |
|
| 201 | 201 | ON opportunities.assigned_user_id=users.id"; |
| 202 | 202 | $query .= " LEFT JOIN $this->rel_account_table |
| 203 | 203 | ON opportunities.id=$this->rel_account_table.opportunity_id |
| 204 | 204 | LEFT JOIN accounts |
| 205 | 205 | ON $this->rel_account_table.account_id=accounts.id "; |
| 206 | 206 | $query .= $custom_join['join']; |
| 207 | - $where_auto = " |
|
| 207 | + $where_auto = " |
|
| 208 | 208 | ($this->rel_account_table.deleted is null OR $this->rel_account_table.deleted=0) |
| 209 | 209 | AND (accounts.deleted is null OR accounts.deleted=0) |
| 210 | 210 | AND opportunities.deleted=0"; |
@@ -221,138 +221,138 @@ discard block |
||
| 221 | 221 | return $query; |
| 222 | 222 | } |
| 223 | 223 | |
| 224 | - function fill_in_additional_list_fields() |
|
| 225 | - { |
|
| 224 | + function fill_in_additional_list_fields() |
|
| 225 | + { |
|
| 226 | 226 | if ( $this->force_load_details == true) |
| 227 | 227 | { |
| 228 | 228 | $this->fill_in_additional_detail_fields(); |
| 229 | 229 | } |
| 230 | - } |
|
| 231 | - |
|
| 232 | - function fill_in_additional_detail_fields() |
|
| 233 | - { |
|
| 234 | - parent::fill_in_additional_detail_fields(); |
|
| 235 | - |
|
| 236 | - if(!empty($this->currency_id)) { |
|
| 237 | - $currency = new Currency(); |
|
| 238 | - $currency->retrieve($this->currency_id); |
|
| 239 | - if($currency->id != $this->currency_id || $currency->deleted == 1){ |
|
| 240 | - $this->amount = $this->amount_usdollar; |
|
| 241 | - $this->currency_id = $currency->id; |
|
| 242 | - } |
|
| 243 | - } |
|
| 244 | - //get campaign name |
|
| 230 | + } |
|
| 231 | + |
|
| 232 | + function fill_in_additional_detail_fields() |
|
| 233 | + { |
|
| 234 | + parent::fill_in_additional_detail_fields(); |
|
| 235 | + |
|
| 236 | + if(!empty($this->currency_id)) { |
|
| 237 | + $currency = new Currency(); |
|
| 238 | + $currency->retrieve($this->currency_id); |
|
| 239 | + if($currency->id != $this->currency_id || $currency->deleted == 1){ |
|
| 240 | + $this->amount = $this->amount_usdollar; |
|
| 241 | + $this->currency_id = $currency->id; |
|
| 242 | + } |
|
| 243 | + } |
|
| 244 | + //get campaign name |
|
| 245 | 245 | if(!empty($this->campaign_id)) { |
| 246 | - $camp = new Campaign(); |
|
| 247 | - $camp->retrieve($this->campaign_id); |
|
| 246 | + $camp = new Campaign(); |
|
| 247 | + $camp->retrieve($this->campaign_id); |
|
| 248 | 248 | $this->campaign_name = $camp->name; |
| 249 | 249 | } |
| 250 | - $this->account_name = ''; |
|
| 251 | - $this->account_id = ''; |
|
| 252 | - if(!empty($this->id)) { |
|
| 253 | - $ret_values=Opportunity::get_account_detail($this->id); |
|
| 254 | - if (!empty($ret_values)) { |
|
| 255 | - $this->account_name=$ret_values['name']; |
|
| 256 | - $this->account_id=$ret_values['id']; |
|
| 257 | - $this->account_id_owner =$ret_values['assigned_user_id']; |
|
| 258 | - } |
|
| 259 | - } |
|
| 260 | - } |
|
| 261 | - |
|
| 262 | - /** Returns a list of the associated contacts |
|
| 263 | - * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.. |
|
| 264 | - * All Rights Reserved.. |
|
| 265 | - * Contributor(s): ______________________________________.. |
|
| 266 | - */ |
|
| 267 | - function get_contacts() |
|
| 268 | - { |
|
| 269 | - $this->load_relationship('contacts'); |
|
| 270 | - $query_array=$this->contacts->getQuery(true); |
|
| 271 | - |
|
| 272 | - //update the select clause in the retruned query. |
|
| 273 | - $query_array['select']="SELECT contacts.id, contacts.first_name, contacts.last_name, contacts.title, contacts.email1, contacts.phone_work, opportunities_contacts.contact_role as opportunity_role, opportunities_contacts.id as opportunity_rel_id "; |
|
| 274 | - |
|
| 275 | - $query=''; |
|
| 276 | - foreach ($query_array as $qstring) { |
|
| 277 | - $query.=' '.$qstring; |
|
| 278 | - } |
|
| 279 | - $temp = Array('id', 'first_name', 'last_name', 'title', 'email1', 'phone_work', 'opportunity_role', 'opportunity_rel_id'); |
|
| 280 | - return $this->build_related_list2($query, new Contact(), $temp); |
|
| 281 | - } |
|
| 282 | - |
|
| 283 | - function update_currency_id($fromid, $toid){ |
|
| 284 | - $idequals = ''; |
|
| 285 | - |
|
| 286 | - $currency = new Currency(); |
|
| 287 | - $currency->retrieve($toid); |
|
| 288 | - foreach($fromid as $f){ |
|
| 289 | - if(!empty($idequals)){ |
|
| 290 | - $idequals .=' or '; |
|
| 291 | - } |
|
| 292 | - $idequals .= "currency_id='$f'"; |
|
| 293 | - } |
|
| 294 | - |
|
| 295 | - if(!empty($idequals)){ |
|
| 296 | - $query = "select amount, id from opportunities where (". $idequals. ") and deleted=0 and opportunities.sales_stage <> 'Closed Won' AND opportunities.sales_stage <> 'Closed Lost';"; |
|
| 297 | - $result = $this->db->query($query); |
|
| 298 | - while($row = $this->db->fetchByAssoc($result)){ |
|
| 299 | - |
|
| 300 | - $query = "update opportunities set currency_id='".$currency->id."', amount_usdollar='".$currency->convertToDollar($row['amount'])."' where id='".$row['id']."';"; |
|
| 301 | - $this->db->query($query); |
|
| 302 | - |
|
| 303 | - } |
|
| 304 | - |
|
| 305 | - } |
|
| 306 | - } |
|
| 307 | - |
|
| 308 | - function get_list_view_data(){ |
|
| 309 | - global $locale, $current_language, $current_user, $mod_strings, $app_list_strings, $sugar_config; |
|
| 310 | - $app_strings = return_application_language($current_language); |
|
| 250 | + $this->account_name = ''; |
|
| 251 | + $this->account_id = ''; |
|
| 252 | + if(!empty($this->id)) { |
|
| 253 | + $ret_values=Opportunity::get_account_detail($this->id); |
|
| 254 | + if (!empty($ret_values)) { |
|
| 255 | + $this->account_name=$ret_values['name']; |
|
| 256 | + $this->account_id=$ret_values['id']; |
|
| 257 | + $this->account_id_owner =$ret_values['assigned_user_id']; |
|
| 258 | + } |
|
| 259 | + } |
|
| 260 | + } |
|
| 261 | + |
|
| 262 | + /** Returns a list of the associated contacts |
|
| 263 | + * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.. |
|
| 264 | + * All Rights Reserved.. |
|
| 265 | + * Contributor(s): ______________________________________.. |
|
| 266 | + */ |
|
| 267 | + function get_contacts() |
|
| 268 | + { |
|
| 269 | + $this->load_relationship('contacts'); |
|
| 270 | + $query_array=$this->contacts->getQuery(true); |
|
| 271 | + |
|
| 272 | + //update the select clause in the retruned query. |
|
| 273 | + $query_array['select']="SELECT contacts.id, contacts.first_name, contacts.last_name, contacts.title, contacts.email1, contacts.phone_work, opportunities_contacts.contact_role as opportunity_role, opportunities_contacts.id as opportunity_rel_id "; |
|
| 274 | + |
|
| 275 | + $query=''; |
|
| 276 | + foreach ($query_array as $qstring) { |
|
| 277 | + $query.=' '.$qstring; |
|
| 278 | + } |
|
| 279 | + $temp = Array('id', 'first_name', 'last_name', 'title', 'email1', 'phone_work', 'opportunity_role', 'opportunity_rel_id'); |
|
| 280 | + return $this->build_related_list2($query, new Contact(), $temp); |
|
| 281 | + } |
|
| 282 | + |
|
| 283 | + function update_currency_id($fromid, $toid){ |
|
| 284 | + $idequals = ''; |
|
| 285 | + |
|
| 286 | + $currency = new Currency(); |
|
| 287 | + $currency->retrieve($toid); |
|
| 288 | + foreach($fromid as $f){ |
|
| 289 | + if(!empty($idequals)){ |
|
| 290 | + $idequals .=' or '; |
|
| 291 | + } |
|
| 292 | + $idequals .= "currency_id='$f'"; |
|
| 293 | + } |
|
| 294 | + |
|
| 295 | + if(!empty($idequals)){ |
|
| 296 | + $query = "select amount, id from opportunities where (". $idequals. ") and deleted=0 and opportunities.sales_stage <> 'Closed Won' AND opportunities.sales_stage <> 'Closed Lost';"; |
|
| 297 | + $result = $this->db->query($query); |
|
| 298 | + while($row = $this->db->fetchByAssoc($result)){ |
|
| 299 | + |
|
| 300 | + $query = "update opportunities set currency_id='".$currency->id."', amount_usdollar='".$currency->convertToDollar($row['amount'])."' where id='".$row['id']."';"; |
|
| 301 | + $this->db->query($query); |
|
| 302 | + |
|
| 303 | + } |
|
| 304 | + |
|
| 305 | + } |
|
| 306 | + } |
|
| 307 | + |
|
| 308 | + function get_list_view_data(){ |
|
| 309 | + global $locale, $current_language, $current_user, $mod_strings, $app_list_strings, $sugar_config; |
|
| 310 | + $app_strings = return_application_language($current_language); |
|
| 311 | 311 | $params = array(); |
| 312 | 312 | |
| 313 | - $temp_array = $this->get_list_view_array(); |
|
| 314 | - $temp_array['SALES_STAGE'] = empty($temp_array['SALES_STAGE']) ? '' : $temp_array['SALES_STAGE']; |
|
| 315 | - $temp_array["ENCODED_NAME"]=$this->name; |
|
| 316 | - return $temp_array; |
|
| 317 | - } |
|
| 313 | + $temp_array = $this->get_list_view_array(); |
|
| 314 | + $temp_array['SALES_STAGE'] = empty($temp_array['SALES_STAGE']) ? '' : $temp_array['SALES_STAGE']; |
|
| 315 | + $temp_array["ENCODED_NAME"]=$this->name; |
|
| 316 | + return $temp_array; |
|
| 317 | + } |
|
| 318 | 318 | |
| 319 | 319 | function get_currency_symbol(){ |
| 320 | - if(isset($this->currency_id)){ |
|
| 321 | - $cur_qry = "select * from currencies where id ='".$this->currency_id."'"; |
|
| 322 | - $cur_res = $this->db->query($cur_qry); |
|
| 323 | - if(!empty($cur_res)){ |
|
| 320 | + if(isset($this->currency_id)){ |
|
| 321 | + $cur_qry = "select * from currencies where id ='".$this->currency_id."'"; |
|
| 322 | + $cur_res = $this->db->query($cur_qry); |
|
| 323 | + if(!empty($cur_res)){ |
|
| 324 | 324 | $cur_row = $this->db->fetchByAssoc($cur_res); |
| 325 | 325 | if(isset($cur_row['symbol'])){ |
| 326 | - return $cur_row['symbol']; |
|
| 326 | + return $cur_row['symbol']; |
|
| 327 | 327 | } |
| 328 | - } |
|
| 329 | - } |
|
| 330 | - return ''; |
|
| 328 | + } |
|
| 329 | + } |
|
| 330 | + return ''; |
|
| 331 | 331 | } |
| 332 | 332 | |
| 333 | 333 | |
| 334 | - /** |
|
| 334 | + /** |
|
| 335 | 335 | builds a generic search based on the query string using or |
| 336 | 336 | do not include any $this-> because this is called on without having the class instantiated |
| 337 | - */ |
|
| 338 | - function build_generic_where_clause ($the_query_string) { |
|
| 339 | - $where_clauses = Array(); |
|
| 340 | - $the_query_string = $GLOBALS['db']->quote($the_query_string); |
|
| 341 | - array_push($where_clauses, "opportunities.name like '$the_query_string%'"); |
|
| 342 | - array_push($where_clauses, "accounts.name like '$the_query_string%'"); |
|
| 343 | - |
|
| 344 | - $the_where = ""; |
|
| 345 | - foreach($where_clauses as $clause) |
|
| 346 | - { |
|
| 347 | - if($the_where != "") $the_where .= " or "; |
|
| 348 | - $the_where .= $clause; |
|
| 349 | - } |
|
| 350 | - |
|
| 351 | - |
|
| 352 | - return $the_where; |
|
| 337 | + */ |
|
| 338 | + function build_generic_where_clause ($the_query_string) { |
|
| 339 | + $where_clauses = Array(); |
|
| 340 | + $the_query_string = $GLOBALS['db']->quote($the_query_string); |
|
| 341 | + array_push($where_clauses, "opportunities.name like '$the_query_string%'"); |
|
| 342 | + array_push($where_clauses, "accounts.name like '$the_query_string%'"); |
|
| 343 | + |
|
| 344 | + $the_where = ""; |
|
| 345 | + foreach($where_clauses as $clause) |
|
| 346 | + { |
|
| 347 | + if($the_where != "") $the_where .= " or "; |
|
| 348 | + $the_where .= $clause; |
|
| 349 | + } |
|
| 350 | + |
|
| 351 | + |
|
| 352 | + return $the_where; |
|
| 353 | 353 | } |
| 354 | 354 | |
| 355 | - function save($check_notify = FALSE) |
|
| 355 | + function save($check_notify = FALSE) |
|
| 356 | 356 | { |
| 357 | 357 | // Bug 32581 - Make sure the currency_id is set to something |
| 358 | 358 | global $current_user, $app_list_strings; |
@@ -366,119 +366,119 @@ discard block |
||
| 366 | 366 | if (!isset($this->probability) && !empty($this->sales_stage)) |
| 367 | 367 | { |
| 368 | 368 | $prob_arr = $app_list_strings['sales_probability_dom']; |
| 369 | - if (isset($prob_arr[$this->sales_stage])) |
|
| 370 | - $this->probability = $prob_arr[$this->sales_stage]; |
|
| 369 | + if (isset($prob_arr[$this->sales_stage])) |
|
| 370 | + $this->probability = $prob_arr[$this->sales_stage]; |
|
| 371 | + } |
|
| 372 | + |
|
| 373 | + require_once('modules/Opportunities/SaveOverload.php'); |
|
| 374 | + |
|
| 375 | + perform_save($this); |
|
| 376 | + return parent::save($check_notify); |
|
| 377 | + |
|
| 378 | + } |
|
| 379 | + |
|
| 380 | + function save_relationship_changes($is_update, $exclude = array()) |
|
| 381 | + { |
|
| 382 | + //if account_id was replaced unlink the previous account_id. |
|
| 383 | + //this rel_fields_before_value is populated by sugarbean during the retrieve call. |
|
| 384 | + if (!empty($this->account_id) and !empty($this->rel_fields_before_value['account_id']) and |
|
| 385 | + (trim($this->account_id) != trim($this->rel_fields_before_value['account_id']))) { |
|
| 386 | + //unlink the old record. |
|
| 387 | + $this->load_relationship('accounts'); |
|
| 388 | + $this->accounts->delete($this->id,$this->rel_fields_before_value['account_id']); |
|
| 371 | 389 | } |
| 390 | + // Bug 38529 & 40938 - exclude currency_id |
|
| 391 | + parent::save_relationship_changes($is_update, array('currency_id')); |
|
| 372 | 392 | |
| 373 | - require_once('modules/Opportunities/SaveOverload.php'); |
|
| 374 | - |
|
| 375 | - perform_save($this); |
|
| 376 | - return parent::save($check_notify); |
|
| 377 | - |
|
| 378 | - } |
|
| 379 | - |
|
| 380 | - function save_relationship_changes($is_update, $exclude = array()) |
|
| 381 | - { |
|
| 382 | - //if account_id was replaced unlink the previous account_id. |
|
| 383 | - //this rel_fields_before_value is populated by sugarbean during the retrieve call. |
|
| 384 | - if (!empty($this->account_id) and !empty($this->rel_fields_before_value['account_id']) and |
|
| 385 | - (trim($this->account_id) != trim($this->rel_fields_before_value['account_id']))) { |
|
| 386 | - //unlink the old record. |
|
| 387 | - $this->load_relationship('accounts'); |
|
| 388 | - $this->accounts->delete($this->id,$this->rel_fields_before_value['account_id']); |
|
| 389 | - } |
|
| 390 | - // Bug 38529 & 40938 - exclude currency_id |
|
| 391 | - parent::save_relationship_changes($is_update, array('currency_id')); |
|
| 392 | - |
|
| 393 | - if (!empty($this->contact_id)) { |
|
| 394 | - $this->set_opportunity_contact_relationship($this->contact_id); |
|
| 395 | - } |
|
| 396 | - } |
|
| 397 | - |
|
| 398 | - function set_opportunity_contact_relationship($contact_id) |
|
| 399 | - { |
|
| 400 | - global $app_list_strings; |
|
| 401 | - $default = $app_list_strings['opportunity_relationship_type_default_key']; |
|
| 402 | - $this->load_relationship('contacts'); |
|
| 403 | - $this->contacts->add($contact_id,array('contact_role'=>$default)); |
|
| 404 | - } |
|
| 405 | - |
|
| 406 | - function set_notification_body($xtpl, $oppty) |
|
| 407 | - { |
|
| 408 | - global $app_list_strings; |
|
| 409 | - |
|
| 410 | - $xtpl->assign("OPPORTUNITY_NAME", $oppty->name); |
|
| 411 | - $xtpl->assign("OPPORTUNITY_AMOUNT", $oppty->amount); |
|
| 412 | - $xtpl->assign("OPPORTUNITY_CLOSEDATE", $oppty->date_closed); |
|
| 413 | - $xtpl->assign("OPPORTUNITY_STAGE", (isset($oppty->sales_stage)?$app_list_strings['sales_stage_dom'][$oppty->sales_stage]:"")); |
|
| 414 | - $xtpl->assign("OPPORTUNITY_DESCRIPTION", $oppty->description); |
|
| 415 | - |
|
| 416 | - return $xtpl; |
|
| 417 | - } |
|
| 418 | - |
|
| 419 | - function bean_implements($interface){ |
|
| 420 | - switch($interface){ |
|
| 421 | - case 'ACL':return true; |
|
| 422 | - } |
|
| 423 | - return false; |
|
| 424 | - } |
|
| 425 | - function listviewACLHelper(){ |
|
| 426 | - $array_assign = parent::listviewACLHelper(); |
|
| 427 | - $is_owner = false; |
|
| 428 | - $in_group = false; //SECURITY GROUPS |
|
| 429 | - if(!empty($this->account_id)){ |
|
| 430 | - |
|
| 431 | - if(!empty($this->account_id_owner)){ |
|
| 432 | - global $current_user; |
|
| 433 | - $is_owner = $current_user->id == $this->account_id_owner; |
|
| 434 | - } |
|
| 435 | - /* BEGIN - SECURITY GROUPS */ |
|
| 436 | - else { |
|
| 437 | - global $current_user; |
|
| 393 | + if (!empty($this->contact_id)) { |
|
| 394 | + $this->set_opportunity_contact_relationship($this->contact_id); |
|
| 395 | + } |
|
| 396 | + } |
|
| 397 | + |
|
| 398 | + function set_opportunity_contact_relationship($contact_id) |
|
| 399 | + { |
|
| 400 | + global $app_list_strings; |
|
| 401 | + $default = $app_list_strings['opportunity_relationship_type_default_key']; |
|
| 402 | + $this->load_relationship('contacts'); |
|
| 403 | + $this->contacts->add($contact_id,array('contact_role'=>$default)); |
|
| 404 | + } |
|
| 405 | + |
|
| 406 | + function set_notification_body($xtpl, $oppty) |
|
| 407 | + { |
|
| 408 | + global $app_list_strings; |
|
| 409 | + |
|
| 410 | + $xtpl->assign("OPPORTUNITY_NAME", $oppty->name); |
|
| 411 | + $xtpl->assign("OPPORTUNITY_AMOUNT", $oppty->amount); |
|
| 412 | + $xtpl->assign("OPPORTUNITY_CLOSEDATE", $oppty->date_closed); |
|
| 413 | + $xtpl->assign("OPPORTUNITY_STAGE", (isset($oppty->sales_stage)?$app_list_strings['sales_stage_dom'][$oppty->sales_stage]:"")); |
|
| 414 | + $xtpl->assign("OPPORTUNITY_DESCRIPTION", $oppty->description); |
|
| 415 | + |
|
| 416 | + return $xtpl; |
|
| 417 | + } |
|
| 418 | + |
|
| 419 | + function bean_implements($interface){ |
|
| 420 | + switch($interface){ |
|
| 421 | + case 'ACL':return true; |
|
| 422 | + } |
|
| 423 | + return false; |
|
| 424 | + } |
|
| 425 | + function listviewACLHelper(){ |
|
| 426 | + $array_assign = parent::listviewACLHelper(); |
|
| 427 | + $is_owner = false; |
|
| 428 | + $in_group = false; //SECURITY GROUPS |
|
| 429 | + if(!empty($this->account_id)){ |
|
| 430 | + |
|
| 431 | + if(!empty($this->account_id_owner)){ |
|
| 432 | + global $current_user; |
|
| 433 | + $is_owner = $current_user->id == $this->account_id_owner; |
|
| 434 | + } |
|
| 435 | + /* BEGIN - SECURITY GROUPS */ |
|
| 436 | + else { |
|
| 437 | + global $current_user; |
|
| 438 | 438 | $parent_bean = BeanFactory::getBean('Accounts',$this->account_id); |
| 439 | 439 | if($parent_bean !== false) { |
| 440 | - $is_owner = $current_user->id == $parent_bean->assigned_user_id; |
|
| 440 | + $is_owner = $current_user->id == $parent_bean->assigned_user_id; |
|
| 441 | 441 | } |
| 442 | - } |
|
| 443 | - require_once("modules/SecurityGroups/SecurityGroup.php"); |
|
| 444 | - $in_group = SecurityGroup::groupHasAccess('Accounts', $this->account_id, 'view'); |
|
| 445 | - /* END - SECURITY GROUPS */ |
|
| 446 | - } |
|
| 447 | - /* BEGIN - SECURITY GROUPS */ |
|
| 448 | - /** |
|
| 442 | + } |
|
| 443 | + require_once("modules/SecurityGroups/SecurityGroup.php"); |
|
| 444 | + $in_group = SecurityGroup::groupHasAccess('Accounts', $this->account_id, 'view'); |
|
| 445 | + /* END - SECURITY GROUPS */ |
|
| 446 | + } |
|
| 447 | + /* BEGIN - SECURITY GROUPS */ |
|
| 448 | + /** |
|
| 449 | 449 | if(!ACLController::moduleSupportsACL('Accounts') || ACLController::checkAccess('Accounts', 'view', $is_owner)){ |
| 450 | - */ |
|
| 451 | - if(!ACLController::moduleSupportsACL('Accounts') || ACLController::checkAccess('Accounts', 'view', $is_owner, 'module', $in_group)){ |
|
| 452 | - /* END - SECURITY GROUPS */ |
|
| 453 | - $array_assign['ACCOUNT'] = 'a'; |
|
| 454 | - }else{ |
|
| 455 | - $array_assign['ACCOUNT'] = 'span'; |
|
| 456 | - } |
|
| 457 | - |
|
| 458 | - return $array_assign; |
|
| 459 | - } |
|
| 460 | - |
|
| 461 | - /** |
|
| 462 | - * Static helper function for getting releated account info. |
|
| 463 | - */ |
|
| 464 | - function get_account_detail($opp_id) { |
|
| 465 | - $ret_array = array(); |
|
| 466 | - $db = DBManagerFactory::getInstance(); |
|
| 467 | - $query = "SELECT acc.id, acc.name, acc.assigned_user_id " |
|
| 468 | - . "FROM accounts acc, accounts_opportunities a_o " |
|
| 469 | - . "WHERE acc.id=a_o.account_id" |
|
| 470 | - . " AND a_o.opportunity_id='$opp_id'" |
|
| 471 | - . " AND a_o.deleted=0" |
|
| 472 | - . " AND acc.deleted=0"; |
|
| 473 | - $result = $db->query($query, true,"Error filling in opportunity account details: "); |
|
| 474 | - $row = $db->fetchByAssoc($result); |
|
| 475 | - if($row != null) { |
|
| 476 | - $ret_array['name'] = $row['name']; |
|
| 477 | - $ret_array['id'] = $row['id']; |
|
| 478 | - $ret_array['assigned_user_id'] = $row['assigned_user_id']; |
|
| 479 | - } |
|
| 480 | - return $ret_array; |
|
| 481 | - } |
|
| 450 | + */ |
|
| 451 | + if(!ACLController::moduleSupportsACL('Accounts') || ACLController::checkAccess('Accounts', 'view', $is_owner, 'module', $in_group)){ |
|
| 452 | + /* END - SECURITY GROUPS */ |
|
| 453 | + $array_assign['ACCOUNT'] = 'a'; |
|
| 454 | + }else{ |
|
| 455 | + $array_assign['ACCOUNT'] = 'span'; |
|
| 456 | + } |
|
| 457 | + |
|
| 458 | + return $array_assign; |
|
| 459 | + } |
|
| 460 | + |
|
| 461 | + /** |
|
| 462 | + * Static helper function for getting releated account info. |
|
| 463 | + */ |
|
| 464 | + function get_account_detail($opp_id) { |
|
| 465 | + $ret_array = array(); |
|
| 466 | + $db = DBManagerFactory::getInstance(); |
|
| 467 | + $query = "SELECT acc.id, acc.name, acc.assigned_user_id " |
|
| 468 | + . "FROM accounts acc, accounts_opportunities a_o " |
|
| 469 | + . "WHERE acc.id=a_o.account_id" |
|
| 470 | + . " AND a_o.opportunity_id='$opp_id'" |
|
| 471 | + . " AND a_o.deleted=0" |
|
| 472 | + . " AND acc.deleted=0"; |
|
| 473 | + $result = $db->query($query, true,"Error filling in opportunity account details: "); |
|
| 474 | + $row = $db->fetchByAssoc($result); |
|
| 475 | + if($row != null) { |
|
| 476 | + $ret_array['name'] = $row['name']; |
|
| 477 | + $ret_array['id'] = $row['id']; |
|
| 478 | + $ret_array['assigned_user_id'] = $row['assigned_user_id']; |
|
| 479 | + } |
|
| 480 | + return $ret_array; |
|
| 481 | + } |
|
| 482 | 482 | } |
| 483 | 483 | function getCurrencyType(){ |
| 484 | 484 | |
@@ -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. |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | public function __construct() { |
| 113 | 113 | parent::__construct(); |
| 114 | 114 | global $sugar_config; |
| 115 | - if(!$sugar_config['require_accounts']){ |
|
| 115 | + if (!$sugar_config['require_accounts']) { |
|
| 116 | 116 | unset($this->required_fields['account_name']); |
| 117 | 117 | } |
| 118 | 118 | } |
@@ -120,9 +120,9 @@ discard block |
||
| 120 | 120 | /** |
| 121 | 121 | * @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 |
| 122 | 122 | */ |
| 123 | - function Opportunity(){ |
|
| 123 | + function Opportunity() { |
|
| 124 | 124 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 125 | - if(isset($GLOBALS['log'])) { |
|
| 125 | + if (isset($GLOBALS['log'])) { |
|
| 126 | 126 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 127 | 127 | } |
| 128 | 128 | else { |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | FROM opportunities "; |
| 157 | 157 | |
| 158 | 158 | |
| 159 | -$query .= "LEFT JOIN users |
|
| 159 | +$query .= "LEFT JOIN users |
|
| 160 | 160 | ON opportunities.assigned_user_id=users.id "; |
| 161 | 161 | $query .= "LEFT JOIN $this->rel_account_table |
| 162 | 162 | ON opportunities.id=$this->rel_account_table.opportunity_id |
@@ -164,21 +164,21 @@ discard block |
||
| 164 | 164 | ON $this->rel_account_table.account_id=accounts.id "; |
| 165 | 165 | $query .= $custom_join['join']; |
| 166 | 166 | $where_auto = '1=1'; |
| 167 | - if($show_deleted == 0){ |
|
| 167 | + if ($show_deleted == 0) { |
|
| 168 | 168 | $where_auto = " |
| 169 | 169 | ($this->rel_account_table.deleted is null OR $this->rel_account_table.deleted=0) |
| 170 | 170 | AND (accounts.deleted is null OR accounts.deleted=0) |
| 171 | 171 | AND opportunities.deleted=0"; |
| 172 | - }else if($show_deleted == 1){ |
|
| 172 | + } else if ($show_deleted == 1) { |
|
| 173 | 173 | $where_auto = " opportunities.deleted=1"; |
| 174 | 174 | } |
| 175 | 175 | |
| 176 | - if($where != "") |
|
| 176 | + if ($where != "") |
|
| 177 | 177 | $query .= "where ($where) AND ".$where_auto; |
| 178 | 178 | else |
| 179 | 179 | $query .= "where ".$where_auto; |
| 180 | 180 | |
| 181 | - if($order_by != "") |
|
| 181 | + if ($order_by != "") |
|
| 182 | 182 | $query .= " ORDER BY $order_by"; |
| 183 | 183 | else |
| 184 | 184 | $query .= " ORDER BY opportunities.name"; |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | } |
| 188 | 188 | |
| 189 | 189 | |
| 190 | - function create_export_query($order_by, $where, $relate_link_join='') |
|
| 190 | + function create_export_query($order_by, $where, $relate_link_join = '') |
|
| 191 | 191 | { |
| 192 | 192 | $custom_join = $this->getCustomJoin(true, true, $where); |
| 193 | 193 | $custom_join['join'] .= $relate_link_join; |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | users.user_name as assigned_user_name "; |
| 198 | 198 | $query .= $custom_join['select']; |
| 199 | 199 | $query .= " FROM opportunities "; |
| 200 | - $query .= "LEFT JOIN users |
|
| 200 | + $query .= "LEFT JOIN users |
|
| 201 | 201 | ON opportunities.assigned_user_id=users.id"; |
| 202 | 202 | $query .= " LEFT JOIN $this->rel_account_table |
| 203 | 203 | ON opportunities.id=$this->rel_account_table.opportunity_id |
@@ -209,12 +209,12 @@ discard block |
||
| 209 | 209 | AND (accounts.deleted is null OR accounts.deleted=0) |
| 210 | 210 | AND opportunities.deleted=0"; |
| 211 | 211 | |
| 212 | - if($where != "") |
|
| 212 | + if ($where != "") |
|
| 213 | 213 | $query .= "where $where AND ".$where_auto; |
| 214 | 214 | else |
| 215 | 215 | $query .= "where ".$where_auto; |
| 216 | 216 | |
| 217 | - if($order_by != "") |
|
| 217 | + if ($order_by != "") |
|
| 218 | 218 | $query .= " ORDER BY opportunities.$order_by"; |
| 219 | 219 | else |
| 220 | 220 | $query .= " ORDER BY opportunities.name"; |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | |
| 224 | 224 | function fill_in_additional_list_fields() |
| 225 | 225 | { |
| 226 | - if ( $this->force_load_details == true) |
|
| 226 | + if ($this->force_load_details == true) |
|
| 227 | 227 | { |
| 228 | 228 | $this->fill_in_additional_detail_fields(); |
| 229 | 229 | } |
@@ -233,28 +233,28 @@ discard block |
||
| 233 | 233 | { |
| 234 | 234 | parent::fill_in_additional_detail_fields(); |
| 235 | 235 | |
| 236 | - if(!empty($this->currency_id)) { |
|
| 236 | + if (!empty($this->currency_id)) { |
|
| 237 | 237 | $currency = new Currency(); |
| 238 | 238 | $currency->retrieve($this->currency_id); |
| 239 | - if($currency->id != $this->currency_id || $currency->deleted == 1){ |
|
| 239 | + if ($currency->id != $this->currency_id || $currency->deleted == 1) { |
|
| 240 | 240 | $this->amount = $this->amount_usdollar; |
| 241 | 241 | $this->currency_id = $currency->id; |
| 242 | 242 | } |
| 243 | 243 | } |
| 244 | 244 | //get campaign name |
| 245 | - if(!empty($this->campaign_id)) { |
|
| 245 | + if (!empty($this->campaign_id)) { |
|
| 246 | 246 | $camp = new Campaign(); |
| 247 | 247 | $camp->retrieve($this->campaign_id); |
| 248 | 248 | $this->campaign_name = $camp->name; |
| 249 | 249 | } |
| 250 | 250 | $this->account_name = ''; |
| 251 | 251 | $this->account_id = ''; |
| 252 | - if(!empty($this->id)) { |
|
| 253 | - $ret_values=Opportunity::get_account_detail($this->id); |
|
| 252 | + if (!empty($this->id)) { |
|
| 253 | + $ret_values = Opportunity::get_account_detail($this->id); |
|
| 254 | 254 | if (!empty($ret_values)) { |
| 255 | - $this->account_name=$ret_values['name']; |
|
| 256 | - $this->account_id=$ret_values['id']; |
|
| 257 | - $this->account_id_owner =$ret_values['assigned_user_id']; |
|
| 255 | + $this->account_name = $ret_values['name']; |
|
| 256 | + $this->account_id = $ret_values['id']; |
|
| 257 | + $this->account_id_owner = $ret_values['assigned_user_id']; |
|
| 258 | 258 | } |
| 259 | 259 | } |
| 260 | 260 | } |
@@ -267,35 +267,35 @@ discard block |
||
| 267 | 267 | function get_contacts() |
| 268 | 268 | { |
| 269 | 269 | $this->load_relationship('contacts'); |
| 270 | - $query_array=$this->contacts->getQuery(true); |
|
| 270 | + $query_array = $this->contacts->getQuery(true); |
|
| 271 | 271 | |
| 272 | 272 | //update the select clause in the retruned query. |
| 273 | - $query_array['select']="SELECT contacts.id, contacts.first_name, contacts.last_name, contacts.title, contacts.email1, contacts.phone_work, opportunities_contacts.contact_role as opportunity_role, opportunities_contacts.id as opportunity_rel_id "; |
|
| 273 | + $query_array['select'] = "SELECT contacts.id, contacts.first_name, contacts.last_name, contacts.title, contacts.email1, contacts.phone_work, opportunities_contacts.contact_role as opportunity_role, opportunities_contacts.id as opportunity_rel_id "; |
|
| 274 | 274 | |
| 275 | - $query=''; |
|
| 275 | + $query = ''; |
|
| 276 | 276 | foreach ($query_array as $qstring) { |
| 277 | - $query.=' '.$qstring; |
|
| 277 | + $query .= ' '.$qstring; |
|
| 278 | 278 | } |
| 279 | 279 | $temp = Array('id', 'first_name', 'last_name', 'title', 'email1', 'phone_work', 'opportunity_role', 'opportunity_rel_id'); |
| 280 | 280 | return $this->build_related_list2($query, new Contact(), $temp); |
| 281 | 281 | } |
| 282 | 282 | |
| 283 | - function update_currency_id($fromid, $toid){ |
|
| 283 | + function update_currency_id($fromid, $toid) { |
|
| 284 | 284 | $idequals = ''; |
| 285 | 285 | |
| 286 | 286 | $currency = new Currency(); |
| 287 | 287 | $currency->retrieve($toid); |
| 288 | - foreach($fromid as $f){ |
|
| 289 | - if(!empty($idequals)){ |
|
| 290 | - $idequals .=' or '; |
|
| 288 | + foreach ($fromid as $f) { |
|
| 289 | + if (!empty($idequals)) { |
|
| 290 | + $idequals .= ' or '; |
|
| 291 | 291 | } |
| 292 | 292 | $idequals .= "currency_id='$f'"; |
| 293 | 293 | } |
| 294 | 294 | |
| 295 | - if(!empty($idequals)){ |
|
| 296 | - $query = "select amount, id from opportunities where (". $idequals. ") and deleted=0 and opportunities.sales_stage <> 'Closed Won' AND opportunities.sales_stage <> 'Closed Lost';"; |
|
| 295 | + if (!empty($idequals)) { |
|
| 296 | + $query = "select amount, id from opportunities where (".$idequals.") and deleted=0 and opportunities.sales_stage <> 'Closed Won' AND opportunities.sales_stage <> 'Closed Lost';"; |
|
| 297 | 297 | $result = $this->db->query($query); |
| 298 | - while($row = $this->db->fetchByAssoc($result)){ |
|
| 298 | + while ($row = $this->db->fetchByAssoc($result)) { |
|
| 299 | 299 | |
| 300 | 300 | $query = "update opportunities set currency_id='".$currency->id."', amount_usdollar='".$currency->convertToDollar($row['amount'])."' where id='".$row['id']."';"; |
| 301 | 301 | $this->db->query($query); |
@@ -305,24 +305,24 @@ discard block |
||
| 305 | 305 | } |
| 306 | 306 | } |
| 307 | 307 | |
| 308 | - function get_list_view_data(){ |
|
| 308 | + function get_list_view_data() { |
|
| 309 | 309 | global $locale, $current_language, $current_user, $mod_strings, $app_list_strings, $sugar_config; |
| 310 | 310 | $app_strings = return_application_language($current_language); |
| 311 | 311 | $params = array(); |
| 312 | 312 | |
| 313 | 313 | $temp_array = $this->get_list_view_array(); |
| 314 | 314 | $temp_array['SALES_STAGE'] = empty($temp_array['SALES_STAGE']) ? '' : $temp_array['SALES_STAGE']; |
| 315 | - $temp_array["ENCODED_NAME"]=$this->name; |
|
| 315 | + $temp_array["ENCODED_NAME"] = $this->name; |
|
| 316 | 316 | return $temp_array; |
| 317 | 317 | } |
| 318 | 318 | |
| 319 | - function get_currency_symbol(){ |
|
| 320 | - if(isset($this->currency_id)){ |
|
| 319 | + function get_currency_symbol() { |
|
| 320 | + if (isset($this->currency_id)) { |
|
| 321 | 321 | $cur_qry = "select * from currencies where id ='".$this->currency_id."'"; |
| 322 | 322 | $cur_res = $this->db->query($cur_qry); |
| 323 | - if(!empty($cur_res)){ |
|
| 323 | + if (!empty($cur_res)) { |
|
| 324 | 324 | $cur_row = $this->db->fetchByAssoc($cur_res); |
| 325 | - if(isset($cur_row['symbol'])){ |
|
| 325 | + if (isset($cur_row['symbol'])) { |
|
| 326 | 326 | return $cur_row['symbol']; |
| 327 | 327 | } |
| 328 | 328 | } |
@@ -335,16 +335,16 @@ discard block |
||
| 335 | 335 | builds a generic search based on the query string using or |
| 336 | 336 | do not include any $this-> because this is called on without having the class instantiated |
| 337 | 337 | */ |
| 338 | - function build_generic_where_clause ($the_query_string) { |
|
| 338 | + function build_generic_where_clause($the_query_string) { |
|
| 339 | 339 | $where_clauses = Array(); |
| 340 | 340 | $the_query_string = $GLOBALS['db']->quote($the_query_string); |
| 341 | 341 | array_push($where_clauses, "opportunities.name like '$the_query_string%'"); |
| 342 | 342 | array_push($where_clauses, "accounts.name like '$the_query_string%'"); |
| 343 | 343 | |
| 344 | 344 | $the_where = ""; |
| 345 | - foreach($where_clauses as $clause) |
|
| 345 | + foreach ($where_clauses as $clause) |
|
| 346 | 346 | { |
| 347 | - if($the_where != "") $the_where .= " or "; |
|
| 347 | + if ($the_where != "") $the_where .= " or "; |
|
| 348 | 348 | $the_where .= $clause; |
| 349 | 349 | } |
| 350 | 350 | |
@@ -357,9 +357,9 @@ discard block |
||
| 357 | 357 | // Bug 32581 - Make sure the currency_id is set to something |
| 358 | 358 | global $current_user, $app_list_strings; |
| 359 | 359 | |
| 360 | - if ( empty($this->currency_id) ) |
|
| 360 | + if (empty($this->currency_id)) |
|
| 361 | 361 | $this->currency_id = $current_user->getPreference('currency'); |
| 362 | - if ( empty($this->currency_id) ) |
|
| 362 | + if (empty($this->currency_id)) |
|
| 363 | 363 | $this->currency_id = -99; |
| 364 | 364 | |
| 365 | 365 | //if probablity isn't set, set it based on the sales stage |
@@ -385,7 +385,7 @@ discard block |
||
| 385 | 385 | (trim($this->account_id) != trim($this->rel_fields_before_value['account_id']))) { |
| 386 | 386 | //unlink the old record. |
| 387 | 387 | $this->load_relationship('accounts'); |
| 388 | - $this->accounts->delete($this->id,$this->rel_fields_before_value['account_id']); |
|
| 388 | + $this->accounts->delete($this->id, $this->rel_fields_before_value['account_id']); |
|
| 389 | 389 | } |
| 390 | 390 | // Bug 38529 & 40938 - exclude currency_id |
| 391 | 391 | parent::save_relationship_changes($is_update, array('currency_id')); |
@@ -400,7 +400,7 @@ discard block |
||
| 400 | 400 | global $app_list_strings; |
| 401 | 401 | $default = $app_list_strings['opportunity_relationship_type_default_key']; |
| 402 | 402 | $this->load_relationship('contacts'); |
| 403 | - $this->contacts->add($contact_id,array('contact_role'=>$default)); |
|
| 403 | + $this->contacts->add($contact_id, array('contact_role'=>$default)); |
|
| 404 | 404 | } |
| 405 | 405 | |
| 406 | 406 | function set_notification_body($xtpl, $oppty) |
@@ -410,33 +410,33 @@ discard block |
||
| 410 | 410 | $xtpl->assign("OPPORTUNITY_NAME", $oppty->name); |
| 411 | 411 | $xtpl->assign("OPPORTUNITY_AMOUNT", $oppty->amount); |
| 412 | 412 | $xtpl->assign("OPPORTUNITY_CLOSEDATE", $oppty->date_closed); |
| 413 | - $xtpl->assign("OPPORTUNITY_STAGE", (isset($oppty->sales_stage)?$app_list_strings['sales_stage_dom'][$oppty->sales_stage]:"")); |
|
| 413 | + $xtpl->assign("OPPORTUNITY_STAGE", (isset($oppty->sales_stage) ? $app_list_strings['sales_stage_dom'][$oppty->sales_stage] : "")); |
|
| 414 | 414 | $xtpl->assign("OPPORTUNITY_DESCRIPTION", $oppty->description); |
| 415 | 415 | |
| 416 | 416 | return $xtpl; |
| 417 | 417 | } |
| 418 | 418 | |
| 419 | - function bean_implements($interface){ |
|
| 420 | - switch($interface){ |
|
| 419 | + function bean_implements($interface) { |
|
| 420 | + switch ($interface) { |
|
| 421 | 421 | case 'ACL':return true; |
| 422 | 422 | } |
| 423 | 423 | return false; |
| 424 | 424 | } |
| 425 | - function listviewACLHelper(){ |
|
| 425 | + function listviewACLHelper() { |
|
| 426 | 426 | $array_assign = parent::listviewACLHelper(); |
| 427 | 427 | $is_owner = false; |
| 428 | 428 | $in_group = false; //SECURITY GROUPS |
| 429 | - if(!empty($this->account_id)){ |
|
| 429 | + if (!empty($this->account_id)) { |
|
| 430 | 430 | |
| 431 | - if(!empty($this->account_id_owner)){ |
|
| 431 | + if (!empty($this->account_id_owner)) { |
|
| 432 | 432 | global $current_user; |
| 433 | 433 | $is_owner = $current_user->id == $this->account_id_owner; |
| 434 | 434 | } |
| 435 | 435 | /* BEGIN - SECURITY GROUPS */ |
| 436 | 436 | else { |
| 437 | 437 | global $current_user; |
| 438 | - $parent_bean = BeanFactory::getBean('Accounts',$this->account_id); |
|
| 439 | - if($parent_bean !== false) { |
|
| 438 | + $parent_bean = BeanFactory::getBean('Accounts', $this->account_id); |
|
| 439 | + if ($parent_bean !== false) { |
|
| 440 | 440 | $is_owner = $current_user->id == $parent_bean->assigned_user_id; |
| 441 | 441 | } |
| 442 | 442 | } |
@@ -448,10 +448,10 @@ discard block |
||
| 448 | 448 | /** |
| 449 | 449 | if(!ACLController::moduleSupportsACL('Accounts') || ACLController::checkAccess('Accounts', 'view', $is_owner)){ |
| 450 | 450 | */ |
| 451 | - if(!ACLController::moduleSupportsACL('Accounts') || ACLController::checkAccess('Accounts', 'view', $is_owner, 'module', $in_group)){ |
|
| 451 | + if (!ACLController::moduleSupportsACL('Accounts') || ACLController::checkAccess('Accounts', 'view', $is_owner, 'module', $in_group)) { |
|
| 452 | 452 | /* END - SECURITY GROUPS */ |
| 453 | 453 | $array_assign['ACCOUNT'] = 'a'; |
| 454 | - }else{ |
|
| 454 | + } else { |
|
| 455 | 455 | $array_assign['ACCOUNT'] = 'span'; |
| 456 | 456 | } |
| 457 | 457 | |
@@ -470,9 +470,9 @@ discard block |
||
| 470 | 470 | . " AND a_o.opportunity_id='$opp_id'" |
| 471 | 471 | . " AND a_o.deleted=0" |
| 472 | 472 | . " AND acc.deleted=0"; |
| 473 | - $result = $db->query($query, true,"Error filling in opportunity account details: "); |
|
| 473 | + $result = $db->query($query, true, "Error filling in opportunity account details: "); |
|
| 474 | 474 | $row = $db->fetchByAssoc($result); |
| 475 | - if($row != null) { |
|
| 475 | + if ($row != null) { |
|
| 476 | 476 | $ret_array['name'] = $row['name']; |
| 477 | 477 | $ret_array['id'] = $row['id']; |
| 478 | 478 | $ret_array['assigned_user_id'] = $row['assigned_user_id']; |
@@ -480,7 +480,7 @@ discard block |
||
| 480 | 480 | return $ret_array; |
| 481 | 481 | } |
| 482 | 482 | } |
| 483 | -function getCurrencyType(){ |
|
| 483 | +function getCurrencyType() { |
|
| 484 | 484 | |
| 485 | 485 | } |
| 486 | 486 | |
@@ -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. |
@@ -124,8 +126,7 @@ discard block |
||
| 124 | 126 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 125 | 127 | if(isset($GLOBALS['log'])) { |
| 126 | 128 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 127 | - } |
|
| 128 | - else { |
|
| 129 | + } else { |
|
| 129 | 130 | trigger_error($deprecatedMessage, E_USER_DEPRECATED); |
| 130 | 131 | } |
| 131 | 132 | self::__construct(); |
@@ -169,19 +170,21 @@ discard block |
||
| 169 | 170 | ($this->rel_account_table.deleted is null OR $this->rel_account_table.deleted=0) |
| 170 | 171 | AND (accounts.deleted is null OR accounts.deleted=0) |
| 171 | 172 | AND opportunities.deleted=0"; |
| 172 | - }else if($show_deleted == 1){ |
|
| 173 | + } else if($show_deleted == 1){ |
|
| 173 | 174 | $where_auto = " opportunities.deleted=1"; |
| 174 | 175 | } |
| 175 | 176 | |
| 176 | - if($where != "") |
|
| 177 | - $query .= "where ($where) AND ".$where_auto; |
|
| 178 | - else |
|
| 179 | - $query .= "where ".$where_auto; |
|
| 177 | + if($where != "") { |
|
| 178 | + $query .= "where ($where) AND ".$where_auto; |
|
| 179 | + } else { |
|
| 180 | + $query .= "where ".$where_auto; |
|
| 181 | + } |
|
| 180 | 182 | |
| 181 | - if($order_by != "") |
|
| 182 | - $query .= " ORDER BY $order_by"; |
|
| 183 | - else |
|
| 184 | - $query .= " ORDER BY opportunities.name"; |
|
| 183 | + if($order_by != "") { |
|
| 184 | + $query .= " ORDER BY $order_by"; |
|
| 185 | + } else { |
|
| 186 | + $query .= " ORDER BY opportunities.name"; |
|
| 187 | + } |
|
| 185 | 188 | |
| 186 | 189 | return $query; |
| 187 | 190 | } |
@@ -209,15 +212,17 @@ discard block |
||
| 209 | 212 | AND (accounts.deleted is null OR accounts.deleted=0) |
| 210 | 213 | AND opportunities.deleted=0"; |
| 211 | 214 | |
| 212 | - if($where != "") |
|
| 213 | - $query .= "where $where AND ".$where_auto; |
|
| 214 | - else |
|
| 215 | - $query .= "where ".$where_auto; |
|
| 215 | + if($where != "") { |
|
| 216 | + $query .= "where $where AND ".$where_auto; |
|
| 217 | + } else { |
|
| 218 | + $query .= "where ".$where_auto; |
|
| 219 | + } |
|
| 216 | 220 | |
| 217 | - if($order_by != "") |
|
| 218 | - $query .= " ORDER BY opportunities.$order_by"; |
|
| 219 | - else |
|
| 220 | - $query .= " ORDER BY opportunities.name"; |
|
| 221 | + if($order_by != "") { |
|
| 222 | + $query .= " ORDER BY opportunities.$order_by"; |
|
| 223 | + } else { |
|
| 224 | + $query .= " ORDER BY opportunities.name"; |
|
| 225 | + } |
|
| 221 | 226 | return $query; |
| 222 | 227 | } |
| 223 | 228 | |
@@ -344,7 +349,9 @@ discard block |
||
| 344 | 349 | $the_where = ""; |
| 345 | 350 | foreach($where_clauses as $clause) |
| 346 | 351 | { |
| 347 | - if($the_where != "") $the_where .= " or "; |
|
| 352 | + if($the_where != "") { |
|
| 353 | + $the_where .= " or "; |
|
| 354 | + } |
|
| 348 | 355 | $the_where .= $clause; |
| 349 | 356 | } |
| 350 | 357 | |
@@ -357,17 +364,20 @@ discard block |
||
| 357 | 364 | // Bug 32581 - Make sure the currency_id is set to something |
| 358 | 365 | global $current_user, $app_list_strings; |
| 359 | 366 | |
| 360 | - if ( empty($this->currency_id) ) |
|
| 361 | - $this->currency_id = $current_user->getPreference('currency'); |
|
| 362 | - if ( empty($this->currency_id) ) |
|
| 363 | - $this->currency_id = -99; |
|
| 367 | + if ( empty($this->currency_id) ) { |
|
| 368 | + $this->currency_id = $current_user->getPreference('currency'); |
|
| 369 | + } |
|
| 370 | + if ( empty($this->currency_id) ) { |
|
| 371 | + $this->currency_id = -99; |
|
| 372 | + } |
|
| 364 | 373 | |
| 365 | 374 | //if probablity isn't set, set it based on the sales stage |
| 366 | 375 | if (!isset($this->probability) && !empty($this->sales_stage)) |
| 367 | 376 | { |
| 368 | 377 | $prob_arr = $app_list_strings['sales_probability_dom']; |
| 369 | - if (isset($prob_arr[$this->sales_stage])) |
|
| 370 | - $this->probability = $prob_arr[$this->sales_stage]; |
|
| 378 | + if (isset($prob_arr[$this->sales_stage])) { |
|
| 379 | + $this->probability = $prob_arr[$this->sales_stage]; |
|
| 380 | + } |
|
| 371 | 381 | } |
| 372 | 382 | |
| 373 | 383 | require_once('modules/Opportunities/SaveOverload.php'); |
@@ -451,7 +461,7 @@ discard block |
||
| 451 | 461 | if(!ACLController::moduleSupportsACL('Accounts') || ACLController::checkAccess('Accounts', 'view', $is_owner, 'module', $in_group)){ |
| 452 | 462 | /* END - SECURITY GROUPS */ |
| 453 | 463 | $array_assign['ACCOUNT'] = 'a'; |
| 454 | - }else{ |
|
| 464 | + } else{ |
|
| 455 | 465 | $array_assign['ACCOUNT'] = 'span'; |
| 456 | 466 | } |
| 457 | 467 | |
@@ -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 | /********************************************************************************* |
| 5 | 5 | * SugarCRM Community Edition is a customer relationship management program developed by |
@@ -53,16 +53,16 @@ discard block |
||
| 53 | 53 | |
| 54 | 54 | class OpportunitiesViewDetail extends ViewDetail { |
| 55 | 55 | |
| 56 | - function __construct(){ |
|
| 56 | + function __construct() { |
|
| 57 | 57 | parent::__construct(); |
| 58 | 58 | } |
| 59 | 59 | |
| 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 OpportunitiesViewDetail(){ |
|
| 63 | + function OpportunitiesViewDetail() { |
|
| 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 { |
@@ -75,16 +75,16 @@ discard block |
||
| 75 | 75 | function display() { |
| 76 | 76 | |
| 77 | 77 | $currency = new Currency(); |
| 78 | - if(isset($this->bean->currency_id) && !empty($this->bean->currency_id)) |
|
| 78 | + if (isset($this->bean->currency_id) && !empty($this->bean->currency_id)) |
|
| 79 | 79 | { |
| 80 | 80 | $currency->retrieve($this->bean->currency_id); |
| 81 | - if( $currency->deleted != 1){ |
|
| 82 | - $this->ss->assign('CURRENCY', $currency->iso4217 .' '.$currency->symbol); |
|
| 83 | - }else { |
|
| 84 | - $this->ss->assign('CURRENCY', $currency->getDefaultISO4217() .' '.$currency->getDefaultCurrencySymbol()); |
|
| 81 | + if ($currency->deleted != 1) { |
|
| 82 | + $this->ss->assign('CURRENCY', $currency->iso4217.' '.$currency->symbol); |
|
| 83 | + } else { |
|
| 84 | + $this->ss->assign('CURRENCY', $currency->getDefaultISO4217().' '.$currency->getDefaultCurrencySymbol()); |
|
| 85 | 85 | } |
| 86 | - }else{ |
|
| 87 | - $this->ss->assign('CURRENCY', $currency->getDefaultISO4217() .' '.$currency->getDefaultCurrencySymbol()); |
|
| 86 | + } else { |
|
| 87 | + $this->ss->assign('CURRENCY', $currency->getDefaultISO4217().' '.$currency->getDefaultCurrencySymbol()); |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | parent::display(); |
@@ -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 | /********************************************************************************* |
| 5 | 7 | * SugarCRM Community Edition is a customer relationship management program developed by |
@@ -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(); |
@@ -80,10 +81,10 @@ discard block |
||
| 80 | 81 | $currency->retrieve($this->bean->currency_id); |
| 81 | 82 | if( $currency->deleted != 1){ |
| 82 | 83 | $this->ss->assign('CURRENCY', $currency->iso4217 .' '.$currency->symbol); |
| 83 | - }else { |
|
| 84 | + } else { |
|
| 84 | 85 | $this->ss->assign('CURRENCY', $currency->getDefaultISO4217() .' '.$currency->getDefaultCurrencySymbol()); |
| 85 | 86 | } |
| 86 | - }else{ |
|
| 87 | + } else{ |
|
| 87 | 88 | $this->ss->assign('CURRENCY', $currency->getDefaultISO4217() .' '.$currency->getDefaultCurrencySymbol()); |
| 88 | 89 | } |
| 89 | 90 | |
@@ -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 | /********************************************************************************* |
| 5 | 5 | * SugarCRM Community Edition is a customer relationship management program developed by |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | |
| 51 | 51 | class OpportunitiesViewEdit extends ViewEdit { |
| 52 | 52 | |
| 53 | - function __construct(){ |
|
| 53 | + function __construct() { |
|
| 54 | 54 | parent::__construct(); |
| 55 | 55 | $this->useForSubpanel = true; |
| 56 | 56 | } |
@@ -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 OpportunitiesViewEdit(){ |
|
| 61 | + function OpportunitiesViewEdit() { |
|
| 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 { |
@@ -75,11 +75,11 @@ discard block |
||
| 75 | 75 | $json = getJSONobj(); |
| 76 | 76 | $prob_array = $json->encode($app_list_strings['sales_probability_dom']); |
| 77 | 77 | $prePopProb = ''; |
| 78 | - if(empty($this->bean->id) && empty($_REQUEST['probability'])) { |
|
| 78 | + if (empty($this->bean->id) && empty($_REQUEST['probability'])) { |
|
| 79 | 79 | $prePopProb = 'document.getElementsByName(\'sales_stage\')[0].onchange();'; |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | -$probability_script=<<<EOQ |
|
| 82 | +$probability_script = <<<EOQ |
|
| 83 | 83 | <script> |
| 84 | 84 | prob_array = $prob_array; |
| 85 | 85 | document.getElementsByName('sales_stage')[0].onchange = function() { |
@@ -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(); |
@@ -5,16 +5,16 @@ discard block |
||
| 5 | 5 | |
| 6 | 6 | class OpportunitiesViewList extends ViewList { |
| 7 | 7 | |
| 8 | - function __construct(){ |
|
| 8 | + function __construct() { |
|
| 9 | 9 | parent::__construct(); |
| 10 | 10 | } |
| 11 | 11 | |
| 12 | 12 | /** |
| 13 | 13 | * @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 |
| 14 | 14 | */ |
| 15 | - function OpportunitiesViewList(){ |
|
| 15 | + function OpportunitiesViewList() { |
|
| 16 | 16 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 17 | - if(isset($GLOBALS['log'])) { |
|
| 17 | + if (isset($GLOBALS['log'])) { |
|
| 18 | 18 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 19 | 19 | } |
| 20 | 20 | else { |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | |
| 27 | - function preDisplay(){ |
|
| 27 | + function preDisplay() { |
|
| 28 | 28 | $this->lv = new OpportunitiesListViewSmarty(); |
| 29 | 29 | } |
| 30 | 30 | } |
@@ -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. |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | parent::__construct($id, $def); |
| 54 | 54 | |
| 55 | - if(empty($def['title'])) $this->title = translate('LBL_TOP_OPPORTUNITIES', 'Opportunities'); |
|
| 55 | + if (empty($def['title'])) $this->title = translate('LBL_TOP_OPPORTUNITIES', 'Opportunities'); |
|
| 56 | 56 | |
| 57 | 57 | $this->searchFields = $dashletData['MyOpportunitiesDashlet']['searchFields']; |
| 58 | 58 | $this->columns = $dashletData['MyOpportunitiesDashlet']['columns']; |
@@ -63,9 +63,9 @@ discard block |
||
| 63 | 63 | /** |
| 64 | 64 | * @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 |
| 65 | 65 | */ |
| 66 | - function MyOpportunitiesDashlet($id, $def = null){ |
|
| 66 | + function MyOpportunitiesDashlet($id, $def = null) { |
|
| 67 | 67 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 68 | - if(isset($GLOBALS['log'])) { |
|
| 68 | + if (isset($GLOBALS['log'])) { |
|
| 69 | 69 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 70 | 70 | } |
| 71 | 71 | else { |
@@ -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. |
@@ -52,7 +54,9 @@ discard block |
||
| 52 | 54 | |
| 53 | 55 | parent::__construct($id, $def); |
| 54 | 56 | |
| 55 | - if(empty($def['title'])) $this->title = translate('LBL_TOP_OPPORTUNITIES', 'Opportunities'); |
|
| 57 | + if(empty($def['title'])) { |
|
| 58 | + $this->title = translate('LBL_TOP_OPPORTUNITIES', 'Opportunities'); |
|
| 59 | + } |
|
| 56 | 60 | |
| 57 | 61 | $this->searchFields = $dashletData['MyOpportunitiesDashlet']['searchFields']; |
| 58 | 62 | $this->columns = $dashletData['MyOpportunitiesDashlet']['columns']; |
@@ -67,8 +71,7 @@ discard block |
||
| 67 | 71 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 68 | 72 | if(isset($GLOBALS['log'])) { |
| 69 | 73 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 70 | - } |
|
| 71 | - else { |
|
| 74 | + } else { |
|
| 72 | 75 | trigger_error($deprecatedMessage, E_USER_DEPRECATED); |
| 73 | 76 | } |
| 74 | 77 | self::__construct($id, $def); |
@@ -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 | require_once('include/Dashlets/DashletGeneric.php'); |
| 5 | 5 | require_once('modules/jjwg_Markers/jjwg_Markers.php'); |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | parent::__construct($id, $def); |
| 14 | 14 | |
| 15 | - if(empty($def['title'])) $this->title = translate('LBL_HOMEPAGE_TITLE', 'jjwg_Markers'); |
|
| 15 | + if (empty($def['title'])) $this->title = translate('LBL_HOMEPAGE_TITLE', 'jjwg_Markers'); |
|
| 16 | 16 | |
| 17 | 17 | $this->searchFields = $dashletData['jjwg_MarkersDashlet']['searchFields']; |
| 18 | 18 | $this->columns = $dashletData['jjwg_MarkersDashlet']['columns']; |
@@ -23,9 +23,9 @@ discard block |
||
| 23 | 23 | /** |
| 24 | 24 | * @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 |
| 25 | 25 | */ |
| 26 | - function jjwg_MarkersDashlet($id, $def = null){ |
|
| 26 | + function jjwg_MarkersDashlet($id, $def = null) { |
|
| 27 | 27 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 28 | - if(isset($GLOBALS['log'])) { |
|
| 28 | + if (isset($GLOBALS['log'])) { |
|
| 29 | 29 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 30 | 30 | } |
| 31 | 31 | else { |
@@ -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 | require_once('include/Dashlets/DashletGeneric.php'); |
| 5 | 7 | require_once('modules/jjwg_Markers/jjwg_Markers.php'); |
@@ -12,7 +14,9 @@ discard block |
||
| 12 | 14 | |
| 13 | 15 | parent::__construct($id, $def); |
| 14 | 16 | |
| 15 | - if(empty($def['title'])) $this->title = translate('LBL_HOMEPAGE_TITLE', 'jjwg_Markers'); |
|
| 17 | + if(empty($def['title'])) { |
|
| 18 | + $this->title = translate('LBL_HOMEPAGE_TITLE', 'jjwg_Markers'); |
|
| 19 | + } |
|
| 16 | 20 | |
| 17 | 21 | $this->searchFields = $dashletData['jjwg_MarkersDashlet']['searchFields']; |
| 18 | 22 | $this->columns = $dashletData['jjwg_MarkersDashlet']['columns']; |
@@ -27,8 +31,7 @@ discard block |
||
| 27 | 31 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 28 | 32 | if(isset($GLOBALS['log'])) { |
| 29 | 33 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 30 | - } |
|
| 31 | - else { |
|
| 34 | + } else { |
|
| 32 | 35 | trigger_error($deprecatedMessage, E_USER_DEPRECATED); |
| 33 | 36 | } |
| 34 | 37 | self::__construct($id, $def); |