@@ -40,12 +40,12 @@ |
||
| 40 | 40 | require_once('modules/ModuleBuilder/MB/MBPackageTree.php'); |
| 41 | 41 | require_once('modules/ModuleBuilder/Module/StudioBrowser.php'); |
| 42 | 42 | class MainTree extends MBPackageTree{ |
| 43 | - function __construct(){ |
|
| 44 | - $this->tree = new Tree('package_tree'); |
|
| 45 | - $this->tree->id = 'package_tree'; |
|
| 46 | - $this->mb = new StudioBrowser(); |
|
| 47 | - $this->populateTree(array(), $this->tree); |
|
| 48 | - } |
|
| 43 | + function __construct(){ |
|
| 44 | + $this->tree = new Tree('package_tree'); |
|
| 45 | + $this->tree->id = 'package_tree'; |
|
| 46 | + $this->mb = new StudioBrowser(); |
|
| 47 | + $this->populateTree(array(), $this->tree); |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | 50 | /** |
| 51 | 51 | * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead |
@@ -39,8 +39,8 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | require_once('modules/ModuleBuilder/MB/MBPackageTree.php'); |
| 41 | 41 | require_once('modules/ModuleBuilder/Module/StudioBrowser.php'); |
| 42 | -class MainTree extends MBPackageTree{ |
|
| 43 | - function __construct(){ |
|
| 42 | +class MainTree extends MBPackageTree { |
|
| 43 | + function __construct() { |
|
| 44 | 44 | $this->tree = new Tree('package_tree'); |
| 45 | 45 | $this->tree->id = 'package_tree'; |
| 46 | 46 | $this->mb = new StudioBrowser(); |
@@ -50,9 +50,9 @@ discard block |
||
| 50 | 50 | /** |
| 51 | 51 | * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead |
| 52 | 52 | */ |
| 53 | - function MainTree(){ |
|
| 53 | + function MainTree() { |
|
| 54 | 54 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 55 | - if(isset($GLOBALS['log'])) { |
|
| 55 | + if (isset($GLOBALS['log'])) { |
|
| 56 | 56 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 57 | 57 | } |
| 58 | 58 | else { |
@@ -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); |
@@ -39,8 +39,8 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | require_once('modules/ModuleBuilder/MB/MBPackageTree.php'); |
| 41 | 41 | require_once('modules/ModuleBuilder/Module/StudioBrowser.php'); |
| 42 | -class StudioTree extends MBPackageTree{ |
|
| 43 | - function __construct(){ |
|
| 42 | +class StudioTree extends MBPackageTree { |
|
| 43 | + function __construct() { |
|
| 44 | 44 | $this->tree = new Tree('package_tree'); |
| 45 | 45 | $this->tree->id = 'package_tree'; |
| 46 | 46 | $this->mb = new StudioBrowser(); |
@@ -50,9 +50,9 @@ discard block |
||
| 50 | 50 | /** |
| 51 | 51 | * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead |
| 52 | 52 | */ |
| 53 | - function StudioTree(){ |
|
| 53 | + function StudioTree() { |
|
| 54 | 54 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 55 | - if(isset($GLOBALS['log'])) { |
|
| 55 | + if (isset($GLOBALS['log'])) { |
|
| 56 | 56 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 57 | 57 | } |
| 58 | 58 | else { |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | |
| 65 | - function getName(){ |
|
| 65 | + function getName() { |
|
| 66 | 66 | return translate('LBL_SECTION_MODULES'); |
| 67 | 67 | } |
| 68 | 68 | |
@@ -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); |
@@ -52,29 +52,29 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | class Role extends SugarBean { |
| 54 | 54 | |
| 55 | - var $field_name_map; |
|
| 56 | - |
|
| 57 | - var $id; |
|
| 58 | - var $deleted; |
|
| 59 | - var $date_entered; |
|
| 60 | - var $date_modified; |
|
| 61 | - var $modified_user_id; |
|
| 62 | - var $created_by; |
|
| 63 | - var $name; |
|
| 64 | - var $description; |
|
| 65 | - var $modules; |
|
| 66 | - var $disable_row_level_security = true; |
|
| 67 | - |
|
| 68 | - var $table_name = 'roles'; |
|
| 69 | - var $rel_module_table = 'roles_modules'; |
|
| 70 | - var $object_name = 'Role'; |
|
| 71 | - var $module_dir = 'Roles'; |
|
| 72 | - var $new_schema = true; |
|
| 55 | + var $field_name_map; |
|
| 56 | + |
|
| 57 | + var $id; |
|
| 58 | + var $deleted; |
|
| 59 | + var $date_entered; |
|
| 60 | + var $date_modified; |
|
| 61 | + var $modified_user_id; |
|
| 62 | + var $created_by; |
|
| 63 | + var $name; |
|
| 64 | + var $description; |
|
| 65 | + var $modules; |
|
| 66 | + var $disable_row_level_security = true; |
|
| 67 | + |
|
| 68 | + var $table_name = 'roles'; |
|
| 69 | + var $rel_module_table = 'roles_modules'; |
|
| 70 | + var $object_name = 'Role'; |
|
| 71 | + var $module_dir = 'Roles'; |
|
| 72 | + var $new_schema = true; |
|
| 73 | 73 | |
| 74 | 74 | public function __construct() |
| 75 | - { |
|
| 76 | - parent::__construct(); |
|
| 77 | - } |
|
| 75 | + { |
|
| 76 | + parent::__construct(); |
|
| 77 | + } |
|
| 78 | 78 | |
| 79 | 79 | /** |
| 80 | 80 | * @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 |
@@ -91,129 +91,129 @@ discard block |
||
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | |
| 94 | - function get_summary_text() |
|
| 95 | - { |
|
| 96 | - return $this->name; |
|
| 97 | - } |
|
| 98 | - |
|
| 99 | - function create_export_query($order_by, $where) |
|
| 100 | - { |
|
| 101 | - return $this->create_new_list_query($order_by, $where); |
|
| 102 | - } |
|
| 94 | + function get_summary_text() |
|
| 95 | + { |
|
| 96 | + return $this->name; |
|
| 97 | + } |
|
| 103 | 98 | |
| 104 | - function query_modules($allow = 1) |
|
| 105 | - { |
|
| 106 | - $query = "SELECT module_id FROM roles_modules WHERE "; |
|
| 107 | - $query .= "role_id = '$this->id' AND allow = '$allow' AND deleted=0"; |
|
| 108 | - $result = $this->db->query($query); |
|
| 99 | + function create_export_query($order_by, $where) |
|
| 100 | + { |
|
| 101 | + return $this->create_new_list_query($order_by, $where); |
|
| 102 | + } |
|
| 109 | 103 | |
| 110 | - $return_array = array(); |
|
| 111 | - |
|
| 112 | - while($row = $this->db->fetchByAssoc($result)) |
|
| 113 | - { |
|
| 114 | - array_push($return_array, $row['module_id']); |
|
| 115 | - } |
|
| 104 | + function query_modules($allow = 1) |
|
| 105 | + { |
|
| 106 | + $query = "SELECT module_id FROM roles_modules WHERE "; |
|
| 107 | + $query .= "role_id = '$this->id' AND allow = '$allow' AND deleted=0"; |
|
| 108 | + $result = $this->db->query($query); |
|
| 116 | 109 | |
| 117 | - return $return_array; |
|
| 118 | - } |
|
| 119 | - function set_module_relationship($role_id, &$mod_ids, $allow) |
|
| 120 | - { |
|
| 121 | - foreach($mod_ids as $mod_id) |
|
| 122 | - { |
|
| 123 | - if($mod_id != '') |
|
| 124 | - $this->set_relationship('roles_modules', array( 'module_id'=>$mod_id, 'role_id'=>$role_id, 'allow'=>$allow )); |
|
| 125 | - } |
|
| 126 | - } |
|
| 110 | + $return_array = array(); |
|
| 127 | 111 | |
| 128 | - function clear_module_relationship($role_id) |
|
| 129 | - { |
|
| 130 | - $query = "DELETE FROM roles_modules WHERE role_id='$role_id'"; |
|
| 131 | - $this->db->query($query); |
|
| 132 | - } |
|
| 112 | + while($row = $this->db->fetchByAssoc($result)) |
|
| 113 | + { |
|
| 114 | + array_push($return_array, $row['module_id']); |
|
| 115 | + } |
|
| 133 | 116 | |
| 134 | - function set_user_relationship($role_id, &$user_ids) |
|
| 135 | - { |
|
| 136 | - foreach($user_ids as $user_id) |
|
| 137 | - { |
|
| 138 | - if($user_id != '') |
|
| 139 | - $this->set_relationship('roles_users', array( 'user_id'=>$user_id, 'role_id'=>$role_id )); |
|
| 140 | - } |
|
| 141 | - } |
|
| 117 | + return $return_array; |
|
| 118 | + } |
|
| 119 | + function set_module_relationship($role_id, &$mod_ids, $allow) |
|
| 120 | + { |
|
| 121 | + foreach($mod_ids as $mod_id) |
|
| 122 | + { |
|
| 123 | + if($mod_id != '') |
|
| 124 | + $this->set_relationship('roles_modules', array( 'module_id'=>$mod_id, 'role_id'=>$role_id, 'allow'=>$allow )); |
|
| 125 | + } |
|
| 126 | + } |
|
| 142 | 127 | |
| 143 | - function clear_user_relationship($role_id, $user_id) |
|
| 144 | - { |
|
| 145 | - $query = "DELETE FROM roles_users WHERE role_id='$role_id' AND user_id='$user_id'"; |
|
| 146 | - $this->db->query($query); |
|
| 147 | - } |
|
| 128 | + function clear_module_relationship($role_id) |
|
| 129 | + { |
|
| 130 | + $query = "DELETE FROM roles_modules WHERE role_id='$role_id'"; |
|
| 131 | + $this->db->query($query); |
|
| 132 | + } |
|
| 148 | 133 | |
| 149 | - function query_user_allowed_modules($user_id) |
|
| 150 | - { |
|
| 151 | - $userArray = array(); |
|
| 152 | - global $app_list_strings; |
|
| 134 | + function set_user_relationship($role_id, &$user_ids) |
|
| 135 | + { |
|
| 136 | + foreach($user_ids as $user_id) |
|
| 137 | + { |
|
| 138 | + if($user_id != '') |
|
| 139 | + $this->set_relationship('roles_users', array( 'user_id'=>$user_id, 'role_id'=>$role_id )); |
|
| 140 | + } |
|
| 141 | + } |
|
| 153 | 142 | |
| 143 | + function clear_user_relationship($role_id, $user_id) |
|
| 144 | + { |
|
| 145 | + $query = "DELETE FROM roles_users WHERE role_id='$role_id' AND user_id='$user_id'"; |
|
| 146 | + $this->db->query($query); |
|
| 147 | + } |
|
| 154 | 148 | |
| 149 | + function query_user_allowed_modules($user_id) |
|
| 150 | + { |
|
| 151 | + $userArray = array(); |
|
| 152 | + global $app_list_strings; |
|
| 155 | 153 | |
| 156 | - $sql = "SELECT role_id FROM roles_users WHERE user_id='$user_id'"; |
|
| 157 | 154 | |
| 158 | - $result = $this->db->query($sql); |
|
| 159 | 155 | |
| 160 | - while($row = $this->db->fetchByAssoc($result)) |
|
| 161 | - { |
|
| 162 | - $role_id = $row["role_id"]; |
|
| 163 | - $sql = "SELECT module_id FROM roles_modules WHERE role_id='$role_id' AND allow='1'"; |
|
| 164 | - $res = $this->db->query($sql); |
|
| 156 | + $sql = "SELECT role_id FROM roles_users WHERE user_id='$user_id'"; |
|
| 165 | 157 | |
| 166 | - while($col = $this->db->fetchByAssoc($res)) |
|
| 167 | - { |
|
| 168 | - $key = $col['module_id']; |
|
| 169 | - if(!(array_key_exists($key, $userArray))) |
|
| 170 | - { |
|
| 171 | - $userArray[$key] = $app_list_strings['moduleList'][$key]; |
|
| 172 | - } |
|
| 173 | - } |
|
| 174 | - } |
|
| 158 | + $result = $this->db->query($sql); |
|
| 175 | 159 | |
| 176 | - return $userArray; |
|
| 177 | - } |
|
| 160 | + while($row = $this->db->fetchByAssoc($result)) |
|
| 161 | + { |
|
| 162 | + $role_id = $row["role_id"]; |
|
| 163 | + $sql = "SELECT module_id FROM roles_modules WHERE role_id='$role_id' AND allow='1'"; |
|
| 164 | + $res = $this->db->query($sql); |
|
| 178 | 165 | |
| 179 | - function query_user_disallowed_modules($user_id, &$allowed) |
|
| 180 | - { |
|
| 181 | - global $moduleList; |
|
| 166 | + while($col = $this->db->fetchByAssoc($res)) |
|
| 167 | + { |
|
| 168 | + $key = $col['module_id']; |
|
| 169 | + if(!(array_key_exists($key, $userArray))) |
|
| 170 | + { |
|
| 171 | + $userArray[$key] = $app_list_strings['moduleList'][$key]; |
|
| 172 | + } |
|
| 173 | + } |
|
| 174 | + } |
|
| 182 | 175 | |
| 183 | - $returnArray = array(); |
|
| 176 | + return $userArray; |
|
| 177 | + } |
|
| 184 | 178 | |
| 185 | - foreach($moduleList as $key=>$val) |
|
| 186 | - { |
|
| 187 | - if(array_key_exists($val, $allowed)) |
|
| 188 | - continue; |
|
| 189 | - $returnArray[$val] = $val; |
|
| 190 | - } |
|
| 179 | + function query_user_disallowed_modules($user_id, &$allowed) |
|
| 180 | + { |
|
| 181 | + global $moduleList; |
|
| 191 | 182 | |
| 192 | - return $returnArray; |
|
| 193 | - |
|
| 194 | - } |
|
| 195 | - |
|
| 196 | - function get_users() |
|
| 197 | - { |
|
| 198 | - // First, get the list of IDs. |
|
| 199 | - |
|
| 200 | - |
|
| 201 | - |
|
| 202 | - $query = "SELECT user_id as id FROM roles_users WHERE role_id='$this->id' AND deleted=0"; |
|
| 183 | + $returnArray = array(); |
|
| 184 | + |
|
| 185 | + foreach($moduleList as $key=>$val) |
|
| 186 | + { |
|
| 187 | + if(array_key_exists($val, $allowed)) |
|
| 188 | + continue; |
|
| 189 | + $returnArray[$val] = $val; |
|
| 190 | + } |
|
| 191 | + |
|
| 192 | + return $returnArray; |
|
| 193 | + |
|
| 194 | + } |
|
| 195 | + |
|
| 196 | + function get_users() |
|
| 197 | + { |
|
| 198 | + // First, get the list of IDs. |
|
| 203 | 199 | |
| 204 | - return $this->build_related_list($query, new User()); |
|
| 205 | - } |
|
| 206 | 200 | |
| 207 | - function check_user_role_count($user_id) |
|
| 208 | - { |
|
| 209 | - $query = "SELECT count(*) AS num FROM roles_users WHERE "; |
|
| 210 | - $query .= "user_id='$user_id' AND deleted=0"; |
|
| 211 | - $result = $this->db->query($query); |
|
| 212 | - |
|
| 213 | - $row = $this->db->fetchByAssoc($result); |
|
| 214 | 201 | |
| 215 | - return $row['num']; |
|
| 216 | - } |
|
| 202 | + $query = "SELECT user_id as id FROM roles_users WHERE role_id='$this->id' AND deleted=0"; |
|
| 203 | + |
|
| 204 | + return $this->build_related_list($query, new User()); |
|
| 205 | + } |
|
| 206 | + |
|
| 207 | + function check_user_role_count($user_id) |
|
| 208 | + { |
|
| 209 | + $query = "SELECT count(*) AS num FROM roles_users WHERE "; |
|
| 210 | + $query .= "user_id='$user_id' AND deleted=0"; |
|
| 211 | + $result = $this->db->query($query); |
|
| 212 | + |
|
| 213 | + $row = $this->db->fetchByAssoc($result); |
|
| 214 | + |
|
| 215 | + return $row['num']; |
|
| 216 | + } |
|
| 217 | 217 | |
| 218 | 218 | } |
| 219 | 219 | |
@@ -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. |
@@ -79,9 +79,9 @@ discard block |
||
| 79 | 79 | /** |
| 80 | 80 | * @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 |
| 81 | 81 | */ |
| 82 | - public function Role(){ |
|
| 82 | + public function Role() { |
|
| 83 | 83 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 84 | - if(isset($GLOBALS['log'])) { |
|
| 84 | + if (isset($GLOBALS['log'])) { |
|
| 85 | 85 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 86 | 86 | } |
| 87 | 87 | else { |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | |
| 110 | 110 | $return_array = array(); |
| 111 | 111 | |
| 112 | - while($row = $this->db->fetchByAssoc($result)) |
|
| 112 | + while ($row = $this->db->fetchByAssoc($result)) |
|
| 113 | 113 | { |
| 114 | 114 | array_push($return_array, $row['module_id']); |
| 115 | 115 | } |
@@ -118,10 +118,10 @@ discard block |
||
| 118 | 118 | } |
| 119 | 119 | function set_module_relationship($role_id, &$mod_ids, $allow) |
| 120 | 120 | { |
| 121 | - foreach($mod_ids as $mod_id) |
|
| 121 | + foreach ($mod_ids as $mod_id) |
|
| 122 | 122 | { |
| 123 | - if($mod_id != '') |
|
| 124 | - $this->set_relationship('roles_modules', array( 'module_id'=>$mod_id, 'role_id'=>$role_id, 'allow'=>$allow )); |
|
| 123 | + if ($mod_id != '') |
|
| 124 | + $this->set_relationship('roles_modules', array('module_id'=>$mod_id, 'role_id'=>$role_id, 'allow'=>$allow)); |
|
| 125 | 125 | } |
| 126 | 126 | } |
| 127 | 127 | |
@@ -133,10 +133,10 @@ discard block |
||
| 133 | 133 | |
| 134 | 134 | function set_user_relationship($role_id, &$user_ids) |
| 135 | 135 | { |
| 136 | - foreach($user_ids as $user_id) |
|
| 136 | + foreach ($user_ids as $user_id) |
|
| 137 | 137 | { |
| 138 | - if($user_id != '') |
|
| 139 | - $this->set_relationship('roles_users', array( 'user_id'=>$user_id, 'role_id'=>$role_id )); |
|
| 138 | + if ($user_id != '') |
|
| 139 | + $this->set_relationship('roles_users', array('user_id'=>$user_id, 'role_id'=>$role_id)); |
|
| 140 | 140 | } |
| 141 | 141 | } |
| 142 | 142 | |
@@ -157,16 +157,16 @@ discard block |
||
| 157 | 157 | |
| 158 | 158 | $result = $this->db->query($sql); |
| 159 | 159 | |
| 160 | - while($row = $this->db->fetchByAssoc($result)) |
|
| 160 | + while ($row = $this->db->fetchByAssoc($result)) |
|
| 161 | 161 | { |
| 162 | 162 | $role_id = $row["role_id"]; |
| 163 | 163 | $sql = "SELECT module_id FROM roles_modules WHERE role_id='$role_id' AND allow='1'"; |
| 164 | 164 | $res = $this->db->query($sql); |
| 165 | 165 | |
| 166 | - while($col = $this->db->fetchByAssoc($res)) |
|
| 166 | + while ($col = $this->db->fetchByAssoc($res)) |
|
| 167 | 167 | { |
| 168 | 168 | $key = $col['module_id']; |
| 169 | - if(!(array_key_exists($key, $userArray))) |
|
| 169 | + if (!(array_key_exists($key, $userArray))) |
|
| 170 | 170 | { |
| 171 | 171 | $userArray[$key] = $app_list_strings['moduleList'][$key]; |
| 172 | 172 | } |
@@ -182,9 +182,9 @@ discard block |
||
| 182 | 182 | |
| 183 | 183 | $returnArray = array(); |
| 184 | 184 | |
| 185 | - foreach($moduleList as $key=>$val) |
|
| 185 | + foreach ($moduleList as $key=>$val) |
|
| 186 | 186 | { |
| 187 | - if(array_key_exists($val, $allowed)) |
|
| 187 | + if (array_key_exists($val, $allowed)) |
|
| 188 | 188 | continue; |
| 189 | 189 | $returnArray[$val] = $val; |
| 190 | 190 | } |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | |
| 207 | 207 | function check_user_role_count($user_id) |
| 208 | 208 | { |
| 209 | - $query = "SELECT count(*) AS num FROM roles_users WHERE "; |
|
| 209 | + $query = "SELECT count(*) AS num FROM roles_users WHERE "; |
|
| 210 | 210 | $query .= "user_id='$user_id' AND deleted=0"; |
| 211 | 211 | $result = $this->db->query($query); |
| 212 | 212 | |
@@ -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. |
@@ -83,8 +85,7 @@ discard block |
||
| 83 | 85 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 84 | 86 | if(isset($GLOBALS['log'])) { |
| 85 | 87 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 86 | - } |
|
| 87 | - else { |
|
| 88 | + } else { |
|
| 88 | 89 | trigger_error($deprecatedMessage, E_USER_DEPRECATED); |
| 89 | 90 | } |
| 90 | 91 | self::__construct(); |
@@ -120,8 +121,9 @@ discard block |
||
| 120 | 121 | { |
| 121 | 122 | foreach($mod_ids as $mod_id) |
| 122 | 123 | { |
| 123 | - if($mod_id != '') |
|
| 124 | - $this->set_relationship('roles_modules', array( 'module_id'=>$mod_id, 'role_id'=>$role_id, 'allow'=>$allow )); |
|
| 124 | + if($mod_id != '') { |
|
| 125 | + $this->set_relationship('roles_modules', array( 'module_id'=>$mod_id, 'role_id'=>$role_id, 'allow'=>$allow )); |
|
| 126 | + } |
|
| 125 | 127 | } |
| 126 | 128 | } |
| 127 | 129 | |
@@ -135,8 +137,9 @@ discard block |
||
| 135 | 137 | { |
| 136 | 138 | foreach($user_ids as $user_id) |
| 137 | 139 | { |
| 138 | - if($user_id != '') |
|
| 139 | - $this->set_relationship('roles_users', array( 'user_id'=>$user_id, 'role_id'=>$role_id )); |
|
| 140 | + if($user_id != '') { |
|
| 141 | + $this->set_relationship('roles_users', array( 'user_id'=>$user_id, 'role_id'=>$role_id )); |
|
| 142 | + } |
|
| 140 | 143 | } |
| 141 | 144 | } |
| 142 | 145 | |
@@ -184,8 +187,9 @@ discard block |
||
| 184 | 187 | |
| 185 | 188 | foreach($moduleList as $key=>$val) |
| 186 | 189 | { |
| 187 | - if(array_key_exists($val, $allowed)) |
|
| 188 | - continue; |
|
| 190 | + if(array_key_exists($val, $allowed)) { |
|
| 191 | + continue; |
|
| 192 | + } |
|
| 189 | 193 | $returnArray[$val] = $val; |
| 190 | 194 | } |
| 191 | 195 | |
@@ -5,7 +5,7 @@ discard block |
||
| 5 | 5 | |
| 6 | 6 | class LeadsListViewSmarty extends ListViewSmarty { |
| 7 | 7 | |
| 8 | - function __construct(){ |
|
| 8 | + function __construct() { |
|
| 9 | 9 | |
| 10 | 10 | parent::__construct(); |
| 11 | 11 | $this->targetList = true; |
@@ -15,9 +15,9 @@ discard block |
||
| 15 | 15 | /** |
| 16 | 16 | * @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 |
| 17 | 17 | */ |
| 18 | - function LeadsListViewSmarty(){ |
|
| 18 | + function LeadsListViewSmarty() { |
|
| 19 | 19 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 20 | - if(isset($GLOBALS['log'])) { |
|
| 20 | + if (isset($GLOBALS['log'])) { |
|
| 21 | 21 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 22 | 22 | } |
| 23 | 23 | else { |
@@ -30,25 +30,25 @@ discard block |
||
| 30 | 30 | function process($file, $data, $htmlVar) { |
| 31 | 31 | parent::process($file, $data, $htmlVar); |
| 32 | 32 | |
| 33 | - if(!ACLController::checkAccess($this->seed->module_dir,'export',true) || !$this->export) { |
|
| 33 | + if (!ACLController::checkAccess($this->seed->module_dir, 'export', true) || !$this->export) { |
|
| 34 | 34 | $this->ss->assign('exportLink', $this->buildExportLink()); |
| 35 | 35 | } |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - function buildExportLink($id = 'export_link'){ |
|
| 38 | + function buildExportLink($id = 'export_link') { |
|
| 39 | 39 | global $app_strings; |
| 40 | 40 | global $sugar_config; |
| 41 | 41 | |
| 42 | 42 | $script = ""; |
| 43 | - if(ACLController::checkAccess($this->seed->module_dir,'export',true)) { |
|
| 44 | - if($this->export) { |
|
| 43 | + if (ACLController::checkAccess($this->seed->module_dir, 'export', true)) { |
|
| 44 | + if ($this->export) { |
|
| 45 | 45 | $script = parent::buildExportLink($id); |
| 46 | 46 | } |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - $script .= "<a href='javascript:void(0)' id='map_listview_top' " . |
|
| 50 | - " onclick=\"return sListView.send_form(true, 'jjwg_Maps', " . |
|
| 51 | - "'index.php?entryPoint=jjwg_Maps&display_module={$_REQUEST['module']}', " . |
|
| 49 | + $script .= "<a href='javascript:void(0)' id='map_listview_top' ". |
|
| 50 | + " onclick=\"return sListView.send_form(true, 'jjwg_Maps', ". |
|
| 51 | + "'index.php?entryPoint=jjwg_Maps&display_module={$_REQUEST['module']}', ". |
|
| 52 | 52 | "'{$app_strings['LBL_LISTVIEW_NO_SELECTED']}')\">{$app_strings['LBL_MAP']}</a>"; |
| 53 | 53 | |
| 54 | 54 | return formLetter::LVSmarty().$script; |
@@ -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); |
@@ -59,97 +59,97 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | // Lead is used to store profile information for people who may become customers. |
| 61 | 61 | class Lead extends Person { |
| 62 | - var $field_name_map; |
|
| 63 | - // Stored fields |
|
| 64 | - var $id; |
|
| 65 | - var $date_entered; |
|
| 66 | - var $date_modified; |
|
| 67 | - var $modified_user_id; |
|
| 68 | - var $assigned_user_id; |
|
| 69 | - var $created_by; |
|
| 70 | - var $created_by_name; |
|
| 71 | - var $modified_by_name; |
|
| 72 | - var $description; |
|
| 73 | - var $salutation; |
|
| 74 | - var $first_name; |
|
| 75 | - var $last_name; |
|
| 76 | - var $title; |
|
| 77 | - var $department; |
|
| 78 | - var $reports_to_id; |
|
| 79 | - var $do_not_call; |
|
| 80 | - var $phone_home; |
|
| 81 | - var $phone_mobile; |
|
| 82 | - var $phone_work; |
|
| 83 | - var $phone_other; |
|
| 84 | - var $phone_fax; |
|
| 85 | - var $refered_by; |
|
| 86 | - var $email1; |
|
| 87 | - var $email2; |
|
| 88 | - var $primary_address_street; |
|
| 89 | - var $primary_address_city; |
|
| 90 | - var $primary_address_state; |
|
| 91 | - var $primary_address_postalcode; |
|
| 92 | - var $primary_address_country; |
|
| 93 | - var $alt_address_street; |
|
| 94 | - var $alt_address_city; |
|
| 95 | - var $alt_address_state; |
|
| 96 | - var $alt_address_postalcode; |
|
| 97 | - var $alt_address_country; |
|
| 98 | - var $name; |
|
| 99 | - var $full_name; |
|
| 100 | - var $portal_name; |
|
| 101 | - var $portal_app; |
|
| 102 | - var $contact_id; |
|
| 103 | - var $contact_name; |
|
| 104 | - var $account_id; |
|
| 105 | - var $opportunity_id; |
|
| 106 | - var $opportunity_name; |
|
| 107 | - var $opportunity_amount; |
|
| 108 | - //used for vcard export only |
|
| 109 | - var $birthdate; |
|
| 110 | - var $status; |
|
| 111 | - var $status_description; |
|
| 112 | - |
|
| 113 | - var $lead_source; |
|
| 114 | - var $lead_source_description; |
|
| 115 | - // These are for related fields |
|
| 116 | - var $account_name; |
|
| 117 | - var $acc_name_from_accounts; |
|
| 118 | - var $account_site; |
|
| 119 | - var $account_description; |
|
| 120 | - var $case_role; |
|
| 121 | - var $case_rel_id; |
|
| 122 | - var $case_id; |
|
| 123 | - var $task_id; |
|
| 124 | - var $note_id; |
|
| 125 | - var $meeting_id; |
|
| 126 | - var $call_id; |
|
| 127 | - var $email_id; |
|
| 128 | - var $assigned_user_name; |
|
| 129 | - var $campaign_id; |
|
| 130 | - var $campaign_name; |
|
| 62 | + var $field_name_map; |
|
| 63 | + // Stored fields |
|
| 64 | + var $id; |
|
| 65 | + var $date_entered; |
|
| 66 | + var $date_modified; |
|
| 67 | + var $modified_user_id; |
|
| 68 | + var $assigned_user_id; |
|
| 69 | + var $created_by; |
|
| 70 | + var $created_by_name; |
|
| 71 | + var $modified_by_name; |
|
| 72 | + var $description; |
|
| 73 | + var $salutation; |
|
| 74 | + var $first_name; |
|
| 75 | + var $last_name; |
|
| 76 | + var $title; |
|
| 77 | + var $department; |
|
| 78 | + var $reports_to_id; |
|
| 79 | + var $do_not_call; |
|
| 80 | + var $phone_home; |
|
| 81 | + var $phone_mobile; |
|
| 82 | + var $phone_work; |
|
| 83 | + var $phone_other; |
|
| 84 | + var $phone_fax; |
|
| 85 | + var $refered_by; |
|
| 86 | + var $email1; |
|
| 87 | + var $email2; |
|
| 88 | + var $primary_address_street; |
|
| 89 | + var $primary_address_city; |
|
| 90 | + var $primary_address_state; |
|
| 91 | + var $primary_address_postalcode; |
|
| 92 | + var $primary_address_country; |
|
| 93 | + var $alt_address_street; |
|
| 94 | + var $alt_address_city; |
|
| 95 | + var $alt_address_state; |
|
| 96 | + var $alt_address_postalcode; |
|
| 97 | + var $alt_address_country; |
|
| 98 | + var $name; |
|
| 99 | + var $full_name; |
|
| 100 | + var $portal_name; |
|
| 101 | + var $portal_app; |
|
| 102 | + var $contact_id; |
|
| 103 | + var $contact_name; |
|
| 104 | + var $account_id; |
|
| 105 | + var $opportunity_id; |
|
| 106 | + var $opportunity_name; |
|
| 107 | + var $opportunity_amount; |
|
| 108 | + //used for vcard export only |
|
| 109 | + var $birthdate; |
|
| 110 | + var $status; |
|
| 111 | + var $status_description; |
|
| 112 | + |
|
| 113 | + var $lead_source; |
|
| 114 | + var $lead_source_description; |
|
| 115 | + // These are for related fields |
|
| 116 | + var $account_name; |
|
| 117 | + var $acc_name_from_accounts; |
|
| 118 | + var $account_site; |
|
| 119 | + var $account_description; |
|
| 120 | + var $case_role; |
|
| 121 | + var $case_rel_id; |
|
| 122 | + var $case_id; |
|
| 123 | + var $task_id; |
|
| 124 | + var $note_id; |
|
| 125 | + var $meeting_id; |
|
| 126 | + var $call_id; |
|
| 127 | + var $email_id; |
|
| 128 | + var $assigned_user_name; |
|
| 129 | + var $campaign_id; |
|
| 130 | + var $campaign_name; |
|
| 131 | 131 | var $alt_address_street_2; |
| 132 | 132 | var $alt_address_street_3; |
| 133 | 133 | var $primary_address_street_2; |
| 134 | 134 | var $primary_address_street_3; |
| 135 | 135 | |
| 136 | 136 | |
| 137 | - var $table_name = "leads"; |
|
| 138 | - var $object_name = "Lead"; |
|
| 139 | - var $object_names = "Leads"; |
|
| 140 | - var $module_dir = "Leads"; |
|
| 141 | - var $new_schema = true; |
|
| 142 | - var $emailAddress; |
|
| 137 | + var $table_name = "leads"; |
|
| 138 | + var $object_name = "Lead"; |
|
| 139 | + var $object_names = "Leads"; |
|
| 140 | + var $module_dir = "Leads"; |
|
| 141 | + var $new_schema = true; |
|
| 142 | + var $emailAddress; |
|
| 143 | 143 | |
| 144 | - var $importable = true; |
|
| 144 | + var $importable = true; |
|
| 145 | 145 | |
| 146 | - // This is used to retrieve related fields from form posts. |
|
| 147 | - var $additional_column_fields = Array('assigned_user_name', 'task_id', 'note_id', 'meeting_id', 'call_id', 'email_id'); |
|
| 148 | - var $relationship_fields = Array('email_id'=>'emails','call_id'=>'calls','meeting_id'=>'meetings','task_id'=>'tasks',); |
|
| 146 | + // This is used to retrieve related fields from form posts. |
|
| 147 | + var $additional_column_fields = Array('assigned_user_name', 'task_id', 'note_id', 'meeting_id', 'call_id', 'email_id'); |
|
| 148 | + var $relationship_fields = Array('email_id'=>'emails','call_id'=>'calls','meeting_id'=>'meetings','task_id'=>'tasks',); |
|
| 149 | 149 | |
| 150 | - public function __construct() { |
|
| 151 | - parent::__construct(); |
|
| 152 | - } |
|
| 150 | + public function __construct() { |
|
| 151 | + parent::__construct(); |
|
| 152 | + } |
|
| 153 | 153 | |
| 154 | 154 | /** |
| 155 | 155 | * @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 |
@@ -166,150 +166,150 @@ discard block |
||
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | |
| 169 | - function get_account() |
|
| 170 | - { |
|
| 171 | - if(isset($this->account_id) && !empty($this->account_id)){ |
|
| 172 | - $query = "SELECT name , assigned_user_id account_name_owner FROM accounts WHERE id='{$this->account_id}'"; |
|
| 173 | - |
|
| 174 | - //requireSingleResult has beeen deprecated. |
|
| 175 | - //$result = $this->db->requireSingleResult($query); |
|
| 176 | - $result = $this->db->limitQuery($query,0,1,true, "Want only a single row"); |
|
| 177 | - |
|
| 178 | - if(!empty($result)){ |
|
| 179 | - $row = $this->db->fetchByAssoc($result); |
|
| 180 | - $this->account_name = $row['name']; |
|
| 181 | - $this->account_name_owner = $row['account_name_owner']; |
|
| 182 | - $this->account_name_mod = 'Accounts'; |
|
| 183 | - } |
|
| 184 | - |
|
| 185 | - }} |
|
| 186 | - function get_opportunity() |
|
| 187 | - { |
|
| 188 | - if(isset($this->opportunity_id) && !empty($this->opportunity_id)){ |
|
| 189 | - $query = "SELECT name, assigned_user_id opportunity_name_owner FROM opportunities WHERE id='{$this->opportunity_id}'"; |
|
| 190 | - |
|
| 191 | - //requireSingleResult has beeen deprecated. |
|
| 192 | - //$result = $this->db->requireSingleResult($query); |
|
| 193 | - $result = $this->db->limitQuery($query,0,1,true, "Want only a single row"); |
|
| 194 | - |
|
| 195 | - if(!empty($result)){ |
|
| 196 | - $row = $this->db->fetchByAssoc($result); |
|
| 197 | - $this->opportunity_name = $row['name']; |
|
| 198 | - $this->opportunity_name_owner = $row['opportunity_name_owner']; |
|
| 199 | - $this->opportunity_name_mod = 'Opportunities'; |
|
| 200 | - } |
|
| 201 | - |
|
| 202 | - }} |
|
| 203 | - function get_contact() |
|
| 204 | - { |
|
| 205 | - global $locale; |
|
| 206 | - if(isset($this->contact_id) && !empty($this->contact_id)){ |
|
| 207 | - $query = "SELECT first_name, last_name, assigned_user_id contact_name_owner FROM contacts WHERE id='{$this->contact_id}'"; |
|
| 208 | - |
|
| 209 | - //requireSingleResult has beeen deprecated. |
|
| 210 | - //$result = $this->db->requireSingleResult($query); |
|
| 211 | - $result = $this->db->limitQuery($query,0,1,true, "Want only a single row"); |
|
| 212 | - if(!empty($result)){ |
|
| 213 | - $row= $this->db->fetchByAssoc($result); |
|
| 214 | - $this->contact_name = $locale->getLocaleFormattedName($row['first_name'], $row['last_name']); |
|
| 215 | - $this->contact_name_owner = $row['contact_name_owner']; |
|
| 216 | - $this->contact_name_mod = 'Contacts'; |
|
| 217 | - } |
|
| 218 | - |
|
| 219 | - }} |
|
| 220 | - |
|
| 221 | - function create_list_query($order_by, $where, $show_deleted=0) |
|
| 222 | - { |
|
| 169 | + function get_account() |
|
| 170 | + { |
|
| 171 | + if(isset($this->account_id) && !empty($this->account_id)){ |
|
| 172 | + $query = "SELECT name , assigned_user_id account_name_owner FROM accounts WHERE id='{$this->account_id}'"; |
|
| 173 | + |
|
| 174 | + //requireSingleResult has beeen deprecated. |
|
| 175 | + //$result = $this->db->requireSingleResult($query); |
|
| 176 | + $result = $this->db->limitQuery($query,0,1,true, "Want only a single row"); |
|
| 177 | + |
|
| 178 | + if(!empty($result)){ |
|
| 179 | + $row = $this->db->fetchByAssoc($result); |
|
| 180 | + $this->account_name = $row['name']; |
|
| 181 | + $this->account_name_owner = $row['account_name_owner']; |
|
| 182 | + $this->account_name_mod = 'Accounts'; |
|
| 183 | + } |
|
| 184 | + |
|
| 185 | + }} |
|
| 186 | + function get_opportunity() |
|
| 187 | + { |
|
| 188 | + if(isset($this->opportunity_id) && !empty($this->opportunity_id)){ |
|
| 189 | + $query = "SELECT name, assigned_user_id opportunity_name_owner FROM opportunities WHERE id='{$this->opportunity_id}'"; |
|
| 190 | + |
|
| 191 | + //requireSingleResult has beeen deprecated. |
|
| 192 | + //$result = $this->db->requireSingleResult($query); |
|
| 193 | + $result = $this->db->limitQuery($query,0,1,true, "Want only a single row"); |
|
| 194 | + |
|
| 195 | + if(!empty($result)){ |
|
| 196 | + $row = $this->db->fetchByAssoc($result); |
|
| 197 | + $this->opportunity_name = $row['name']; |
|
| 198 | + $this->opportunity_name_owner = $row['opportunity_name_owner']; |
|
| 199 | + $this->opportunity_name_mod = 'Opportunities'; |
|
| 200 | + } |
|
| 201 | + |
|
| 202 | + }} |
|
| 203 | + function get_contact() |
|
| 204 | + { |
|
| 205 | + global $locale; |
|
| 206 | + if(isset($this->contact_id) && !empty($this->contact_id)){ |
|
| 207 | + $query = "SELECT first_name, last_name, assigned_user_id contact_name_owner FROM contacts WHERE id='{$this->contact_id}'"; |
|
| 208 | + |
|
| 209 | + //requireSingleResult has beeen deprecated. |
|
| 210 | + //$result = $this->db->requireSingleResult($query); |
|
| 211 | + $result = $this->db->limitQuery($query,0,1,true, "Want only a single row"); |
|
| 212 | + if(!empty($result)){ |
|
| 213 | + $row= $this->db->fetchByAssoc($result); |
|
| 214 | + $this->contact_name = $locale->getLocaleFormattedName($row['first_name'], $row['last_name']); |
|
| 215 | + $this->contact_name_owner = $row['contact_name_owner']; |
|
| 216 | + $this->contact_name_mod = 'Contacts'; |
|
| 217 | + } |
|
| 218 | + |
|
| 219 | + }} |
|
| 220 | + |
|
| 221 | + function create_list_query($order_by, $where, $show_deleted=0) |
|
| 222 | + { |
|
| 223 | 223 | $custom_join = $this->getCustomJoin(); |
| 224 | 224 | $query = "SELECT "; |
| 225 | 225 | |
| 226 | 226 | |
| 227 | - $query .= "$this->table_name.*, users.user_name assigned_user_name"; |
|
| 227 | + $query .= "$this->table_name.*, users.user_name assigned_user_name"; |
|
| 228 | 228 | $query .= $custom_join['select']; |
| 229 | 229 | $query .= " FROM leads "; |
| 230 | 230 | |
| 231 | - $query .= " LEFT JOIN users |
|
| 231 | + $query .= " LEFT JOIN users |
|
| 232 | 232 | ON leads.assigned_user_id=users.id "; |
| 233 | - $query .= "LEFT JOIN email_addr_bean_rel eabl ON eabl.bean_id = leads.id AND eabl.bean_module = 'Leads' and eabl.primary_address = 1 and eabl.deleted=0 "; |
|
| 234 | - $query .= "LEFT JOIN email_addresses ea ON (ea.id = eabl.email_address_id) "; |
|
| 233 | + $query .= "LEFT JOIN email_addr_bean_rel eabl ON eabl.bean_id = leads.id AND eabl.bean_module = 'Leads' and eabl.primary_address = 1 and eabl.deleted=0 "; |
|
| 234 | + $query .= "LEFT JOIN email_addresses ea ON (ea.id = eabl.email_address_id) "; |
|
| 235 | 235 | $query .= $custom_join['join']; |
| 236 | - $where_auto = '1=1'; |
|
| 237 | - if($show_deleted == 0){ |
|
| 238 | - $where_auto = " leads.deleted=0 "; |
|
| 239 | - }else if($show_deleted == 1){ |
|
| 240 | - $where_auto = " leads.deleted=1 "; |
|
| 241 | - } |
|
| 242 | - |
|
| 243 | - if($where != "") |
|
| 244 | - $query .= "where ($where) AND ".$where_auto; |
|
| 245 | - else |
|
| 246 | - $query .= "where ".$where_auto; //."and (leads.converted='0')"; |
|
| 247 | - |
|
| 248 | - if(!empty($order_by)) |
|
| 249 | - $query .= " ORDER BY $order_by"; |
|
| 250 | - |
|
| 251 | - return $query; |
|
| 252 | - } |
|
| 253 | - |
|
| 254 | - function create_new_list_query($order_by, $where,$filter=array(),$params=array(), $show_deleted = 0,$join_type='', $return_array = false,$parentbean=null, $singleSelect = false, $ifListForExport = false){ |
|
| 255 | - |
|
| 256 | - $ret_array = parent::create_new_list_query($order_by, $where, $filter, $params, $show_deleted, $join_type, true, $parentbean, $singleSelect, $ifListForExport); |
|
| 257 | - if(strpos($ret_array['select'],"leads.account_name") == false && strpos($ret_array['select'],"leads.*") == false) |
|
| 258 | - $ret_array['select'] .= " ,leads.account_name"; |
|
| 259 | - if ( !$return_array ) |
|
| 236 | + $where_auto = '1=1'; |
|
| 237 | + if($show_deleted == 0){ |
|
| 238 | + $where_auto = " leads.deleted=0 "; |
|
| 239 | + }else if($show_deleted == 1){ |
|
| 240 | + $where_auto = " leads.deleted=1 "; |
|
| 241 | + } |
|
| 242 | + |
|
| 243 | + if($where != "") |
|
| 244 | + $query .= "where ($where) AND ".$where_auto; |
|
| 245 | + else |
|
| 246 | + $query .= "where ".$where_auto; //."and (leads.converted='0')"; |
|
| 247 | + |
|
| 248 | + if(!empty($order_by)) |
|
| 249 | + $query .= " ORDER BY $order_by"; |
|
| 250 | + |
|
| 251 | + return $query; |
|
| 252 | + } |
|
| 253 | + |
|
| 254 | + function create_new_list_query($order_by, $where,$filter=array(),$params=array(), $show_deleted = 0,$join_type='', $return_array = false,$parentbean=null, $singleSelect = false, $ifListForExport = false){ |
|
| 255 | + |
|
| 256 | + $ret_array = parent::create_new_list_query($order_by, $where, $filter, $params, $show_deleted, $join_type, true, $parentbean, $singleSelect, $ifListForExport); |
|
| 257 | + if(strpos($ret_array['select'],"leads.account_name") == false && strpos($ret_array['select'],"leads.*") == false) |
|
| 258 | + $ret_array['select'] .= " ,leads.account_name"; |
|
| 259 | + if ( !$return_array ) |
|
| 260 | 260 | return $ret_array['select'] . $ret_array['from'] . $ret_array['where']. $ret_array['order_by']; |
| 261 | 261 | return $ret_array; |
| 262 | - } |
|
| 262 | + } |
|
| 263 | 263 | |
| 264 | 264 | function converted_lead($leadid, $contactid, $accountid, $opportunityid){ |
| 265 | - $query = "UPDATE leads set converted='1', contact_id=$contactid, account_id=$accountid, opportunity_id=$opportunityid where id=$leadid and deleted=0"; |
|
| 266 | - $this->db->query($query,true,"Error converting lead: "); |
|
| 267 | - |
|
| 268 | - //we must move the status out here in order to be able to capture workflow conditions |
|
| 269 | - $leadid = str_replace("'","", $leadid); |
|
| 270 | - $lead = new Lead(); |
|
| 271 | - $lead->retrieve($leadid); |
|
| 272 | - $lead->status='Converted'; |
|
| 273 | - $lead->save(); |
|
| 265 | + $query = "UPDATE leads set converted='1', contact_id=$contactid, account_id=$accountid, opportunity_id=$opportunityid where id=$leadid and deleted=0"; |
|
| 266 | + $this->db->query($query,true,"Error converting lead: "); |
|
| 267 | + |
|
| 268 | + //we must move the status out here in order to be able to capture workflow conditions |
|
| 269 | + $leadid = str_replace("'","", $leadid); |
|
| 270 | + $lead = new Lead(); |
|
| 271 | + $lead->retrieve($leadid); |
|
| 272 | + $lead->status='Converted'; |
|
| 273 | + $lead->save(); |
|
| 274 | 274 | } |
| 275 | 275 | |
| 276 | - function fill_in_additional_list_fields() |
|
| 277 | - { |
|
| 278 | - parent::fill_in_additional_list_fields(); |
|
| 279 | - $this->_create_proper_name_field(); |
|
| 280 | - $this->get_account(); |
|
| 281 | - |
|
| 282 | - } |
|
| 283 | - |
|
| 284 | - function fill_in_additional_detail_fields() |
|
| 285 | - { |
|
| 286 | - //Fill in the assigned_user_name |
|
| 287 | - //if(!empty($this->status)) |
|
| 288 | - //$this->status = translate('lead_status_dom', '', $this->status); |
|
| 289 | - parent::fill_in_additional_detail_fields(); |
|
| 290 | - $this->_create_proper_name_field(); |
|
| 291 | - $this->get_contact(); |
|
| 292 | - $this->get_opportunity(); |
|
| 293 | - $this->get_account(); |
|
| 276 | + function fill_in_additional_list_fields() |
|
| 277 | + { |
|
| 278 | + parent::fill_in_additional_list_fields(); |
|
| 279 | + $this->_create_proper_name_field(); |
|
| 280 | + $this->get_account(); |
|
| 294 | 281 | |
| 295 | - if(!empty($this->campaign_id)){ |
|
| 282 | + } |
|
| 296 | 283 | |
| 297 | - $camp = new Campaign(); |
|
| 298 | - $where = "campaigns.id='$this->campaign_id'"; |
|
| 299 | - $campaign_list = $camp->get_full_list("campaigns.name", $where, true); |
|
| 300 | - if(!empty($campaign_list)) |
|
| 301 | - $this->campaign_name = $campaign_list[0]->name; |
|
| 302 | - } |
|
| 303 | - } |
|
| 284 | + function fill_in_additional_detail_fields() |
|
| 285 | + { |
|
| 286 | + //Fill in the assigned_user_name |
|
| 287 | + //if(!empty($this->status)) |
|
| 288 | + //$this->status = translate('lead_status_dom', '', $this->status); |
|
| 289 | + parent::fill_in_additional_detail_fields(); |
|
| 290 | + $this->_create_proper_name_field(); |
|
| 291 | + $this->get_contact(); |
|
| 292 | + $this->get_opportunity(); |
|
| 293 | + $this->get_account(); |
|
| 294 | + |
|
| 295 | + if(!empty($this->campaign_id)){ |
|
| 296 | + |
|
| 297 | + $camp = new Campaign(); |
|
| 298 | + $where = "campaigns.id='$this->campaign_id'"; |
|
| 299 | + $campaign_list = $camp->get_full_list("campaigns.name", $where, true); |
|
| 300 | + if(!empty($campaign_list)) |
|
| 301 | + $this->campaign_name = $campaign_list[0]->name; |
|
| 302 | + } |
|
| 303 | + } |
|
| 304 | 304 | |
| 305 | - function get_list_view_data(){ |
|
| 305 | + function get_list_view_data(){ |
|
| 306 | 306 | |
| 307 | - $temp_array = parent::get_list_view_data(); |
|
| 307 | + $temp_array = parent::get_list_view_data(); |
|
| 308 | 308 | |
| 309 | - $temp_array['ACC_NAME_FROM_ACCOUNTS'] = empty($temp_array['ACC_NAME_FROM_ACCOUNTS']) ? ($temp_array['ACCOUNT_NAME']) : ($temp_array['ACC_NAME_FROM_ACCOUNTS']); |
|
| 309 | + $temp_array['ACC_NAME_FROM_ACCOUNTS'] = empty($temp_array['ACC_NAME_FROM_ACCOUNTS']) ? ($temp_array['ACCOUNT_NAME']) : ($temp_array['ACC_NAME_FROM_ACCOUNTS']); |
|
| 310 | 310 | |
| 311 | - return $temp_array; |
|
| 312 | - } |
|
| 311 | + return $temp_array; |
|
| 312 | + } |
|
| 313 | 313 | |
| 314 | 314 | /** |
| 315 | 315 | * Returns an array of fields that are of type link. |
@@ -318,253 +318,253 @@ discard block |
||
| 318 | 318 | * |
| 319 | 319 | * Internal function, do not override. |
| 320 | 320 | */ |
| 321 | - //fix for bug 27339 Shine |
|
| 321 | + //fix for bug 27339 Shine |
|
| 322 | 322 | function get_linked_fields() |
| 323 | 323 | { |
| 324 | - $linked_fields=array(); |
|
| 325 | - $fieldDefs = $this->getFieldDefinitions(); |
|
| 326 | - |
|
| 327 | - //find all definitions of type link. |
|
| 328 | - if (!empty($fieldDefs)) |
|
| 329 | - { |
|
| 330 | - foreach ($fieldDefs as $name=>$properties) |
|
| 331 | - { |
|
| 332 | - if ($name == 'oldmeetings' || $name == 'oldcalls') { continue; } |
|
| 333 | - elseif (array_search('link',$properties) === 'type') |
|
| 334 | - { |
|
| 335 | - $linked_fields[$name]=$properties; |
|
| 336 | - } |
|
| 337 | - } |
|
| 338 | - } |
|
| 339 | - return $linked_fields; |
|
| 324 | + $linked_fields=array(); |
|
| 325 | + $fieldDefs = $this->getFieldDefinitions(); |
|
| 326 | + |
|
| 327 | + //find all definitions of type link. |
|
| 328 | + if (!empty($fieldDefs)) |
|
| 329 | + { |
|
| 330 | + foreach ($fieldDefs as $name=>$properties) |
|
| 331 | + { |
|
| 332 | + if ($name == 'oldmeetings' || $name == 'oldcalls') { continue; } |
|
| 333 | + elseif (array_search('link',$properties) === 'type') |
|
| 334 | + { |
|
| 335 | + $linked_fields[$name]=$properties; |
|
| 336 | + } |
|
| 337 | + } |
|
| 338 | + } |
|
| 339 | + return $linked_fields; |
|
| 340 | 340 | } |
| 341 | 341 | |
| 342 | - /** |
|
| 342 | + /** |
|
| 343 | 343 | builds a generic search based on the query string using or |
| 344 | 344 | do not include any $this-> because this is called on without having the class instantiated |
| 345 | - */ |
|
| 346 | - function build_generic_where_clause ($the_query_string) { |
|
| 347 | - $where_clauses = Array(); |
|
| 348 | - $the_query_string = $GLOBALS['db']->quote($the_query_string); |
|
| 349 | - |
|
| 350 | - array_push($where_clauses, "leads.last_name like '$the_query_string%'"); |
|
| 351 | - array_push($where_clauses, "leads.account_name like '$the_query_string%'"); |
|
| 352 | - array_push($where_clauses, "leads.first_name like '$the_query_string%'"); |
|
| 353 | - array_push($where_clauses, "ea.email_address like '$the_query_string%'"); |
|
| 354 | - |
|
| 355 | - if (is_numeric($the_query_string)) { |
|
| 356 | - array_push($where_clauses, "leads.phone_home like '%$the_query_string%'"); |
|
| 357 | - array_push($where_clauses, "leads.phone_mobile like '%$the_query_string%'"); |
|
| 358 | - array_push($where_clauses, "leads.phone_work like '%$the_query_string%'"); |
|
| 359 | - array_push($where_clauses, "leads.phone_other like '%$the_query_string%'"); |
|
| 360 | - array_push($where_clauses, "leads.phone_fax like '%$the_query_string%'"); |
|
| 361 | - |
|
| 362 | - } |
|
| 363 | - |
|
| 364 | - $the_where = ""; |
|
| 365 | - foreach($where_clauses as $clause) |
|
| 366 | - { |
|
| 367 | - if($the_where != "") $the_where .= " or "; |
|
| 368 | - $the_where .= $clause; |
|
| 369 | - } |
|
| 370 | - |
|
| 371 | - |
|
| 372 | - return $the_where; |
|
| 373 | - } |
|
| 374 | - |
|
| 375 | - function set_notification_body($xtpl, $lead) |
|
| 376 | - { |
|
| 377 | - global $app_list_strings; |
|
| 345 | + */ |
|
| 346 | + function build_generic_where_clause ($the_query_string) { |
|
| 347 | + $where_clauses = Array(); |
|
| 348 | + $the_query_string = $GLOBALS['db']->quote($the_query_string); |
|
| 349 | + |
|
| 350 | + array_push($where_clauses, "leads.last_name like '$the_query_string%'"); |
|
| 351 | + array_push($where_clauses, "leads.account_name like '$the_query_string%'"); |
|
| 352 | + array_push($where_clauses, "leads.first_name like '$the_query_string%'"); |
|
| 353 | + array_push($where_clauses, "ea.email_address like '$the_query_string%'"); |
|
| 354 | + |
|
| 355 | + if (is_numeric($the_query_string)) { |
|
| 356 | + array_push($where_clauses, "leads.phone_home like '%$the_query_string%'"); |
|
| 357 | + array_push($where_clauses, "leads.phone_mobile like '%$the_query_string%'"); |
|
| 358 | + array_push($where_clauses, "leads.phone_work like '%$the_query_string%'"); |
|
| 359 | + array_push($where_clauses, "leads.phone_other like '%$the_query_string%'"); |
|
| 360 | + array_push($where_clauses, "leads.phone_fax like '%$the_query_string%'"); |
|
| 361 | + |
|
| 362 | + } |
|
| 363 | + |
|
| 364 | + $the_where = ""; |
|
| 365 | + foreach($where_clauses as $clause) |
|
| 366 | + { |
|
| 367 | + if($the_where != "") $the_where .= " or "; |
|
| 368 | + $the_where .= $clause; |
|
| 369 | + } |
|
| 370 | + |
|
| 371 | + |
|
| 372 | + return $the_where; |
|
| 373 | + } |
|
| 374 | + |
|
| 375 | + function set_notification_body($xtpl, $lead) |
|
| 376 | + { |
|
| 377 | + global $app_list_strings; |
|
| 378 | 378 | global $locale; |
| 379 | 379 | |
| 380 | - $xtpl->assign("LEAD_NAME", $locale->getLocaleFormattedName($lead->first_name, $lead->last_name, $lead->salutation)); |
|
| 381 | - $xtpl->assign("LEAD_SOURCE", (isset($lead->lead_source) ? $app_list_strings['lead_source_dom'][$lead->lead_source] : "")); |
|
| 382 | - $xtpl->assign("LEAD_STATUS", (isset($lead->status)? $app_list_strings['lead_status_dom'][$lead->status]:"")); |
|
| 383 | - $xtpl->assign("LEAD_DESCRIPTION", $lead->description); |
|
| 384 | - |
|
| 385 | - return $xtpl; |
|
| 386 | - } |
|
| 387 | - |
|
| 388 | - function bean_implements($interface){ |
|
| 389 | - switch($interface){ |
|
| 390 | - case 'ACL':return true; |
|
| 391 | - } |
|
| 392 | - return false; |
|
| 393 | - } |
|
| 394 | - function listviewACLHelper(){ |
|
| 395 | - $array_assign = parent::listviewACLHelper(); |
|
| 396 | - $is_owner = false; |
|
| 397 | - $in_group = false; //SECURITY GROUPS |
|
| 398 | - if(!empty($this->account_name)){ |
|
| 399 | - |
|
| 400 | - if(!empty($this->account_name_owner)){ |
|
| 401 | - global $current_user; |
|
| 402 | - $is_owner = $current_user->id == $this->account_name_owner; |
|
| 403 | - } |
|
| 404 | - /* BEGIN - SECURITY GROUPS */ |
|
| 405 | - else { |
|
| 406 | - global $current_user; |
|
| 380 | + $xtpl->assign("LEAD_NAME", $locale->getLocaleFormattedName($lead->first_name, $lead->last_name, $lead->salutation)); |
|
| 381 | + $xtpl->assign("LEAD_SOURCE", (isset($lead->lead_source) ? $app_list_strings['lead_source_dom'][$lead->lead_source] : "")); |
|
| 382 | + $xtpl->assign("LEAD_STATUS", (isset($lead->status)? $app_list_strings['lead_status_dom'][$lead->status]:"")); |
|
| 383 | + $xtpl->assign("LEAD_DESCRIPTION", $lead->description); |
|
| 384 | + |
|
| 385 | + return $xtpl; |
|
| 386 | + } |
|
| 387 | + |
|
| 388 | + function bean_implements($interface){ |
|
| 389 | + switch($interface){ |
|
| 390 | + case 'ACL':return true; |
|
| 391 | + } |
|
| 392 | + return false; |
|
| 393 | + } |
|
| 394 | + function listviewACLHelper(){ |
|
| 395 | + $array_assign = parent::listviewACLHelper(); |
|
| 396 | + $is_owner = false; |
|
| 397 | + $in_group = false; //SECURITY GROUPS |
|
| 398 | + if(!empty($this->account_name)){ |
|
| 399 | + |
|
| 400 | + if(!empty($this->account_name_owner)){ |
|
| 401 | + global $current_user; |
|
| 402 | + $is_owner = $current_user->id == $this->account_name_owner; |
|
| 403 | + } |
|
| 404 | + /* BEGIN - SECURITY GROUPS */ |
|
| 405 | + else { |
|
| 406 | + global $current_user; |
|
| 407 | 407 | $parent_bean = BeanFactory::getBean('Accounts',$this->account_id); |
| 408 | 408 | if($parent_bean !== false) { |
| 409 | - $is_owner = $current_user->id == $parent_bean->assigned_user_id; |
|
| 409 | + $is_owner = $current_user->id == $parent_bean->assigned_user_id; |
|
| 410 | 410 | } |
| 411 | - } |
|
| 412 | - require_once("modules/SecurityGroups/SecurityGroup.php"); |
|
| 413 | - $in_group = SecurityGroup::groupHasAccess('Accounts', $this->account_id, 'view'); |
|
| 414 | - /* END - SECURITY GROUPS */ |
|
| 415 | - } |
|
| 416 | - /* BEGIN - SECURITY GROUPS */ |
|
| 417 | - /** |
|
| 411 | + } |
|
| 412 | + require_once("modules/SecurityGroups/SecurityGroup.php"); |
|
| 413 | + $in_group = SecurityGroup::groupHasAccess('Accounts', $this->account_id, 'view'); |
|
| 414 | + /* END - SECURITY GROUPS */ |
|
| 415 | + } |
|
| 416 | + /* BEGIN - SECURITY GROUPS */ |
|
| 417 | + /** |
|
| 418 | 418 | if( ACLController::checkAccess('Accounts', 'view', $is_owner)){ |
| 419 | - */ |
|
| 420 | - if( ACLController::checkAccess('Accounts', 'view', $is_owner, 'module', $in_group)){ |
|
| 421 | - /* END - SECURITY GROUPS */ |
|
| 422 | - $array_assign['ACCOUNT'] = 'a'; |
|
| 423 | - }else{ |
|
| 424 | - $array_assign['ACCOUNT'] = 'span'; |
|
| 425 | - } |
|
| 426 | - $is_owner = false; |
|
| 427 | - $in_group = false; //SECURITY GROUPS |
|
| 428 | - if(!empty($this->opportunity_name)){ |
|
| 429 | - |
|
| 430 | - if(!empty($this->opportunity_name_owner)){ |
|
| 431 | - global $current_user; |
|
| 432 | - $is_owner = $current_user->id == $this->opportunity_name_owner; |
|
| 433 | - } |
|
| 434 | - /* BEGIN - SECURITY GROUPS */ |
|
| 435 | - else { |
|
| 436 | - global $current_user; |
|
| 419 | + */ |
|
| 420 | + if( ACLController::checkAccess('Accounts', 'view', $is_owner, 'module', $in_group)){ |
|
| 421 | + /* END - SECURITY GROUPS */ |
|
| 422 | + $array_assign['ACCOUNT'] = 'a'; |
|
| 423 | + }else{ |
|
| 424 | + $array_assign['ACCOUNT'] = 'span'; |
|
| 425 | + } |
|
| 426 | + $is_owner = false; |
|
| 427 | + $in_group = false; //SECURITY GROUPS |
|
| 428 | + if(!empty($this->opportunity_name)){ |
|
| 429 | + |
|
| 430 | + if(!empty($this->opportunity_name_owner)){ |
|
| 431 | + global $current_user; |
|
| 432 | + $is_owner = $current_user->id == $this->opportunity_name_owner; |
|
| 433 | + } |
|
| 434 | + /* BEGIN - SECURITY GROUPS */ |
|
| 435 | + else { |
|
| 436 | + global $current_user; |
|
| 437 | 437 | $parent_bean = BeanFactory::getBean('Opportunities',$this->opportunity_id); |
| 438 | 438 | if($parent_bean !== false) { |
| 439 | - $is_owner = $current_user->id == $parent_bean->assigned_user_id; |
|
| 439 | + $is_owner = $current_user->id == $parent_bean->assigned_user_id; |
|
| 440 | 440 | } |
| 441 | - } |
|
| 442 | - require_once("modules/SecurityGroups/SecurityGroup.php"); |
|
| 443 | - $in_group = SecurityGroup::groupHasAccess('Opportunities', $this->opportunity_id, 'view'); |
|
| 444 | - /* END - SECURITY GROUPS */ |
|
| 445 | - } |
|
| 446 | - /* BEGIN - SECURITY GROUPS */ |
|
| 447 | - /** |
|
| 441 | + } |
|
| 442 | + require_once("modules/SecurityGroups/SecurityGroup.php"); |
|
| 443 | + $in_group = SecurityGroup::groupHasAccess('Opportunities', $this->opportunity_id, 'view'); |
|
| 444 | + /* END - SECURITY GROUPS */ |
|
| 445 | + } |
|
| 446 | + /* BEGIN - SECURITY GROUPS */ |
|
| 447 | + /** |
|
| 448 | 448 | if( ACLController::checkAccess('Opportunities', 'view', $is_owner)){ |
| 449 | - */ |
|
| 450 | - if( ACLController::checkAccess('Opportunities', 'view', $is_owner, 'module', $in_group)){ |
|
| 451 | - /* END - SECURITY GROUPS */ |
|
| 452 | - $array_assign['OPPORTUNITY'] = 'a'; |
|
| 453 | - }else{ |
|
| 454 | - $array_assign['OPPORTUNITY'] = 'span'; |
|
| 455 | - } |
|
| 456 | - |
|
| 457 | - |
|
| 458 | - $is_owner = false; |
|
| 459 | - $in_group = false; //SECURITY GROUPS |
|
| 460 | - if(!empty($this->contact_name)){ |
|
| 461 | - |
|
| 462 | - if(!empty($this->contact_name_owner)){ |
|
| 463 | - global $current_user; |
|
| 464 | - $is_owner = $current_user->id == $this->contact_name_owner; |
|
| 465 | - } |
|
| 466 | - /* BEGIN - SECURITY GROUPS */ |
|
| 467 | - //contact_name_owner not being set for whatever reason so we need to figure this out |
|
| 468 | - else { |
|
| 469 | - global $current_user; |
|
| 449 | + */ |
|
| 450 | + if( ACLController::checkAccess('Opportunities', 'view', $is_owner, 'module', $in_group)){ |
|
| 451 | + /* END - SECURITY GROUPS */ |
|
| 452 | + $array_assign['OPPORTUNITY'] = 'a'; |
|
| 453 | + }else{ |
|
| 454 | + $array_assign['OPPORTUNITY'] = 'span'; |
|
| 455 | + } |
|
| 456 | + |
|
| 457 | + |
|
| 458 | + $is_owner = false; |
|
| 459 | + $in_group = false; //SECURITY GROUPS |
|
| 460 | + if(!empty($this->contact_name)){ |
|
| 461 | + |
|
| 462 | + if(!empty($this->contact_name_owner)){ |
|
| 463 | + global $current_user; |
|
| 464 | + $is_owner = $current_user->id == $this->contact_name_owner; |
|
| 465 | + } |
|
| 466 | + /* BEGIN - SECURITY GROUPS */ |
|
| 467 | + //contact_name_owner not being set for whatever reason so we need to figure this out |
|
| 468 | + else { |
|
| 469 | + global $current_user; |
|
| 470 | 470 | $parent_bean = BeanFactory::getBean('Contacts',$this->contact_id); |
| 471 | 471 | if($parent_bean !== false) { |
| 472 | - $is_owner = $current_user->id == $parent_bean->assigned_user_id; |
|
| 472 | + $is_owner = $current_user->id == $parent_bean->assigned_user_id; |
|
| 473 | 473 | } |
| 474 | - } |
|
| 475 | - require_once("modules/SecurityGroups/SecurityGroup.php"); |
|
| 476 | - $in_group = SecurityGroup::groupHasAccess('Contacts', $this->contact_id, 'view'); |
|
| 477 | - /* END - SECURITY GROUPS */ |
|
| 478 | - } |
|
| 479 | - /* BEGIN - SECURITY GROUPS */ |
|
| 480 | - /** |
|
| 474 | + } |
|
| 475 | + require_once("modules/SecurityGroups/SecurityGroup.php"); |
|
| 476 | + $in_group = SecurityGroup::groupHasAccess('Contacts', $this->contact_id, 'view'); |
|
| 477 | + /* END - SECURITY GROUPS */ |
|
| 478 | + } |
|
| 479 | + /* BEGIN - SECURITY GROUPS */ |
|
| 480 | + /** |
|
| 481 | 481 | if( ACLController::checkAccess('Contacts', 'view', $is_owner)){ |
| 482 | - */ |
|
| 483 | - if( ACLController::checkAccess('Contacts', 'view', $is_owner, 'module', $in_group)){ |
|
| 484 | - /* END - SECURITY GROUPS */ |
|
| 485 | - $array_assign['CONTACT'] = 'a'; |
|
| 486 | - }else{ |
|
| 487 | - $array_assign['CONTACT'] = 'span'; |
|
| 488 | - } |
|
| 489 | - |
|
| 490 | - return $array_assign; |
|
| 491 | - } |
|
| 482 | + */ |
|
| 483 | + if( ACLController::checkAccess('Contacts', 'view', $is_owner, 'module', $in_group)){ |
|
| 484 | + /* END - SECURITY GROUPS */ |
|
| 485 | + $array_assign['CONTACT'] = 'a'; |
|
| 486 | + }else{ |
|
| 487 | + $array_assign['CONTACT'] = 'span'; |
|
| 488 | + } |
|
| 489 | + |
|
| 490 | + return $array_assign; |
|
| 491 | + } |
|
| 492 | 492 | |
| 493 | 493 | //carrys forward custom lead fields to contacts, accounts, opportunities during Lead Conversion |
| 494 | - function convertCustomFieldsForm(&$form, &$tempBean, &$prefix) { |
|
| 495 | - |
|
| 496 | - global $mod_strings, $app_list_strings, $app_strings, $lbl_required_symbol; |
|
| 497 | - |
|
| 498 | - foreach($this->field_defs as $field => $value) { |
|
| 499 | - |
|
| 500 | - if(!empty($value['source']) && $value['source'] == 'custom_fields') { |
|
| 501 | - if( !empty($tempBean->field_defs[$field]) AND isset($tempBean->field_defs[$field]) ) { |
|
| 502 | - $form .= "<tr><td nowrap colspan='4' class='dataLabel'>".$mod_strings[$tempBean->field_defs[$field]['vname']].":"; |
|
| 503 | - |
|
| 504 | - if( !empty($tempBean->custom_fields->avail_fields[$field]['required']) AND ( ($tempBean->custom_fields->avail_fields[$field]['required']== 1) OR ($tempBean->custom_fields->avail_fields[$field]['required']== '1') OR ($tempBean->custom_fields->avail_fields[$field]['required']== 'true') OR ($tempBean->custom_fields->avail_fields[$field]['required']== true) ) ) { |
|
| 505 | - $form .= " <span class='required'>".$lbl_required_symbol."</span>"; |
|
| 506 | - } |
|
| 507 | - $form .= "</td></tr>"; |
|
| 508 | - $form .= "<tr><td nowrap colspan='4' class='dataField' nowrap>"; |
|
| 509 | - |
|
| 510 | - if(isset($value['isMultiSelect']) && $value['isMultiSelect'] == 1){ |
|
| 511 | - $this->$field = unencodeMultienum($this->$field); |
|
| 512 | - $multiple = "multiple"; |
|
| 513 | - $array = '[]'; |
|
| 514 | - } else { |
|
| 515 | - $multiple = null; |
|
| 516 | - $array = null; |
|
| 517 | - } |
|
| 518 | - |
|
| 519 | - if(!empty($value['options']) AND isset($value['options']) ) { |
|
| 520 | - $form .= "<select " . $multiple . " name='".$prefix.$field.$array."'>"; |
|
| 521 | - $form .= get_select_options_with_id($app_list_strings[$value['options']], $this->$field); |
|
| 522 | - $form .= "</select"; |
|
| 523 | - } elseif($value['type'] == 'bool' ) { |
|
| 524 | - if( ($this->$field == 1) OR ($this->$field == '1') ) { $checked = 'checked'; } else { $checked = ''; } |
|
| 525 | - $form .= "<input type='checkbox' name='".$prefix.$field."' id='".$prefix.$field."' value='1' ".$checked."/>"; |
|
| 526 | - } elseif($value['type'] == 'text' ) { |
|
| 527 | - $form .= "<textarea name='".$prefix.$field."' rows='6' cols='50'>".$this->$field."</textarea>"; |
|
| 528 | - } elseif($value['type'] == 'date' ) { |
|
| 529 | - $form .= "<input name='".$prefix.$field."' id='jscal_field".$field."' type='text' size='11' maxlength='10' value='".$this->$field."'> ".SugarThemeRegistry::current()->getImage("jscalendar", "id='jscal_trigger".$field."' align='absmiddle'", null, null, ".gif", $mod_strings['LBL_ENTERDATE'])."' <span class='dateFormat'>yyyy-mm-dd</span><script type='text/javascript'>Calendar.setup ({inputField : 'jscal_field".$field."', ifFormat : '%Y-%m-%d', showsTime : false, button : 'jscal_trigger".$field."', singleClick : true, step : 1, weekNumbers:false}); addToValidate('ConvertLead', '".$field."', 'date', false,'".$mod_strings[$tempBean->field_defs[$field]['vname']]."' );</script>"; |
|
| 530 | - } else { |
|
| 531 | - $form .= "<input name='".$prefix.$field."' type='text' value='".$this->$field."'>"; |
|
| 532 | - |
|
| 533 | - if($this->custom_fields->avail_fields[$field]['type'] == 'int') { |
|
| 534 | - $form .= "<script>addToValidate('ConvertLead', '".$prefix.$field."', 'int', false,'".$prefix.":".$mod_strings[$tempBean->field_defs[$field]['vname']]."' );</script>"; |
|
| 535 | - } |
|
| 536 | - elseif($this->custom_fields->avail_fields[$field]['type'] == 'float') { |
|
| 537 | - $form .= "<script>addToValidate('ConvertLead', '".$prefix.$field."', 'float', false,'".$prefix.":".$mod_strings[$tempBean->field_defs[$field]['vname']]."' );</script>"; |
|
| 538 | - } |
|
| 539 | - |
|
| 540 | - } |
|
| 541 | - |
|
| 542 | - if( !empty($tempBean->custom_fields->avail_fields[$field]['required']) AND ( ($tempBean->custom_fields->avail_fields[$field]['required']== 1) OR ($tempBean->custom_fields->avail_fields[$field]['required']== '1') OR ($tempBean->custom_fields->avail_fields[$field]['required']== 'true') OR ($tempBean->custom_fields->avail_fields[$field]['required']== true) ) ) { |
|
| 543 | - $form .= "<script>addToValidate('ConvertLead', '".$prefix.$field."', 'relate', true,'".$prefix.":".$mod_strings[$tempBean->field_defs[$field]['vname']]."' );</script>"; |
|
| 544 | - } |
|
| 545 | - |
|
| 546 | - $form .= "</td></tr>"; |
|
| 547 | - |
|
| 548 | - |
|
| 549 | - } |
|
| 550 | - } |
|
| 551 | - |
|
| 552 | - } |
|
| 553 | - |
|
| 554 | - return true; |
|
| 555 | - } |
|
| 556 | - |
|
| 557 | - function save($check_notify = false) { |
|
| 558 | - if(empty($this->status)) |
|
| 559 | - $this->status = 'New'; |
|
| 560 | - // call save first so that $this->id will be set |
|
| 561 | - $value = parent::save($check_notify); |
|
| 562 | - return $value; |
|
| 563 | - } |
|
| 564 | - function get_unlinked_email_query($type=array()) { |
|
| 565 | - |
|
| 566 | - return get_unlinked_email_query($type, $this); |
|
| 567 | - } |
|
| 494 | + function convertCustomFieldsForm(&$form, &$tempBean, &$prefix) { |
|
| 495 | + |
|
| 496 | + global $mod_strings, $app_list_strings, $app_strings, $lbl_required_symbol; |
|
| 497 | + |
|
| 498 | + foreach($this->field_defs as $field => $value) { |
|
| 499 | + |
|
| 500 | + if(!empty($value['source']) && $value['source'] == 'custom_fields') { |
|
| 501 | + if( !empty($tempBean->field_defs[$field]) AND isset($tempBean->field_defs[$field]) ) { |
|
| 502 | + $form .= "<tr><td nowrap colspan='4' class='dataLabel'>".$mod_strings[$tempBean->field_defs[$field]['vname']].":"; |
|
| 503 | + |
|
| 504 | + if( !empty($tempBean->custom_fields->avail_fields[$field]['required']) AND ( ($tempBean->custom_fields->avail_fields[$field]['required']== 1) OR ($tempBean->custom_fields->avail_fields[$field]['required']== '1') OR ($tempBean->custom_fields->avail_fields[$field]['required']== 'true') OR ($tempBean->custom_fields->avail_fields[$field]['required']== true) ) ) { |
|
| 505 | + $form .= " <span class='required'>".$lbl_required_symbol."</span>"; |
|
| 506 | + } |
|
| 507 | + $form .= "</td></tr>"; |
|
| 508 | + $form .= "<tr><td nowrap colspan='4' class='dataField' nowrap>"; |
|
| 509 | + |
|
| 510 | + if(isset($value['isMultiSelect']) && $value['isMultiSelect'] == 1){ |
|
| 511 | + $this->$field = unencodeMultienum($this->$field); |
|
| 512 | + $multiple = "multiple"; |
|
| 513 | + $array = '[]'; |
|
| 514 | + } else { |
|
| 515 | + $multiple = null; |
|
| 516 | + $array = null; |
|
| 517 | + } |
|
| 518 | + |
|
| 519 | + if(!empty($value['options']) AND isset($value['options']) ) { |
|
| 520 | + $form .= "<select " . $multiple . " name='".$prefix.$field.$array."'>"; |
|
| 521 | + $form .= get_select_options_with_id($app_list_strings[$value['options']], $this->$field); |
|
| 522 | + $form .= "</select"; |
|
| 523 | + } elseif($value['type'] == 'bool' ) { |
|
| 524 | + if( ($this->$field == 1) OR ($this->$field == '1') ) { $checked = 'checked'; } else { $checked = ''; } |
|
| 525 | + $form .= "<input type='checkbox' name='".$prefix.$field."' id='".$prefix.$field."' value='1' ".$checked."/>"; |
|
| 526 | + } elseif($value['type'] == 'text' ) { |
|
| 527 | + $form .= "<textarea name='".$prefix.$field."' rows='6' cols='50'>".$this->$field."</textarea>"; |
|
| 528 | + } elseif($value['type'] == 'date' ) { |
|
| 529 | + $form .= "<input name='".$prefix.$field."' id='jscal_field".$field."' type='text' size='11' maxlength='10' value='".$this->$field."'> ".SugarThemeRegistry::current()->getImage("jscalendar", "id='jscal_trigger".$field."' align='absmiddle'", null, null, ".gif", $mod_strings['LBL_ENTERDATE'])."' <span class='dateFormat'>yyyy-mm-dd</span><script type='text/javascript'>Calendar.setup ({inputField : 'jscal_field".$field."', ifFormat : '%Y-%m-%d', showsTime : false, button : 'jscal_trigger".$field."', singleClick : true, step : 1, weekNumbers:false}); addToValidate('ConvertLead', '".$field."', 'date', false,'".$mod_strings[$tempBean->field_defs[$field]['vname']]."' );</script>"; |
|
| 530 | + } else { |
|
| 531 | + $form .= "<input name='".$prefix.$field."' type='text' value='".$this->$field."'>"; |
|
| 532 | + |
|
| 533 | + if($this->custom_fields->avail_fields[$field]['type'] == 'int') { |
|
| 534 | + $form .= "<script>addToValidate('ConvertLead', '".$prefix.$field."', 'int', false,'".$prefix.":".$mod_strings[$tempBean->field_defs[$field]['vname']]."' );</script>"; |
|
| 535 | + } |
|
| 536 | + elseif($this->custom_fields->avail_fields[$field]['type'] == 'float') { |
|
| 537 | + $form .= "<script>addToValidate('ConvertLead', '".$prefix.$field."', 'float', false,'".$prefix.":".$mod_strings[$tempBean->field_defs[$field]['vname']]."' );</script>"; |
|
| 538 | + } |
|
| 539 | + |
|
| 540 | + } |
|
| 541 | + |
|
| 542 | + if( !empty($tempBean->custom_fields->avail_fields[$field]['required']) AND ( ($tempBean->custom_fields->avail_fields[$field]['required']== 1) OR ($tempBean->custom_fields->avail_fields[$field]['required']== '1') OR ($tempBean->custom_fields->avail_fields[$field]['required']== 'true') OR ($tempBean->custom_fields->avail_fields[$field]['required']== true) ) ) { |
|
| 543 | + $form .= "<script>addToValidate('ConvertLead', '".$prefix.$field."', 'relate', true,'".$prefix.":".$mod_strings[$tempBean->field_defs[$field]['vname']]."' );</script>"; |
|
| 544 | + } |
|
| 545 | + |
|
| 546 | + $form .= "</td></tr>"; |
|
| 547 | + |
|
| 548 | + |
|
| 549 | + } |
|
| 550 | + } |
|
| 551 | + |
|
| 552 | + } |
|
| 553 | + |
|
| 554 | + return true; |
|
| 555 | + } |
|
| 556 | + |
|
| 557 | + function save($check_notify = false) { |
|
| 558 | + if(empty($this->status)) |
|
| 559 | + $this->status = 'New'; |
|
| 560 | + // call save first so that $this->id will be set |
|
| 561 | + $value = parent::save($check_notify); |
|
| 562 | + return $value; |
|
| 563 | + } |
|
| 564 | + function get_unlinked_email_query($type=array()) { |
|
| 565 | + |
|
| 566 | + return get_unlinked_email_query($type, $this); |
|
| 567 | + } |
|
| 568 | 568 | |
| 569 | 569 | /** |
| 570 | 570 | * Returns query to find the related calls created pre-5.1 |
@@ -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. |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | |
| 146 | 146 | // This is used to retrieve related fields from form posts. |
| 147 | 147 | var $additional_column_fields = Array('assigned_user_name', 'task_id', 'note_id', 'meeting_id', 'call_id', 'email_id'); |
| 148 | - var $relationship_fields = Array('email_id'=>'emails','call_id'=>'calls','meeting_id'=>'meetings','task_id'=>'tasks',); |
|
| 148 | + var $relationship_fields = Array('email_id'=>'emails', 'call_id'=>'calls', 'meeting_id'=>'meetings', 'task_id'=>'tasks',); |
|
| 149 | 149 | |
| 150 | 150 | public function __construct() { |
| 151 | 151 | parent::__construct(); |
@@ -154,9 +154,9 @@ discard block |
||
| 154 | 154 | /** |
| 155 | 155 | * @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 |
| 156 | 156 | */ |
| 157 | - public function Lead(){ |
|
| 157 | + public function Lead() { |
|
| 158 | 158 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 159 | - if(isset($GLOBALS['log'])) { |
|
| 159 | + if (isset($GLOBALS['log'])) { |
|
| 160 | 160 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 161 | 161 | } |
| 162 | 162 | else { |
@@ -168,14 +168,14 @@ discard block |
||
| 168 | 168 | |
| 169 | 169 | function get_account() |
| 170 | 170 | { |
| 171 | - if(isset($this->account_id) && !empty($this->account_id)){ |
|
| 171 | + if (isset($this->account_id) && !empty($this->account_id)) { |
|
| 172 | 172 | $query = "SELECT name , assigned_user_id account_name_owner FROM accounts WHERE id='{$this->account_id}'"; |
| 173 | 173 | |
| 174 | 174 | //requireSingleResult has beeen deprecated. |
| 175 | 175 | //$result = $this->db->requireSingleResult($query); |
| 176 | - $result = $this->db->limitQuery($query,0,1,true, "Want only a single row"); |
|
| 176 | + $result = $this->db->limitQuery($query, 0, 1, true, "Want only a single row"); |
|
| 177 | 177 | |
| 178 | - if(!empty($result)){ |
|
| 178 | + if (!empty($result)) { |
|
| 179 | 179 | $row = $this->db->fetchByAssoc($result); |
| 180 | 180 | $this->account_name = $row['name']; |
| 181 | 181 | $this->account_name_owner = $row['account_name_owner']; |
@@ -185,14 +185,14 @@ discard block |
||
| 185 | 185 | }} |
| 186 | 186 | function get_opportunity() |
| 187 | 187 | { |
| 188 | - if(isset($this->opportunity_id) && !empty($this->opportunity_id)){ |
|
| 188 | + if (isset($this->opportunity_id) && !empty($this->opportunity_id)) { |
|
| 189 | 189 | $query = "SELECT name, assigned_user_id opportunity_name_owner FROM opportunities WHERE id='{$this->opportunity_id}'"; |
| 190 | 190 | |
| 191 | 191 | //requireSingleResult has beeen deprecated. |
| 192 | 192 | //$result = $this->db->requireSingleResult($query); |
| 193 | - $result = $this->db->limitQuery($query,0,1,true, "Want only a single row"); |
|
| 193 | + $result = $this->db->limitQuery($query, 0, 1, true, "Want only a single row"); |
|
| 194 | 194 | |
| 195 | - if(!empty($result)){ |
|
| 195 | + if (!empty($result)) { |
|
| 196 | 196 | $row = $this->db->fetchByAssoc($result); |
| 197 | 197 | $this->opportunity_name = $row['name']; |
| 198 | 198 | $this->opportunity_name_owner = $row['opportunity_name_owner']; |
@@ -203,14 +203,14 @@ discard block |
||
| 203 | 203 | function get_contact() |
| 204 | 204 | { |
| 205 | 205 | global $locale; |
| 206 | - if(isset($this->contact_id) && !empty($this->contact_id)){ |
|
| 206 | + if (isset($this->contact_id) && !empty($this->contact_id)) { |
|
| 207 | 207 | $query = "SELECT first_name, last_name, assigned_user_id contact_name_owner FROM contacts WHERE id='{$this->contact_id}'"; |
| 208 | 208 | |
| 209 | 209 | //requireSingleResult has beeen deprecated. |
| 210 | 210 | //$result = $this->db->requireSingleResult($query); |
| 211 | - $result = $this->db->limitQuery($query,0,1,true, "Want only a single row"); |
|
| 212 | - if(!empty($result)){ |
|
| 213 | - $row= $this->db->fetchByAssoc($result); |
|
| 211 | + $result = $this->db->limitQuery($query, 0, 1, true, "Want only a single row"); |
|
| 212 | + if (!empty($result)) { |
|
| 213 | + $row = $this->db->fetchByAssoc($result); |
|
| 214 | 214 | $this->contact_name = $locale->getLocaleFormattedName($row['first_name'], $row['last_name']); |
| 215 | 215 | $this->contact_name_owner = $row['contact_name_owner']; |
| 216 | 216 | $this->contact_name_mod = 'Contacts'; |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | |
| 219 | 219 | }} |
| 220 | 220 | |
| 221 | - function create_list_query($order_by, $where, $show_deleted=0) |
|
| 221 | + function create_list_query($order_by, $where, $show_deleted = 0) |
|
| 222 | 222 | { |
| 223 | 223 | $custom_join = $this->getCustomJoin(); |
| 224 | 224 | $query = "SELECT "; |
@@ -234,42 +234,42 @@ discard block |
||
| 234 | 234 | $query .= "LEFT JOIN email_addresses ea ON (ea.id = eabl.email_address_id) "; |
| 235 | 235 | $query .= $custom_join['join']; |
| 236 | 236 | $where_auto = '1=1'; |
| 237 | - if($show_deleted == 0){ |
|
| 237 | + if ($show_deleted == 0) { |
|
| 238 | 238 | $where_auto = " leads.deleted=0 "; |
| 239 | - }else if($show_deleted == 1){ |
|
| 239 | + } else if ($show_deleted == 1) { |
|
| 240 | 240 | $where_auto = " leads.deleted=1 "; |
| 241 | 241 | } |
| 242 | 242 | |
| 243 | - if($where != "") |
|
| 243 | + if ($where != "") |
|
| 244 | 244 | $query .= "where ($where) AND ".$where_auto; |
| 245 | 245 | else |
| 246 | 246 | $query .= "where ".$where_auto; //."and (leads.converted='0')"; |
| 247 | 247 | |
| 248 | - if(!empty($order_by)) |
|
| 248 | + if (!empty($order_by)) |
|
| 249 | 249 | $query .= " ORDER BY $order_by"; |
| 250 | 250 | |
| 251 | 251 | return $query; |
| 252 | 252 | } |
| 253 | 253 | |
| 254 | - function create_new_list_query($order_by, $where,$filter=array(),$params=array(), $show_deleted = 0,$join_type='', $return_array = false,$parentbean=null, $singleSelect = false, $ifListForExport = false){ |
|
| 254 | + function create_new_list_query($order_by, $where, $filter = array(), $params = array(), $show_deleted = 0, $join_type = '', $return_array = false, $parentbean = null, $singleSelect = false, $ifListForExport = false) { |
|
| 255 | 255 | |
| 256 | 256 | $ret_array = parent::create_new_list_query($order_by, $where, $filter, $params, $show_deleted, $join_type, true, $parentbean, $singleSelect, $ifListForExport); |
| 257 | - if(strpos($ret_array['select'],"leads.account_name") == false && strpos($ret_array['select'],"leads.*") == false) |
|
| 257 | + if (strpos($ret_array['select'], "leads.account_name") == false && strpos($ret_array['select'], "leads.*") == false) |
|
| 258 | 258 | $ret_array['select'] .= " ,leads.account_name"; |
| 259 | - if ( !$return_array ) |
|
| 260 | - return $ret_array['select'] . $ret_array['from'] . $ret_array['where']. $ret_array['order_by']; |
|
| 259 | + if (!$return_array) |
|
| 260 | + return $ret_array['select'].$ret_array['from'].$ret_array['where'].$ret_array['order_by']; |
|
| 261 | 261 | return $ret_array; |
| 262 | 262 | } |
| 263 | 263 | |
| 264 | - function converted_lead($leadid, $contactid, $accountid, $opportunityid){ |
|
| 264 | + function converted_lead($leadid, $contactid, $accountid, $opportunityid) { |
|
| 265 | 265 | $query = "UPDATE leads set converted='1', contact_id=$contactid, account_id=$accountid, opportunity_id=$opportunityid where id=$leadid and deleted=0"; |
| 266 | - $this->db->query($query,true,"Error converting lead: "); |
|
| 266 | + $this->db->query($query, true, "Error converting lead: "); |
|
| 267 | 267 | |
| 268 | 268 | //we must move the status out here in order to be able to capture workflow conditions |
| 269 | - $leadid = str_replace("'","", $leadid); |
|
| 269 | + $leadid = str_replace("'", "", $leadid); |
|
| 270 | 270 | $lead = new Lead(); |
| 271 | 271 | $lead->retrieve($leadid); |
| 272 | - $lead->status='Converted'; |
|
| 272 | + $lead->status = 'Converted'; |
|
| 273 | 273 | $lead->save(); |
| 274 | 274 | } |
| 275 | 275 | |
@@ -292,17 +292,17 @@ discard block |
||
| 292 | 292 | $this->get_opportunity(); |
| 293 | 293 | $this->get_account(); |
| 294 | 294 | |
| 295 | - if(!empty($this->campaign_id)){ |
|
| 295 | + if (!empty($this->campaign_id)) { |
|
| 296 | 296 | |
| 297 | 297 | $camp = new Campaign(); |
| 298 | 298 | $where = "campaigns.id='$this->campaign_id'"; |
| 299 | 299 | $campaign_list = $camp->get_full_list("campaigns.name", $where, true); |
| 300 | - if(!empty($campaign_list)) |
|
| 300 | + if (!empty($campaign_list)) |
|
| 301 | 301 | $this->campaign_name = $campaign_list[0]->name; |
| 302 | 302 | } |
| 303 | 303 | } |
| 304 | 304 | |
| 305 | - function get_list_view_data(){ |
|
| 305 | + function get_list_view_data() { |
|
| 306 | 306 | |
| 307 | 307 | $temp_array = parent::get_list_view_data(); |
| 308 | 308 | |
@@ -321,7 +321,7 @@ discard block |
||
| 321 | 321 | //fix for bug 27339 Shine |
| 322 | 322 | function get_linked_fields() |
| 323 | 323 | { |
| 324 | - $linked_fields=array(); |
|
| 324 | + $linked_fields = array(); |
|
| 325 | 325 | $fieldDefs = $this->getFieldDefinitions(); |
| 326 | 326 | |
| 327 | 327 | //find all definitions of type link. |
@@ -330,9 +330,9 @@ discard block |
||
| 330 | 330 | foreach ($fieldDefs as $name=>$properties) |
| 331 | 331 | { |
| 332 | 332 | if ($name == 'oldmeetings' || $name == 'oldcalls') { continue; } |
| 333 | - elseif (array_search('link',$properties) === 'type') |
|
| 333 | + elseif (array_search('link', $properties) === 'type') |
|
| 334 | 334 | { |
| 335 | - $linked_fields[$name]=$properties; |
|
| 335 | + $linked_fields[$name] = $properties; |
|
| 336 | 336 | } |
| 337 | 337 | } |
| 338 | 338 | } |
@@ -343,7 +343,7 @@ discard block |
||
| 343 | 343 | builds a generic search based on the query string using or |
| 344 | 344 | do not include any $this-> because this is called on without having the class instantiated |
| 345 | 345 | */ |
| 346 | - function build_generic_where_clause ($the_query_string) { |
|
| 346 | + function build_generic_where_clause($the_query_string) { |
|
| 347 | 347 | $where_clauses = Array(); |
| 348 | 348 | $the_query_string = $GLOBALS['db']->quote($the_query_string); |
| 349 | 349 | |
@@ -362,9 +362,9 @@ discard block |
||
| 362 | 362 | } |
| 363 | 363 | |
| 364 | 364 | $the_where = ""; |
| 365 | - foreach($where_clauses as $clause) |
|
| 365 | + foreach ($where_clauses as $clause) |
|
| 366 | 366 | { |
| 367 | - if($the_where != "") $the_where .= " or "; |
|
| 367 | + if ($the_where != "") $the_where .= " or "; |
|
| 368 | 368 | $the_where .= $clause; |
| 369 | 369 | } |
| 370 | 370 | |
@@ -379,33 +379,33 @@ discard block |
||
| 379 | 379 | |
| 380 | 380 | $xtpl->assign("LEAD_NAME", $locale->getLocaleFormattedName($lead->first_name, $lead->last_name, $lead->salutation)); |
| 381 | 381 | $xtpl->assign("LEAD_SOURCE", (isset($lead->lead_source) ? $app_list_strings['lead_source_dom'][$lead->lead_source] : "")); |
| 382 | - $xtpl->assign("LEAD_STATUS", (isset($lead->status)? $app_list_strings['lead_status_dom'][$lead->status]:"")); |
|
| 382 | + $xtpl->assign("LEAD_STATUS", (isset($lead->status) ? $app_list_strings['lead_status_dom'][$lead->status] : "")); |
|
| 383 | 383 | $xtpl->assign("LEAD_DESCRIPTION", $lead->description); |
| 384 | 384 | |
| 385 | 385 | return $xtpl; |
| 386 | 386 | } |
| 387 | 387 | |
| 388 | - function bean_implements($interface){ |
|
| 389 | - switch($interface){ |
|
| 388 | + function bean_implements($interface) { |
|
| 389 | + switch ($interface) { |
|
| 390 | 390 | case 'ACL':return true; |
| 391 | 391 | } |
| 392 | 392 | return false; |
| 393 | 393 | } |
| 394 | - function listviewACLHelper(){ |
|
| 394 | + function listviewACLHelper() { |
|
| 395 | 395 | $array_assign = parent::listviewACLHelper(); |
| 396 | 396 | $is_owner = false; |
| 397 | 397 | $in_group = false; //SECURITY GROUPS |
| 398 | - if(!empty($this->account_name)){ |
|
| 398 | + if (!empty($this->account_name)) { |
|
| 399 | 399 | |
| 400 | - if(!empty($this->account_name_owner)){ |
|
| 400 | + if (!empty($this->account_name_owner)) { |
|
| 401 | 401 | global $current_user; |
| 402 | 402 | $is_owner = $current_user->id == $this->account_name_owner; |
| 403 | 403 | } |
| 404 | 404 | /* BEGIN - SECURITY GROUPS */ |
| 405 | 405 | else { |
| 406 | 406 | global $current_user; |
| 407 | - $parent_bean = BeanFactory::getBean('Accounts',$this->account_id); |
|
| 408 | - if($parent_bean !== false) { |
|
| 407 | + $parent_bean = BeanFactory::getBean('Accounts', $this->account_id); |
|
| 408 | + if ($parent_bean !== false) { |
|
| 409 | 409 | $is_owner = $current_user->id == $parent_bean->assigned_user_id; |
| 410 | 410 | } |
| 411 | 411 | } |
@@ -417,25 +417,25 @@ discard block |
||
| 417 | 417 | /** |
| 418 | 418 | if( ACLController::checkAccess('Accounts', 'view', $is_owner)){ |
| 419 | 419 | */ |
| 420 | - if( ACLController::checkAccess('Accounts', 'view', $is_owner, 'module', $in_group)){ |
|
| 420 | + if (ACLController::checkAccess('Accounts', 'view', $is_owner, 'module', $in_group)) { |
|
| 421 | 421 | /* END - SECURITY GROUPS */ |
| 422 | 422 | $array_assign['ACCOUNT'] = 'a'; |
| 423 | - }else{ |
|
| 423 | + } else { |
|
| 424 | 424 | $array_assign['ACCOUNT'] = 'span'; |
| 425 | 425 | } |
| 426 | 426 | $is_owner = false; |
| 427 | 427 | $in_group = false; //SECURITY GROUPS |
| 428 | - if(!empty($this->opportunity_name)){ |
|
| 428 | + if (!empty($this->opportunity_name)) { |
|
| 429 | 429 | |
| 430 | - if(!empty($this->opportunity_name_owner)){ |
|
| 430 | + if (!empty($this->opportunity_name_owner)) { |
|
| 431 | 431 | global $current_user; |
| 432 | 432 | $is_owner = $current_user->id == $this->opportunity_name_owner; |
| 433 | 433 | } |
| 434 | 434 | /* BEGIN - SECURITY GROUPS */ |
| 435 | 435 | else { |
| 436 | 436 | global $current_user; |
| 437 | - $parent_bean = BeanFactory::getBean('Opportunities',$this->opportunity_id); |
|
| 438 | - if($parent_bean !== false) { |
|
| 437 | + $parent_bean = BeanFactory::getBean('Opportunities', $this->opportunity_id); |
|
| 438 | + if ($parent_bean !== false) { |
|
| 439 | 439 | $is_owner = $current_user->id == $parent_bean->assigned_user_id; |
| 440 | 440 | } |
| 441 | 441 | } |
@@ -447,19 +447,19 @@ discard block |
||
| 447 | 447 | /** |
| 448 | 448 | if( ACLController::checkAccess('Opportunities', 'view', $is_owner)){ |
| 449 | 449 | */ |
| 450 | - if( ACLController::checkAccess('Opportunities', 'view', $is_owner, 'module', $in_group)){ |
|
| 450 | + if (ACLController::checkAccess('Opportunities', 'view', $is_owner, 'module', $in_group)) { |
|
| 451 | 451 | /* END - SECURITY GROUPS */ |
| 452 | 452 | $array_assign['OPPORTUNITY'] = 'a'; |
| 453 | - }else{ |
|
| 453 | + } else { |
|
| 454 | 454 | $array_assign['OPPORTUNITY'] = 'span'; |
| 455 | 455 | } |
| 456 | 456 | |
| 457 | 457 | |
| 458 | 458 | $is_owner = false; |
| 459 | 459 | $in_group = false; //SECURITY GROUPS |
| 460 | - if(!empty($this->contact_name)){ |
|
| 460 | + if (!empty($this->contact_name)) { |
|
| 461 | 461 | |
| 462 | - if(!empty($this->contact_name_owner)){ |
|
| 462 | + if (!empty($this->contact_name_owner)) { |
|
| 463 | 463 | global $current_user; |
| 464 | 464 | $is_owner = $current_user->id == $this->contact_name_owner; |
| 465 | 465 | } |
@@ -467,8 +467,8 @@ discard block |
||
| 467 | 467 | //contact_name_owner not being set for whatever reason so we need to figure this out |
| 468 | 468 | else { |
| 469 | 469 | global $current_user; |
| 470 | - $parent_bean = BeanFactory::getBean('Contacts',$this->contact_id); |
|
| 471 | - if($parent_bean !== false) { |
|
| 470 | + $parent_bean = BeanFactory::getBean('Contacts', $this->contact_id); |
|
| 471 | + if ($parent_bean !== false) { |
|
| 472 | 472 | $is_owner = $current_user->id == $parent_bean->assigned_user_id; |
| 473 | 473 | } |
| 474 | 474 | } |
@@ -480,10 +480,10 @@ discard block |
||
| 480 | 480 | /** |
| 481 | 481 | if( ACLController::checkAccess('Contacts', 'view', $is_owner)){ |
| 482 | 482 | */ |
| 483 | - if( ACLController::checkAccess('Contacts', 'view', $is_owner, 'module', $in_group)){ |
|
| 483 | + if (ACLController::checkAccess('Contacts', 'view', $is_owner, 'module', $in_group)) { |
|
| 484 | 484 | /* END - SECURITY GROUPS */ |
| 485 | 485 | $array_assign['CONTACT'] = 'a'; |
| 486 | - }else{ |
|
| 486 | + } else { |
|
| 487 | 487 | $array_assign['CONTACT'] = 'span'; |
| 488 | 488 | } |
| 489 | 489 | |
@@ -495,19 +495,19 @@ discard block |
||
| 495 | 495 | |
| 496 | 496 | global $mod_strings, $app_list_strings, $app_strings, $lbl_required_symbol; |
| 497 | 497 | |
| 498 | - foreach($this->field_defs as $field => $value) { |
|
| 498 | + foreach ($this->field_defs as $field => $value) { |
|
| 499 | 499 | |
| 500 | - if(!empty($value['source']) && $value['source'] == 'custom_fields') { |
|
| 501 | - if( !empty($tempBean->field_defs[$field]) AND isset($tempBean->field_defs[$field]) ) { |
|
| 500 | + if (!empty($value['source']) && $value['source'] == 'custom_fields') { |
|
| 501 | + if (!empty($tempBean->field_defs[$field]) AND isset($tempBean->field_defs[$field])) { |
|
| 502 | 502 | $form .= "<tr><td nowrap colspan='4' class='dataLabel'>".$mod_strings[$tempBean->field_defs[$field]['vname']].":"; |
| 503 | 503 | |
| 504 | - if( !empty($tempBean->custom_fields->avail_fields[$field]['required']) AND ( ($tempBean->custom_fields->avail_fields[$field]['required']== 1) OR ($tempBean->custom_fields->avail_fields[$field]['required']== '1') OR ($tempBean->custom_fields->avail_fields[$field]['required']== 'true') OR ($tempBean->custom_fields->avail_fields[$field]['required']== true) ) ) { |
|
| 504 | + if (!empty($tempBean->custom_fields->avail_fields[$field]['required']) AND (($tempBean->custom_fields->avail_fields[$field]['required'] == 1) OR ($tempBean->custom_fields->avail_fields[$field]['required'] == '1') OR ($tempBean->custom_fields->avail_fields[$field]['required'] == 'true') OR ($tempBean->custom_fields->avail_fields[$field]['required'] == true))) { |
|
| 505 | 505 | $form .= " <span class='required'>".$lbl_required_symbol."</span>"; |
| 506 | 506 | } |
| 507 | 507 | $form .= "</td></tr>"; |
| 508 | 508 | $form .= "<tr><td nowrap colspan='4' class='dataField' nowrap>"; |
| 509 | 509 | |
| 510 | - if(isset($value['isMultiSelect']) && $value['isMultiSelect'] == 1){ |
|
| 510 | + if (isset($value['isMultiSelect']) && $value['isMultiSelect'] == 1) { |
|
| 511 | 511 | $this->$field = unencodeMultienum($this->$field); |
| 512 | 512 | $multiple = "multiple"; |
| 513 | 513 | $array = '[]'; |
@@ -516,30 +516,30 @@ discard block |
||
| 516 | 516 | $array = null; |
| 517 | 517 | } |
| 518 | 518 | |
| 519 | - if(!empty($value['options']) AND isset($value['options']) ) { |
|
| 520 | - $form .= "<select " . $multiple . " name='".$prefix.$field.$array."'>"; |
|
| 519 | + if (!empty($value['options']) AND isset($value['options'])) { |
|
| 520 | + $form .= "<select ".$multiple." name='".$prefix.$field.$array."'>"; |
|
| 521 | 521 | $form .= get_select_options_with_id($app_list_strings[$value['options']], $this->$field); |
| 522 | 522 | $form .= "</select"; |
| 523 | - } elseif($value['type'] == 'bool' ) { |
|
| 524 | - if( ($this->$field == 1) OR ($this->$field == '1') ) { $checked = 'checked'; } else { $checked = ''; } |
|
| 523 | + } elseif ($value['type'] == 'bool') { |
|
| 524 | + if (($this->$field == 1) OR ($this->$field == '1')) { $checked = 'checked'; } else { $checked = ''; } |
|
| 525 | 525 | $form .= "<input type='checkbox' name='".$prefix.$field."' id='".$prefix.$field."' value='1' ".$checked."/>"; |
| 526 | - } elseif($value['type'] == 'text' ) { |
|
| 526 | + } elseif ($value['type'] == 'text') { |
|
| 527 | 527 | $form .= "<textarea name='".$prefix.$field."' rows='6' cols='50'>".$this->$field."</textarea>"; |
| 528 | - } elseif($value['type'] == 'date' ) { |
|
| 528 | + } elseif ($value['type'] == 'date') { |
|
| 529 | 529 | $form .= "<input name='".$prefix.$field."' id='jscal_field".$field."' type='text' size='11' maxlength='10' value='".$this->$field."'> ".SugarThemeRegistry::current()->getImage("jscalendar", "id='jscal_trigger".$field."' align='absmiddle'", null, null, ".gif", $mod_strings['LBL_ENTERDATE'])."' <span class='dateFormat'>yyyy-mm-dd</span><script type='text/javascript'>Calendar.setup ({inputField : 'jscal_field".$field."', ifFormat : '%Y-%m-%d', showsTime : false, button : 'jscal_trigger".$field."', singleClick : true, step : 1, weekNumbers:false}); addToValidate('ConvertLead', '".$field."', 'date', false,'".$mod_strings[$tempBean->field_defs[$field]['vname']]."' );</script>"; |
| 530 | 530 | } else { |
| 531 | 531 | $form .= "<input name='".$prefix.$field."' type='text' value='".$this->$field."'>"; |
| 532 | 532 | |
| 533 | - if($this->custom_fields->avail_fields[$field]['type'] == 'int') { |
|
| 533 | + if ($this->custom_fields->avail_fields[$field]['type'] == 'int') { |
|
| 534 | 534 | $form .= "<script>addToValidate('ConvertLead', '".$prefix.$field."', 'int', false,'".$prefix.":".$mod_strings[$tempBean->field_defs[$field]['vname']]."' );</script>"; |
| 535 | 535 | } |
| 536 | - elseif($this->custom_fields->avail_fields[$field]['type'] == 'float') { |
|
| 536 | + elseif ($this->custom_fields->avail_fields[$field]['type'] == 'float') { |
|
| 537 | 537 | $form .= "<script>addToValidate('ConvertLead', '".$prefix.$field."', 'float', false,'".$prefix.":".$mod_strings[$tempBean->field_defs[$field]['vname']]."' );</script>"; |
| 538 | 538 | } |
| 539 | 539 | |
| 540 | 540 | } |
| 541 | 541 | |
| 542 | - if( !empty($tempBean->custom_fields->avail_fields[$field]['required']) AND ( ($tempBean->custom_fields->avail_fields[$field]['required']== 1) OR ($tempBean->custom_fields->avail_fields[$field]['required']== '1') OR ($tempBean->custom_fields->avail_fields[$field]['required']== 'true') OR ($tempBean->custom_fields->avail_fields[$field]['required']== true) ) ) { |
|
| 542 | + if (!empty($tempBean->custom_fields->avail_fields[$field]['required']) AND (($tempBean->custom_fields->avail_fields[$field]['required'] == 1) OR ($tempBean->custom_fields->avail_fields[$field]['required'] == '1') OR ($tempBean->custom_fields->avail_fields[$field]['required'] == 'true') OR ($tempBean->custom_fields->avail_fields[$field]['required'] == true))) { |
|
| 543 | 543 | $form .= "<script>addToValidate('ConvertLead', '".$prefix.$field."', 'relate', true,'".$prefix.":".$mod_strings[$tempBean->field_defs[$field]['vname']]."' );</script>"; |
| 544 | 544 | } |
| 545 | 545 | |
@@ -555,13 +555,13 @@ discard block |
||
| 555 | 555 | } |
| 556 | 556 | |
| 557 | 557 | function save($check_notify = false) { |
| 558 | - if(empty($this->status)) |
|
| 558 | + if (empty($this->status)) |
|
| 559 | 559 | $this->status = 'New'; |
| 560 | 560 | // call save first so that $this->id will be set |
| 561 | 561 | $value = parent::save($check_notify); |
| 562 | 562 | return $value; |
| 563 | 563 | } |
| 564 | - function get_unlinked_email_query($type=array()) { |
|
| 564 | + function get_unlinked_email_query($type = array()) { |
|
| 565 | 565 | |
| 566 | 566 | return get_unlinked_email_query($type, $this); |
| 567 | 567 | } |
@@ -573,9 +573,9 @@ discard block |
||
| 573 | 573 | */ |
| 574 | 574 | public function get_old_related_calls() |
| 575 | 575 | { |
| 576 | - $return_array['select']='SELECT calls.id '; |
|
| 577 | - $return_array['from']='FROM calls '; |
|
| 578 | - $return_array['where']=" WHERE calls.parent_id = '$this->id' |
|
| 576 | + $return_array['select'] = 'SELECT calls.id '; |
|
| 577 | + $return_array['from'] = 'FROM calls '; |
|
| 578 | + $return_array['where'] = " WHERE calls.parent_id = '$this->id' |
|
| 579 | 579 | AND calls.parent_type = 'Leads' AND calls.id NOT IN ( SELECT call_id FROM calls_leads ) "; |
| 580 | 580 | $return_array['join'] = ""; |
| 581 | 581 | $return_array['join_tables'][0] = ''; |
@@ -605,9 +605,9 @@ discard block |
||
| 605 | 605 | */ |
| 606 | 606 | public function get_old_related_meetings() |
| 607 | 607 | { |
| 608 | - $return_array['select']='SELECT meetings.id '; |
|
| 609 | - $return_array['from']='FROM meetings '; |
|
| 610 | - $return_array['where']=" WHERE meetings.parent_id = '$this->id' |
|
| 608 | + $return_array['select'] = 'SELECT meetings.id '; |
|
| 609 | + $return_array['from'] = 'FROM meetings '; |
|
| 610 | + $return_array['where'] = " WHERE meetings.parent_id = '$this->id' |
|
| 611 | 611 | AND meetings.parent_type = 'Leads' AND meetings.id NOT IN ( SELECT meeting_id FROM meetings_leads ) "; |
| 612 | 612 | $return_array['join'] = ""; |
| 613 | 613 | $return_array['join_tables'][0] = ''; |
@@ -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. |
@@ -158,8 +160,7 @@ discard block |
||
| 158 | 160 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 159 | 161 | if(isset($GLOBALS['log'])) { |
| 160 | 162 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 161 | - } |
|
| 162 | - else { |
|
| 163 | + } else { |
|
| 163 | 164 | trigger_error($deprecatedMessage, E_USER_DEPRECATED); |
| 164 | 165 | } |
| 165 | 166 | self::__construct(); |
@@ -236,17 +237,20 @@ discard block |
||
| 236 | 237 | $where_auto = '1=1'; |
| 237 | 238 | if($show_deleted == 0){ |
| 238 | 239 | $where_auto = " leads.deleted=0 "; |
| 239 | - }else if($show_deleted == 1){ |
|
| 240 | + } else if($show_deleted == 1){ |
|
| 240 | 241 | $where_auto = " leads.deleted=1 "; |
| 241 | 242 | } |
| 242 | 243 | |
| 243 | - if($where != "") |
|
| 244 | - $query .= "where ($where) AND ".$where_auto; |
|
| 245 | - else |
|
| 246 | - $query .= "where ".$where_auto; //."and (leads.converted='0')"; |
|
| 244 | + if($where != "") { |
|
| 245 | + $query .= "where ($where) AND ".$where_auto; |
|
| 246 | + } else { |
|
| 247 | + $query .= "where ".$where_auto; |
|
| 248 | + } |
|
| 249 | + //."and (leads.converted='0')"; |
|
| 247 | 250 | |
| 248 | - if(!empty($order_by)) |
|
| 249 | - $query .= " ORDER BY $order_by"; |
|
| 251 | + if(!empty($order_by)) { |
|
| 252 | + $query .= " ORDER BY $order_by"; |
|
| 253 | + } |
|
| 250 | 254 | |
| 251 | 255 | return $query; |
| 252 | 256 | } |
@@ -254,10 +258,12 @@ discard block |
||
| 254 | 258 | function create_new_list_query($order_by, $where,$filter=array(),$params=array(), $show_deleted = 0,$join_type='', $return_array = false,$parentbean=null, $singleSelect = false, $ifListForExport = false){ |
| 255 | 259 | |
| 256 | 260 | $ret_array = parent::create_new_list_query($order_by, $where, $filter, $params, $show_deleted, $join_type, true, $parentbean, $singleSelect, $ifListForExport); |
| 257 | - if(strpos($ret_array['select'],"leads.account_name") == false && strpos($ret_array['select'],"leads.*") == false) |
|
| 258 | - $ret_array['select'] .= " ,leads.account_name"; |
|
| 259 | - if ( !$return_array ) |
|
| 260 | - return $ret_array['select'] . $ret_array['from'] . $ret_array['where']. $ret_array['order_by']; |
|
| 261 | + if(strpos($ret_array['select'],"leads.account_name") == false && strpos($ret_array['select'],"leads.*") == false) { |
|
| 262 | + $ret_array['select'] .= " ,leads.account_name"; |
|
| 263 | + } |
|
| 264 | + if ( !$return_array ) { |
|
| 265 | + return $ret_array['select'] . $ret_array['from'] . $ret_array['where']. $ret_array['order_by']; |
|
| 266 | + } |
|
| 261 | 267 | return $ret_array; |
| 262 | 268 | } |
| 263 | 269 | |
@@ -297,8 +303,9 @@ discard block |
||
| 297 | 303 | $camp = new Campaign(); |
| 298 | 304 | $where = "campaigns.id='$this->campaign_id'"; |
| 299 | 305 | $campaign_list = $camp->get_full_list("campaigns.name", $where, true); |
| 300 | - if(!empty($campaign_list)) |
|
| 301 | - $this->campaign_name = $campaign_list[0]->name; |
|
| 306 | + if(!empty($campaign_list)) { |
|
| 307 | + $this->campaign_name = $campaign_list[0]->name; |
|
| 308 | + } |
|
| 302 | 309 | } |
| 303 | 310 | } |
| 304 | 311 | |
@@ -329,8 +336,7 @@ discard block |
||
| 329 | 336 | { |
| 330 | 337 | foreach ($fieldDefs as $name=>$properties) |
| 331 | 338 | { |
| 332 | - if ($name == 'oldmeetings' || $name == 'oldcalls') { continue; } |
|
| 333 | - elseif (array_search('link',$properties) === 'type') |
|
| 339 | + if ($name == 'oldmeetings' || $name == 'oldcalls') { continue; } elseif (array_search('link',$properties) === 'type') |
|
| 334 | 340 | { |
| 335 | 341 | $linked_fields[$name]=$properties; |
| 336 | 342 | } |
@@ -364,7 +370,9 @@ discard block |
||
| 364 | 370 | $the_where = ""; |
| 365 | 371 | foreach($where_clauses as $clause) |
| 366 | 372 | { |
| 367 | - if($the_where != "") $the_where .= " or "; |
|
| 373 | + if($the_where != "") { |
|
| 374 | + $the_where .= " or "; |
|
| 375 | + } |
|
| 368 | 376 | $the_where .= $clause; |
| 369 | 377 | } |
| 370 | 378 | |
@@ -420,7 +428,7 @@ discard block |
||
| 420 | 428 | if( ACLController::checkAccess('Accounts', 'view', $is_owner, 'module', $in_group)){ |
| 421 | 429 | /* END - SECURITY GROUPS */ |
| 422 | 430 | $array_assign['ACCOUNT'] = 'a'; |
| 423 | - }else{ |
|
| 431 | + } else{ |
|
| 424 | 432 | $array_assign['ACCOUNT'] = 'span'; |
| 425 | 433 | } |
| 426 | 434 | $is_owner = false; |
@@ -450,7 +458,7 @@ discard block |
||
| 450 | 458 | if( ACLController::checkAccess('Opportunities', 'view', $is_owner, 'module', $in_group)){ |
| 451 | 459 | /* END - SECURITY GROUPS */ |
| 452 | 460 | $array_assign['OPPORTUNITY'] = 'a'; |
| 453 | - }else{ |
|
| 461 | + } else{ |
|
| 454 | 462 | $array_assign['OPPORTUNITY'] = 'span'; |
| 455 | 463 | } |
| 456 | 464 | |
@@ -483,7 +491,7 @@ discard block |
||
| 483 | 491 | if( ACLController::checkAccess('Contacts', 'view', $is_owner, 'module', $in_group)){ |
| 484 | 492 | /* END - SECURITY GROUPS */ |
| 485 | 493 | $array_assign['CONTACT'] = 'a'; |
| 486 | - }else{ |
|
| 494 | + } else{ |
|
| 487 | 495 | $array_assign['CONTACT'] = 'span'; |
| 488 | 496 | } |
| 489 | 497 | |
@@ -532,8 +540,7 @@ discard block |
||
| 532 | 540 | |
| 533 | 541 | if($this->custom_fields->avail_fields[$field]['type'] == 'int') { |
| 534 | 542 | $form .= "<script>addToValidate('ConvertLead', '".$prefix.$field."', 'int', false,'".$prefix.":".$mod_strings[$tempBean->field_defs[$field]['vname']]."' );</script>"; |
| 535 | - } |
|
| 536 | - elseif($this->custom_fields->avail_fields[$field]['type'] == 'float') { |
|
| 543 | + } elseif($this->custom_fields->avail_fields[$field]['type'] == 'float') { |
|
| 537 | 544 | $form .= "<script>addToValidate('ConvertLead', '".$prefix.$field."', 'float', false,'".$prefix.":".$mod_strings[$tempBean->field_defs[$field]['vname']]."' );</script>"; |
| 538 | 545 | } |
| 539 | 546 | |
@@ -555,8 +562,9 @@ discard block |
||
| 555 | 562 | } |
| 556 | 563 | |
| 557 | 564 | function save($check_notify = false) { |
| 558 | - if(empty($this->status)) |
|
| 559 | - $this->status = 'New'; |
|
| 565 | + if(empty($this->status)) { |
|
| 566 | + $this->status = 'New'; |
|
| 567 | + } |
|
| 560 | 568 | // call save first so that $this->id will be set |
| 561 | 569 | $value = parent::save($check_notify); |
| 562 | 570 | return $value; |
@@ -592,8 +600,7 @@ discard block |
||
| 592 | 600 | |
| 593 | 601 | if (isset($GLOBALS['app_list_strings']['lead_conv_activity_opt'])) { |
| 594 | 602 | return $GLOBALS['app_list_strings']['lead_conv_activity_opt']; |
| 595 | - } |
|
| 596 | - else { |
|
| 603 | + } else { |
|
| 597 | 604 | return array(); |
| 598 | 605 | } |
| 599 | 606 | } |
@@ -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_LEADS', 'Leads'); |
|
| 55 | + if (empty($def['title'])) $this->title = translate('LBL_LIST_MY_LEADS', 'Leads'); |
|
| 56 | 56 | |
| 57 | 57 | $this->searchFields = $dashletData['MyLeadsDashlet']['searchFields']; |
| 58 | 58 | $this->columns = $dashletData['MyLeadsDashlet']['columns']; |
@@ -62,9 +62,9 @@ discard block |
||
| 62 | 62 | /** |
| 63 | 63 | * @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 |
| 64 | 64 | */ |
| 65 | - function MyLeadsDashlet($id, $def = null){ |
|
| 65 | + function MyLeadsDashlet($id, $def = null) { |
|
| 66 | 66 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 67 | - if(isset($GLOBALS['log'])) { |
|
| 67 | + if (isset($GLOBALS['log'])) { |
|
| 68 | 68 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 69 | 69 | } |
| 70 | 70 | 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_LEADS', 'Leads'); |
|
| 57 | + if(empty($def['title'])) { |
|
| 58 | + $this->title = translate('LBL_LIST_MY_LEADS', 'Leads'); |
|
| 59 | + } |
|
| 56 | 60 | |
| 57 | 61 | $this->searchFields = $dashletData['MyLeadsDashlet']['searchFields']; |
| 58 | 62 | $this->columns = $dashletData['MyLeadsDashlet']['columns']; |
@@ -66,8 +70,7 @@ discard block |
||
| 66 | 70 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 67 | 71 | if(isset($GLOBALS['log'])) { |
| 68 | 72 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 69 | - } |
|
| 70 | - else { |
|
| 73 | + } else { |
|
| 71 | 74 | trigger_error($deprecatedMessage, E_USER_DEPRECATED); |
| 72 | 75 | } |
| 73 | 76 | self::__construct($id, $def); |
@@ -38,9 +38,9 @@ discard block |
||
| 38 | 38 | ********************************************************************************/ |
| 39 | 39 | |
| 40 | 40 | class LeadsController extends SugarController{ |
| 41 | - function __construct(){ |
|
| 42 | - parent::__construct(); |
|
| 43 | - } |
|
| 41 | + function __construct(){ |
|
| 42 | + parent::__construct(); |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | 45 | /** |
| 46 | 46 | * @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 |
@@ -56,48 +56,48 @@ discard block |
||
| 56 | 56 | self::__construct(); |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - function pre_editview(){ |
|
| 60 | - //IF we have a prospect id leads convert it to a lead |
|
| 61 | - if (empty($this->bean->id) && !empty($_REQUEST['return_module']) &&$_REQUEST['return_module'] == 'Prospects' ) { |
|
| 59 | + function pre_editview(){ |
|
| 60 | + //IF we have a prospect id leads convert it to a lead |
|
| 61 | + if (empty($this->bean->id) && !empty($_REQUEST['return_module']) &&$_REQUEST['return_module'] == 'Prospects' ) { |
|
| 62 | 62 | |
| 63 | - $prospect=new Prospect(); |
|
| 64 | - $prospect->retrieve($_REQUEST['return_id']); |
|
| 65 | - foreach($prospect->field_defs as $key=>$value) |
|
| 66 | - { |
|
| 67 | - if ($key == 'id' or $key=='deleted' )continue; |
|
| 68 | - if (isset($this->bean->field_defs[$key])) { |
|
| 69 | - $this->bean->$key = $prospect->$key; |
|
| 70 | - } |
|
| 71 | - } |
|
| 72 | - $_POST['is_converted']=true; |
|
| 73 | - } |
|
| 74 | - return true; |
|
| 75 | - } |
|
| 76 | - function action_editview(){ |
|
| 77 | - $this->view = 'edit'; |
|
| 78 | - return true; |
|
| 79 | - } |
|
| 63 | + $prospect=new Prospect(); |
|
| 64 | + $prospect->retrieve($_REQUEST['return_id']); |
|
| 65 | + foreach($prospect->field_defs as $key=>$value) |
|
| 66 | + { |
|
| 67 | + if ($key == 'id' or $key=='deleted' )continue; |
|
| 68 | + if (isset($this->bean->field_defs[$key])) { |
|
| 69 | + $this->bean->$key = $prospect->$key; |
|
| 70 | + } |
|
| 71 | + } |
|
| 72 | + $_POST['is_converted']=true; |
|
| 73 | + } |
|
| 74 | + return true; |
|
| 75 | + } |
|
| 76 | + function action_editview(){ |
|
| 77 | + $this->view = 'edit'; |
|
| 78 | + return true; |
|
| 79 | + } |
|
| 80 | 80 | |
| 81 | - protected function callLegacyCode(){ |
|
| 82 | - if(strtolower($this->do_action) == 'convertlead'){ |
|
| 83 | - if(file_exists('modules/Leads/ConvertLead.php') && !file_exists('custom/modules/Leads/metadata/convertdefs.php')){ |
|
| 84 | - if(!empty($_REQUEST['emailAddressWidget'])) { |
|
| 85 | - foreach($_REQUEST as $key=>$value) { |
|
| 86 | - if(preg_match('/^Leads.*?emailAddress[\d]+$/', $key)) { |
|
| 87 | - $_REQUEST['Leads_email_widget_id'] = 0; |
|
| 88 | - break; |
|
| 89 | - } |
|
| 90 | - } |
|
| 91 | - } |
|
| 92 | - $this->action_default(); |
|
| 81 | + protected function callLegacyCode(){ |
|
| 82 | + if(strtolower($this->do_action) == 'convertlead'){ |
|
| 83 | + if(file_exists('modules/Leads/ConvertLead.php') && !file_exists('custom/modules/Leads/metadata/convertdefs.php')){ |
|
| 84 | + if(!empty($_REQUEST['emailAddressWidget'])) { |
|
| 85 | + foreach($_REQUEST as $key=>$value) { |
|
| 86 | + if(preg_match('/^Leads.*?emailAddress[\d]+$/', $key)) { |
|
| 87 | + $_REQUEST['Leads_email_widget_id'] = 0; |
|
| 88 | + break; |
|
| 89 | + } |
|
| 90 | + } |
|
| 91 | + } |
|
| 92 | + $this->action_default(); |
|
| 93 | 93 | $this->_processed = true; |
| 94 | 94 | }else{ |
| 95 | - $this->view = 'convertlead'; |
|
| 95 | + $this->view = 'convertlead'; |
|
| 96 | 96 | $this->_processed = true; |
| 97 | 97 | } |
| 98 | - }else{ |
|
| 98 | + }else{ |
|
| 99 | 99 | parent::callLegacyCode(); |
| 100 | 100 | } |
| 101 | - } |
|
| 101 | + } |
|
| 102 | 102 | } |
| 103 | 103 | ?> |
| 104 | 104 | \ No newline at end of file |
@@ -37,17 +37,17 @@ discard block |
||
| 37 | 37 | * display the words "Powered by SugarCRM" and "Supercharged by SuiteCRM". |
| 38 | 38 | ********************************************************************************/ |
| 39 | 39 | |
| 40 | -class LeadsController extends SugarController{ |
|
| 41 | - function __construct(){ |
|
| 40 | +class LeadsController extends SugarController { |
|
| 41 | + function __construct() { |
|
| 42 | 42 | parent::__construct(); |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | /** |
| 46 | 46 | * @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 |
| 47 | 47 | */ |
| 48 | - function LeadsController(){ |
|
| 48 | + function LeadsController() { |
|
| 49 | 49 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 50 | - if(isset($GLOBALS['log'])) { |
|
| 50 | + if (isset($GLOBALS['log'])) { |
|
| 51 | 51 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 52 | 52 | } |
| 53 | 53 | else { |
@@ -56,34 +56,34 @@ discard block |
||
| 56 | 56 | self::__construct(); |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - function pre_editview(){ |
|
| 59 | + function pre_editview() { |
|
| 60 | 60 | //IF we have a prospect id leads convert it to a lead |
| 61 | - if (empty($this->bean->id) && !empty($_REQUEST['return_module']) &&$_REQUEST['return_module'] == 'Prospects' ) { |
|
| 61 | + if (empty($this->bean->id) && !empty($_REQUEST['return_module']) && $_REQUEST['return_module'] == 'Prospects') { |
|
| 62 | 62 | |
| 63 | - $prospect=new Prospect(); |
|
| 63 | + $prospect = new Prospect(); |
|
| 64 | 64 | $prospect->retrieve($_REQUEST['return_id']); |
| 65 | - foreach($prospect->field_defs as $key=>$value) |
|
| 65 | + foreach ($prospect->field_defs as $key=>$value) |
|
| 66 | 66 | { |
| 67 | - if ($key == 'id' or $key=='deleted' )continue; |
|
| 67 | + if ($key == 'id' or $key == 'deleted')continue; |
|
| 68 | 68 | if (isset($this->bean->field_defs[$key])) { |
| 69 | 69 | $this->bean->$key = $prospect->$key; |
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | - $_POST['is_converted']=true; |
|
| 72 | + $_POST['is_converted'] = true; |
|
| 73 | 73 | } |
| 74 | 74 | return true; |
| 75 | 75 | } |
| 76 | - function action_editview(){ |
|
| 76 | + function action_editview() { |
|
| 77 | 77 | $this->view = 'edit'; |
| 78 | 78 | return true; |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - protected function callLegacyCode(){ |
|
| 82 | - if(strtolower($this->do_action) == 'convertlead'){ |
|
| 83 | - if(file_exists('modules/Leads/ConvertLead.php') && !file_exists('custom/modules/Leads/metadata/convertdefs.php')){ |
|
| 84 | - if(!empty($_REQUEST['emailAddressWidget'])) { |
|
| 85 | - foreach($_REQUEST as $key=>$value) { |
|
| 86 | - if(preg_match('/^Leads.*?emailAddress[\d]+$/', $key)) { |
|
| 81 | + protected function callLegacyCode() { |
|
| 82 | + if (strtolower($this->do_action) == 'convertlead') { |
|
| 83 | + if (file_exists('modules/Leads/ConvertLead.php') && !file_exists('custom/modules/Leads/metadata/convertdefs.php')) { |
|
| 84 | + if (!empty($_REQUEST['emailAddressWidget'])) { |
|
| 85 | + foreach ($_REQUEST as $key=>$value) { |
|
| 86 | + if (preg_match('/^Leads.*?emailAddress[\d]+$/', $key)) { |
|
| 87 | 87 | $_REQUEST['Leads_email_widget_id'] = 0; |
| 88 | 88 | break; |
| 89 | 89 | } |
@@ -91,11 +91,11 @@ discard block |
||
| 91 | 91 | } |
| 92 | 92 | $this->action_default(); |
| 93 | 93 | $this->_processed = true; |
| 94 | - }else{ |
|
| 94 | + } else { |
|
| 95 | 95 | $this->view = 'convertlead'; |
| 96 | 96 | $this->_processed = true; |
| 97 | 97 | } |
| 98 | - }else{ |
|
| 98 | + } else { |
|
| 99 | 99 | parent::callLegacyCode(); |
| 100 | 100 | } |
| 101 | 101 | } |
@@ -49,8 +49,7 @@ discard block |
||
| 49 | 49 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 50 | 50 | if(isset($GLOBALS['log'])) { |
| 51 | 51 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 52 | - } |
|
| 53 | - else { |
|
| 52 | + } else { |
|
| 54 | 53 | trigger_error($deprecatedMessage, E_USER_DEPRECATED); |
| 55 | 54 | } |
| 56 | 55 | self::__construct(); |
@@ -64,7 +63,9 @@ discard block |
||
| 64 | 63 | $prospect->retrieve($_REQUEST['return_id']); |
| 65 | 64 | foreach($prospect->field_defs as $key=>$value) |
| 66 | 65 | { |
| 67 | - if ($key == 'id' or $key=='deleted' )continue; |
|
| 66 | + if ($key == 'id' or $key=='deleted' ) { |
|
| 67 | + continue; |
|
| 68 | + } |
|
| 68 | 69 | if (isset($this->bean->field_defs[$key])) { |
| 69 | 70 | $this->bean->$key = $prospect->$key; |
| 70 | 71 | } |
@@ -91,11 +92,11 @@ discard block |
||
| 91 | 92 | } |
| 92 | 93 | $this->action_default(); |
| 93 | 94 | $this->_processed = true; |
| 94 | - }else{ |
|
| 95 | + } else{ |
|
| 95 | 96 | $this->view = 'convertlead'; |
| 96 | 97 | $this->_processed = true; |
| 97 | 98 | } |
| 98 | - }else{ |
|
| 99 | + } else{ |
|
| 99 | 100 | parent::callLegacyCode(); |
| 100 | 101 | } |
| 101 | 102 | } |
@@ -52,9 +52,9 @@ discard block |
||
| 52 | 52 | /** |
| 53 | 53 | * @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 |
| 54 | 54 | */ |
| 55 | - public function Favorites(){ |
|
| 55 | + public function Favorites() { |
|
| 56 | 56 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 57 | - if(isset($GLOBALS['log'])) { |
|
| 57 | + if (isset($GLOBALS['log'])) { |
|
| 58 | 58 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 59 | 59 | } |
| 60 | 60 | else { |
@@ -64,13 +64,13 @@ discard block |
||
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | |
| 67 | - public function deleteFavorite($id){ |
|
| 68 | - if($id){ |
|
| 69 | - $favorite_record = BeanFactory::getBean('Favorites',$id); |
|
| 67 | + public function deleteFavorite($id) { |
|
| 68 | + if ($id) { |
|
| 69 | + $favorite_record = BeanFactory::getBean('Favorites', $id); |
|
| 70 | 70 | $favorite_record->deleted = 1; |
| 71 | 71 | $favorite_record->save(); |
| 72 | 72 | return true; |
| 73 | - }else{ |
|
| 73 | + } else { |
|
| 74 | 74 | return false; |
| 75 | 75 | } |
| 76 | 76 | |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | public function getFavoriteID($module, $record_id) |
| 80 | 80 | { |
| 81 | 81 | global $db, $current_user; |
| 82 | - $query = "SELECT id FROM favorites WHERE parent_id= '" . $record_id . "' AND parent_type = '" . $module . "' AND assigned_user_id = '" . $current_user->id . "' AND deleted = 0 ORDER BY date_entered desc"; |
|
| 82 | + $query = "SELECT id FROM favorites WHERE parent_id= '".$record_id."' AND parent_type = '".$module."' AND assigned_user_id = '".$current_user->id."' AND deleted = 0 ORDER BY date_entered desc"; |
|
| 83 | 83 | return $db->getOne($query); |
| 84 | 84 | } |
| 85 | 85 | |
@@ -89,10 +89,10 @@ discard block |
||
| 89 | 89 | |
| 90 | 90 | $return_array = array(); |
| 91 | 91 | |
| 92 | - if($id){ |
|
| 93 | - $query = "SELECT parent_id, parent_type FROM favorites WHERE assigned_user_id = '" . $current_user->id . "' AND parent_id = '" . $id . "' AND deleted = 0 ORDER BY date_entered desc"; |
|
| 94 | - }else{ |
|
| 95 | - $query = "SELECT parent_id, parent_type FROM favorites WHERE assigned_user_id = '" . $current_user->id . "' AND deleted = 0 ORDER BY date_entered desc"; |
|
| 92 | + if ($id) { |
|
| 93 | + $query = "SELECT parent_id, parent_type FROM favorites WHERE assigned_user_id = '".$current_user->id."' AND parent_id = '".$id."' AND deleted = 0 ORDER BY date_entered desc"; |
|
| 94 | + } else { |
|
| 95 | + $query = "SELECT parent_id, parent_type FROM favorites WHERE assigned_user_id = '".$current_user->id."' AND deleted = 0 ORDER BY date_entered desc"; |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | $result = $db->query($query); |
@@ -100,12 +100,12 @@ discard block |
||
| 100 | 100 | $i = 0; |
| 101 | 101 | while ($row = $db->fetchByAssoc($result)) { |
| 102 | 102 | |
| 103 | - $bean = BeanFactory::getBean($row['parent_type'],$row['parent_id']); |
|
| 103 | + $bean = BeanFactory::getBean($row['parent_type'], $row['parent_id']); |
|
| 104 | 104 | $return_array[$i]['item_summary'] = $bean->name; |
| 105 | 105 | $return_array[$i]['item_summary_short'] = to_html(getTrackerSubstring($bean->name)); |
| 106 | 106 | $return_array[$i]['id'] = $row['parent_id']; |
| 107 | 107 | $return_array[$i]['module_name'] = $row['parent_type']; |
| 108 | - $return_array[$i]['image'] = SugarThemeRegistry::current() ->getImage($row['parent_type'],'border="0" align="absmiddle"',null,null,'.gif',$bean->name); |
|
| 108 | + $return_array[$i]['image'] = SugarThemeRegistry::current() ->getImage($row['parent_type'], 'border="0" align="absmiddle"', null, null, '.gif', $bean->name); |
|
| 109 | 109 | |
| 110 | 110 | $i++; |
| 111 | 111 | } |
@@ -56,8 +56,7 @@ discard block |
||
| 56 | 56 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 57 | 57 | if(isset($GLOBALS['log'])) { |
| 58 | 58 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 59 | - } |
|
| 60 | - else { |
|
| 59 | + } else { |
|
| 61 | 60 | trigger_error($deprecatedMessage, E_USER_DEPRECATED); |
| 62 | 61 | } |
| 63 | 62 | self::__construct(); |
@@ -70,7 +69,7 @@ discard block |
||
| 70 | 69 | $favorite_record->deleted = 1; |
| 71 | 70 | $favorite_record->save(); |
| 72 | 71 | return true; |
| 73 | - }else{ |
|
| 72 | + } else{ |
|
| 74 | 73 | return false; |
| 75 | 74 | } |
| 76 | 75 | |
@@ -91,7 +90,7 @@ discard block |
||
| 91 | 90 | |
| 92 | 91 | if($id){ |
| 93 | 92 | $query = "SELECT parent_id, parent_type FROM favorites WHERE assigned_user_id = '" . $current_user->id . "' AND parent_id = '" . $id . "' AND deleted = 0 ORDER BY date_entered desc"; |
| 94 | - }else{ |
|
| 93 | + } else{ |
|
| 95 | 94 | $query = "SELECT parent_id, parent_type FROM favorites WHERE assigned_user_id = '" . $current_user->id . "' AND deleted = 0 ORDER BY date_entered desc"; |
| 96 | 95 | } |
| 97 | 96 | |
@@ -79,9 +79,9 @@ |
||
| 79 | 79 | /** |
| 80 | 80 | * @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 |
| 81 | 81 | */ |
| 82 | - public function Favorites_sugar(){ |
|
| 82 | + public function Favorites_sugar() { |
|
| 83 | 83 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 84 | - if(isset($GLOBALS['log'])) { |
|
| 84 | + if (isset($GLOBALS['log'])) { |
|
| 85 | 85 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 86 | 86 | } |
| 87 | 87 | else { |
@@ -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); |