@@ -57,8 +57,7 @@ discard block |
||
| 57 | 57 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 58 | 58 | if(isset($GLOBALS['log'])) { |
| 59 | 59 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 60 | - } |
|
| 61 | - else { |
|
| 60 | + } else { |
|
| 62 | 61 | trigger_error($deprecatedMessage, E_USER_DEPRECATED); |
| 63 | 62 | } |
| 64 | 63 | self::__construct(); |
@@ -124,8 +123,9 @@ discard block |
||
| 124 | 123 | $type_str = ''; |
| 125 | 124 | foreach($types as $type){ |
| 126 | 125 | $type_str .= "'".$type."'"; |
| 127 | - if($index < $count) |
|
| 128 | - $type_str .= ","; |
|
| 126 | + if($index < $count) { |
|
| 127 | + $type_str .= ","; |
|
| 128 | + } |
|
| 129 | 129 | $index++; |
| 130 | 130 | } |
| 131 | 131 | |
@@ -310,18 +310,20 @@ discard block |
||
| 310 | 310 | } |
| 311 | 311 | if(isset($_REQUEST['terms_checked'])) { |
| 312 | 312 | $terms_checked = $_REQUEST['terms_checked']; |
| 313 | - if($terms_checked == 'on') |
|
| 314 | - $terms_checked = true; |
|
| 313 | + if($terms_checked == 'on') { |
|
| 314 | + $terms_checked = true; |
|
| 315 | + } |
|
| 315 | 316 | } |
| 316 | 317 | |
| 317 | 318 | if(!empty($username) && !empty($password)){ |
| 318 | 319 | $password = md5($password); |
| 319 | 320 | $result = PackageManager::authenticate($username, $password, $servername, $terms_checked); |
| 320 | - if(!is_array($result) && $result == true) |
|
| 321 | - $status = 'success'; |
|
| 322 | - else |
|
| 323 | - $status = $result['faultstring']; |
|
| 324 | - }else{ |
|
| 321 | + if(!is_array($result) && $result == true) { |
|
| 322 | + $status = 'success'; |
|
| 323 | + } else { |
|
| 324 | + $status = $result['faultstring']; |
|
| 325 | + } |
|
| 326 | + } else{ |
|
| 325 | 327 | $status = 'failed'; |
| 326 | 328 | } |
| 327 | 329 | |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | $name_value_list = PackageManager::fromNameValueList($name_value_list); |
| 90 | 90 | return $name_value_list['description']; |
| 91 | 91 | }else { |
| 92 | - return ''; |
|
| 92 | + return ''; |
|
| 93 | 93 | } |
| 94 | 94 | } |
| 95 | 95 | |
@@ -97,10 +97,10 @@ discard block |
||
| 97 | 97 | * Obtain a list of category/packages/releases for use within the module loader |
| 98 | 98 | */ |
| 99 | 99 | function getModuleLoaderCategoryPackages($category_id = ''){ |
| 100 | - $filter = array(); |
|
| 101 | - $filter = array('type' => "'module', 'theme', 'langpack'"); |
|
| 102 | - $filter = PackageManager::toNameValueList($filter); |
|
| 103 | - return PackageManager::getCategoryPackages($category_id, $filter); |
|
| 100 | + $filter = array(); |
|
| 101 | + $filter = array('type' => "'module', 'theme', 'langpack'"); |
|
| 102 | + $filter = PackageManager::toNameValueList($filter); |
|
| 103 | + return PackageManager::getCategoryPackages($category_id, $filter); |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | /** |
@@ -108,41 +108,41 @@ discard block |
||
| 108 | 108 | * @return category_packages |
| 109 | 109 | */ |
| 110 | 110 | function getCategoryPackages($category_id = '', $filter = array()){ |
| 111 | - $results = PackageManagerComm::getCategoryPackages($category_id, $filter); |
|
| 112 | - PackageManagerComm::errorCheck(); |
|
| 113 | - $nodes = array(); |
|
| 111 | + $results = PackageManagerComm::getCategoryPackages($category_id, $filter); |
|
| 112 | + PackageManagerComm::errorCheck(); |
|
| 113 | + $nodes = array(); |
|
| 114 | 114 | |
| 115 | 115 | $nodes[$category_id]['packages'] = array(); |
| 116 | 116 | if(!empty($results['categories'])){ |
| 117 | - foreach($results['categories'] as $category){ |
|
| 118 | - $mycat = PackageManager::fromNameValueList($category); |
|
| 119 | - $nodes[$mycat['id']] = array('id' => $mycat['id'], 'label' => $mycat['name'], 'description' => $mycat['description'], 'type' => 'cat', 'parent' => $mycat['parent_id']); |
|
| 120 | - $nodes[$mycat['id']]['packages'] = array(); |
|
| 121 | - } |
|
| 122 | - } |
|
| 123 | - if(!empty($results['packages'])){ |
|
| 124 | - $uh = new UpgradeHistory(); |
|
| 125 | - foreach($results['packages'] as $package){ |
|
| 126 | - $mypack = PackageManager::fromNameValueList($package); |
|
| 127 | - $nodes[$mypack['category_id']]['packages'][$mypack['id']] = array('id' => $mypack['id'], 'label' => $mypack['name'], 'description' => $mypack['description'], 'category_id' => $mypack['category_id'], 'type' => 'package'); |
|
| 128 | - $releases = PackageManager::getReleases($category_id, $mypack['id'], $filter); |
|
| 129 | - $arr_releases = array(); |
|
| 130 | - $nodes[$mypack['category_id']]['packages'][$mypack['id']]['releases'] = array(); |
|
| 131 | - if(!empty($releases['packages'])){ |
|
| 132 | - foreach($releases['packages'] as $release){ |
|
| 133 | - $myrelease = PackageManager::fromNameValueList($release); |
|
| 134 | - //check to see if we already this one installed |
|
| 135 | - $result = $uh->determineIfUpgrade($myrelease['id_name'], $myrelease['version']); |
|
| 136 | - $enable = false; |
|
| 137 | - if($result == true || is_array($result)) |
|
| 138 | - $enable = true; |
|
| 139 | - $nodes[$mypack['category_id']]['packages'][$mypack['id']]['releases'][$myrelease['id']] = array('id' => $myrelease['id'], 'version' => $myrelease['version'], 'label' => $myrelease['description'], 'category_id' => $mypack['category_id'], 'package_id' => $mypack['id'], 'type' => 'release', 'enable' => $enable); |
|
| 140 | - } |
|
| 141 | - } |
|
| 142 | - //array_push($nodes[$mypack['category_id']]['packages'], $package_arr); |
|
| 143 | - } |
|
| 144 | - } |
|
| 145 | - $GLOBALS['log']->debug("NODES". var_export($nodes, true)); |
|
| 117 | + foreach($results['categories'] as $category){ |
|
| 118 | + $mycat = PackageManager::fromNameValueList($category); |
|
| 119 | + $nodes[$mycat['id']] = array('id' => $mycat['id'], 'label' => $mycat['name'], 'description' => $mycat['description'], 'type' => 'cat', 'parent' => $mycat['parent_id']); |
|
| 120 | + $nodes[$mycat['id']]['packages'] = array(); |
|
| 121 | + } |
|
| 122 | + } |
|
| 123 | + if(!empty($results['packages'])){ |
|
| 124 | + $uh = new UpgradeHistory(); |
|
| 125 | + foreach($results['packages'] as $package){ |
|
| 126 | + $mypack = PackageManager::fromNameValueList($package); |
|
| 127 | + $nodes[$mypack['category_id']]['packages'][$mypack['id']] = array('id' => $mypack['id'], 'label' => $mypack['name'], 'description' => $mypack['description'], 'category_id' => $mypack['category_id'], 'type' => 'package'); |
|
| 128 | + $releases = PackageManager::getReleases($category_id, $mypack['id'], $filter); |
|
| 129 | + $arr_releases = array(); |
|
| 130 | + $nodes[$mypack['category_id']]['packages'][$mypack['id']]['releases'] = array(); |
|
| 131 | + if(!empty($releases['packages'])){ |
|
| 132 | + foreach($releases['packages'] as $release){ |
|
| 133 | + $myrelease = PackageManager::fromNameValueList($release); |
|
| 134 | + //check to see if we already this one installed |
|
| 135 | + $result = $uh->determineIfUpgrade($myrelease['id_name'], $myrelease['version']); |
|
| 136 | + $enable = false; |
|
| 137 | + if($result == true || is_array($result)) |
|
| 138 | + $enable = true; |
|
| 139 | + $nodes[$mypack['category_id']]['packages'][$mypack['id']]['releases'][$myrelease['id']] = array('id' => $myrelease['id'], 'version' => $myrelease['version'], 'label' => $myrelease['description'], 'category_id' => $mypack['category_id'], 'package_id' => $mypack['id'], 'type' => 'release', 'enable' => $enable); |
|
| 140 | + } |
|
| 141 | + } |
|
| 142 | + //array_push($nodes[$mypack['category_id']]['packages'], $package_arr); |
|
| 143 | + } |
|
| 144 | + } |
|
| 145 | + $GLOBALS['log']->debug("NODES". var_export($nodes, true)); |
|
| 146 | 146 | return $nodes; |
| 147 | 147 | } |
| 148 | 148 | |
@@ -157,10 +157,10 @@ discard block |
||
| 157 | 157 | $results = PackageManagerComm::getCategories($category_id, $filter); |
| 158 | 158 | PackageManagerComm::errorCheck(); |
| 159 | 159 | if(!empty($results['categories'])){ |
| 160 | - foreach($results['categories'] as $category){ |
|
| 161 | - $mycat = PackageManager::fromNameValueList($category); |
|
| 162 | - $nodes[] = array('id' => $mycat['id'], 'label' => $mycat['name'], 'description' => $mycat['description'], 'type' => 'cat', 'parent' => $mycat['parent_id']); |
|
| 163 | - } |
|
| 160 | + foreach($results['categories'] as $category){ |
|
| 161 | + $mycat = PackageManager::fromNameValueList($category); |
|
| 162 | + $nodes[] = array('id' => $mycat['id'], 'label' => $mycat['name'], 'description' => $mycat['description'], 'type' => 'cat', 'parent' => $mycat['parent_id']); |
|
| 163 | + } |
|
| 164 | 164 | } |
| 165 | 165 | return $nodes; |
| 166 | 166 | } |
@@ -173,17 +173,17 @@ discard block |
||
| 173 | 173 | //$xml = ''; |
| 174 | 174 | //$xml .= '<packages>'; |
| 175 | 175 | if(!empty($results['packages'])){ |
| 176 | - foreach($results['packages'] as $package){ |
|
| 177 | - $mypack = PackageManager::fromNameValueList($package); |
|
| 178 | - $packages[$mypack['id']] = array('package_id' => $mypack['id'], 'name' => $mypack['name'], 'description' => $mypack['description'], 'category_id' => $mypack['category_id']); |
|
| 179 | - $releases = PackageManager::getReleases($category_id, $mypack['id']); |
|
| 180 | - $arr_releases = array(); |
|
| 181 | - foreach($releases['packages'] as $release){ |
|
| 182 | - $myrelease = PackageManager::fromNameValueList($release); |
|
| 183 | - $arr_releases[$myrelease['id']] = array('release_id' => $myrelease['id'], 'version' => $myrelease['version'], 'description' => $myrelease['description'], 'category_id' => $mypack['category_id'], 'package_id' => $mypack['id']); |
|
| 184 | - } |
|
| 185 | - $packages[$mypack['id']]['releases'] = $arr_releases; |
|
| 186 | - } |
|
| 176 | + foreach($results['packages'] as $package){ |
|
| 177 | + $mypack = PackageManager::fromNameValueList($package); |
|
| 178 | + $packages[$mypack['id']] = array('package_id' => $mypack['id'], 'name' => $mypack['name'], 'description' => $mypack['description'], 'category_id' => $mypack['category_id']); |
|
| 179 | + $releases = PackageManager::getReleases($category_id, $mypack['id']); |
|
| 180 | + $arr_releases = array(); |
|
| 181 | + foreach($releases['packages'] as $release){ |
|
| 182 | + $myrelease = PackageManager::fromNameValueList($release); |
|
| 183 | + $arr_releases[$myrelease['id']] = array('release_id' => $myrelease['id'], 'version' => $myrelease['version'], 'description' => $myrelease['description'], 'category_id' => $mypack['category_id'], 'package_id' => $mypack['id']); |
|
| 184 | + } |
|
| 185 | + $packages[$mypack['id']]['releases'] = $arr_releases; |
|
| 186 | + } |
|
| 187 | 187 | } |
| 188 | 188 | return $packages; |
| 189 | 189 | } |
@@ -208,10 +208,10 @@ discard block |
||
| 208 | 208 | if(!empty($release_id)){ |
| 209 | 209 | $filename = PackageManagerComm::addDownload($category_id, $package_id, $release_id); |
| 210 | 210 | if($filename){ |
| 211 | - $GLOBALS['log']->debug('RESULT: '.$filename); |
|
| 212 | - PackageManagerComm::errorCheck(); |
|
| 213 | - $filepath = PackageManagerComm::performDownload($filename); |
|
| 214 | - return $filepath; |
|
| 211 | + $GLOBALS['log']->debug('RESULT: '.$filename); |
|
| 212 | + PackageManagerComm::errorCheck(); |
|
| 213 | + $filepath = PackageManagerComm::performDownload($filename); |
|
| 214 | + return $filepath; |
|
| 215 | 215 | } |
| 216 | 216 | }else{ |
| 217 | 217 | return null; |
@@ -232,20 +232,20 @@ discard block |
||
| 232 | 232 | PackageManagerComm::clearSession(); |
| 233 | 233 | $result = PackageManagerComm::login($terms_checked); |
| 234 | 234 | if(is_array($result)) |
| 235 | - return $result; |
|
| 236 | - else |
|
| 237 | - return true; |
|
| 235 | + return $result; |
|
| 236 | + else |
|
| 237 | + return true; |
|
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | function setCredentials($username, $password, $systemname){ |
| 241 | 241 | |
| 242 | 242 | $admin = new Administration(); |
| 243 | 243 | $admin->retrieveSettings(); |
| 244 | - $admin->saveSetting(CREDENTIAL_CATEGORY, CREDENTIAL_USERNAME, $username); |
|
| 245 | - $admin->saveSetting(CREDENTIAL_CATEGORY, CREDENTIAL_PASSWORD, $password); |
|
| 246 | - if(!empty($systemname)){ |
|
| 247 | - $admin->saveSetting('system', 'name', $systemname); |
|
| 248 | - } |
|
| 244 | + $admin->saveSetting(CREDENTIAL_CATEGORY, CREDENTIAL_USERNAME, $username); |
|
| 245 | + $admin->saveSetting(CREDENTIAL_CATEGORY, CREDENTIAL_PASSWORD, $password); |
|
| 246 | + if(!empty($systemname)){ |
|
| 247 | + $admin->saveSetting('system', 'name', $systemname); |
|
| 248 | + } |
|
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | static function getCredentials(){ |
@@ -255,21 +255,21 @@ discard block |
||
| 255 | 255 | $credentials = array(); |
| 256 | 256 | $credentials['username'] = ''; |
| 257 | 257 | $credentials['password'] = ''; |
| 258 | - $credentials['system_name'] = ''; |
|
| 258 | + $credentials['system_name'] = ''; |
|
| 259 | 259 | if(!empty($admin->settings[CREDENTIAL_CATEGORY.'_'.CREDENTIAL_USERNAME])){ |
| 260 | - $credentials['username'] = $admin->settings[CREDENTIAL_CATEGORY.'_'.CREDENTIAL_USERNAME]; |
|
| 260 | + $credentials['username'] = $admin->settings[CREDENTIAL_CATEGORY.'_'.CREDENTIAL_USERNAME]; |
|
| 261 | 261 | } |
| 262 | 262 | if(!empty($admin->settings[CREDENTIAL_CATEGORY.'_'.CREDENTIAL_USERNAME])){ |
| 263 | - $credentials['password'] = $admin->settings[CREDENTIAL_CATEGORY.'_'.CREDENTIAL_PASSWORD]; |
|
| 263 | + $credentials['password'] = $admin->settings[CREDENTIAL_CATEGORY.'_'.CREDENTIAL_PASSWORD]; |
|
| 264 | 264 | } |
| 265 | 265 | if(!empty($admin->settings['system_name'])){ |
| 266 | - $credentials['system_name'] = $admin->settings['system_name']; |
|
| 266 | + $credentials['system_name'] = $admin->settings['system_name']; |
|
| 267 | 267 | } |
| 268 | 268 | return $credentials; |
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | function getTermsAndConditions(){ |
| 272 | - return PackageManagerComm::getTermsAndConditions(); |
|
| 272 | + return PackageManagerComm::getTermsAndConditions(); |
|
| 273 | 273 | |
| 274 | 274 | } |
| 275 | 275 | |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | * @return documents |
| 283 | 283 | */ |
| 284 | 284 | function getDocumentation($package_id, $release_id){ |
| 285 | - if(!empty($release_id) || !empty($package_id)){ |
|
| 285 | + if(!empty($release_id) || !empty($package_id)){ |
|
| 286 | 286 | $documents = PackageManagerComm::getDocumentation($package_id, $release_id); |
| 287 | 287 | return $documents; |
| 288 | 288 | }else{ |
@@ -295,33 +295,33 @@ discard block |
||
| 295 | 295 | * The depot will then send back a list of modules that need to be updated |
| 296 | 296 | */ |
| 297 | 297 | function checkForUpdates(){ |
| 298 | - $lists = $this->buildInstalledReleases(array('module'), true); |
|
| 299 | - $updates = array(); |
|
| 300 | - if(!empty($lists)){ |
|
| 301 | - $updates = PackageManagerComm::checkForUpdates($lists); |
|
| 302 | - }//fi |
|
| 303 | - return $updates; |
|
| 298 | + $lists = $this->buildInstalledReleases(array('module'), true); |
|
| 299 | + $updates = array(); |
|
| 300 | + if(!empty($lists)){ |
|
| 301 | + $updates = PackageManagerComm::checkForUpdates($lists); |
|
| 302 | + }//fi |
|
| 303 | + return $updates; |
|
| 304 | 304 | } |
| 305 | 305 | |
| 306 | - //////////////////////////////////////////////////////// |
|
| 307 | - /////////// HELPER FUNCTIONS |
|
| 306 | + //////////////////////////////////////////////////////// |
|
| 307 | + /////////// HELPER FUNCTIONS |
|
| 308 | 308 | function toNameValueList($array){ |
| 309 | - $list = array(); |
|
| 310 | - foreach($array as $name=>$value){ |
|
| 311 | - $list[] = array('name'=>$name, 'value'=>$value); |
|
| 312 | - } |
|
| 313 | - return $list; |
|
| 314 | - } |
|
| 315 | - |
|
| 316 | - function toNameValueLists($arrays){ |
|
| 317 | - $lists = array(); |
|
| 318 | - foreach($arrays as $array){ |
|
| 319 | - $lists[] = PackageManager::toNameValueList($array); |
|
| 320 | - } |
|
| 321 | - return $lists; |
|
| 322 | - } |
|
| 323 | - |
|
| 324 | - function fromNameValueList($nvl){ |
|
| 309 | + $list = array(); |
|
| 310 | + foreach($array as $name=>$value){ |
|
| 311 | + $list[] = array('name'=>$name, 'value'=>$value); |
|
| 312 | + } |
|
| 313 | + return $list; |
|
| 314 | + } |
|
| 315 | + |
|
| 316 | + function toNameValueLists($arrays){ |
|
| 317 | + $lists = array(); |
|
| 318 | + foreach($arrays as $array){ |
|
| 319 | + $lists[] = PackageManager::toNameValueList($array); |
|
| 320 | + } |
|
| 321 | + return $lists; |
|
| 322 | + } |
|
| 323 | + |
|
| 324 | + function fromNameValueList($nvl){ |
|
| 325 | 325 | $array = array(); |
| 326 | 326 | foreach($nvl as $list){ |
| 327 | 327 | $array[$list['name']] = $list['value']; |
@@ -330,19 +330,19 @@ discard block |
||
| 330 | 330 | } |
| 331 | 331 | |
| 332 | 332 | function buildInstalledReleases($types = array('module')){ |
| 333 | - //1) get list of installed modules |
|
| 334 | - $installeds = $this->getInstalled($types); |
|
| 335 | - $releases = array(); |
|
| 336 | - foreach($installeds as $installed){ |
|
| 337 | - $releases[] = array('name' => $installed->name, 'id_name' => $installed->id_name, 'version' => $installed->version, 'filename' => $installed->filename, 'type' => $installed->type); |
|
| 338 | - } |
|
| 333 | + //1) get list of installed modules |
|
| 334 | + $installeds = $this->getInstalled($types); |
|
| 335 | + $releases = array(); |
|
| 336 | + foreach($installeds as $installed){ |
|
| 337 | + $releases[] = array('name' => $installed->name, 'id_name' => $installed->id_name, 'version' => $installed->version, 'filename' => $installed->filename, 'type' => $installed->type); |
|
| 338 | + } |
|
| 339 | 339 | |
| 340 | - $lists = array(); |
|
| 341 | - $name_value_list = array(); |
|
| 342 | - if(!empty($releases)){ |
|
| 343 | - $lists = $this->toNameValueLists($releases); |
|
| 344 | - }//fi |
|
| 345 | - return $lists; |
|
| 340 | + $lists = array(); |
|
| 341 | + $name_value_list = array(); |
|
| 342 | + if(!empty($releases)){ |
|
| 343 | + $lists = $this->toNameValueLists($releases); |
|
| 344 | + }//fi |
|
| 345 | + return $lists; |
|
| 346 | 346 | } |
| 347 | 347 | |
| 348 | 348 | function buildPackageXML($package, $releases = array()){ |
@@ -351,19 +351,19 @@ discard block |
||
| 351 | 351 | $xml .= '<name>'.$package['name'].'</name>'; |
| 352 | 352 | $xml .= '<description>'.$package['description'].'</description>'; |
| 353 | 353 | if(!empty($releases)){ |
| 354 | - $xml .= '<releases>'; |
|
| 355 | - foreach($releases['packages'] as $release){ |
|
| 356 | - |
|
| 357 | - $myrelease = PackageManager::fromNameValueList($release); |
|
| 358 | - $xml .= '<release>'; |
|
| 359 | - $xml .= '<release_id>'.$myrelease['id'].'</release_id>'; |
|
| 360 | - $xml .= '<version>'.$myrelease['version'].'</version>'; |
|
| 361 | - $xml .= '<description>'.$myrelease['description'].'</description>'; |
|
| 362 | - $xml .= '<package_id>'.$package['id'].'</package_id>'; |
|
| 363 | - $xml .= '<category_id>'.$package['category_id'].'</category_id>'; |
|
| 364 | - $xml .= '</release>'; |
|
| 365 | - } |
|
| 366 | - $xml .= '</releases>'; |
|
| 354 | + $xml .= '<releases>'; |
|
| 355 | + foreach($releases['packages'] as $release){ |
|
| 356 | + |
|
| 357 | + $myrelease = PackageManager::fromNameValueList($release); |
|
| 358 | + $xml .= '<release>'; |
|
| 359 | + $xml .= '<release_id>'.$myrelease['id'].'</release_id>'; |
|
| 360 | + $xml .= '<version>'.$myrelease['version'].'</version>'; |
|
| 361 | + $xml .= '<description>'.$myrelease['description'].'</description>'; |
|
| 362 | + $xml .= '<package_id>'.$package['id'].'</package_id>'; |
|
| 363 | + $xml .= '<category_id>'.$package['category_id'].'</category_id>'; |
|
| 364 | + $xml .= '</release>'; |
|
| 365 | + } |
|
| 366 | + $xml .= '</releases>'; |
|
| 367 | 367 | } |
| 368 | 368 | $xml .= '</package>'; |
| 369 | 369 | return $xml; |
@@ -444,7 +444,7 @@ discard block |
||
| 444 | 444 | } |
| 445 | 445 | } |
| 446 | 446 | |
| 447 | - if( isset($manifest['acceptable_sugar_flavors']) && sizeof($manifest['acceptable_sugar_flavors']) > 0 ){ |
|
| 447 | + if( isset($manifest['acceptable_sugar_flavors']) && sizeof($manifest['acceptable_sugar_flavors']) > 0 ){ |
|
| 448 | 448 | $flavor_ok = false; |
| 449 | 449 | foreach( $manifest['acceptable_sugar_flavors'] as $match ){ |
| 450 | 450 | if( $match == $sugar_flavor ){ |
@@ -479,7 +479,7 @@ discard block |
||
| 479 | 479 | $base_upgrade_dir = $this->upload_dir.'/upgrades'; |
| 480 | 480 | $base_tmp_upgrade_dir = "$base_upgrade_dir/temp"; |
| 481 | 481 | $manifest_file = $this->extractManifest( $base_filename,$base_tmp_upgrade_dir); |
| 482 | - $GLOBALS['log']->debug("Manifest: ".$manifest_file); |
|
| 482 | + $GLOBALS['log']->debug("Manifest: ".$manifest_file); |
|
| 483 | 483 | if($view == 'module') |
| 484 | 484 | $license_file = $this->extractFile($base_filename, 'LICENSE.txt', $base_tmp_upgrade_dir); |
| 485 | 485 | if(is_file($manifest_file)){ |
@@ -521,7 +521,7 @@ discard block |
||
| 521 | 521 | $messages = '<script>ajaxStatus.flashStatus("' .$base_filename.$mod_strings['LBL_UW_UPLOAD_SUCCESS'] . ', 5000");</script>'; |
| 522 | 522 | }else{ |
| 523 | 523 | if($display_messages) |
| 524 | - $messages = '<script>ajaxStatus.flashStatus("' .$mod_strings['ERR_UW_UPLOAD_ERROR'] . ', 5000");</script>'; |
|
| 524 | + $messages = '<script>ajaxStatus.flashStatus("' .$mod_strings['ERR_UW_UPLOAD_ERROR'] . ', 5000");</script>'; |
|
| 525 | 525 | } |
| 526 | 526 | }//fi |
| 527 | 527 | else{ |
@@ -553,9 +553,9 @@ discard block |
||
| 553 | 553 | $mi = new ModuleInstaller(); |
| 554 | 554 | $mi->silent = $silent; |
| 555 | 555 | $mod_strings = return_module_language($current_language, "Administration"); |
| 556 | - $GLOBALS['log']->debug("ABOUT TO INSTALL: ".$file); |
|
| 556 | + $GLOBALS['log']->debug("ABOUT TO INSTALL: ".$file); |
|
| 557 | 557 | if(preg_match("#.*\.zip\$#", $file)) { |
| 558 | - $GLOBALS['log']->debug("1: ".$file); |
|
| 558 | + $GLOBALS['log']->debug("1: ".$file); |
|
| 559 | 559 | // handle manifest.php |
| 560 | 560 | $target_manifest = remove_file_extension( $file ) . '-manifest.php'; |
| 561 | 561 | include($target_manifest); |
@@ -565,18 +565,18 @@ discard block |
||
| 565 | 565 | unzip($file, $unzip_dir ); |
| 566 | 566 | $GLOBALS['log']->debug("3: ".$unzip_dir); |
| 567 | 567 | $id_name = $installdefs['id']; |
| 568 | - $version = $manifest['version']; |
|
| 569 | - $uh = new UpgradeHistory(); |
|
| 570 | - $previous_install = array(); |
|
| 571 | - if(!empty($id_name) & !empty($version)) |
|
| 572 | - $previous_install = $uh->determineIfUpgrade($id_name, $version); |
|
| 573 | - $previous_version = (empty($previous_install['version'])) ? '' : $previous_install['version']; |
|
| 574 | - $previous_id = (empty($previous_install['id'])) ? '' : $previous_install['id']; |
|
| 568 | + $version = $manifest['version']; |
|
| 569 | + $uh = new UpgradeHistory(); |
|
| 570 | + $previous_install = array(); |
|
| 571 | + if(!empty($id_name) & !empty($version)) |
|
| 572 | + $previous_install = $uh->determineIfUpgrade($id_name, $version); |
|
| 573 | + $previous_version = (empty($previous_install['version'])) ? '' : $previous_install['version']; |
|
| 574 | + $previous_id = (empty($previous_install['id'])) ? '' : $previous_install['id']; |
|
| 575 | 575 | |
| 576 | 576 | if(!empty($previous_version)){ |
| 577 | - $mi->install($unzip_dir, true, $previous_version); |
|
| 577 | + $mi->install($unzip_dir, true, $previous_version); |
|
| 578 | 578 | }else{ |
| 579 | - $mi->install($unzip_dir); |
|
| 579 | + $mi->install($unzip_dir); |
|
| 580 | 580 | } |
| 581 | 581 | $GLOBALS['log']->debug("INSTALLED: ".$file); |
| 582 | 582 | $new_upgrade = new UpgradeHistory(); |
@@ -589,11 +589,11 @@ discard block |
||
| 589 | 589 | $new_upgrade->name = $manifest['name']; |
| 590 | 590 | $new_upgrade->description = $manifest['description']; |
| 591 | 591 | $new_upgrade->id_name = $id_name; |
| 592 | - $serial_manifest = array(); |
|
| 593 | - $serial_manifest['manifest'] = (isset($manifest) ? $manifest : ''); |
|
| 594 | - $serial_manifest['installdefs'] = (isset($installdefs) ? $installdefs : ''); |
|
| 595 | - $serial_manifest['upgrade_manifest'] = (isset($upgrade_manifest) ? $upgrade_manifest : ''); |
|
| 596 | - $new_upgrade->manifest = base64_encode(serialize($serial_manifest)); |
|
| 592 | + $serial_manifest = array(); |
|
| 593 | + $serial_manifest['manifest'] = (isset($manifest) ? $manifest : ''); |
|
| 594 | + $serial_manifest['installdefs'] = (isset($installdefs) ? $installdefs : ''); |
|
| 595 | + $serial_manifest['upgrade_manifest'] = (isset($upgrade_manifest) ? $upgrade_manifest : ''); |
|
| 596 | + $new_upgrade->manifest = base64_encode(serialize($serial_manifest)); |
|
| 597 | 597 | //$new_upgrade->unique_key = (isset($manifest['unique_key'])) ? $manifest['unique_key'] : ''; |
| 598 | 598 | $new_upgrade->save(); |
| 599 | 599 | //unlink($file); |
@@ -601,16 +601,16 @@ discard block |
||
| 601 | 601 | } |
| 602 | 602 | |
| 603 | 603 | function performUninstall($name){ |
| 604 | - $uh = new UpgradeHistory(); |
|
| 605 | - $uh->name = $name; |
|
| 606 | - $uh->id_name = $name; |
|
| 607 | - $found = $uh->checkForExisting($uh); |
|
| 608 | - if($found != null){ |
|
| 609 | - global $sugar_config; |
|
| 610 | - global $mod_strings; |
|
| 611 | - global $current_language; |
|
| 612 | - $base_upgrade_dir = $this->upload_dir.'/upgrades'; |
|
| 613 | - $base_tmp_upgrade_dir = "$base_upgrade_dir/temp"; |
|
| 604 | + $uh = new UpgradeHistory(); |
|
| 605 | + $uh->name = $name; |
|
| 606 | + $uh->id_name = $name; |
|
| 607 | + $found = $uh->checkForExisting($uh); |
|
| 608 | + if($found != null){ |
|
| 609 | + global $sugar_config; |
|
| 610 | + global $mod_strings; |
|
| 611 | + global $current_language; |
|
| 612 | + $base_upgrade_dir = $this->upload_dir.'/upgrades'; |
|
| 613 | + $base_tmp_upgrade_dir = "$base_upgrade_dir/temp"; |
|
| 614 | 614 | if(is_file($found->filename)){ |
| 615 | 615 | if(!isset($GLOBALS['mi_remove_tables']))$GLOBALS['mi_remove_tables'] = true; |
| 616 | 616 | $unzip_dir = mk_temp_dir( $base_tmp_upgrade_dir ); |
@@ -625,7 +625,7 @@ discard block |
||
| 625 | 625 | //file(s_ have been deleted or are not found in the directory, allow database delete to happen but no need to change filesystem |
| 626 | 626 | $found->delete(); |
| 627 | 627 | } |
| 628 | - } |
|
| 628 | + } |
|
| 629 | 629 | } |
| 630 | 630 | |
| 631 | 631 | function getUITextForType( $type ){ |
@@ -686,10 +686,10 @@ discard block |
||
| 686 | 686 | $content_values = array_values($uContent); |
| 687 | 687 | $alreadyProcessed = array(); |
| 688 | 688 | foreach($content_values as $val){ |
| 689 | - if(empty($alreadyProcessed[$val])){ |
|
| 690 | - $upgrade_contents[] = $val; |
|
| 691 | - $alreadyProcessed[$val] = true; |
|
| 692 | - } |
|
| 689 | + if(empty($alreadyProcessed[$val])){ |
|
| 690 | + $upgrade_contents[] = $val; |
|
| 691 | + $alreadyProcessed[$val] = true; |
|
| 692 | + } |
|
| 693 | 693 | } |
| 694 | 694 | |
| 695 | 695 | $upgrades_available = 0; |
@@ -703,35 +703,35 @@ discard block |
||
| 703 | 703 | $the_base = basename($upgrade_content); |
| 704 | 704 | $the_md5 = md5_file($upgrade_content); |
| 705 | 705 | $md5_matches = $uh->findByMd5($the_md5); |
| 706 | - $file_install = $upgrade_content; |
|
| 706 | + $file_install = $upgrade_content; |
|
| 707 | 707 | if(empty($md5_matches)) |
| 708 | 708 | { |
| 709 | 709 | $target_manifest = remove_file_extension( $upgrade_content ) . '-manifest.php'; |
| 710 | 710 | if(file_exists($target_manifest)) { |
| 711 | - require_once($target_manifest); |
|
| 712 | - |
|
| 713 | - $name = empty($manifest['name']) ? $upgrade_content : $manifest['name']; |
|
| 714 | - $version = empty($manifest['version']) ? '' : $manifest['version']; |
|
| 715 | - $published_date = empty($manifest['published_date']) ? '' : $manifest['published_date']; |
|
| 716 | - $icon = ''; |
|
| 717 | - $description = empty($manifest['description']) ? 'None' : $manifest['description']; |
|
| 718 | - $uninstallable = empty($manifest['is_uninstallable']) ? 'No' : 'Yes'; |
|
| 719 | - $type = $this->getUITextForType( $manifest['type'] ); |
|
| 720 | - $manifest_type = $manifest['type']; |
|
| 721 | - $dependencies = array(); |
|
| 722 | - if( isset( $manifest['dependencies']) ){ |
|
| 723 | - $dependencies = $manifest['dependencies']; |
|
| 724 | - } |
|
| 711 | + require_once($target_manifest); |
|
| 712 | + |
|
| 713 | + $name = empty($manifest['name']) ? $upgrade_content : $manifest['name']; |
|
| 714 | + $version = empty($manifest['version']) ? '' : $manifest['version']; |
|
| 715 | + $published_date = empty($manifest['published_date']) ? '' : $manifest['published_date']; |
|
| 716 | + $icon = ''; |
|
| 717 | + $description = empty($manifest['description']) ? 'None' : $manifest['description']; |
|
| 718 | + $uninstallable = empty($manifest['is_uninstallable']) ? 'No' : 'Yes'; |
|
| 719 | + $type = $this->getUITextForType( $manifest['type'] ); |
|
| 720 | + $manifest_type = $manifest['type']; |
|
| 721 | + $dependencies = array(); |
|
| 722 | + if( isset( $manifest['dependencies']) ){ |
|
| 723 | + $dependencies = $manifest['dependencies']; |
|
| 724 | + } |
|
| 725 | 725 | } |
| 726 | 726 | |
| 727 | - //check dependencies first |
|
| 728 | - if(!empty($dependencies)) { |
|
| 729 | - $uh = new UpgradeHistory(); |
|
| 730 | - $not_found = $uh->checkDependencies($dependencies); |
|
| 731 | - if(!empty($not_found) && count($not_found) > 0){ |
|
| 732 | - $file_install = 'errors_'.$mod_strings['ERR_UW_NO_DEPENDENCY']."[".implode(',', $not_found)."]"; |
|
| 733 | - } |
|
| 734 | - } |
|
| 727 | + //check dependencies first |
|
| 728 | + if(!empty($dependencies)) { |
|
| 729 | + $uh = new UpgradeHistory(); |
|
| 730 | + $not_found = $uh->checkDependencies($dependencies); |
|
| 731 | + if(!empty($not_found) && count($not_found) > 0){ |
|
| 732 | + $file_install = 'errors_'.$mod_strings['ERR_UW_NO_DEPENDENCY']."[".implode(',', $not_found)."]"; |
|
| 733 | + } |
|
| 734 | + } |
|
| 735 | 735 | |
| 736 | 736 | if($view == 'default' && $manifest_type != 'patch') { |
| 737 | 737 | continue; |
@@ -752,8 +752,8 @@ discard block |
||
| 752 | 752 | $upgrades_available++; |
| 753 | 753 | |
| 754 | 754 | $packages[] = array('name' => $name, 'version' => $version, 'published_date' => $published_date, |
| 755 | - 'description' => $description, 'uninstallable' =>$uninstallable, 'type' => $type, |
|
| 756 | - 'file' => fileToHash($upgrade_content), 'file_install' => fileToHash($upgrade_content), 'unFile' => fileToHash($upgrade_content)); |
|
| 755 | + 'description' => $description, 'uninstallable' =>$uninstallable, 'type' => $type, |
|
| 756 | + 'file' => fileToHash($upgrade_content), 'file_install' => fileToHash($upgrade_content), 'unFile' => fileToHash($upgrade_content)); |
|
| 757 | 757 | }//fi |
| 758 | 758 | }//rof |
| 759 | 759 | return $packages; |
@@ -781,112 +781,112 @@ discard block |
||
| 781 | 781 | * @return an array of installed upgrade_history objects |
| 782 | 782 | */ |
| 783 | 783 | function getInstalled($types = array('module')){ |
| 784 | - $uh = new UpgradeHistory(); |
|
| 785 | - $in = ""; |
|
| 786 | - for($i = 0; $i < count($types); $i++){ |
|
| 787 | - $in .= "'".$types[$i]."'"; |
|
| 788 | - if(($i+1) < count($types)){ |
|
| 789 | - $in .= ","; |
|
| 790 | - } |
|
| 791 | - } |
|
| 792 | - $query = "SELECT * FROM ".$uh->table_name." WHERE type IN (".$in.")"; |
|
| 793 | - return $uh->getList($query); |
|
| 784 | + $uh = new UpgradeHistory(); |
|
| 785 | + $in = ""; |
|
| 786 | + for($i = 0; $i < count($types); $i++){ |
|
| 787 | + $in .= "'".$types[$i]."'"; |
|
| 788 | + if(($i+1) < count($types)){ |
|
| 789 | + $in .= ","; |
|
| 790 | + } |
|
| 791 | + } |
|
| 792 | + $query = "SELECT * FROM ".$uh->table_name." WHERE type IN (".$in.")"; |
|
| 793 | + return $uh->getList($query); |
|
| 794 | 794 | } |
| 795 | 795 | |
| 796 | 796 | function getinstalledPackages($types = array('module', 'langpack')){ |
| 797 | - global $sugar_config; |
|
| 798 | - $installeds = $this->getInstalled($types); |
|
| 799 | - $packages = array(); |
|
| 800 | - $upgrades_installed = 0; |
|
| 801 | - $uh = new UpgradeHistory(); |
|
| 797 | + global $sugar_config; |
|
| 798 | + $installeds = $this->getInstalled($types); |
|
| 799 | + $packages = array(); |
|
| 800 | + $upgrades_installed = 0; |
|
| 801 | + $uh = new UpgradeHistory(); |
|
| 802 | 802 | $base_upgrade_dir = $this->upload_dir.'/upgrades'; |
| 803 | 803 | $base_tmp_upgrade_dir = "$base_upgrade_dir/temp"; |
| 804 | - foreach($installeds as $installed) |
|
| 805 | - { |
|
| 806 | - $populate = false; |
|
| 807 | - $filename = from_html($installed->filename); |
|
| 808 | - $date_entered = $installed->date_entered; |
|
| 809 | - $type = $installed->type; |
|
| 810 | - $version = $installed->version; |
|
| 811 | - $uninstallable = false; |
|
| 812 | - $link = ""; |
|
| 813 | - $description = $installed->description; |
|
| 814 | - $name = $installed->name; |
|
| 815 | - $enabled = true; |
|
| 816 | - $enabled_string = 'ENABLED'; |
|
| 817 | - //if the name is empty then we should try to pull from manifest and populate upgrade_history_table |
|
| 818 | - if(empty($name)){ |
|
| 819 | - $populate = true; |
|
| 820 | - } |
|
| 821 | - $upgrades_installed++; |
|
| 822 | - switch($type) |
|
| 823 | - { |
|
| 824 | - case "theme": |
|
| 825 | - case "langpack": |
|
| 826 | - case "module": |
|
| 827 | - case "patch": |
|
| 828 | - if($populate){ |
|
| 829 | - $manifest_file = $this->extractManifest($filename, $base_tmp_upgrade_dir); |
|
| 830 | - require_once($manifest_file); |
|
| 831 | - $GLOBALS['log']->info("Filling in upgrade_history table"); |
|
| 832 | - $populate = false; |
|
| 833 | - if( isset( $manifest['name'] ) ){ |
|
| 834 | - $name = $manifest['name']; |
|
| 835 | - $installed->name = $name; |
|
| 836 | - } |
|
| 837 | - if( isset( $manifest['description'] ) ){ |
|
| 838 | - $description = $manifest['description']; |
|
| 839 | - $installed->description = $description; |
|
| 840 | - } |
|
| 841 | - if(isset($installdefs) && isset( $installdefs['id'] ) ){ |
|
| 842 | - $id_name = $installdefs['id']; |
|
| 843 | - $installed->id_name = $id_name; |
|
| 844 | - } |
|
| 845 | - |
|
| 846 | - $serial_manifest = array(); |
|
| 847 | - $serial_manifest['manifest'] = (isset($manifest) ? $manifest : ''); |
|
| 848 | - $serial_manifest['installdefs'] = (isset($installdefs) ? $installdefs : ''); |
|
| 849 | - $serial_manifest['upgrade_manifest'] = (isset($upgrade_manifest) ? $upgrade_manifest : ''); |
|
| 850 | - $installed->manifest = base64_encode(serialize($serial_manifest)); |
|
| 851 | - $installed->save(); |
|
| 852 | - }else{ |
|
| 853 | - $serial_manifest = unserialize(base64_decode($installed->manifest)); |
|
| 854 | - $manifest = $serial_manifest['manifest']; |
|
| 855 | - } |
|
| 856 | - if(($upgrades_installed==0 || $uh->UninstallAvailable($installeds, $installed)) |
|
| 857 | - && is_file($filename) && !empty($manifest['is_uninstallable'])) |
|
| 858 | - { |
|
| 859 | - $uninstallable = true; |
|
| 860 | - } |
|
| 861 | - $enabled = $installed->enabled; |
|
| 862 | - if(!$enabled) |
|
| 863 | - $enabled_string = 'DISABLED'; |
|
| 864 | - $file_uninstall = $filename; |
|
| 865 | - if(!$uninstallable){ |
|
| 866 | - $file_uninstall = 'UNINSTALLABLE'; |
|
| 867 | - $enabled_string = 'UNINSTALLABLE'; |
|
| 868 | - } else { |
|
| 869 | - $file_uninstall = fileToHash( $file_uninstall ); |
|
| 870 | - } |
|
| 871 | - |
|
| 872 | - $packages[] = array( |
|
| 873 | - 'name' => $name, |
|
| 874 | - 'version' => $version, |
|
| 875 | - 'type' => $type, |
|
| 876 | - 'published_date' => $date_entered, |
|
| 877 | - 'description' => $description, |
|
| 878 | - 'uninstallable' =>$uninstallable, |
|
| 879 | - 'file_install' => $file_uninstall , |
|
| 880 | - 'file' => fileToHash($filename), |
|
| 881 | - 'enabled' => $enabled_string |
|
| 882 | - ); |
|
| 883 | - break; |
|
| 884 | - default: |
|
| 885 | - break; |
|
| 886 | - } |
|
| 887 | - |
|
| 888 | - }//rof |
|
| 889 | - return $packages; |
|
| 890 | - } |
|
| 891 | - } |
|
| 804 | + foreach($installeds as $installed) |
|
| 805 | + { |
|
| 806 | + $populate = false; |
|
| 807 | + $filename = from_html($installed->filename); |
|
| 808 | + $date_entered = $installed->date_entered; |
|
| 809 | + $type = $installed->type; |
|
| 810 | + $version = $installed->version; |
|
| 811 | + $uninstallable = false; |
|
| 812 | + $link = ""; |
|
| 813 | + $description = $installed->description; |
|
| 814 | + $name = $installed->name; |
|
| 815 | + $enabled = true; |
|
| 816 | + $enabled_string = 'ENABLED'; |
|
| 817 | + //if the name is empty then we should try to pull from manifest and populate upgrade_history_table |
|
| 818 | + if(empty($name)){ |
|
| 819 | + $populate = true; |
|
| 820 | + } |
|
| 821 | + $upgrades_installed++; |
|
| 822 | + switch($type) |
|
| 823 | + { |
|
| 824 | + case "theme": |
|
| 825 | + case "langpack": |
|
| 826 | + case "module": |
|
| 827 | + case "patch": |
|
| 828 | + if($populate){ |
|
| 829 | + $manifest_file = $this->extractManifest($filename, $base_tmp_upgrade_dir); |
|
| 830 | + require_once($manifest_file); |
|
| 831 | + $GLOBALS['log']->info("Filling in upgrade_history table"); |
|
| 832 | + $populate = false; |
|
| 833 | + if( isset( $manifest['name'] ) ){ |
|
| 834 | + $name = $manifest['name']; |
|
| 835 | + $installed->name = $name; |
|
| 836 | + } |
|
| 837 | + if( isset( $manifest['description'] ) ){ |
|
| 838 | + $description = $manifest['description']; |
|
| 839 | + $installed->description = $description; |
|
| 840 | + } |
|
| 841 | + if(isset($installdefs) && isset( $installdefs['id'] ) ){ |
|
| 842 | + $id_name = $installdefs['id']; |
|
| 843 | + $installed->id_name = $id_name; |
|
| 844 | + } |
|
| 845 | + |
|
| 846 | + $serial_manifest = array(); |
|
| 847 | + $serial_manifest['manifest'] = (isset($manifest) ? $manifest : ''); |
|
| 848 | + $serial_manifest['installdefs'] = (isset($installdefs) ? $installdefs : ''); |
|
| 849 | + $serial_manifest['upgrade_manifest'] = (isset($upgrade_manifest) ? $upgrade_manifest : ''); |
|
| 850 | + $installed->manifest = base64_encode(serialize($serial_manifest)); |
|
| 851 | + $installed->save(); |
|
| 852 | + }else{ |
|
| 853 | + $serial_manifest = unserialize(base64_decode($installed->manifest)); |
|
| 854 | + $manifest = $serial_manifest['manifest']; |
|
| 855 | + } |
|
| 856 | + if(($upgrades_installed==0 || $uh->UninstallAvailable($installeds, $installed)) |
|
| 857 | + && is_file($filename) && !empty($manifest['is_uninstallable'])) |
|
| 858 | + { |
|
| 859 | + $uninstallable = true; |
|
| 860 | + } |
|
| 861 | + $enabled = $installed->enabled; |
|
| 862 | + if(!$enabled) |
|
| 863 | + $enabled_string = 'DISABLED'; |
|
| 864 | + $file_uninstall = $filename; |
|
| 865 | + if(!$uninstallable){ |
|
| 866 | + $file_uninstall = 'UNINSTALLABLE'; |
|
| 867 | + $enabled_string = 'UNINSTALLABLE'; |
|
| 868 | + } else { |
|
| 869 | + $file_uninstall = fileToHash( $file_uninstall ); |
|
| 870 | + } |
|
| 871 | + |
|
| 872 | + $packages[] = array( |
|
| 873 | + 'name' => $name, |
|
| 874 | + 'version' => $version, |
|
| 875 | + 'type' => $type, |
|
| 876 | + 'published_date' => $date_entered, |
|
| 877 | + 'description' => $description, |
|
| 878 | + 'uninstallable' =>$uninstallable, |
|
| 879 | + 'file_install' => $file_uninstall , |
|
| 880 | + 'file' => fileToHash($filename), |
|
| 881 | + 'enabled' => $enabled_string |
|
| 882 | + ); |
|
| 883 | + break; |
|
| 884 | + default: |
|
| 885 | + break; |
|
| 886 | + } |
|
| 887 | + |
|
| 888 | + }//rof |
|
| 889 | + return $packages; |
|
| 890 | + } |
|
| 891 | + } |
|
| 892 | 892 | ?> |
@@ -67,8 +67,7 @@ discard block |
||
| 67 | 67 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 68 | 68 | if(isset($GLOBALS['log'])) { |
| 69 | 69 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 70 | - } |
|
| 71 | - else { |
|
| 70 | + } else { |
|
| 72 | 71 | trigger_error($deprecatedMessage, E_USER_DEPRECATED); |
| 73 | 72 | } |
| 74 | 73 | self::__construct(); |
@@ -88,7 +87,7 @@ discard block |
||
| 88 | 87 | if(!empty($name_value_list)){ |
| 89 | 88 | $name_value_list = PackageManager::fromNameValueList($name_value_list); |
| 90 | 89 | return $name_value_list['description']; |
| 91 | - }else { |
|
| 90 | + } else { |
|
| 92 | 91 | return ''; |
| 93 | 92 | } |
| 94 | 93 | } |
@@ -134,8 +133,9 @@ discard block |
||
| 134 | 133 | //check to see if we already this one installed |
| 135 | 134 | $result = $uh->determineIfUpgrade($myrelease['id_name'], $myrelease['version']); |
| 136 | 135 | $enable = false; |
| 137 | - if($result == true || is_array($result)) |
|
| 138 | - $enable = true; |
|
| 136 | + if($result == true || is_array($result)) { |
|
| 137 | + $enable = true; |
|
| 138 | + } |
|
| 139 | 139 | $nodes[$mypack['category_id']]['packages'][$mypack['id']]['releases'][$myrelease['id']] = array('id' => $myrelease['id'], 'version' => $myrelease['version'], 'label' => $myrelease['description'], 'category_id' => $mypack['category_id'], 'package_id' => $mypack['id'], 'type' => 'release', 'enable' => $enable); |
| 140 | 140 | } |
| 141 | 141 | } |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | $filepath = PackageManagerComm::performDownload($filename); |
| 214 | 214 | return $filepath; |
| 215 | 215 | } |
| 216 | - }else{ |
|
| 216 | + } else{ |
|
| 217 | 217 | return null; |
| 218 | 218 | } |
| 219 | 219 | } |
@@ -231,10 +231,11 @@ discard block |
||
| 231 | 231 | PackageManager::setCredentials($username, $password, $systemname); |
| 232 | 232 | PackageManagerComm::clearSession(); |
| 233 | 233 | $result = PackageManagerComm::login($terms_checked); |
| 234 | - if(is_array($result)) |
|
| 235 | - return $result; |
|
| 236 | - else |
|
| 237 | - return true; |
|
| 234 | + if(is_array($result)) { |
|
| 235 | + return $result; |
|
| 236 | + } else { |
|
| 237 | + return true; |
|
| 238 | + } |
|
| 238 | 239 | } |
| 239 | 240 | |
| 240 | 241 | function setCredentials($username, $password, $systemname){ |
@@ -285,7 +286,7 @@ discard block |
||
| 285 | 286 | if(!empty($release_id) || !empty($package_id)){ |
| 286 | 287 | $documents = PackageManagerComm::getDocumentation($package_id, $release_id); |
| 287 | 288 | return $documents; |
| 288 | - }else{ |
|
| 289 | + } else{ |
|
| 289 | 290 | return null; |
| 290 | 291 | } |
| 291 | 292 | } |
@@ -480,8 +481,9 @@ discard block |
||
| 480 | 481 | $base_tmp_upgrade_dir = "$base_upgrade_dir/temp"; |
| 481 | 482 | $manifest_file = $this->extractManifest( $base_filename,$base_tmp_upgrade_dir); |
| 482 | 483 | $GLOBALS['log']->debug("Manifest: ".$manifest_file); |
| 483 | - if($view == 'module') |
|
| 484 | - $license_file = $this->extractFile($base_filename, 'LICENSE.txt', $base_tmp_upgrade_dir); |
|
| 484 | + if($view == 'module') { |
|
| 485 | + $license_file = $this->extractFile($base_filename, 'LICENSE.txt', $base_tmp_upgrade_dir); |
|
| 486 | + } |
|
| 485 | 487 | if(is_file($manifest_file)){ |
| 486 | 488 | $GLOBALS['log']->debug("VALIDATING MANIFEST". $manifest_file); |
| 487 | 489 | require_once( $manifest_file ); |
@@ -492,14 +494,16 @@ discard block |
||
| 492 | 494 | if( $view == "module" ){ |
| 493 | 495 | if ($upgrade_zip_type != "module" && $upgrade_zip_type != "theme" && $upgrade_zip_type != "langpack"){ |
| 494 | 496 | $this->unlinkTempFiles(); |
| 495 | - if($display_messages) |
|
| 496 | - die($mod_strings['ERR_UW_NOT_ACCEPTIBLE_TYPE']); |
|
| 497 | + if($display_messages) { |
|
| 498 | + die($mod_strings['ERR_UW_NOT_ACCEPTIBLE_TYPE']); |
|
| 499 | + } |
|
| 497 | 500 | } |
| 498 | - }elseif( $view == "default" ){ |
|
| 501 | + } elseif( $view == "default" ){ |
|
| 499 | 502 | if($upgrade_zip_type != "patch" ){ |
| 500 | 503 | $this->unlinkTempFiles(); |
| 501 | - if($display_messages) |
|
| 502 | - die($mod_strings['ERR_UW_ONLY_PATCHES']); |
|
| 504 | + if($display_messages) { |
|
| 505 | + die($mod_strings['ERR_UW_ONLY_PATCHES']); |
|
| 506 | + } |
|
| 503 | 507 | } |
| 504 | 508 | } |
| 505 | 509 | |
@@ -517,20 +521,24 @@ discard block |
||
| 517 | 521 | |
| 518 | 522 | if( copy( $tempFile , $target_path ) ){ |
| 519 | 523 | copy( $manifest_file, $target_manifest ); |
| 520 | - if($display_messages) |
|
| 521 | - $messages = '<script>ajaxStatus.flashStatus("' .$base_filename.$mod_strings['LBL_UW_UPLOAD_SUCCESS'] . ', 5000");</script>'; |
|
| 522 | - }else{ |
|
| 523 | - if($display_messages) |
|
| 524 | - $messages = '<script>ajaxStatus.flashStatus("' .$mod_strings['ERR_UW_UPLOAD_ERROR'] . ', 5000");</script>'; |
|
| 524 | + if($display_messages) { |
|
| 525 | + $messages = '<script>ajaxStatus.flashStatus("' .$base_filename.$mod_strings['LBL_UW_UPLOAD_SUCCESS'] . ', 5000");</script>'; |
|
| 526 | + } |
|
| 527 | + } else{ |
|
| 528 | + if($display_messages) { |
|
| 529 | + $messages = '<script>ajaxStatus.flashStatus("' .$mod_strings['ERR_UW_UPLOAD_ERROR'] . ', 5000");</script>'; |
|
| 530 | + } |
|
| 525 | 531 | } |
| 526 | 532 | }//fi |
| 527 | 533 | else{ |
| 528 | 534 | $this->unlinkTempFiles(); |
| 529 | - if($display_messages) |
|
| 530 | - die($mod_strings['ERR_UW_NO_MANIFEST']); |
|
| 535 | + if($display_messages) { |
|
| 536 | + die($mod_strings['ERR_UW_NO_MANIFEST']); |
|
| 537 | + } |
|
| 538 | + } |
|
| 539 | + if(isset($messages)) { |
|
| 540 | + return $messages; |
|
| 531 | 541 | } |
| 532 | - if(isset($messages)) |
|
| 533 | - return $messages; |
|
| 534 | 542 | } |
| 535 | 543 | |
| 536 | 544 | function unlinkTempFiles() { |
@@ -568,14 +576,15 @@ discard block |
||
| 568 | 576 | $version = $manifest['version']; |
| 569 | 577 | $uh = new UpgradeHistory(); |
| 570 | 578 | $previous_install = array(); |
| 571 | - if(!empty($id_name) & !empty($version)) |
|
| 572 | - $previous_install = $uh->determineIfUpgrade($id_name, $version); |
|
| 579 | + if(!empty($id_name) & !empty($version)) { |
|
| 580 | + $previous_install = $uh->determineIfUpgrade($id_name, $version); |
|
| 581 | + } |
|
| 573 | 582 | $previous_version = (empty($previous_install['version'])) ? '' : $previous_install['version']; |
| 574 | 583 | $previous_id = (empty($previous_install['id'])) ? '' : $previous_install['id']; |
| 575 | 584 | |
| 576 | 585 | if(!empty($previous_version)){ |
| 577 | 586 | $mi->install($unzip_dir, true, $previous_version); |
| 578 | - }else{ |
|
| 587 | + } else{ |
|
| 579 | 588 | $mi->install($unzip_dir); |
| 580 | 589 | } |
| 581 | 590 | $GLOBALS['log']->debug("INSTALLED: ".$file); |
@@ -612,7 +621,9 @@ discard block |
||
| 612 | 621 | $base_upgrade_dir = $this->upload_dir.'/upgrades'; |
| 613 | 622 | $base_tmp_upgrade_dir = "$base_upgrade_dir/temp"; |
| 614 | 623 | if(is_file($found->filename)){ |
| 615 | - if(!isset($GLOBALS['mi_remove_tables']))$GLOBALS['mi_remove_tables'] = true; |
|
| 624 | + if(!isset($GLOBALS['mi_remove_tables'])) { |
|
| 625 | + $GLOBALS['mi_remove_tables'] = true; |
|
| 626 | + } |
|
| 616 | 627 | $unzip_dir = mk_temp_dir( $base_tmp_upgrade_dir ); |
| 617 | 628 | unzip($found->filename, $unzip_dir ); |
| 618 | 629 | $mi = new ModuleInstaller(); |
@@ -621,7 +632,7 @@ discard block |
||
| 621 | 632 | $found->delete(); |
| 622 | 633 | unlink(remove_file_extension( $found->filename ) . '-manifest.php'); |
| 623 | 634 | unlink($found->filename); |
| 624 | - }else{ |
|
| 635 | + } else{ |
|
| 625 | 636 | //file(s_ have been deleted or are not found in the directory, allow database delete to happen but no need to change filesystem |
| 626 | 637 | $found->delete(); |
| 627 | 638 | } |
@@ -767,7 +778,7 @@ discard block |
||
| 767 | 778 | if(is_file($license_file)){ |
| 768 | 779 | $contents = file_get_contents($license_file); |
| 769 | 780 | return $contents; |
| 770 | - }else{ |
|
| 781 | + } else{ |
|
| 771 | 782 | return null; |
| 772 | 783 | } |
| 773 | 784 | } |
@@ -849,7 +860,7 @@ discard block |
||
| 849 | 860 | $serial_manifest['upgrade_manifest'] = (isset($upgrade_manifest) ? $upgrade_manifest : ''); |
| 850 | 861 | $installed->manifest = base64_encode(serialize($serial_manifest)); |
| 851 | 862 | $installed->save(); |
| 852 | - }else{ |
|
| 863 | + } else{ |
|
| 853 | 864 | $serial_manifest = unserialize(base64_decode($installed->manifest)); |
| 854 | 865 | $manifest = $serial_manifest['manifest']; |
| 855 | 866 | } |
@@ -859,8 +870,9 @@ discard block |
||
| 859 | 870 | $uninstallable = true; |
| 860 | 871 | } |
| 861 | 872 | $enabled = $installed->enabled; |
| 862 | - if(!$enabled) |
|
| 863 | - $enabled_string = 'DISABLED'; |
|
| 873 | + if(!$enabled) { |
|
| 874 | + $enabled_string = 'DISABLED'; |
|
| 875 | + } |
|
| 864 | 876 | $file_uninstall = $filename; |
| 865 | 877 | if(!$uninstallable){ |
| 866 | 878 | $file_uninstall = 'UNINSTALLABLE'; |
@@ -1,6 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if (! defined ( 'sugarEntry' ) || ! sugarEntry) |
|
| 2 | +if (! defined ( 'sugarEntry' ) || ! sugarEntry) { |
|
| 3 | 3 | die ( 'Not A Valid Entry Point' ) ; |
| 4 | +} |
|
| 4 | 5 | |
| 5 | 6 | /********************************************************************************* |
| 6 | 7 | * SugarCRM Community Edition is a customer relationship management program developed by |
@@ -58,8 +59,7 @@ discard block |
||
| 58 | 59 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 59 | 60 | if(isset($GLOBALS['log'])) { |
| 60 | 61 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 61 | - } |
|
| 62 | - else { |
|
| 62 | + } else { |
|
| 63 | 63 | trigger_error($deprecatedMessage, E_USER_DEPRECATED); |
| 64 | 64 | } |
| 65 | 65 | self::__construct($module); |
@@ -117,9 +117,12 @@ discard block |
||
| 117 | 117 | */ |
| 118 | 118 | function buildCache($module = false, $saveCache=true) { |
| 119 | 119 | //We can't build the cache while installing as the required database tables may not exist. |
| 120 | - if (!empty($GLOBALS['installing']) && $GLOBALS['installing'] == true|| empty($GLOBALS['db'])) |
|
| 120 | + if (!empty($GLOBALS['installing']) && $GLOBALS['installing'] == true|| empty($GLOBALS['db'])) { |
|
| 121 | + return false; |
|
| 122 | + } |
|
| 123 | + if($module == '../data') { |
|
| 121 | 124 | return false; |
| 122 | - if($module == '../data')return false; |
|
| 125 | + } |
|
| 123 | 126 | |
| 124 | 127 | static $results = array ( ) ; |
| 125 | 128 | |
@@ -127,8 +130,7 @@ discard block |
||
| 127 | 130 | if (! empty ( $module )) { |
| 128 | 131 | $where .= " custom_module='$module' AND "; |
| 129 | 132 | unset( $results[ $module ] ) ; // clear out any old results for the module as $results is declared static |
| 130 | - } |
|
| 131 | - else |
|
| 133 | + } else |
|
| 132 | 134 | { |
| 133 | 135 | $results = array ( ) ; // clear out results - if we remove a module we don't want to have its old vardefs hanging around |
| 134 | 136 | } |
@@ -152,10 +154,12 @@ discard block |
||
| 152 | 154 | $vardef = $field->get_field_def (); |
| 153 | 155 | $vardef ['id'] = $row ['id']; |
| 154 | 156 | $vardef ['custom_module'] = $row ['custom_module']; |
| 155 | - if (empty ( $vardef ['source'] )) |
|
| 156 | - $vardef ['source'] = 'custom_fields'; |
|
| 157 | - if (empty ( $results [$row ['custom_module']] )) |
|
| 158 | - $results [$row ['custom_module']] = array ( ); |
|
| 157 | + if (empty ( $vardef ['source'] )) { |
|
| 158 | + $vardef ['source'] = 'custom_fields'; |
|
| 159 | + } |
|
| 160 | + if (empty ( $results [$row ['custom_module']] )) { |
|
| 161 | + $results [$row ['custom_module']] = array ( ); |
|
| 162 | + } |
|
| 159 | 163 | $results [$row ['custom_module']] [$row ['name']] = $vardef; |
| 160 | 164 | } |
| 161 | 165 | if (empty ( $module )) { |
@@ -165,7 +169,7 @@ discard block |
||
| 165 | 169 | } else { |
| 166 | 170 | if (! empty ( $results [$module] )) { |
| 167 | 171 | $this->saveToVardef ( $module, $results [$module], $saveCache); |
| 168 | - }else{ |
|
| 172 | + } else{ |
|
| 169 | 173 | $this->saveToVardef ( $module, false, $saveCache); |
| 170 | 174 | } |
| 171 | 175 | } |
@@ -210,7 +214,9 @@ discard block |
||
| 210 | 214 | //if the vardef isn't loaded let's try loading it. |
| 211 | 215 | VardefManager::refreshVardefs($module,$object, null, false); |
| 212 | 216 | //if it's still not loaded we really don't have anything useful to cache |
| 213 | - if(empty($GLOBALS['dictionary'][$object]['fields']))return; |
|
| 217 | + if(empty($GLOBALS['dictionary'][$object]['fields'])) { |
|
| 218 | + return; |
|
| 219 | + } |
|
| 214 | 220 | } |
| 215 | 221 | if (!isset($GLOBALS['dictionary'][$object]['custom_fields'])) { |
| 216 | 222 | $GLOBALS['dictionary'][$object]['custom_fields'] = false; |
@@ -280,8 +286,7 @@ discard block |
||
| 280 | 286 | if (empty($expandedList) ) |
| 281 | 287 | { |
| 282 | 288 | $select = ",{$this->bean->table_name}_cstm.*" ; |
| 283 | - } |
|
| 284 | - else |
|
| 289 | + } else |
|
| 285 | 290 | { |
| 286 | 291 | $select = ''; |
| 287 | 292 | $isList = is_array($expandedList); |
@@ -290,8 +295,9 @@ discard block |
||
| 290 | 295 | if (!empty($field['source']) && $field['source'] == 'custom_fields' && (!$isList || !empty($expandedList[$name]))){ |
| 291 | 296 | // assumption: that the column name in _cstm is the same as the field name. Currently true. |
| 292 | 297 | // however, two types of dynamic fields do not have columns in the custom table - html fields (they're readonly) and flex relates (parent_name doesn't exist) |
| 293 | - if ( $field['type'] != 'html' && $name != 'parent_name') |
|
| 294 | - $select .= ",{$this->bean->table_name}_cstm.{$name}" ; |
|
| 298 | + if ( $field['type'] != 'html' && $name != 'parent_name') { |
|
| 299 | + $select .= ",{$this->bean->table_name}_cstm.{$name}" ; |
|
| 300 | + } |
|
| 295 | 301 | } |
| 296 | 302 | } |
| 297 | 303 | } |
@@ -346,8 +352,7 @@ discard block |
||
| 346 | 352 | else if(!empty($rel_mod->field_defs['name']['source']) && $rel_mod->field_defs['name']['source'] == "non-db" && !empty($field_def['rname'])) |
| 347 | 353 | { |
| 348 | 354 | $name_field = "$joinTableAlias." . $field_def['rname']; |
| 349 | - } |
|
| 350 | - else |
|
| 355 | + } else |
|
| 351 | 356 | { |
| 352 | 357 | $name_field = "$joinTableAlias.name"; |
| 353 | 358 | } |
@@ -369,12 +374,16 @@ discard block |
||
| 369 | 374 | function fill_relationships(){ |
| 370 | 375 | global $beanList, $beanFiles; |
| 371 | 376 | if(!empty($this->bean->relDepth)) { |
| 372 | - if($this->bean->relDepth > 1)return; |
|
| 373 | - }else{ |
|
| 377 | + if($this->bean->relDepth > 1) { |
|
| 378 | + return; |
|
| 379 | + } |
|
| 380 | + } else{ |
|
| 374 | 381 | $this->bean->relDepth = 0; |
| 375 | 382 | } |
| 376 | 383 | foreach($this->bean->field_defs as $field){ |
| 377 | - if(empty($field['source']) || $field['source'] != 'custom_fields')continue; |
|
| 384 | + if(empty($field['source']) || $field['source'] != 'custom_fields') { |
|
| 385 | + continue; |
|
| 386 | + } |
|
| 378 | 387 | if($field['type'] == 'relate'){ |
| 379 | 388 | $related_module =$field['ext2']; |
| 380 | 389 | $name = $field['name']; |
@@ -413,8 +422,12 @@ discard block |
||
| 413 | 422 | $first = true; |
| 414 | 423 | foreach($this->bean->field_defs as $name=>$field){ |
| 415 | 424 | |
| 416 | - if(empty($field['source']) || $field['source'] != 'custom_fields')continue; |
|
| 417 | - if($field['type'] == 'html' || $field['type'] == 'parent')continue; |
|
| 425 | + if(empty($field['source']) || $field['source'] != 'custom_fields') { |
|
| 426 | + continue; |
|
| 427 | + } |
|
| 428 | + if($field['type'] == 'html' || $field['type'] == 'parent') { |
|
| 429 | + continue; |
|
| 430 | + } |
|
| 418 | 431 | if(isset($this->bean->$name)){ |
| 419 | 432 | $quote = "'"; |
| 420 | 433 | |
@@ -423,16 +436,17 @@ discard block |
||
| 423 | 436 | if(!isset($this->bean->$name) || !is_numeric($this->bean->$name) ){ |
| 424 | 437 | if($field['required']){ |
| 425 | 438 | $this->bean->$name = 0; |
| 426 | - }else{ |
|
| 439 | + } else{ |
|
| 427 | 440 | $this->bean->$name = 'NULL'; |
| 428 | 441 | } |
| 429 | 442 | } |
| 430 | 443 | } |
| 431 | 444 | if ( $field['type'] == 'bool' ) { |
| 432 | - if ( $this->bean->$name === FALSE ) |
|
| 433 | - $this->bean->$name = '0'; |
|
| 434 | - elseif ( $this->bean->$name === TRUE ) |
|
| 435 | - $this->bean->$name = '1'; |
|
| 445 | + if ( $this->bean->$name === FALSE ) { |
|
| 446 | + $this->bean->$name = '0'; |
|
| 447 | + } elseif ( $this->bean->$name === TRUE ) { |
|
| 448 | + $this->bean->$name = '1'; |
|
| 449 | + } |
|
| 436 | 450 | } |
| 437 | 451 | |
| 438 | 452 | $val = $this->bean->$name; |
@@ -445,7 +459,7 @@ discard block |
||
| 445 | 459 | if($first){ |
| 446 | 460 | $query .= " $name=$quote".$GLOBALS['db']->quote($val)."$quote"; |
| 447 | 461 | |
| 448 | - }else{ |
|
| 462 | + } else{ |
|
| 449 | 463 | $query .= " ,$name=$quote".$GLOBALS['db']->quote($val)."$quote"; |
| 450 | 464 | } |
| 451 | 465 | } |
@@ -464,7 +478,7 @@ discard block |
||
| 464 | 478 | if(!$first){ |
| 465 | 479 | if(!$isUpdate){ |
| 466 | 480 | $GLOBALS['db']->query($queryInsert); |
| 467 | - }else{ |
|
| 481 | + } else{ |
|
| 468 | 482 | $checkquery = "SELECT id_c FROM {$this->bean->table_name}_cstm WHERE id_c = '{$this->bean->id}'"; |
| 469 | 483 | if ( $GLOBALS['db']->getOne($checkquery) ) { |
| 470 | 484 | $result = $GLOBALS['db']->query($query); |
@@ -499,8 +513,9 @@ discard block |
||
| 499 | 513 | |
| 500 | 514 | $GLOBALS['db']->query("DELETE FROM fields_meta_data WHERE id='" . $this->module . $widget->name . "'"); |
| 501 | 515 | $sql = $widget->get_db_delete_alter_table( $this->bean->table_name . "_cstm" ) ; |
| 502 | - if (! empty( $sql ) ) |
|
| 503 | - $GLOBALS['db']->query( $sql ); |
|
| 516 | + if (! empty( $sql ) ) { |
|
| 517 | + $GLOBALS['db']->query( $sql ); |
|
| 518 | + } |
|
| 504 | 519 | |
| 505 | 520 | $this->removeVardefExtension($widget); |
| 506 | 521 | VardefManager::clearVardef(); |
@@ -518,19 +533,21 @@ discard block |
||
| 518 | 533 | $name = $this->getDBName($name); |
| 519 | 534 | $vardefs = $GLOBALS['dictionary'][$this->bean->object_name]['fields']; |
| 520 | 535 | if(!empty($vardefs)){ |
| 521 | - if(empty($type) && empty($name)) |
|
| 522 | - return false; |
|
| 523 | - else if(empty($type)) |
|
| 524 | - return !empty($vardefs[$name]); |
|
| 525 | - else if(empty($name)){ |
|
| 536 | + if(empty($type) && empty($name)) { |
|
| 537 | + return false; |
|
| 538 | + } else if(empty($type)) { |
|
| 539 | + return !empty($vardefs[$name]); |
|
| 540 | + } else if(empty($name)){ |
|
| 526 | 541 | foreach($vardefs as $def){ |
| 527 | - if(!empty($def['type']) && $def['type'] == $type) |
|
| 528 | - return true; |
|
| 542 | + if(!empty($def['type']) && $def['type'] == $type) { |
|
| 543 | + return true; |
|
| 544 | + } |
|
| 529 | 545 | } |
| 530 | 546 | return false; |
| 531 | - }else |
|
| 532 | - return (!empty($vardefs[$name]) && ($vardefs[$name]['type'] == $type)); |
|
| 533 | - }else{ |
|
| 547 | + } else { |
|
| 548 | + return (!empty($vardefs[$name]) && ($vardefs[$name]['type'] == $type)); |
|
| 549 | + } |
|
| 550 | + } else{ |
|
| 534 | 551 | return false; |
| 535 | 552 | } |
| 536 | 553 | } |
@@ -553,7 +570,7 @@ discard block |
||
| 553 | 570 | $label = strtoupper( $field->label ); |
| 554 | 571 | if(!empty($id)){ |
| 555 | 572 | $is_update = true; |
| 556 | - }else{ |
|
| 573 | + } else{ |
|
| 557 | 574 | $db_name = $this->getDBName($field->name); |
| 558 | 575 | $field->name = $db_name; |
| 559 | 576 | } |
@@ -564,8 +581,10 @@ discard block |
||
| 564 | 581 | $fmd->vname = $label; |
| 565 | 582 | $fmd->type = $field->type; |
| 566 | 583 | $fmd->help = $field->help; |
| 567 | - if (!empty($field->len)) |
|
| 568 | - $fmd->len = $field->len; // tyoung bug 15407 - was being set to $field->size so changes weren't being saved |
|
| 584 | + if (!empty($field->len)) { |
|
| 585 | + $fmd->len = $field->len; |
|
| 586 | + } |
|
| 587 | + // tyoung bug 15407 - was being set to $field->size so changes weren't being saved |
|
| 569 | 588 | $fmd->required = ($field->required ? 1 : 0); |
| 570 | 589 | $fmd->default_value = $field->default; |
| 571 | 590 | $fmd->ext1 = $field->ext1; |
@@ -605,7 +624,7 @@ discard block |
||
| 605 | 624 | $GLOBALS['db']->query($query, true, "Cannot set default"); |
| 606 | 625 | } |
| 607 | 626 | } |
| 608 | - }else{ |
|
| 627 | + } else{ |
|
| 609 | 628 | $query = $field->get_db_modify_alter_table($this->bean->table_name . '_cstm'); |
| 610 | 629 | if(!empty($query)){ |
| 611 | 630 | $GLOBALS['db']->query($query, true, "Cannot modify field"); |
@@ -685,16 +704,16 @@ discard block |
||
| 685 | 704 | |
| 686 | 705 | $out .= "\n ?>"; |
| 687 | 706 | |
| 688 | - if (!file_exists($this->base_path)) |
|
| 689 | - mkdir_recursive($this->base_path); |
|
| 707 | + if (!file_exists($this->base_path)) { |
|
| 708 | + mkdir_recursive($this->base_path); |
|
| 709 | + } |
|
| 690 | 710 | |
| 691 | 711 | if( $fh = @sugar_fopen( $file_loc, 'w' ) ) |
| 692 | 712 | { |
| 693 | 713 | fputs( $fh, $out); |
| 694 | 714 | fclose( $fh ); |
| 695 | 715 | return true ; |
| 696 | - } |
|
| 697 | - else |
|
| 716 | + } else |
|
| 698 | 717 | { |
| 699 | 718 | return false ; |
| 700 | 719 | } |
@@ -815,8 +834,9 @@ discard block |
||
| 815 | 834 | $out = ""; |
| 816 | 835 | if($this->bean->hasCustomFields()){ |
| 817 | 836 | foreach($this->bean->field_defs as $name=>$data){ |
| 818 | - if(empty($data['source']) || $data['source'] != 'custom_fields') |
|
| 819 | - continue; |
|
| 837 | + if(empty($data['source']) || $data['source'] != 'custom_fields') { |
|
| 838 | + continue; |
|
| 839 | + } |
|
| 820 | 840 | $out .= $this->add_existing_custom_field($data, $execute); |
| 821 | 841 | } |
| 822 | 842 | } |
@@ -831,8 +851,9 @@ discard block |
||
| 831 | 851 | $query = "/*MISSING IN DATABASE - {$data['name']} - ROW*/\n" |
| 832 | 852 | . $field->get_db_add_alter_table($this->bean->table_name . '_cstm'); |
| 833 | 853 | $out = $query . "\n"; |
| 834 | - if ($execute) |
|
| 835 | - $GLOBALS['db']->query($query); |
|
| 854 | + if ($execute) { |
|
| 855 | + $GLOBALS['db']->query($query); |
|
| 856 | + } |
|
| 836 | 857 | |
| 837 | 858 | return $out; |
| 838 | 859 | } |
@@ -841,16 +862,18 @@ discard block |
||
| 841 | 862 | { |
| 842 | 863 | $out = $this->createCustomTable($execute); |
| 843 | 864 | //If the table didn't exist, createCustomTable will have returned all the SQL to create and populate it |
| 844 | - if (!empty($out)) |
|
| 845 | - return "/*Checking Custom Fields for module : {$this->module} */\n$out"; |
|
| 865 | + if (!empty($out)) { |
|
| 866 | + return "/*Checking Custom Fields for module : {$this->module} */\n$out"; |
|
| 867 | + } |
|
| 846 | 868 | //Otherwise make sure all the custom fields defined in the vardefs exist in the custom table. |
| 847 | 869 | //We aren't checking for data types, just that the column exists. |
| 848 | 870 | $db = $GLOBALS['db']; |
| 849 | 871 | $tablename = $this->bean->table_name."_cstm"; |
| 850 | 872 | $compareFieldDefs = $db->get_columns($tablename); |
| 851 | 873 | foreach($this->bean->field_defs as $name=>$data){ |
| 852 | - if(empty($data['source']) || $data['source'] != 'custom_fields') |
|
| 853 | - continue; |
|
| 874 | + if(empty($data['source']) || $data['source'] != 'custom_fields') { |
|
| 875 | + continue; |
|
| 876 | + } |
|
| 854 | 877 | /** |
| 855 | 878 | * @bug 43471 |
| 856 | 879 | * @issue 43471 |
@@ -864,8 +887,9 @@ discard block |
||
| 864 | 887 | } |
| 865 | 888 | $out .= $this->add_existing_custom_field($data, $execute); |
| 866 | 889 | } |
| 867 | - if (!empty($out)) |
|
| 868 | - $out = "/*Checking Custom Fields for module : {$this->module} */\n$out"; |
|
| 890 | + if (!empty($out)) { |
|
| 891 | + $out = "/*Checking Custom Fields for module : {$this->module} */\n$out"; |
|
| 892 | + } |
|
| 869 | 893 | |
| 870 | 894 | return $out; |
| 871 | 895 | } |
@@ -51,75 +51,75 @@ discard block |
||
| 51 | 51 | |
| 52 | 52 | |
| 53 | 53 | class FieldsMetaData extends SugarBean { |
| 54 | - // database table columns |
|
| 55 | - var $id; |
|
| 56 | - var $name; |
|
| 57 | - var $vname; |
|
| 58 | - var $custom_module; |
|
| 59 | - var $type; |
|
| 60 | - var $len; |
|
| 61 | - var $required; |
|
| 62 | - var $default_value; |
|
| 63 | - var $deleted; |
|
| 64 | - var $ext1; |
|
| 65 | - var $ext2; |
|
| 66 | - var $ext3; |
|
| 67 | - var $audited; |
|
| 68 | - var $inline_edit; |
|
| 54 | + // database table columns |
|
| 55 | + var $id; |
|
| 56 | + var $name; |
|
| 57 | + var $vname; |
|
| 58 | + var $custom_module; |
|
| 59 | + var $type; |
|
| 60 | + var $len; |
|
| 61 | + var $required; |
|
| 62 | + var $default_value; |
|
| 63 | + var $deleted; |
|
| 64 | + var $ext1; |
|
| 65 | + var $ext2; |
|
| 66 | + var $ext3; |
|
| 67 | + var $audited; |
|
| 68 | + var $inline_edit; |
|
| 69 | 69 | var $duplicate_merge; |
| 70 | 70 | var $reportable; |
| 71 | - var $required_fields = array("name"=>1, "date_start"=>2, "time_start"=>3,); |
|
| 72 | - |
|
| 73 | - var $table_name = 'fields_meta_data'; |
|
| 74 | - var $object_name = 'FieldsMetaData'; |
|
| 75 | - var $module_dir = 'DynamicFields'; |
|
| 76 | - var $column_fields = array( |
|
| 77 | - 'id', |
|
| 78 | - 'name', |
|
| 79 | - 'vname', |
|
| 80 | - 'custom_module', |
|
| 81 | - 'type', |
|
| 82 | - 'len', |
|
| 83 | - 'required', |
|
| 84 | - 'default_value', |
|
| 85 | - 'deleted', |
|
| 86 | - 'ext1', |
|
| 87 | - 'ext2', |
|
| 88 | - 'ext3', |
|
| 89 | - 'audited', |
|
| 90 | - 'inline_edit', |
|
| 91 | - 'massupdate', |
|
| 71 | + var $required_fields = array("name"=>1, "date_start"=>2, "time_start"=>3,); |
|
| 72 | + |
|
| 73 | + var $table_name = 'fields_meta_data'; |
|
| 74 | + var $object_name = 'FieldsMetaData'; |
|
| 75 | + var $module_dir = 'DynamicFields'; |
|
| 76 | + var $column_fields = array( |
|
| 77 | + 'id', |
|
| 78 | + 'name', |
|
| 79 | + 'vname', |
|
| 80 | + 'custom_module', |
|
| 81 | + 'type', |
|
| 82 | + 'len', |
|
| 83 | + 'required', |
|
| 84 | + 'default_value', |
|
| 85 | + 'deleted', |
|
| 86 | + 'ext1', |
|
| 87 | + 'ext2', |
|
| 88 | + 'ext3', |
|
| 89 | + 'audited', |
|
| 90 | + 'inline_edit', |
|
| 91 | + 'massupdate', |
|
| 92 | 92 | 'duplicate_merge', |
| 93 | 93 | 'reportable', |
| 94 | - ); |
|
| 95 | - |
|
| 96 | - var $list_fields = array( |
|
| 97 | - 'id', |
|
| 98 | - 'name', |
|
| 99 | - 'vname', |
|
| 100 | - 'type', |
|
| 101 | - 'len', |
|
| 102 | - 'required', |
|
| 103 | - 'default_value', |
|
| 104 | - 'audited', |
|
| 94 | + ); |
|
| 95 | + |
|
| 96 | + var $list_fields = array( |
|
| 97 | + 'id', |
|
| 98 | + 'name', |
|
| 99 | + 'vname', |
|
| 100 | + 'type', |
|
| 101 | + 'len', |
|
| 102 | + 'required', |
|
| 103 | + 'default_value', |
|
| 104 | + 'audited', |
|
| 105 | 105 | 'inline_edit', |
| 106 | - 'massupdate', |
|
| 106 | + 'massupdate', |
|
| 107 | 107 | 'duplicate_merge', |
| 108 | 108 | 'reportable', |
| 109 | - ); |
|
| 109 | + ); |
|
| 110 | 110 | |
| 111 | - var $field_name_map; |
|
| 112 | - var $new_schema = true; |
|
| 111 | + var $field_name_map; |
|
| 112 | + var $new_schema = true; |
|
| 113 | 113 | |
| 114 | - ////////////////////////////////////////////////////////////////// |
|
| 115 | - // METHODS |
|
| 116 | - ////////////////////////////////////////////////////////////////// |
|
| 114 | + ////////////////////////////////////////////////////////////////// |
|
| 115 | + // METHODS |
|
| 116 | + ////////////////////////////////////////////////////////////////// |
|
| 117 | 117 | |
| 118 | 118 | public function __construct() |
| 119 | - { |
|
| 120 | - parent::__construct(); |
|
| 121 | - $this->disable_row_level_security = true; |
|
| 122 | - } |
|
| 119 | + { |
|
| 120 | + parent::__construct(); |
|
| 121 | + $this->disable_row_level_security = true; |
|
| 122 | + } |
|
| 123 | 123 | |
| 124 | 124 | /** |
| 125 | 125 | * @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 |
@@ -136,25 +136,25 @@ discard block |
||
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | |
| 139 | - function mark_deleted($id) |
|
| 140 | - { |
|
| 141 | - $query = "DELETE FROM $this->table_name WHERE id='$id'"; |
|
| 142 | - $this->db->query($query, true,"Error deleting record: "); |
|
| 143 | - $this->mark_relationships_deleted($id); |
|
| 139 | + function mark_deleted($id) |
|
| 140 | + { |
|
| 141 | + $query = "DELETE FROM $this->table_name WHERE id='$id'"; |
|
| 142 | + $this->db->query($query, true,"Error deleting record: "); |
|
| 143 | + $this->mark_relationships_deleted($id); |
|
| 144 | 144 | |
| 145 | - } |
|
| 145 | + } |
|
| 146 | 146 | |
| 147 | - function get_list_view_data(){ |
|
| 148 | - $data = parent::get_list_view_data(); |
|
| 149 | - $data['VNAME'] = translate($this->vname, $this->custom_module); |
|
| 150 | - $data['NAMELINK'] = '<input class="checkbox" type="checkbox" name="remove[]" value="' . $this->id . '"> <a href="index.php?module=Studio&action=wizard&wizard=EditCustomFieldsWizard&option=EditCustomField&record=' . $this->id . '" >'; |
|
| 151 | - return $data; |
|
| 152 | - } |
|
| 147 | + function get_list_view_data(){ |
|
| 148 | + $data = parent::get_list_view_data(); |
|
| 149 | + $data['VNAME'] = translate($this->vname, $this->custom_module); |
|
| 150 | + $data['NAMELINK'] = '<input class="checkbox" type="checkbox" name="remove[]" value="' . $this->id . '"> <a href="index.php?module=Studio&action=wizard&wizard=EditCustomFieldsWizard&option=EditCustomField&record=' . $this->id . '" >'; |
|
| 151 | + return $data; |
|
| 152 | + } |
|
| 153 | 153 | |
| 154 | 154 | |
| 155 | - function get_summary_text() |
|
| 156 | - { |
|
| 157 | - return $this->name; |
|
| 158 | - } |
|
| 155 | + function get_summary_text() |
|
| 156 | + { |
|
| 157 | + return $this->name; |
|
| 158 | + } |
|
| 159 | 159 | } |
| 160 | 160 | ?> |
@@ -43,7 +43,9 @@ discard block |
||
| 43 | 43 | * Date: 06/03/15 |
| 44 | 44 | * Comments |
| 45 | 45 | */ |
| 46 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
| 46 | +if(!defined('sugarEntry') || !sugarEntry) { |
|
| 47 | + die('Not A Valid Entry Point'); |
|
| 48 | +} |
|
| 47 | 49 | |
| 48 | 50 | class CasesController extends SugarController { |
| 49 | 51 | |
@@ -90,8 +92,7 @@ discard block |
||
| 90 | 92 | $count++; |
| 91 | 93 | } |
| 92 | 94 | echo '</table>'; |
| 93 | - } |
|
| 94 | - else { |
|
| 95 | + } else { |
|
| 95 | 96 | echo $mod_strings['LBL_NO_SUGGESTIONS']; |
| 96 | 97 | } |
| 97 | 98 | die(); |
@@ -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(); |
@@ -121,10 +122,11 @@ discard block |
||
| 121 | 122 | } |
| 122 | 123 | |
| 123 | 124 | while($row = $this->db->fetchByAssoc($result)) { |
| 124 | - if($row['category']."_".$row['name'] == 'ldap_admin_password' || $row['category']."_".$row['name'] == 'proxy_password') |
|
| 125 | - $this->settings[$row['category']."_".$row['name']] = $this->decrypt_after_retrieve($row['value']); |
|
| 126 | - else |
|
| 127 | - $this->settings[$row['category']."_".$row['name']] = $row['value']; |
|
| 125 | + if($row['category']."_".$row['name'] == 'ldap_admin_password' || $row['category']."_".$row['name'] == 'proxy_password') { |
|
| 126 | + $this->settings[$row['category']."_".$row['name']] = $this->decrypt_after_retrieve($row['value']); |
|
| 127 | + } else { |
|
| 128 | + $this->settings[$row['category']."_".$row['name']] = $row['value']; |
|
| 129 | + } |
|
| 128 | 130 | $this->settings[$row['category']] = true; |
| 129 | 131 | } |
| 130 | 132 | $this->settings[$category] = true; |
@@ -135,8 +137,9 @@ discard block |
||
| 135 | 137 | $oe->getSystemMailerSettings(); |
| 136 | 138 | |
| 137 | 139 | foreach ($oe->field_defs as $def) { |
| 138 | - if (strpos($def, "mail_") !== false) |
|
| 139 | - $this->settings[$def] = $oe->$def; |
|
| 140 | + if (strpos($def, "mail_") !== false) { |
|
| 141 | + $this->settings[$def] = $oe->$def; |
|
| 142 | + } |
|
| 140 | 143 | } |
| 141 | 144 | } |
| 142 | 145 | |
@@ -180,13 +183,13 @@ discard block |
||
| 180 | 183 | $row = $this->db->fetchByAssoc($result); |
| 181 | 184 | $row_count = $row['the_count']; |
| 182 | 185 | |
| 183 | - if($category."_".$key == 'ldap_admin_password' || $category."_".$key == 'proxy_password') |
|
| 184 | - $value = $this->encrpyt_before_save($value); |
|
| 186 | + if($category."_".$key == 'ldap_admin_password' || $category."_".$key == 'proxy_password') { |
|
| 187 | + $value = $this->encrpyt_before_save($value); |
|
| 188 | + } |
|
| 185 | 189 | |
| 186 | 190 | if( $row_count == 0){ |
| 187 | 191 | $result = $this->db->query("INSERT INTO config (value, category, name) VALUES ('$value','$category', '$key')"); |
| 188 | - } |
|
| 189 | - else{ |
|
| 192 | + } else{ |
|
| 190 | 193 | $result = $this->db->query("UPDATE config SET value = '{$value}' WHERE category = '{$category}' AND name = '{$key}'"); |
| 191 | 194 | } |
| 192 | 195 | sugar_cache_clear('admin_settings_cache'); |
@@ -43,11 +43,11 @@ discard block |
||
| 43 | 43 | require_once('modules/Administration/UpgradeWizardCommon.php'); |
| 44 | 44 | require_once('modules/Configurator/Configurator.php'); |
| 45 | 45 | function UWrebuild() { |
| 46 | - global $log; |
|
| 47 | - global $db; |
|
| 48 | - $log->info('Deleting Relationship Cache. Relationships will automatically refresh.'); |
|
| 46 | + global $log; |
|
| 47 | + global $db; |
|
| 48 | + $log->info('Deleting Relationship Cache. Relationships will automatically refresh.'); |
|
| 49 | 49 | |
| 50 | - echo " |
|
| 50 | + echo " |
|
| 51 | 51 | <div id='rrresult'></div> |
| 52 | 52 | <script> |
| 53 | 53 | var xmlhttp=false; |
@@ -88,10 +88,10 @@ discard block |
||
| 88 | 88 | xmlhttp.send(null); |
| 89 | 89 | </script>"; |
| 90 | 90 | |
| 91 | - $log->info('Rebuilding everything.'); |
|
| 92 | - require_once('ModuleInstall/ModuleInstaller.php'); |
|
| 93 | - $mi = new ModuleInstaller(); |
|
| 94 | - $mi->rebuild_all(); |
|
| 91 | + $log->info('Rebuilding everything.'); |
|
| 92 | + require_once('ModuleInstall/ModuleInstaller.php'); |
|
| 93 | + $mi = new ModuleInstaller(); |
|
| 94 | + $mi->rebuild_all(); |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | unset($_SESSION['rebuild_relationships']); |
@@ -140,19 +140,19 @@ discard block |
||
| 140 | 140 | |
| 141 | 141 | $id_name = ''; |
| 142 | 142 | if(isset($_REQUEST['id_name'])){ |
| 143 | - $id_name = $_REQUEST['id_name']; |
|
| 143 | + $id_name = $_REQUEST['id_name']; |
|
| 144 | 144 | } |
| 145 | 145 | $s_manifest = ''; |
| 146 | 146 | if(isset($_REQUEST['s_manifest'])){ |
| 147 | - $s_manifest = $_REQUEST['s_manifest']; |
|
| 147 | + $s_manifest = $_REQUEST['s_manifest']; |
|
| 148 | 148 | } |
| 149 | 149 | $previous_version = ''; |
| 150 | 150 | if(isset($_REQUEST['previous_version'])){ |
| 151 | - $previous_version = $_REQUEST['previous_version']; |
|
| 151 | + $previous_version = $_REQUEST['previous_version']; |
|
| 152 | 152 | } |
| 153 | 153 | $previous_id = ''; |
| 154 | 154 | if(isset($_REQUEST['previous_id'])){ |
| 155 | - $previous_id = $_REQUEST['previous_id']; |
|
| 155 | + $previous_id = $_REQUEST['previous_id']; |
|
| 156 | 156 | } |
| 157 | 157 | if( $install_type != "module" ){ |
| 158 | 158 | if( !isset($_REQUEST['zip_from_dir']) || ($_REQUEST['zip_from_dir'] == "") ){ |
@@ -170,11 +170,11 @@ discard block |
||
| 170 | 170 | } |
| 171 | 171 | $remove_tables = 'true'; |
| 172 | 172 | if(isset($_REQUEST['remove_tables'])){ |
| 173 | - $remove_tables = $_REQUEST['remove_tables']; |
|
| 173 | + $remove_tables = $_REQUEST['remove_tables']; |
|
| 174 | 174 | } |
| 175 | 175 | $overwrite_files = true; |
| 176 | 176 | if(isset($_REQUEST['radio_overwrite'])){ |
| 177 | - $overwrite_files = (($_REQUEST['radio_overwrite'] == 'do_not_overwrite') ? false : true); |
|
| 177 | + $overwrite_files = (($_REQUEST['radio_overwrite'] == 'do_not_overwrite') ? false : true); |
|
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | //rrs |
@@ -200,13 +200,13 @@ discard block |
||
| 200 | 200 | |
| 201 | 201 | if (((defined('MODULE_INSTALLER_PACKAGE_SCAN') && MODULE_INSTALLER_PACKAGE_SCAN) |
| 202 | 202 | || !empty($GLOBALS['sugar_config']['moduleInstaller']['packageScan'])) && $install_type != 'patch') { |
| 203 | - require_once('ModuleInstall/ModuleScanner.php'); |
|
| 204 | - $ms = new ModuleScanner(); |
|
| 205 | - $ms->scanPackage($unzip_dir); |
|
| 206 | - if($ms->hasIssues()){ |
|
| 207 | - $ms->displayIssues(); |
|
| 208 | - sugar_cleanup(true); |
|
| 209 | - } |
|
| 203 | + require_once('ModuleInstall/ModuleScanner.php'); |
|
| 204 | + $ms = new ModuleScanner(); |
|
| 205 | + $ms->scanPackage($unzip_dir); |
|
| 206 | + if($ms->hasIssues()){ |
|
| 207 | + $ms->displayIssues(); |
|
| 208 | + sugar_cleanup(true); |
|
| 209 | + } |
|
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | // |
@@ -214,29 +214,29 @@ discard block |
||
| 214 | 214 | // |
| 215 | 215 | if($install_type == 'patch' || $install_type == 'module') |
| 216 | 216 | { |
| 217 | - switch($mode) |
|
| 218 | - { |
|
| 219 | - case 'Install': |
|
| 220 | - $file = "$unzip_dir/" . constant('SUGARCRM_PRE_INSTALL_FILE'); |
|
| 221 | - if(is_file($file)) |
|
| 222 | - { |
|
| 223 | - print("{$mod_strings['LBL_UW_INCLUDING']}: $file <br>\n"); |
|
| 224 | - include($file); |
|
| 225 | - pre_install(); |
|
| 226 | - } |
|
| 227 | - break; |
|
| 228 | - case 'Uninstall': |
|
| 229 | - $file = "$unzip_dir/" . constant('SUGARCRM_PRE_UNINSTALL_FILE'); |
|
| 230 | - if(is_file($file)) |
|
| 231 | - { |
|
| 232 | - print("{$mod_strings['LBL_UW_INCLUDING']}: $file <br>\n"); |
|
| 233 | - include($file); |
|
| 234 | - pre_uninstall(); |
|
| 235 | - } |
|
| 236 | - break; |
|
| 237 | - default: |
|
| 238 | - break; |
|
| 239 | - } |
|
| 217 | + switch($mode) |
|
| 218 | + { |
|
| 219 | + case 'Install': |
|
| 220 | + $file = "$unzip_dir/" . constant('SUGARCRM_PRE_INSTALL_FILE'); |
|
| 221 | + if(is_file($file)) |
|
| 222 | + { |
|
| 223 | + print("{$mod_strings['LBL_UW_INCLUDING']}: $file <br>\n"); |
|
| 224 | + include($file); |
|
| 225 | + pre_install(); |
|
| 226 | + } |
|
| 227 | + break; |
|
| 228 | + case 'Uninstall': |
|
| 229 | + $file = "$unzip_dir/" . constant('SUGARCRM_PRE_UNINSTALL_FILE'); |
|
| 230 | + if(is_file($file)) |
|
| 231 | + { |
|
| 232 | + print("{$mod_strings['LBL_UW_INCLUDING']}: $file <br>\n"); |
|
| 233 | + include($file); |
|
| 234 | + pre_uninstall(); |
|
| 235 | + } |
|
| 236 | + break; |
|
| 237 | + default: |
|
| 238 | + break; |
|
| 239 | + } |
|
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | // |
@@ -251,9 +251,9 @@ discard block |
||
| 251 | 251 | $sugar_home_dir = getCwd(); |
| 252 | 252 | $dest_file = clean_path( "$sugar_home_dir/$zip_to_dir/$file_to_copy" ); |
| 253 | 253 | if($zip_to_dir != '.') |
| 254 | - $rest_file = clean_path("$rest_dir/$zip_to_dir/$file_to_copy"); |
|
| 254 | + $rest_file = clean_path("$rest_dir/$zip_to_dir/$file_to_copy"); |
|
| 255 | 255 | else |
| 256 | - $rest_file = clean_path("$rest_dir/$file_to_copy"); |
|
| 256 | + $rest_file = clean_path("$rest_dir/$file_to_copy"); |
|
| 257 | 257 | |
| 258 | 258 | switch( $mode ){ |
| 259 | 259 | case "Install": |
@@ -261,11 +261,11 @@ discard block |
||
| 261 | 261 | |
| 262 | 262 | if($install_type=="patch" && is_file($dest_file)) |
| 263 | 263 | { |
| 264 | - if(!is_dir(dirname( $rest_file ))) |
|
| 265 | - mkdir_recursive( dirname( $rest_file ) ); |
|
| 264 | + if(!is_dir(dirname( $rest_file ))) |
|
| 265 | + mkdir_recursive( dirname( $rest_file ) ); |
|
| 266 | 266 | |
| 267 | - copy( $dest_file, $rest_file); |
|
| 268 | - sugar_touch( $rest_file, filemtime($dest_file) ); |
|
| 267 | + copy( $dest_file, $rest_file); |
|
| 268 | + sugar_touch( $rest_file, filemtime($dest_file) ); |
|
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | if( !copy( $src_file, $dest_file ) ){ |
@@ -276,8 +276,8 @@ discard block |
||
| 276 | 276 | case "Uninstall": |
| 277 | 277 | if($install_type=="patch" && is_file($rest_file)) |
| 278 | 278 | { |
| 279 | - copy( $rest_file, $dest_file); |
|
| 280 | - sugar_touch( $dest_file, filemtime($rest_file) ); |
|
| 279 | + copy( $rest_file, $dest_file); |
|
| 280 | + sugar_touch( $dest_file, filemtime($rest_file) ); |
|
| 281 | 281 | } |
| 282 | 282 | elseif(file_exists($dest_file) && !unlink($dest_file)) |
| 283 | 283 | { |
@@ -312,21 +312,21 @@ discard block |
||
| 312 | 312 | $new_langs += array( $key => $value ); |
| 313 | 313 | } |
| 314 | 314 | } |
| 315 | - $sugar_config['languages'] = $new_langs; |
|
| 316 | - |
|
| 317 | - $default_sugar_instance_lang = 'en_us'; |
|
| 318 | - if($current_language == $_REQUEST['new_lang_name']){ |
|
| 319 | - $_SESSION['authenticated_user_language'] =$default_sugar_instance_lang; |
|
| 320 | - $lang_changed_string = $mod_strings['LBL_CURRENT_LANGUAGE_CHANGE'].$sugar_config['languages'][$default_sugar_instance_lang].'<br/>'; |
|
| 321 | - } |
|
| 322 | - |
|
| 323 | - if($sugar_config['default_language'] == $_REQUEST['new_lang_name']){ |
|
| 324 | - $cfg = new Configurator(); |
|
| 325 | - $cfg->config['languages'] = $new_langs; |
|
| 326 | - $cfg->config['default_language'] = $default_sugar_instance_lang; |
|
| 327 | - $cfg->handleOverride(); |
|
| 328 | - $lang_changed_string .= $mod_strings['LBL_DEFAULT_LANGUAGE_CHANGE'].$sugar_config['languages'][$default_sugar_instance_lang].'<br/>'; |
|
| 329 | - } |
|
| 315 | + $sugar_config['languages'] = $new_langs; |
|
| 316 | + |
|
| 317 | + $default_sugar_instance_lang = 'en_us'; |
|
| 318 | + if($current_language == $_REQUEST['new_lang_name']){ |
|
| 319 | + $_SESSION['authenticated_user_language'] =$default_sugar_instance_lang; |
|
| 320 | + $lang_changed_string = $mod_strings['LBL_CURRENT_LANGUAGE_CHANGE'].$sugar_config['languages'][$default_sugar_instance_lang].'<br/>'; |
|
| 321 | + } |
|
| 322 | + |
|
| 323 | + if($sugar_config['default_language'] == $_REQUEST['new_lang_name']){ |
|
| 324 | + $cfg = new Configurator(); |
|
| 325 | + $cfg->config['languages'] = $new_langs; |
|
| 326 | + $cfg->config['default_language'] = $default_sugar_instance_lang; |
|
| 327 | + $cfg->handleOverride(); |
|
| 328 | + $lang_changed_string .= $mod_strings['LBL_DEFAULT_LANGUAGE_CHANGE'].$sugar_config['languages'][$default_sugar_instance_lang].'<br/>'; |
|
| 329 | + } |
|
| 330 | 330 | } |
| 331 | 331 | ksort( $sugar_config ); |
| 332 | 332 | if( !write_array_to_file( "sugar_config", $sugar_config, "config.php" ) ){ |
@@ -339,39 +339,39 @@ discard block |
||
| 339 | 339 | switch( $mode ){ |
| 340 | 340 | case "Install": |
| 341 | 341 | //here we can determine if this is an upgrade or a new version |
| 342 | - if(!empty($previous_version)){ |
|
| 343 | - $mi->install( "$unzip_dir", true, $previous_version); |
|
| 344 | - }else{ |
|
| 345 | - $mi->install( "$unzip_dir" ); |
|
| 346 | - } |
|
| 347 | - |
|
| 348 | - $file = "$unzip_dir/" . constant('SUGARCRM_POST_INSTALL_FILE'); |
|
| 349 | - if(is_file($file)) |
|
| 350 | - { |
|
| 351 | - print("{$mod_strings['LBL_UW_INCLUDING']}: $file <br>\n"); |
|
| 352 | - include($file); |
|
| 353 | - post_install(); |
|
| 354 | - } |
|
| 355 | - break; |
|
| 342 | + if(!empty($previous_version)){ |
|
| 343 | + $mi->install( "$unzip_dir", true, $previous_version); |
|
| 344 | + }else{ |
|
| 345 | + $mi->install( "$unzip_dir" ); |
|
| 346 | + } |
|
| 347 | + |
|
| 348 | + $file = "$unzip_dir/" . constant('SUGARCRM_POST_INSTALL_FILE'); |
|
| 349 | + if(is_file($file)) |
|
| 350 | + { |
|
| 351 | + print("{$mod_strings['LBL_UW_INCLUDING']}: $file <br>\n"); |
|
| 352 | + include($file); |
|
| 353 | + post_install(); |
|
| 354 | + } |
|
| 355 | + break; |
|
| 356 | 356 | case "Uninstall": |
| 357 | 357 | if($remove_tables == 'false') |
| 358 | - $GLOBALS['mi_remove_tables'] = false; |
|
| 358 | + $GLOBALS['mi_remove_tables'] = false; |
|
| 359 | 359 | else |
| 360 | - $GLOBALS['mi_remove_tables'] = true; |
|
| 360 | + $GLOBALS['mi_remove_tables'] = true; |
|
| 361 | 361 | $mi->uninstall( "$unzip_dir" ); |
| 362 | 362 | break; |
| 363 | - case "Disable": |
|
| 363 | + case "Disable": |
|
| 364 | 364 | if(!$overwrite_files) |
| 365 | - $GLOBALS['mi_overwrite_files'] = false; |
|
| 365 | + $GLOBALS['mi_overwrite_files'] = false; |
|
| 366 | 366 | else |
| 367 | - $GLOBALS['mi_overwrite_files'] = true; |
|
| 367 | + $GLOBALS['mi_overwrite_files'] = true; |
|
| 368 | 368 | $mi->disable( "$unzip_dir" ); |
| 369 | 369 | break; |
| 370 | - case "Enable": |
|
| 370 | + case "Enable": |
|
| 371 | 371 | if(!$overwrite_files) |
| 372 | - $GLOBALS['mi_overwrite_files'] = false; |
|
| 372 | + $GLOBALS['mi_overwrite_files'] = false; |
|
| 373 | 373 | else |
| 374 | - $GLOBALS['mi_overwrite_files'] = true; |
|
| 374 | + $GLOBALS['mi_overwrite_files'] = true; |
|
| 375 | 375 | $mi->enable( "$unzip_dir" ); |
| 376 | 376 | break; |
| 377 | 377 | default: |
@@ -382,46 +382,46 @@ discard block |
||
| 382 | 382 | case "full": |
| 383 | 383 | // purposely flow into "case: patch" |
| 384 | 384 | case "patch": |
| 385 | - switch($mode) |
|
| 386 | - { |
|
| 387 | - case 'Install': |
|
| 388 | - $file = "$unzip_dir/" . constant('SUGARCRM_POST_INSTALL_FILE'); |
|
| 389 | - if(is_file($file)) |
|
| 390 | - { |
|
| 391 | - print("{$mod_strings['LBL_UW_INCLUDING']}: $file <br>\n"); |
|
| 392 | - include($file); |
|
| 393 | - post_install(); |
|
| 394 | - } |
|
| 395 | - |
|
| 396 | - UWrebuild(); |
|
| 397 | - break; |
|
| 398 | - case 'Uninstall': |
|
| 399 | - $file = "$unzip_dir/" . constant('SUGARCRM_POST_UNINSTALL_FILE'); |
|
| 400 | - if(is_file($file)) { |
|
| 401 | - print("{$mod_strings['LBL_UW_INCLUDING']}: $file <br>\n"); |
|
| 402 | - include($file); |
|
| 403 | - post_uninstall(); |
|
| 404 | - } |
|
| 405 | - |
|
| 406 | - if(is_dir($rest_dir)) |
|
| 407 | - { |
|
| 408 | - rmdir_recursive($rest_dir); |
|
| 409 | - } |
|
| 410 | - |
|
| 411 | - UWrebuild(); |
|
| 412 | - break; |
|
| 413 | - default: |
|
| 414 | - break; |
|
| 415 | - } |
|
| 416 | - |
|
| 417 | - require( "sugar_version.php" ); |
|
| 418 | - $sugar_config['sugar_version'] = $sugar_version; |
|
| 419 | - ksort( $sugar_config ); |
|
| 420 | - |
|
| 421 | - if( !write_array_to_file( "sugar_config", $sugar_config, "config.php" ) ) |
|
| 422 | - { |
|
| 423 | - die($mod_strings['ERR_UW_UPDATE_CONFIG']); |
|
| 424 | - } |
|
| 385 | + switch($mode) |
|
| 386 | + { |
|
| 387 | + case 'Install': |
|
| 388 | + $file = "$unzip_dir/" . constant('SUGARCRM_POST_INSTALL_FILE'); |
|
| 389 | + if(is_file($file)) |
|
| 390 | + { |
|
| 391 | + print("{$mod_strings['LBL_UW_INCLUDING']}: $file <br>\n"); |
|
| 392 | + include($file); |
|
| 393 | + post_install(); |
|
| 394 | + } |
|
| 395 | + |
|
| 396 | + UWrebuild(); |
|
| 397 | + break; |
|
| 398 | + case 'Uninstall': |
|
| 399 | + $file = "$unzip_dir/" . constant('SUGARCRM_POST_UNINSTALL_FILE'); |
|
| 400 | + if(is_file($file)) { |
|
| 401 | + print("{$mod_strings['LBL_UW_INCLUDING']}: $file <br>\n"); |
|
| 402 | + include($file); |
|
| 403 | + post_uninstall(); |
|
| 404 | + } |
|
| 405 | + |
|
| 406 | + if(is_dir($rest_dir)) |
|
| 407 | + { |
|
| 408 | + rmdir_recursive($rest_dir); |
|
| 409 | + } |
|
| 410 | + |
|
| 411 | + UWrebuild(); |
|
| 412 | + break; |
|
| 413 | + default: |
|
| 414 | + break; |
|
| 415 | + } |
|
| 416 | + |
|
| 417 | + require( "sugar_version.php" ); |
|
| 418 | + $sugar_config['sugar_version'] = $sugar_version; |
|
| 419 | + ksort( $sugar_config ); |
|
| 420 | + |
|
| 421 | + if( !write_array_to_file( "sugar_config", $sugar_config, "config.php" ) ) |
|
| 422 | + { |
|
| 423 | + die($mod_strings['ERR_UW_UPDATE_CONFIG']); |
|
| 424 | + } |
|
| 425 | 425 | break; |
| 426 | 426 | default: |
| 427 | 427 | break; |
@@ -434,15 +434,15 @@ discard block |
||
| 434 | 434 | $new_upgrade = new UpgradeHistory(); |
| 435 | 435 | //determine if this module has already been installed given the unique_key to |
| 436 | 436 | //identify the module |
| 437 | - // $new_upgrade->checkForExisting($unique_key); |
|
| 438 | - if(!empty($previous_id)){ |
|
| 439 | - $new_upgrade->id = $previous_id; |
|
| 440 | - $uh = new UpgradeHistory(); |
|
| 441 | - $uh->retrieve($previous_id); |
|
| 442 | - if(is_file($uh->filename)) { |
|
| 443 | - unlink($uh->filename); |
|
| 444 | - } |
|
| 445 | - } |
|
| 437 | + // $new_upgrade->checkForExisting($unique_key); |
|
| 438 | + if(!empty($previous_id)){ |
|
| 439 | + $new_upgrade->id = $previous_id; |
|
| 440 | + $uh = new UpgradeHistory(); |
|
| 441 | + $uh->retrieve($previous_id); |
|
| 442 | + if(is_file($uh->filename)) { |
|
| 443 | + unlink($uh->filename); |
|
| 444 | + } |
|
| 445 | + } |
|
| 446 | 446 | $new_upgrade->filename = $install_file; |
| 447 | 447 | $new_upgrade->md5sum = md5_file( $install_file ); |
| 448 | 448 | $new_upgrade->type = $install_type; |
@@ -457,25 +457,25 @@ discard block |
||
| 457 | 457 | //Check if we need to show a page for the user to finalize their install with. |
| 458 | 458 | if (is_file("$unzip_dir/manifest.php")) |
| 459 | 459 | { |
| 460 | - include("$unzip_dir/manifest.php"); |
|
| 461 | - if (!empty($manifest['post_install_url'])) |
|
| 462 | - { |
|
| 463 | - $url_conf = $manifest['post_install_url']; |
|
| 464 | - if (is_string($url_conf)) |
|
| 465 | - $url_conf = array('url' => $url_conf); |
|
| 466 | - if (isset($url_conf['type']) && $url_conf['type'] == 'popup') |
|
| 467 | - { |
|
| 468 | - echo '<script type="text/javascript">window.open("' . $url_conf['url'] |
|
| 469 | - . '","' . (empty($url_conf['name']) ? 'sugar_popup' : $url_conf['name']) . '","' |
|
| 470 | - . 'height=' . (empty($url_conf['height']) ? '500' : $url_conf['height']) . ',' |
|
| 471 | - . 'width=' . (empty($url_conf['width']) ? '800' : $url_conf['width']) . '");</script>'; |
|
| 472 | - } else |
|
| 473 | - { |
|
| 474 | - echo '<iframe src="' . $url_conf['url'] . '" ' |
|
| 475 | - . 'width="' . (empty($url_conf['width']) ? '100%' : $url_conf['width']) . '" ' |
|
| 476 | - . 'height="' . (empty($url_conf['height']) ? '500px' : $url_conf['height']) . '"></iframe>'; |
|
| 477 | - } |
|
| 478 | - } |
|
| 460 | + include("$unzip_dir/manifest.php"); |
|
| 461 | + if (!empty($manifest['post_install_url'])) |
|
| 462 | + { |
|
| 463 | + $url_conf = $manifest['post_install_url']; |
|
| 464 | + if (is_string($url_conf)) |
|
| 465 | + $url_conf = array('url' => $url_conf); |
|
| 466 | + if (isset($url_conf['type']) && $url_conf['type'] == 'popup') |
|
| 467 | + { |
|
| 468 | + echo '<script type="text/javascript">window.open("' . $url_conf['url'] |
|
| 469 | + . '","' . (empty($url_conf['name']) ? 'sugar_popup' : $url_conf['name']) . '","' |
|
| 470 | + . 'height=' . (empty($url_conf['height']) ? '500' : $url_conf['height']) . ',' |
|
| 471 | + . 'width=' . (empty($url_conf['width']) ? '800' : $url_conf['width']) . '");</script>'; |
|
| 472 | + } else |
|
| 473 | + { |
|
| 474 | + echo '<iframe src="' . $url_conf['url'] . '" ' |
|
| 475 | + . 'width="' . (empty($url_conf['width']) ? '100%' : $url_conf['width']) . '" ' |
|
| 476 | + . 'height="' . (empty($url_conf['height']) ? '500px' : $url_conf['height']) . '"></iframe>'; |
|
| 477 | + } |
|
| 478 | + } |
|
| 479 | 479 | } |
| 480 | 480 | break; |
| 481 | 481 | case "Uninstall": |
@@ -499,7 +499,7 @@ discard block |
||
| 499 | 499 | die( "{$mod_strings['ERR_UW_NO_UPDATE_RECORD']} $install_file." ); |
| 500 | 500 | } |
| 501 | 501 | foreach( $md5_matches as $md5_match ){ |
| 502 | - $md5_match->enabled = 0; |
|
| 502 | + $md5_match->enabled = 0; |
|
| 503 | 503 | $md5_match->save(); |
| 504 | 504 | } |
| 505 | 505 | break; |
@@ -532,7 +532,7 @@ discard block |
||
| 532 | 532 | echo "</div>"; |
| 533 | 533 | echo "<br>"; |
| 534 | 534 | if(isset($lang_changed_string)) |
| 535 | - print($lang_changed_string); |
|
| 535 | + print($lang_changed_string); |
|
| 536 | 536 | if ($install_type != "module" && $install_type != "langpack"){ |
| 537 | 537 | if( sizeof( $files_to_handle ) > 0 ){ |
| 538 | 538 | echo '<div style="text-align: left; cursor: hand; cursor: pointer; text-decoration: underline;" onclick=\'this.style.display="none"; toggleDisplay("more");\' id="all_text">' . SugarThemeRegistry::current()->getImage('advanced_search', '', null, null, ".gif", $mod_strings['LBL_ADVANCED_SEARCH']) . ' Show Details</div><div id=\'more\' style=\'display: none\'> |
@@ -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. |
@@ -85,8 +87,7 @@ discard block |
||
| 85 | 87 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 86 | 88 | if(isset($GLOBALS['log'])) { |
| 87 | 89 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 88 | - } |
|
| 89 | - else { |
|
| 90 | + } else { |
|
| 90 | 91 | trigger_error($deprecatedMessage, E_USER_DEPRECATED); |
| 91 | 92 | } |
| 92 | 93 | self::__construct(); |
@@ -109,13 +110,13 @@ discard block |
||
| 109 | 110 | |
| 110 | 111 | if(empty($patch_to_check->id_name)){ |
| 111 | 112 | $where = " WHERE name = '$patch_to_check->name' "; |
| 112 | - }else{ |
|
| 113 | + } else{ |
|
| 113 | 114 | $where = " WHERE id_name = '$patch_to_check->id_name' "; |
| 114 | 115 | } |
| 115 | 116 | |
| 116 | 117 | if(!empty($patch_to_check->id)){ |
| 117 | 118 | $where .= " AND id != '$patch_to_check->id' "; |
| 118 | - }else{ |
|
| 119 | + } else{ |
|
| 119 | 120 | $where .= " AND id is not null "; |
| 120 | 121 | } |
| 121 | 122 | |
@@ -144,7 +145,7 @@ discard block |
||
| 144 | 145 | $result = $this->db->query($query); |
| 145 | 146 | if(empty($result)){ |
| 146 | 147 | return null; |
| 147 | - }else{ |
|
| 148 | + } else{ |
|
| 148 | 149 | $temp_version = 0; |
| 149 | 150 | $id = ''; |
| 150 | 151 | while($row = $this->db->fetchByAssoc($result)) |
@@ -154,10 +155,11 @@ discard block |
||
| 154 | 155 | $id = $row['id']; |
| 155 | 156 | } |
| 156 | 157 | }//end while |
| 157 | - if($this->is_right_version_greater(explode('.', $temp_version), explode('.', $version), false)) |
|
| 158 | - return array('id' => $id, 'version' => $temp_version); |
|
| 159 | - else |
|
| 160 | - return null; |
|
| 158 | + if($this->is_right_version_greater(explode('.', $temp_version), explode('.', $version), false)) { |
|
| 159 | + return array('id' => $id, 'version' => $temp_version); |
|
| 160 | + } else { |
|
| 161 | + return null; |
|
| 162 | + } |
|
| 161 | 163 | } |
| 162 | 164 | } |
| 163 | 165 | |
@@ -186,7 +188,7 @@ discard block |
||
| 186 | 188 | //we have found a match |
| 187 | 189 | //if the patch_to_check version is greater than the found version |
| 188 | 190 | return ($this->is_right_version_greater(explode('.', $history_object->version), explode('.', $patch_to_check->version))); |
| 189 | - }else{ |
|
| 191 | + } else{ |
|
| 190 | 192 | return true; |
| 191 | 193 | } |
| 192 | 194 | } |
@@ -194,8 +196,9 @@ discard block |
||
| 194 | 196 | //with a matching unique_key in the database |
| 195 | 197 | foreach($patch_list as $more_recent_patch) |
| 196 | 198 | { |
| 197 | - if($more_recent_patch->id == $patch_to_check->id) |
|
| 198 | - break; |
|
| 199 | + if($more_recent_patch->id == $patch_to_check->id) { |
|
| 200 | + break; |
|
| 201 | + } |
|
| 199 | 202 | |
| 200 | 203 | //we will only resort to checking the files if we cannot find the unique_keys |
| 201 | 204 | //or the unique_keys do not match |
@@ -219,25 +222,27 @@ discard block |
||
| 219 | 222 | { |
| 220 | 223 | if(is_file($check_path)) |
| 221 | 224 | { |
| 222 | - if(file_exists($recent_path)) |
|
| 223 | - return true; |
|
| 224 | - else |
|
| 225 | - return false; |
|
| 226 | - } |
|
| 227 | - elseif(is_dir($check_path)) |
|
| 225 | + if(file_exists($recent_path)) { |
|
| 226 | + return true; |
|
| 227 | + } else { |
|
| 228 | + return false; |
|
| 229 | + } |
|
| 230 | + } elseif(is_dir($check_path)) |
|
| 228 | 231 | { |
| 229 | 232 | $status = false; |
| 230 | 233 | |
| 231 | 234 | $d = dir( $check_path ); |
| 232 | 235 | while( $f = $d->read() ) |
| 233 | 236 | { |
| 234 | - if( $f == "." || $f == ".." ) |
|
| 235 | - continue; |
|
| 237 | + if( $f == "." || $f == ".." ) { |
|
| 238 | + continue; |
|
| 239 | + } |
|
| 236 | 240 | |
| 237 | 241 | $status = $this->foundConflict("$check_path/$f", "$recent_path/$f"); |
| 238 | 242 | |
| 239 | - if($status) |
|
| 240 | - break; |
|
| 243 | + if($status) { |
|
| 244 | + break; |
|
| 245 | + } |
|
| 241 | 246 | } |
| 242 | 247 | |
| 243 | 248 | $d->close(); |
@@ -259,20 +264,17 @@ discard block |
||
| 259 | 264 | function is_right_version_greater($left, $right, $equals_is_greater = true){ |
| 260 | 265 | if(count($left) == 0 && count($right) == 0){ |
| 261 | 266 | return $equals_is_greater; |
| 262 | - } |
|
| 263 | - else if(count($left) == 0 || count($right) == 0){ |
|
| 267 | + } else if(count($left) == 0 || count($right) == 0){ |
|
| 264 | 268 | return true; |
| 265 | - } |
|
| 266 | - else if($left[0] == $right[0]){ |
|
| 269 | + } else if($left[0] == $right[0]){ |
|
| 267 | 270 | array_shift($left); |
| 268 | 271 | array_shift($right); |
| 269 | 272 | return $this->is_right_version_greater($left, $right, $equals_is_greater); |
| 270 | - } |
|
| 271 | - else if($left[0] < $right[0]){ |
|
| 273 | + } else if($left[0] < $right[0]){ |
|
| 272 | 274 | return true; |
| 275 | + } else { |
|
| 276 | + return false; |
|
| 273 | 277 | } |
| 274 | - else |
|
| 275 | - return false; |
|
| 276 | 278 | } |
| 277 | 279 | |
| 278 | 280 | /** |
@@ -40,150 +40,150 @@ discard block |
||
| 40 | 40 | |
| 41 | 41 | |
| 42 | 42 | class Meeting extends SugarBean { |
| 43 | - // Stored fields |
|
| 44 | - var $id; |
|
| 45 | - var $date_entered; |
|
| 46 | - var $date_modified; |
|
| 47 | - var $assigned_user_id; |
|
| 48 | - var $modified_user_id; |
|
| 49 | - var $created_by; |
|
| 50 | - var $created_by_name; |
|
| 51 | - var $modified_by_name; |
|
| 52 | - var $description; |
|
| 53 | - var $name; |
|
| 54 | - var $location; |
|
| 55 | - var $status; |
|
| 56 | - var $type; |
|
| 57 | - var $date_start; |
|
| 58 | - var $time_start; |
|
| 59 | - var $date_end; |
|
| 60 | - var $duration_hours; |
|
| 61 | - var $duration_minutes; |
|
| 62 | - var $time_meridiem; |
|
| 63 | - var $parent_type; |
|
| 64 | - var $parent_type_options; |
|
| 65 | - var $parent_id; |
|
| 66 | - var $field_name_map; |
|
| 67 | - var $contact_id; |
|
| 68 | - var $user_id; |
|
| 69 | - var $meeting_id; |
|
| 70 | - var $reminder_time; |
|
| 71 | - var $reminder_checked; |
|
| 72 | - var $email_reminder_time; |
|
| 73 | - var $email_reminder_checked; |
|
| 74 | - var $email_reminder_sent; |
|
| 75 | - var $required; |
|
| 76 | - var $accept_status; |
|
| 77 | - var $parent_name; |
|
| 78 | - var $contact_name; |
|
| 79 | - var $contact_phone; |
|
| 80 | - var $contact_email; |
|
| 81 | - var $account_id; |
|
| 82 | - var $opportunity_id; |
|
| 83 | - var $case_id; |
|
| 84 | - var $assigned_user_name; |
|
| 85 | - var $outlook_id; |
|
| 86 | - var $sequence; |
|
| 87 | - var $syncing = false; |
|
| 88 | - var $recurring_source; |
|
| 89 | - |
|
| 90 | - var $update_vcal = true; |
|
| 91 | - var $contacts_arr; |
|
| 92 | - var $users_arr; |
|
| 93 | - var $meetings_arr; |
|
| 94 | - // when assoc w/ a user/contact: |
|
| 95 | - var $minutes_value_default = 15; |
|
| 96 | - var $minutes_values = array('0'=>'00','15'=>'15','30'=>'30','45'=>'45'); |
|
| 97 | - var $table_name = "meetings"; |
|
| 98 | - var $rel_users_table = "meetings_users"; |
|
| 99 | - var $rel_contacts_table = "meetings_contacts"; |
|
| 100 | - var $rel_leads_table = "meetings_leads"; |
|
| 101 | - var $module_dir = "Meetings"; |
|
| 102 | - var $object_name = "Meeting"; |
|
| 103 | - |
|
| 104 | - var $importable = true; |
|
| 105 | - // This is used to retrieve related fields from form posts. |
|
| 106 | - var $additional_column_fields = array('assigned_user_name', 'assigned_user_id', 'contact_id', 'user_id', 'contact_name', 'accept_status'); |
|
| 107 | - var $relationship_fields = array('account_id'=>'accounts','opportunity_id'=>'opportunity','case_id'=>'case', |
|
| 108 | - 'assigned_user_id'=>'users','contact_id'=>'contacts', 'user_id'=>'users', 'meeting_id'=>'meetings'); |
|
| 109 | - // so you can run get_users() twice and run query only once |
|
| 110 | - var $cached_get_users = null; |
|
| 111 | - var $new_schema = true; |
|
| 43 | + // Stored fields |
|
| 44 | + var $id; |
|
| 45 | + var $date_entered; |
|
| 46 | + var $date_modified; |
|
| 47 | + var $assigned_user_id; |
|
| 48 | + var $modified_user_id; |
|
| 49 | + var $created_by; |
|
| 50 | + var $created_by_name; |
|
| 51 | + var $modified_by_name; |
|
| 52 | + var $description; |
|
| 53 | + var $name; |
|
| 54 | + var $location; |
|
| 55 | + var $status; |
|
| 56 | + var $type; |
|
| 57 | + var $date_start; |
|
| 58 | + var $time_start; |
|
| 59 | + var $date_end; |
|
| 60 | + var $duration_hours; |
|
| 61 | + var $duration_minutes; |
|
| 62 | + var $time_meridiem; |
|
| 63 | + var $parent_type; |
|
| 64 | + var $parent_type_options; |
|
| 65 | + var $parent_id; |
|
| 66 | + var $field_name_map; |
|
| 67 | + var $contact_id; |
|
| 68 | + var $user_id; |
|
| 69 | + var $meeting_id; |
|
| 70 | + var $reminder_time; |
|
| 71 | + var $reminder_checked; |
|
| 72 | + var $email_reminder_time; |
|
| 73 | + var $email_reminder_checked; |
|
| 74 | + var $email_reminder_sent; |
|
| 75 | + var $required; |
|
| 76 | + var $accept_status; |
|
| 77 | + var $parent_name; |
|
| 78 | + var $contact_name; |
|
| 79 | + var $contact_phone; |
|
| 80 | + var $contact_email; |
|
| 81 | + var $account_id; |
|
| 82 | + var $opportunity_id; |
|
| 83 | + var $case_id; |
|
| 84 | + var $assigned_user_name; |
|
| 85 | + var $outlook_id; |
|
| 86 | + var $sequence; |
|
| 87 | + var $syncing = false; |
|
| 88 | + var $recurring_source; |
|
| 89 | + |
|
| 90 | + var $update_vcal = true; |
|
| 91 | + var $contacts_arr; |
|
| 92 | + var $users_arr; |
|
| 93 | + var $meetings_arr; |
|
| 94 | + // when assoc w/ a user/contact: |
|
| 95 | + var $minutes_value_default = 15; |
|
| 96 | + var $minutes_values = array('0'=>'00','15'=>'15','30'=>'30','45'=>'45'); |
|
| 97 | + var $table_name = "meetings"; |
|
| 98 | + var $rel_users_table = "meetings_users"; |
|
| 99 | + var $rel_contacts_table = "meetings_contacts"; |
|
| 100 | + var $rel_leads_table = "meetings_leads"; |
|
| 101 | + var $module_dir = "Meetings"; |
|
| 102 | + var $object_name = "Meeting"; |
|
| 103 | + |
|
| 104 | + var $importable = true; |
|
| 105 | + // This is used to retrieve related fields from form posts. |
|
| 106 | + var $additional_column_fields = array('assigned_user_name', 'assigned_user_id', 'contact_id', 'user_id', 'contact_name', 'accept_status'); |
|
| 107 | + var $relationship_fields = array('account_id'=>'accounts','opportunity_id'=>'opportunity','case_id'=>'case', |
|
| 108 | + 'assigned_user_id'=>'users','contact_id'=>'contacts', 'user_id'=>'users', 'meeting_id'=>'meetings'); |
|
| 109 | + // so you can run get_users() twice and run query only once |
|
| 110 | + var $cached_get_users = null; |
|
| 111 | + var $new_schema = true; |
|
| 112 | 112 | var $date_changed = false; |
| 113 | 113 | |
| 114 | - /** |
|
| 115 | - * sole constructor |
|
| 116 | - */ |
|
| 117 | - public function __construct() { |
|
| 118 | - parent::__construct(); |
|
| 119 | - $this->setupCustomFields('Meetings'); |
|
| 120 | - foreach($this->field_defs as $field) { |
|
| 121 | - $this->field_name_map[$field['name']] = $field; |
|
| 122 | - } |
|
| 114 | + /** |
|
| 115 | + * sole constructor |
|
| 116 | + */ |
|
| 117 | + public function __construct() { |
|
| 118 | + parent::__construct(); |
|
| 119 | + $this->setupCustomFields('Meetings'); |
|
| 120 | + foreach($this->field_defs as $field) { |
|
| 121 | + $this->field_name_map[$field['name']] = $field; |
|
| 122 | + } |
|
| 123 | 123 | // $this->fill_in_additional_detail_fields(); |
| 124 | 124 | if(!empty($GLOBALS['app_list_strings']['duration_intervals'])) { |
| 125 | 125 | $this->minutes_values = $GLOBALS['app_list_strings']['duration_intervals']; |
| 126 | 126 | } |
| 127 | - } |
|
| 128 | - |
|
| 129 | - /** |
|
| 130 | - * @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 |
|
| 131 | - */ |
|
| 132 | - public function Meeting(){ |
|
| 133 | - $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
|
| 134 | - if(isset($GLOBALS['log'])) { |
|
| 135 | - $GLOBALS['log']->deprecated($deprecatedMessage); |
|
| 136 | - } |
|
| 137 | - else { |
|
| 138 | - trigger_error($deprecatedMessage, E_USER_DEPRECATED); |
|
| 139 | - } |
|
| 140 | - self::__construct(); |
|
| 141 | - } |
|
| 142 | - |
|
| 143 | - /** |
|
| 144 | - * Disable edit if meeting is recurring and source is not Sugar. It should be edited only from Outlook. |
|
| 145 | - * @param $view string |
|
| 146 | - * @param $is_owner bool |
|
| 147 | - */ |
|
| 148 | - function ACLAccess($view,$is_owner='not_set',$in_group='not_set'){ |
|
| 149 | - // don't check if meeting is being synced from Outlook |
|
| 150 | - if($this->syncing == false){ |
|
| 151 | - $view = strtolower($view); |
|
| 152 | - switch($view){ |
|
| 153 | - case 'edit': |
|
| 154 | - case 'save': |
|
| 155 | - case 'editview': |
|
| 156 | - case 'delete': |
|
| 157 | - if(!empty($this->recurring_source) && $this->recurring_source != "Sugar"){ |
|
| 158 | - return false; |
|
| 159 | - } |
|
| 160 | - } |
|
| 161 | - } |
|
| 162 | - return parent::ACLAccess($view,$is_owner,$in_group); |
|
| 163 | - } |
|
| 164 | - |
|
| 165 | - /** |
|
| 166 | - * Stub for integration |
|
| 167 | - * @return bool |
|
| 168 | - */ |
|
| 169 | - function hasIntegratedMeeting() { |
|
| 170 | - return false; |
|
| 171 | - } |
|
| 172 | - |
|
| 173 | - // save date_end by calculating user input |
|
| 174 | - // this is for calendar |
|
| 175 | - function save($check_notify = FALSE) { |
|
| 176 | - global $timedate; |
|
| 177 | - global $current_user; |
|
| 178 | - |
|
| 179 | - global $disable_date_format; |
|
| 127 | + } |
|
| 128 | + |
|
| 129 | + /** |
|
| 130 | + * @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 |
|
| 131 | + */ |
|
| 132 | + public function Meeting(){ |
|
| 133 | + $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
|
| 134 | + if(isset($GLOBALS['log'])) { |
|
| 135 | + $GLOBALS['log']->deprecated($deprecatedMessage); |
|
| 136 | + } |
|
| 137 | + else { |
|
| 138 | + trigger_error($deprecatedMessage, E_USER_DEPRECATED); |
|
| 139 | + } |
|
| 140 | + self::__construct(); |
|
| 141 | + } |
|
| 142 | + |
|
| 143 | + /** |
|
| 144 | + * Disable edit if meeting is recurring and source is not Sugar. It should be edited only from Outlook. |
|
| 145 | + * @param $view string |
|
| 146 | + * @param $is_owner bool |
|
| 147 | + */ |
|
| 148 | + function ACLAccess($view,$is_owner='not_set',$in_group='not_set'){ |
|
| 149 | + // don't check if meeting is being synced from Outlook |
|
| 150 | + if($this->syncing == false){ |
|
| 151 | + $view = strtolower($view); |
|
| 152 | + switch($view){ |
|
| 153 | + case 'edit': |
|
| 154 | + case 'save': |
|
| 155 | + case 'editview': |
|
| 156 | + case 'delete': |
|
| 157 | + if(!empty($this->recurring_source) && $this->recurring_source != "Sugar"){ |
|
| 158 | + return false; |
|
| 159 | + } |
|
| 160 | + } |
|
| 161 | + } |
|
| 162 | + return parent::ACLAccess($view,$is_owner,$in_group); |
|
| 163 | + } |
|
| 164 | + |
|
| 165 | + /** |
|
| 166 | + * Stub for integration |
|
| 167 | + * @return bool |
|
| 168 | + */ |
|
| 169 | + function hasIntegratedMeeting() { |
|
| 170 | + return false; |
|
| 171 | + } |
|
| 172 | + |
|
| 173 | + // save date_end by calculating user input |
|
| 174 | + // this is for calendar |
|
| 175 | + function save($check_notify = FALSE) { |
|
| 176 | + global $timedate; |
|
| 177 | + global $current_user; |
|
| 178 | + |
|
| 179 | + global $disable_date_format; |
|
| 180 | 180 | |
| 181 | 181 | if(isset($this->date_start)) |
| 182 | 182 | { |
| 183 | 183 | $td = $timedate->fromDb($this->date_start); |
| 184 | 184 | if(!$td){ |
| 185 | - $this->date_start = $timedate->to_db($this->date_start); |
|
| 186 | - $td = $timedate->fromDb($this->date_start); |
|
| 185 | + $this->date_start = $timedate->to_db($this->date_start); |
|
| 186 | + $td = $timedate->fromDb($this->date_start); |
|
| 187 | 187 | } |
| 188 | 188 | if($td) |
| 189 | 189 | { |
@@ -199,30 +199,30 @@ discard block |
||
| 199 | 199 | } |
| 200 | 200 | } |
| 201 | 201 | |
| 202 | - $check_notify =(!empty($_REQUEST['send_invites']) && $_REQUEST['send_invites'] == '1') ? true : false; |
|
| 203 | - if(empty($_REQUEST['send_invites'])) { |
|
| 204 | - if(!empty($this->id)) { |
|
| 205 | - $old_record = new Meeting(); |
|
| 206 | - $old_record->retrieve($this->id); |
|
| 207 | - $old_assigned_user_id = $old_record->assigned_user_id; |
|
| 208 | - } |
|
| 209 | - if((empty($this->id) && isset($_REQUEST['assigned_user_id']) && !empty($_REQUEST['assigned_user_id']) && $GLOBALS['current_user']->id != $_REQUEST['assigned_user_id']) || (isset($old_assigned_user_id) && !empty($old_assigned_user_id) && isset($_REQUEST['assigned_user_id']) && !empty($_REQUEST['assigned_user_id']) && $old_assigned_user_id != $_REQUEST['assigned_user_id']) ){ |
|
| 210 | - $this->special_notification = true; |
|
| 211 | - $check_notify = true; |
|
| 202 | + $check_notify =(!empty($_REQUEST['send_invites']) && $_REQUEST['send_invites'] == '1') ? true : false; |
|
| 203 | + if(empty($_REQUEST['send_invites'])) { |
|
| 204 | + if(!empty($this->id)) { |
|
| 205 | + $old_record = new Meeting(); |
|
| 206 | + $old_record->retrieve($this->id); |
|
| 207 | + $old_assigned_user_id = $old_record->assigned_user_id; |
|
| 208 | + } |
|
| 209 | + if((empty($this->id) && isset($_REQUEST['assigned_user_id']) && !empty($_REQUEST['assigned_user_id']) && $GLOBALS['current_user']->id != $_REQUEST['assigned_user_id']) || (isset($old_assigned_user_id) && !empty($old_assigned_user_id) && isset($_REQUEST['assigned_user_id']) && !empty($_REQUEST['assigned_user_id']) && $old_assigned_user_id != $_REQUEST['assigned_user_id']) ){ |
|
| 210 | + $this->special_notification = true; |
|
| 211 | + $check_notify = true; |
|
| 212 | 212 | if(isset($_REQUEST['assigned_user_name'])) { |
| 213 | 213 | $this->new_assigned_user_name = $_REQUEST['assigned_user_name']; |
| 214 | 214 | } |
| 215 | - } |
|
| 216 | - } |
|
| 217 | - /*nsingh 7/3/08 commenting out as bug #20814 is invalid |
|
| 215 | + } |
|
| 216 | + } |
|
| 217 | + /*nsingh 7/3/08 commenting out as bug #20814 is invalid |
|
| 218 | 218 | if($current_user->getPreference('reminder_time')!= -1 && isset($_POST['reminder_checked']) && isset($_POST['reminder_time']) && $_POST['reminder_checked']==0 && $_POST['reminder_time']==-1){ |
| 219 | 219 | $this->reminder_checked = '1'; |
| 220 | 220 | $this->reminder_time = $current_user->getPreference('reminder_time'); |
| 221 | 221 | }*/ |
| 222 | 222 | |
| 223 | - // prevent a mass mailing for recurring meetings created in Calendar module |
|
| 224 | - if(empty($this->id) && !empty($_REQUEST['module']) && $_REQUEST['module'] == "Calendar" && !empty($_REQUEST['repeat_type']) && !empty($this->repeat_parent_id)) |
|
| 225 | - $check_notify = false; |
|
| 223 | + // prevent a mass mailing for recurring meetings created in Calendar module |
|
| 224 | + if(empty($this->id) && !empty($_REQUEST['module']) && $_REQUEST['module'] == "Calendar" && !empty($_REQUEST['repeat_type']) && !empty($this->repeat_parent_id)) |
|
| 225 | + $check_notify = false; |
|
| 226 | 226 | |
| 227 | 227 | if (empty($this->status) ) { |
| 228 | 228 | $this->status = $this->getDefaultStatus(); |
@@ -243,8 +243,8 @@ discard block |
||
| 243 | 243 | } |
| 244 | 244 | |
| 245 | 245 | if (empty($this->type)) { |
| 246 | - $this->type = 'Sugar'; |
|
| 247 | - } |
|
| 246 | + $this->type = 'Sugar'; |
|
| 247 | + } |
|
| 248 | 248 | |
| 249 | 249 | if ( isset($api) && is_a($api,'WebMeeting') && empty($this->in_relationship_update) ) { |
| 250 | 250 | // Make sure the API initialized and it supports Web Meetings |
@@ -272,175 +272,175 @@ discard block |
||
| 272 | 272 | $api->logoff(); |
| 273 | 273 | } |
| 274 | 274 | |
| 275 | - $return_id = parent::save($check_notify); |
|
| 275 | + $return_id = parent::save($check_notify); |
|
| 276 | 276 | |
| 277 | - if($this->update_vcal) { |
|
| 278 | - vCal::cache_sugar_vcal($current_user); |
|
| 279 | - } |
|
| 277 | + if($this->update_vcal) { |
|
| 278 | + vCal::cache_sugar_vcal($current_user); |
|
| 279 | + } |
|
| 280 | 280 | |
| 281 | - if(isset($_REQUEST['reminders_data'])) { |
|
| 282 | - Reminder::saveRemindersDataJson('Meetings', $return_id, html_entity_decode($_REQUEST['reminders_data'])); |
|
| 283 | - } |
|
| 281 | + if(isset($_REQUEST['reminders_data'])) { |
|
| 282 | + Reminder::saveRemindersDataJson('Meetings', $return_id, html_entity_decode($_REQUEST['reminders_data'])); |
|
| 283 | + } |
|
| 284 | 284 | |
| 285 | 285 | |
| 286 | - return $return_id; |
|
| 287 | - } |
|
| 286 | + return $return_id; |
|
| 287 | + } |
|
| 288 | 288 | |
| 289 | - // this is for calendar |
|
| 290 | - function mark_deleted($id) { |
|
| 289 | + // this is for calendar |
|
| 290 | + function mark_deleted($id) { |
|
| 291 | 291 | |
| 292 | - require_once("modules/Calendar/CalendarUtils.php"); |
|
| 293 | - CalendarUtils::correctRecurrences($this, $id); |
|
| 292 | + require_once("modules/Calendar/CalendarUtils.php"); |
|
| 293 | + CalendarUtils::correctRecurrences($this, $id); |
|
| 294 | 294 | |
| 295 | - global $current_user; |
|
| 295 | + global $current_user; |
|
| 296 | 296 | |
| 297 | - parent::mark_deleted($id); |
|
| 297 | + parent::mark_deleted($id); |
|
| 298 | 298 | |
| 299 | - if($this->update_vcal) { |
|
| 300 | - vCal::cache_sugar_vcal($current_user); |
|
| 301 | - } |
|
| 302 | - } |
|
| 299 | + if($this->update_vcal) { |
|
| 300 | + vCal::cache_sugar_vcal($current_user); |
|
| 301 | + } |
|
| 302 | + } |
|
| 303 | 303 | |
| 304 | - function get_summary_text() { |
|
| 305 | - return "$this->name"; |
|
| 306 | - } |
|
| 304 | + function get_summary_text() { |
|
| 305 | + return "$this->name"; |
|
| 306 | + } |
|
| 307 | 307 | |
| 308 | 308 | function create_export_query($order_by, $where, $relate_link_join='') |
| 309 | 309 | { |
| 310 | 310 | $custom_join = $this->getCustomJoin(true, true, $where); |
| 311 | 311 | $custom_join['join'] .= $relate_link_join; |
| 312 | - $contact_required = stristr($where, "contacts"); |
|
| 312 | + $contact_required = stristr($where, "contacts"); |
|
| 313 | 313 | |
| 314 | - if($contact_required) { |
|
| 315 | - $query = "SELECT meetings.*, contacts.first_name, contacts.last_name, contacts.assigned_user_id contact_name_owner, users.user_name as assigned_user_name "; |
|
| 314 | + if($contact_required) { |
|
| 315 | + $query = "SELECT meetings.*, contacts.first_name, contacts.last_name, contacts.assigned_user_id contact_name_owner, users.user_name as assigned_user_name "; |
|
| 316 | 316 | $query .= $custom_join['select']; |
| 317 | - $query .= " FROM contacts, meetings, meetings_contacts "; |
|
| 318 | - $where_auto = " meetings_contacts.contact_id = contacts.id AND meetings_contacts.meeting_id = meetings.id AND meetings.deleted=0 AND contacts.deleted=0"; |
|
| 319 | - } else { |
|
| 320 | - $query = 'SELECT meetings.*, users.user_name as assigned_user_name '; |
|
| 317 | + $query .= " FROM contacts, meetings, meetings_contacts "; |
|
| 318 | + $where_auto = " meetings_contacts.contact_id = contacts.id AND meetings_contacts.meeting_id = meetings.id AND meetings.deleted=0 AND contacts.deleted=0"; |
|
| 319 | + } else { |
|
| 320 | + $query = 'SELECT meetings.*, users.user_name as assigned_user_name '; |
|
| 321 | 321 | $query .= $custom_join['select']; |
| 322 | - $query .= ' FROM meetings '; |
|
| 323 | - $where_auto = "meetings.deleted=0"; |
|
| 324 | - } |
|
| 325 | - $query .= " LEFT JOIN users ON meetings.assigned_user_id=users.id "; |
|
| 322 | + $query .= ' FROM meetings '; |
|
| 323 | + $where_auto = "meetings.deleted=0"; |
|
| 324 | + } |
|
| 325 | + $query .= " LEFT JOIN users ON meetings.assigned_user_id=users.id "; |
|
| 326 | 326 | |
| 327 | 327 | $query .= $custom_join['join']; |
| 328 | 328 | |
| 329 | - if($where != "") |
|
| 330 | - $query .= " where $where AND ".$where_auto; |
|
| 331 | - else |
|
| 332 | - $query .= " where ".$where_auto; |
|
| 329 | + if($where != "") |
|
| 330 | + $query .= " where $where AND ".$where_auto; |
|
| 331 | + else |
|
| 332 | + $query .= " where ".$where_auto; |
|
| 333 | 333 | |
| 334 | 334 | $order_by = $this->process_order_by($order_by); |
| 335 | 335 | if (!empty($order_by)) { |
| 336 | 336 | $query .= ' ORDER BY ' . $order_by; |
| 337 | 337 | } |
| 338 | 338 | |
| 339 | - return $query; |
|
| 340 | - } |
|
| 341 | - |
|
| 342 | - |
|
| 343 | - |
|
| 344 | - function fill_in_additional_detail_fields() { |
|
| 345 | - global $locale; |
|
| 346 | - // Fill in the assigned_user_name |
|
| 347 | - $this->assigned_user_name = get_assigned_user_name($this->assigned_user_id); |
|
| 348 | - |
|
| 349 | - if (!empty($this->contact_id)) { |
|
| 350 | - $query = "SELECT first_name, last_name FROM contacts "; |
|
| 351 | - $query .= "WHERE id='$this->contact_id' AND deleted=0"; |
|
| 352 | - $result = $this->db->limitQuery($query,0,1,true," Error filling in additional detail fields: "); |
|
| 339 | + return $query; |
|
| 340 | + } |
|
| 353 | 341 | |
| 354 | - // Get the contact name. |
|
| 355 | - $row = $this->db->fetchByAssoc($result); |
|
| 356 | - $GLOBALS['log']->info("additional call fields $query"); |
|
| 357 | - if($row != null) |
|
| 358 | - { |
|
| 359 | - $this->contact_name = $locale->getLocaleFormattedName($row['first_name'], $row['last_name'], '', ''); |
|
| 360 | - $GLOBALS['log']->debug("Call($this->id): contact_name = $this->contact_name"); |
|
| 361 | - $GLOBALS['log']->debug("Call($this->id): contact_id = $this->contact_id"); |
|
| 362 | - } |
|
| 363 | - } |
|
| 364 | 342 | |
| 365 | 343 | |
| 344 | + function fill_in_additional_detail_fields() { |
|
| 345 | + global $locale; |
|
| 346 | + // Fill in the assigned_user_name |
|
| 347 | + $this->assigned_user_name = get_assigned_user_name($this->assigned_user_id); |
|
| 366 | 348 | |
| 367 | - $this->created_by_name = get_assigned_user_name($this->created_by); |
|
| 368 | - $this->modified_by_name = get_assigned_user_name($this->modified_user_id); |
|
| 369 | - $this->fill_in_additional_parent_fields(); |
|
| 349 | + if (!empty($this->contact_id)) { |
|
| 350 | + $query = "SELECT first_name, last_name FROM contacts "; |
|
| 351 | + $query .= "WHERE id='$this->contact_id' AND deleted=0"; |
|
| 352 | + $result = $this->db->limitQuery($query,0,1,true," Error filling in additional detail fields: "); |
|
| 370 | 353 | |
| 371 | - if (!isset($this->time_hour_start)) { |
|
| 372 | - $this->time_start_hour = intval(substr($this->time_start, 0, 2)); |
|
| 373 | - } //if-else |
|
| 354 | + // Get the contact name. |
|
| 355 | + $row = $this->db->fetchByAssoc($result); |
|
| 356 | + $GLOBALS['log']->info("additional call fields $query"); |
|
| 357 | + if($row != null) |
|
| 358 | + { |
|
| 359 | + $this->contact_name = $locale->getLocaleFormattedName($row['first_name'], $row['last_name'], '', ''); |
|
| 360 | + $GLOBALS['log']->debug("Call($this->id): contact_name = $this->contact_name"); |
|
| 361 | + $GLOBALS['log']->debug("Call($this->id): contact_id = $this->contact_id"); |
|
| 362 | + } |
|
| 363 | + } |
|
| 374 | 364 | |
| 375 | - if (isset($this->time_minute_start)) { |
|
| 376 | - $time_start_minutes = $this->time_minute_start; |
|
| 377 | - } else { |
|
| 378 | - $time_start_minutes = substr($this->time_start, 3, 5); |
|
| 379 | - if ($time_start_minutes > 0 && $time_start_minutes < 15) { |
|
| 380 | - $time_start_minutes = "15"; |
|
| 381 | - } else if ($time_start_minutes > 15 && $time_start_minutes < 30) { |
|
| 382 | - $time_start_minutes = "30"; |
|
| 383 | - } else if ($time_start_minutes > 30 && $time_start_minutes < 45) { |
|
| 384 | - $time_start_minutes = "45"; |
|
| 385 | - } else if ($time_start_minutes > 45) { |
|
| 386 | - $this->time_start_hour += 1; |
|
| 387 | - $time_start_minutes = "00"; |
|
| 388 | - } //if-else |
|
| 389 | - } //if-else |
|
| 390 | 365 | |
| 391 | 366 | |
| 392 | - if (isset($this->time_hour_start)) { |
|
| 393 | - $time_start_hour = $this->time_hour_start; |
|
| 394 | - } else { |
|
| 395 | - $time_start_hour = intval(substr($this->time_start, 0, 2)); |
|
| 396 | - } |
|
| 367 | + $this->created_by_name = get_assigned_user_name($this->created_by); |
|
| 368 | + $this->modified_by_name = get_assigned_user_name($this->modified_user_id); |
|
| 369 | + $this->fill_in_additional_parent_fields(); |
|
| 370 | + |
|
| 371 | + if (!isset($this->time_hour_start)) { |
|
| 372 | + $this->time_start_hour = intval(substr($this->time_start, 0, 2)); |
|
| 373 | + } //if-else |
|
| 374 | + |
|
| 375 | + if (isset($this->time_minute_start)) { |
|
| 376 | + $time_start_minutes = $this->time_minute_start; |
|
| 377 | + } else { |
|
| 378 | + $time_start_minutes = substr($this->time_start, 3, 5); |
|
| 379 | + if ($time_start_minutes > 0 && $time_start_minutes < 15) { |
|
| 380 | + $time_start_minutes = "15"; |
|
| 381 | + } else if ($time_start_minutes > 15 && $time_start_minutes < 30) { |
|
| 382 | + $time_start_minutes = "30"; |
|
| 383 | + } else if ($time_start_minutes > 30 && $time_start_minutes < 45) { |
|
| 384 | + $time_start_minutes = "45"; |
|
| 385 | + } else if ($time_start_minutes > 45) { |
|
| 386 | + $this->time_start_hour += 1; |
|
| 387 | + $time_start_minutes = "00"; |
|
| 388 | + } //if-else |
|
| 389 | + } //if-else |
|
| 390 | + |
|
| 391 | + |
|
| 392 | + if (isset($this->time_hour_start)) { |
|
| 393 | + $time_start_hour = $this->time_hour_start; |
|
| 394 | + } else { |
|
| 395 | + $time_start_hour = intval(substr($this->time_start, 0, 2)); |
|
| 396 | + } |
|
| 397 | 397 | |
| 398 | - global $timedate; |
|
| 398 | + global $timedate; |
|
| 399 | 399 | $this->time_meridiem = $timedate->AMPMMenu('', $this->time_start, 'onchange="SugarWidgetScheduler.update_time();"'); |
| 400 | - $hours_arr = array (); |
|
| 401 | - $num_of_hours = 13; |
|
| 402 | - $start_at = 1; |
|
| 403 | - |
|
| 404 | - if (empty ($time_meridiem)) { |
|
| 405 | - $num_of_hours = 24; |
|
| 406 | - $start_at = 0; |
|
| 407 | - } //if |
|
| 408 | - |
|
| 409 | - for ($i = $start_at; $i < $num_of_hours; $i ++) { |
|
| 410 | - $i = $i.""; |
|
| 411 | - if (strlen($i) == 1) { |
|
| 412 | - $i = "0".$i; |
|
| 413 | - } |
|
| 414 | - $hours_arr[$i] = $i; |
|
| 415 | - } //for |
|
| 400 | + $hours_arr = array (); |
|
| 401 | + $num_of_hours = 13; |
|
| 402 | + $start_at = 1; |
|
| 403 | + |
|
| 404 | + if (empty ($time_meridiem)) { |
|
| 405 | + $num_of_hours = 24; |
|
| 406 | + $start_at = 0; |
|
| 407 | + } //if |
|
| 408 | + |
|
| 409 | + for ($i = $start_at; $i < $num_of_hours; $i ++) { |
|
| 410 | + $i = $i.""; |
|
| 411 | + if (strlen($i) == 1) { |
|
| 412 | + $i = "0".$i; |
|
| 413 | + } |
|
| 414 | + $hours_arr[$i] = $i; |
|
| 415 | + } //for |
|
| 416 | 416 | |
| 417 | 417 | if (!isset($this->duration_minutes)) { |
| 418 | - $this->duration_minutes = $this->minutes_value_default; |
|
| 419 | - } |
|
| 418 | + $this->duration_minutes = $this->minutes_value_default; |
|
| 419 | + } |
|
| 420 | 420 | |
| 421 | 421 | //setting default date and time |
| 422 | - if (is_null($this->date_start)) |
|
| 423 | - $this->date_start = $timedate->now(); |
|
| 424 | - if (is_null($this->time_start)) |
|
| 425 | - $this->time_start = $timedate->to_display_time(TimeDate::getInstance()->nowDb(), true); |
|
| 426 | - if (is_null($this->duration_hours)) { |
|
| 427 | - $this->duration_hours = "0"; |
|
| 428 | - } |
|
| 429 | - if (is_null($this->duration_minutes)) |
|
| 430 | - $this->duration_minutes = "1"; |
|
| 431 | - |
|
| 432 | - if(empty($this->id) && !empty($_REQUEST['date_start'])){ |
|
| 433 | - $this->date_start = $_REQUEST['date_start']; |
|
| 434 | - } |
|
| 422 | + if (is_null($this->date_start)) |
|
| 423 | + $this->date_start = $timedate->now(); |
|
| 424 | + if (is_null($this->time_start)) |
|
| 425 | + $this->time_start = $timedate->to_display_time(TimeDate::getInstance()->nowDb(), true); |
|
| 426 | + if (is_null($this->duration_hours)) { |
|
| 427 | + $this->duration_hours = "0"; |
|
| 428 | + } |
|
| 429 | + if (is_null($this->duration_minutes)) |
|
| 430 | + $this->duration_minutes = "1"; |
|
| 431 | + |
|
| 432 | + if(empty($this->id) && !empty($_REQUEST['date_start'])){ |
|
| 433 | + $this->date_start = $_REQUEST['date_start']; |
|
| 434 | + } |
|
| 435 | 435 | if(!empty($this->date_start)) |
| 436 | 436 | { |
| 437 | 437 | $td = SugarDateTime::createFromFormat($GLOBALS['timedate']->get_date_time_format(),$this->date_start); |
| 438 | 438 | if (!empty($td)) |
| 439 | 439 | { |
| 440 | - if (!empty($this->duration_hours) && $this->duration_hours != '') |
|
| 440 | + if (!empty($this->duration_hours) && $this->duration_hours != '') |
|
| 441 | 441 | { |
| 442 | - $td = $td->modify("+{$this->duration_hours} hours"); |
|
| 443 | - } |
|
| 442 | + $td = $td->modify("+{$this->duration_hours} hours"); |
|
| 443 | + } |
|
| 444 | 444 | if (!empty($this->duration_minutes) && $this->duration_minutes != '') |
| 445 | 445 | { |
| 446 | 446 | $td = $td->modify("+{$this->duration_minutes} mins"); |
@@ -451,77 +451,77 @@ discard block |
||
| 451 | 451 | { |
| 452 | 452 | $GLOBALS['log']->fatal("Meeting::save: Bad date {$this->date_start} for format ".$GLOBALS['timedate']->get_date_time_format()); |
| 453 | 453 | } |
| 454 | - } |
|
| 455 | - |
|
| 456 | - global $app_list_strings; |
|
| 457 | - $parent_types = $app_list_strings['record_type_display']; |
|
| 458 | - $disabled_parent_types = ACLController::disabledModuleList($parent_types,false, 'list'); |
|
| 459 | - foreach($disabled_parent_types as $disabled_parent_type){ |
|
| 460 | - if($disabled_parent_type != $this->parent_type){ |
|
| 461 | - unset($parent_types[$disabled_parent_type]); |
|
| 462 | - } |
|
| 463 | - } |
|
| 464 | - |
|
| 465 | - $this->parent_type_options = get_select_options_with_id($parent_types, $this->parent_type); |
|
| 466 | - if (empty($this->reminder_time)) { |
|
| 467 | - $this->reminder_time = -1; |
|
| 468 | - } |
|
| 469 | - |
|
| 470 | - if ( empty($this->id) ) { |
|
| 471 | - $reminder_t = $GLOBALS['current_user']->getPreference('reminder_time'); |
|
| 472 | - if ( isset($reminder_t) ) |
|
| 473 | - $this->reminder_time = $reminder_t; |
|
| 474 | - } |
|
| 475 | - $this->reminder_checked = $this->reminder_time == -1 ? false : true; |
|
| 476 | - |
|
| 477 | - if (empty($this->email_reminder_time)) { |
|
| 478 | - $this->email_reminder_time = -1; |
|
| 479 | - } |
|
| 480 | - if(empty($this->id)){ |
|
| 481 | - $reminder_t = $GLOBALS['current_user']->getPreference('email_reminder_time'); |
|
| 482 | - if(isset($reminder_t)) |
|
| 483 | - $this->email_reminder_time = $reminder_t; |
|
| 484 | - } |
|
| 485 | - $this->email_reminder_checked = $this->email_reminder_time == -1 ? false : true; |
|
| 486 | - |
|
| 487 | - if (isset ($_REQUEST['parent_type']) && empty($this->parent_type)) { |
|
| 488 | - $this->parent_type = $_REQUEST['parent_type']; |
|
| 489 | - } elseif (is_null($this->parent_type)) { |
|
| 490 | - $this->parent_type = $app_list_strings['record_type_default_key']; |
|
| 491 | - } |
|
| 492 | - |
|
| 493 | - } |
|
| 494 | - |
|
| 495 | - function get_list_view_data() { |
|
| 496 | - $meeting_fields = $this->get_list_view_array(); |
|
| 497 | - |
|
| 498 | - global $app_list_strings, $focus, $action, $currentModule; |
|
| 499 | - if(isset($this->parent_type)) |
|
| 500 | - $meeting_fields['PARENT_MODULE'] = $this->parent_type; |
|
| 501 | - if($this->status == "Planned") { |
|
| 502 | - //cn: added this if() to deal with sequential Closes in Meetings. this is a hack to a hack(formbase.php->handleRedirect) |
|
| 503 | - if(empty($action)) |
|
| 504 | - $action = "index"; |
|
| 454 | + } |
|
| 455 | + |
|
| 456 | + global $app_list_strings; |
|
| 457 | + $parent_types = $app_list_strings['record_type_display']; |
|
| 458 | + $disabled_parent_types = ACLController::disabledModuleList($parent_types,false, 'list'); |
|
| 459 | + foreach($disabled_parent_types as $disabled_parent_type){ |
|
| 460 | + if($disabled_parent_type != $this->parent_type){ |
|
| 461 | + unset($parent_types[$disabled_parent_type]); |
|
| 462 | + } |
|
| 463 | + } |
|
| 464 | + |
|
| 465 | + $this->parent_type_options = get_select_options_with_id($parent_types, $this->parent_type); |
|
| 466 | + if (empty($this->reminder_time)) { |
|
| 467 | + $this->reminder_time = -1; |
|
| 468 | + } |
|
| 469 | + |
|
| 470 | + if ( empty($this->id) ) { |
|
| 471 | + $reminder_t = $GLOBALS['current_user']->getPreference('reminder_time'); |
|
| 472 | + if ( isset($reminder_t) ) |
|
| 473 | + $this->reminder_time = $reminder_t; |
|
| 474 | + } |
|
| 475 | + $this->reminder_checked = $this->reminder_time == -1 ? false : true; |
|
| 476 | + |
|
| 477 | + if (empty($this->email_reminder_time)) { |
|
| 478 | + $this->email_reminder_time = -1; |
|
| 479 | + } |
|
| 480 | + if(empty($this->id)){ |
|
| 481 | + $reminder_t = $GLOBALS['current_user']->getPreference('email_reminder_time'); |
|
| 482 | + if(isset($reminder_t)) |
|
| 483 | + $this->email_reminder_time = $reminder_t; |
|
| 484 | + } |
|
| 485 | + $this->email_reminder_checked = $this->email_reminder_time == -1 ? false : true; |
|
| 486 | + |
|
| 487 | + if (isset ($_REQUEST['parent_type']) && empty($this->parent_type)) { |
|
| 488 | + $this->parent_type = $_REQUEST['parent_type']; |
|
| 489 | + } elseif (is_null($this->parent_type)) { |
|
| 490 | + $this->parent_type = $app_list_strings['record_type_default_key']; |
|
| 491 | + } |
|
| 492 | + |
|
| 493 | + } |
|
| 494 | + |
|
| 495 | + function get_list_view_data() { |
|
| 496 | + $meeting_fields = $this->get_list_view_array(); |
|
| 497 | + |
|
| 498 | + global $app_list_strings, $focus, $action, $currentModule; |
|
| 499 | + if(isset($this->parent_type)) |
|
| 500 | + $meeting_fields['PARENT_MODULE'] = $this->parent_type; |
|
| 501 | + if($this->status == "Planned") { |
|
| 502 | + //cn: added this if() to deal with sequential Closes in Meetings. this is a hack to a hack(formbase.php->handleRedirect) |
|
| 503 | + if(empty($action)) |
|
| 504 | + $action = "index"; |
|
| 505 | 505 | $setCompleteUrl = "<a id='{$this->id}' onclick='SUGAR.util.closeActivityPanel.show(\"{$this->module_dir}\",\"{$this->id}\",\"Held\",\"listview\",\"1\");'>"; |
| 506 | - if ($this->ACLAccess('edit')) { |
|
| 506 | + if ($this->ACLAccess('edit')) { |
|
| 507 | 507 | $meeting_fields['SET_COMPLETE'] = $setCompleteUrl . SugarThemeRegistry::current()->getImage("close_inline"," border='0'",null,null,'.gif',translate('LBL_CLOSEINLINE'))."</a>"; |
| 508 | 508 | } else { |
| 509 | 509 | $meeting_fields['SET_COMPLETE'] = ''; |
| 510 | 510 | } |
| 511 | - } |
|
| 512 | - global $timedate; |
|
| 513 | - $today = $timedate->nowDb(); |
|
| 514 | - $nextday = $timedate->asDbDate($timedate->getNow()->get("+1 day")); |
|
| 515 | - $mergeTime = $meeting_fields['DATE_START']; //$timedate->merge_date_time($meeting_fields['DATE_START'], $meeting_fields['TIME_START']); |
|
| 516 | - $date_db = $timedate->to_db($mergeTime); |
|
| 517 | - if($date_db < $today ) { |
|
| 518 | - $meeting_fields['DATE_START']= "<font class='overdueTask'>".$meeting_fields['DATE_START']."</font>"; |
|
| 519 | - }else if($date_db < $nextday) { |
|
| 520 | - $meeting_fields['DATE_START'] = "<font class='todaysTask'>".$meeting_fields['DATE_START']."</font>"; |
|
| 521 | - } else { |
|
| 522 | - $meeting_fields['DATE_START'] = "<font class='futureTask'>".$meeting_fields['DATE_START']."</font>"; |
|
| 523 | - } |
|
| 524 | - $this->fill_in_additional_detail_fields(); |
|
| 511 | + } |
|
| 512 | + global $timedate; |
|
| 513 | + $today = $timedate->nowDb(); |
|
| 514 | + $nextday = $timedate->asDbDate($timedate->getNow()->get("+1 day")); |
|
| 515 | + $mergeTime = $meeting_fields['DATE_START']; //$timedate->merge_date_time($meeting_fields['DATE_START'], $meeting_fields['TIME_START']); |
|
| 516 | + $date_db = $timedate->to_db($mergeTime); |
|
| 517 | + if($date_db < $today ) { |
|
| 518 | + $meeting_fields['DATE_START']= "<font class='overdueTask'>".$meeting_fields['DATE_START']."</font>"; |
|
| 519 | + }else if($date_db < $nextday) { |
|
| 520 | + $meeting_fields['DATE_START'] = "<font class='todaysTask'>".$meeting_fields['DATE_START']."</font>"; |
|
| 521 | + } else { |
|
| 522 | + $meeting_fields['DATE_START'] = "<font class='futureTask'>".$meeting_fields['DATE_START']."</font>"; |
|
| 523 | + } |
|
| 524 | + $this->fill_in_additional_detail_fields(); |
|
| 525 | 525 | |
| 526 | 526 | // make sure we grab the localized version of the contact name, if a contact is provided |
| 527 | 527 | if (!empty($this->contact_id)) |
@@ -537,342 +537,342 @@ discard block |
||
| 537 | 537 | |
| 538 | 538 | $meeting_fields['CONTACT_ID'] = $this->contact_id; |
| 539 | 539 | $meeting_fields['CONTACT_NAME'] = $this->contact_name; |
| 540 | - $meeting_fields['PARENT_NAME'] = $this->parent_name; |
|
| 540 | + $meeting_fields['PARENT_NAME'] = $this->parent_name; |
|
| 541 | 541 | $meeting_fields['REMINDER_CHECKED'] = $this->reminder_time==-1 ? false : true; |
| 542 | 542 | $meeting_fields['EMAIL_REMINDER_CHECKED'] = $this->email_reminder_time==-1 ? false : true; |
| 543 | 543 | |
| 544 | 544 | |
| 545 | - return $meeting_fields; |
|
| 546 | - } |
|
| 547 | - |
|
| 548 | - function set_notification_body($xtpl, &$meeting) { |
|
| 549 | - global $sugar_config; |
|
| 550 | - global $app_list_strings; |
|
| 551 | - global $current_user; |
|
| 552 | - global $timedate; |
|
| 553 | - |
|
| 554 | - |
|
| 555 | - // cn: bug 9494 - passing a contact breaks this call |
|
| 556 | - $notifyUser =($meeting->current_notify_user->object_name == 'User') ? $meeting->current_notify_user : $current_user; |
|
| 557 | - // cn: bug 8078 - fixed call to $timedate |
|
| 558 | - if(strtolower(get_class($meeting->current_notify_user)) == 'contact') { |
|
| 559 | - $xtpl->assign("ACCEPT_URL", $sugar_config['site_url']. |
|
| 560 | - '/index.php?entryPoint=acceptDecline&module=Meetings&contact_id='.$meeting->current_notify_user->id.'&record='.$meeting->id); |
|
| 561 | - } elseif(strtolower(get_class($meeting->current_notify_user)) == 'lead') { |
|
| 562 | - $xtpl->assign("ACCEPT_URL", $sugar_config['site_url']. |
|
| 563 | - '/index.php?entryPoint=acceptDecline&module=Meetings&lead_id='.$meeting->current_notify_user->id.'&record='.$meeting->id); |
|
| 564 | - } else { |
|
| 565 | - $xtpl->assign("ACCEPT_URL", $sugar_config['site_url']. |
|
| 566 | - '/index.php?entryPoint=acceptDecline&module=Meetings&user_id='.$meeting->current_notify_user->id.'&record='.$meeting->id); |
|
| 567 | - } |
|
| 568 | - $xtpl->assign("MEETING_TO", $meeting->current_notify_user->new_assigned_user_name); |
|
| 569 | - $xtpl->assign("MEETING_SUBJECT", trim($meeting->name)); |
|
| 570 | - $xtpl->assign("MEETING_STATUS",(isset($meeting->status)? $app_list_strings['meeting_status_dom'][$meeting->status]:"")); |
|
| 571 | - $typekey = strtolower($meeting->type); |
|
| 572 | - if(isset($meeting->type)) { |
|
| 573 | - if(!empty($app_list_strings['eapm_list'][$typekey])) { |
|
| 574 | - $typestring = $app_list_strings['eapm_list'][$typekey]; |
|
| 575 | - } else { |
|
| 576 | - $typestring = $app_list_strings['meeting_type_dom'][$meeting->type]; |
|
| 577 | - } |
|
| 578 | - } |
|
| 579 | - $xtpl->assign("MEETING_TYPE", isset($meeting->type)? $typestring:""); |
|
| 580 | - $startdate = $timedate->fromDb($meeting->date_start); |
|
| 581 | - $xtpl->assign("MEETING_STARTDATE", $timedate->asUser($startdate, $notifyUser)." ".TimeDate::userTimezoneSuffix($startdate, $notifyUser)); |
|
| 582 | - $enddate = $timedate->fromDb($meeting->date_end); |
|
| 583 | - $xtpl->assign("MEETING_ENDDATE", $timedate->asUser($enddate, $notifyUser)." ".TimeDate::userTimezoneSuffix($enddate, $notifyUser)); |
|
| 584 | - $xtpl->assign("MEETING_HOURS", $meeting->duration_hours); |
|
| 585 | - $xtpl->assign("MEETING_MINUTES", $meeting->duration_minutes); |
|
| 586 | - $xtpl->assign("MEETING_DESCRIPTION", $meeting->description); |
|
| 545 | + return $meeting_fields; |
|
| 546 | + } |
|
| 547 | + |
|
| 548 | + function set_notification_body($xtpl, &$meeting) { |
|
| 549 | + global $sugar_config; |
|
| 550 | + global $app_list_strings; |
|
| 551 | + global $current_user; |
|
| 552 | + global $timedate; |
|
| 553 | + |
|
| 554 | + |
|
| 555 | + // cn: bug 9494 - passing a contact breaks this call |
|
| 556 | + $notifyUser =($meeting->current_notify_user->object_name == 'User') ? $meeting->current_notify_user : $current_user; |
|
| 557 | + // cn: bug 8078 - fixed call to $timedate |
|
| 558 | + if(strtolower(get_class($meeting->current_notify_user)) == 'contact') { |
|
| 559 | + $xtpl->assign("ACCEPT_URL", $sugar_config['site_url']. |
|
| 560 | + '/index.php?entryPoint=acceptDecline&module=Meetings&contact_id='.$meeting->current_notify_user->id.'&record='.$meeting->id); |
|
| 561 | + } elseif(strtolower(get_class($meeting->current_notify_user)) == 'lead') { |
|
| 562 | + $xtpl->assign("ACCEPT_URL", $sugar_config['site_url']. |
|
| 563 | + '/index.php?entryPoint=acceptDecline&module=Meetings&lead_id='.$meeting->current_notify_user->id.'&record='.$meeting->id); |
|
| 564 | + } else { |
|
| 565 | + $xtpl->assign("ACCEPT_URL", $sugar_config['site_url']. |
|
| 566 | + '/index.php?entryPoint=acceptDecline&module=Meetings&user_id='.$meeting->current_notify_user->id.'&record='.$meeting->id); |
|
| 567 | + } |
|
| 568 | + $xtpl->assign("MEETING_TO", $meeting->current_notify_user->new_assigned_user_name); |
|
| 569 | + $xtpl->assign("MEETING_SUBJECT", trim($meeting->name)); |
|
| 570 | + $xtpl->assign("MEETING_STATUS",(isset($meeting->status)? $app_list_strings['meeting_status_dom'][$meeting->status]:"")); |
|
| 571 | + $typekey = strtolower($meeting->type); |
|
| 572 | + if(isset($meeting->type)) { |
|
| 573 | + if(!empty($app_list_strings['eapm_list'][$typekey])) { |
|
| 574 | + $typestring = $app_list_strings['eapm_list'][$typekey]; |
|
| 575 | + } else { |
|
| 576 | + $typestring = $app_list_strings['meeting_type_dom'][$meeting->type]; |
|
| 577 | + } |
|
| 578 | + } |
|
| 579 | + $xtpl->assign("MEETING_TYPE", isset($meeting->type)? $typestring:""); |
|
| 580 | + $startdate = $timedate->fromDb($meeting->date_start); |
|
| 581 | + $xtpl->assign("MEETING_STARTDATE", $timedate->asUser($startdate, $notifyUser)." ".TimeDate::userTimezoneSuffix($startdate, $notifyUser)); |
|
| 582 | + $enddate = $timedate->fromDb($meeting->date_end); |
|
| 583 | + $xtpl->assign("MEETING_ENDDATE", $timedate->asUser($enddate, $notifyUser)." ".TimeDate::userTimezoneSuffix($enddate, $notifyUser)); |
|
| 584 | + $xtpl->assign("MEETING_HOURS", $meeting->duration_hours); |
|
| 585 | + $xtpl->assign("MEETING_MINUTES", $meeting->duration_minutes); |
|
| 586 | + $xtpl->assign("MEETING_DESCRIPTION", $meeting->description); |
|
| 587 | 587 | if ( !empty($meeting->join_url) ) { |
| 588 | 588 | $xtpl->assign('MEETING_URL', $meeting->join_url); |
| 589 | 589 | $xtpl->parse('Meeting.Meeting_External_API'); |
| 590 | 590 | } |
| 591 | 591 | |
| 592 | - return $xtpl; |
|
| 593 | - } |
|
| 592 | + return $xtpl; |
|
| 593 | + } |
|
| 594 | 594 | |
| 595 | - /** |
|
| 596 | - * Redefine method to attach ics file to notification email |
|
| 597 | - */ |
|
| 598 | - public function create_notification_email($notify_user){ |
|
| 595 | + /** |
|
| 596 | + * Redefine method to attach ics file to notification email |
|
| 597 | + */ |
|
| 598 | + public function create_notification_email($notify_user){ |
|
| 599 | 599 | // reset acceptance status for non organizer if date is changed |
| 600 | 600 | if (($notify_user->id != $GLOBALS['current_user']->id) && $this->date_changed) { |
| 601 | 601 | $this->set_accept_status($notify_user, 'none'); |
| 602 | 602 | } |
| 603 | 603 | |
| 604 | - $notify_mail = parent::create_notification_email($notify_user); |
|
| 605 | - |
|
| 606 | - $path = SugarConfig::getInstance()->get('upload_dir','upload/') . $this->id; |
|
| 607 | - |
|
| 608 | - require_once("modules/vCals/vCal.php"); |
|
| 609 | - $content = vCal::get_ical_event($this, $GLOBALS['current_user']); |
|
| 610 | - |
|
| 611 | - if(file_put_contents($path,$content)){ |
|
| 612 | - $notify_mail->AddAttachment($path, 'meeting.ics', 'base64', 'text/calendar'); |
|
| 613 | - } |
|
| 614 | - return $notify_mail; |
|
| 615 | - } |
|
| 616 | - |
|
| 617 | - /** |
|
| 618 | - * Redefine method to remove ics after email is sent |
|
| 619 | - */ |
|
| 620 | - public function send_assignment_notifications($notify_user, $admin){ |
|
| 621 | - parent::send_assignment_notifications($notify_user, $admin); |
|
| 622 | - |
|
| 623 | - $path = SugarConfig::getInstance()->get('upload_dir','upload/') . $this->id; |
|
| 624 | - unlink($path); |
|
| 625 | - } |
|
| 626 | - |
|
| 627 | - function get_meeting_users() { |
|
| 628 | - $template = new User(); |
|
| 629 | - // First, get the list of IDs. |
|
| 630 | - $query = "SELECT meetings_users.required, meetings_users.accept_status, meetings_users.user_id from meetings_users where meetings_users.meeting_id='$this->id' AND meetings_users.deleted=0"; |
|
| 631 | - $GLOBALS['log']->debug("Finding linked records $this->object_name: ".$query); |
|
| 632 | - $result = $this->db->query($query, true); |
|
| 633 | - $list = Array(); |
|
| 634 | - |
|
| 635 | - while($row = $this->db->fetchByAssoc($result)) { |
|
| 636 | - $template = new User(); // PHP 5 will retrieve by reference, always over-writing the "old" one |
|
| 637 | - $record = $template->retrieve($row['user_id']); |
|
| 638 | - $template->required = $row['required']; |
|
| 639 | - $template->accept_status = $row['accept_status']; |
|
| 640 | - |
|
| 641 | - if($record != null) { |
|
| 642 | - // this copies the object into the array |
|
| 643 | - $list[] = $template; |
|
| 644 | - } |
|
| 645 | - } |
|
| 646 | - return $list; |
|
| 647 | - } |
|
| 648 | - |
|
| 649 | - function get_invite_meetings(&$user) { |
|
| 650 | - $template = $this; |
|
| 651 | - // First, get the list of IDs. |
|
| 652 | - $GLOBALS['log']->debug("Finding linked records $this->object_name: ".$query); |
|
| 653 | - $query = "SELECT meetings_users.required, meetings_users.accept_status, meetings_users.meeting_id from meetings_users where meetings_users.user_id='$user->id' AND( meetings_users.accept_status IS NULL OR meetings_users.accept_status='none') AND meetings_users.deleted=0"; |
|
| 654 | - $result = $this->db->query($query, true); |
|
| 655 | - $list = Array(); |
|
| 656 | - |
|
| 657 | - while($row = $this->db->fetchByAssoc($result)) { |
|
| 658 | - $record = $template->retrieve($row['meeting_id']); |
|
| 659 | - $template->required = $row['required']; |
|
| 660 | - $template->accept_status = $row['accept_status']; |
|
| 661 | - |
|
| 662 | - |
|
| 663 | - if($record != null) |
|
| 664 | - { |
|
| 665 | - // this copies the object into the array |
|
| 666 | - $list[] = $template; |
|
| 667 | - } |
|
| 668 | - } |
|
| 669 | - return $list; |
|
| 670 | - } |
|
| 671 | - |
|
| 672 | - |
|
| 673 | - function set_accept_status(&$user,$status) |
|
| 674 | - { |
|
| 675 | - if($user->object_name == 'User') |
|
| 676 | - { |
|
| 677 | - $relate_values = array('user_id'=>$user->id,'meeting_id'=>$this->id); |
|
| 678 | - $data_values = array('accept_status'=>$status); |
|
| 679 | - $this->set_relationship($this->rel_users_table, $relate_values, true, true,$data_values); |
|
| 680 | - global $current_user; |
|
| 681 | - |
|
| 682 | - if($this->update_vcal) |
|
| 683 | - { |
|
| 684 | - vCal::cache_sugar_vcal($user); |
|
| 685 | - } |
|
| 686 | - } |
|
| 687 | - else if($user->object_name == 'Contact') |
|
| 688 | - { |
|
| 689 | - $relate_values = array('contact_id'=>$user->id,'meeting_id'=>$this->id); |
|
| 690 | - $data_values = array('accept_status'=>$status); |
|
| 691 | - $this->set_relationship($this->rel_contacts_table, $relate_values, true, true,$data_values); |
|
| 692 | - } |
|
| 604 | + $notify_mail = parent::create_notification_email($notify_user); |
|
| 605 | + |
|
| 606 | + $path = SugarConfig::getInstance()->get('upload_dir','upload/') . $this->id; |
|
| 607 | + |
|
| 608 | + require_once("modules/vCals/vCal.php"); |
|
| 609 | + $content = vCal::get_ical_event($this, $GLOBALS['current_user']); |
|
| 610 | + |
|
| 611 | + if(file_put_contents($path,$content)){ |
|
| 612 | + $notify_mail->AddAttachment($path, 'meeting.ics', 'base64', 'text/calendar'); |
|
| 613 | + } |
|
| 614 | + return $notify_mail; |
|
| 615 | + } |
|
| 616 | + |
|
| 617 | + /** |
|
| 618 | + * Redefine method to remove ics after email is sent |
|
| 619 | + */ |
|
| 620 | + public function send_assignment_notifications($notify_user, $admin){ |
|
| 621 | + parent::send_assignment_notifications($notify_user, $admin); |
|
| 622 | + |
|
| 623 | + $path = SugarConfig::getInstance()->get('upload_dir','upload/') . $this->id; |
|
| 624 | + unlink($path); |
|
| 625 | + } |
|
| 626 | + |
|
| 627 | + function get_meeting_users() { |
|
| 628 | + $template = new User(); |
|
| 629 | + // First, get the list of IDs. |
|
| 630 | + $query = "SELECT meetings_users.required, meetings_users.accept_status, meetings_users.user_id from meetings_users where meetings_users.meeting_id='$this->id' AND meetings_users.deleted=0"; |
|
| 631 | + $GLOBALS['log']->debug("Finding linked records $this->object_name: ".$query); |
|
| 632 | + $result = $this->db->query($query, true); |
|
| 633 | + $list = Array(); |
|
| 634 | + |
|
| 635 | + while($row = $this->db->fetchByAssoc($result)) { |
|
| 636 | + $template = new User(); // PHP 5 will retrieve by reference, always over-writing the "old" one |
|
| 637 | + $record = $template->retrieve($row['user_id']); |
|
| 638 | + $template->required = $row['required']; |
|
| 639 | + $template->accept_status = $row['accept_status']; |
|
| 640 | + |
|
| 641 | + if($record != null) { |
|
| 642 | + // this copies the object into the array |
|
| 643 | + $list[] = $template; |
|
| 644 | + } |
|
| 645 | + } |
|
| 646 | + return $list; |
|
| 647 | + } |
|
| 648 | + |
|
| 649 | + function get_invite_meetings(&$user) { |
|
| 650 | + $template = $this; |
|
| 651 | + // First, get the list of IDs. |
|
| 652 | + $GLOBALS['log']->debug("Finding linked records $this->object_name: ".$query); |
|
| 653 | + $query = "SELECT meetings_users.required, meetings_users.accept_status, meetings_users.meeting_id from meetings_users where meetings_users.user_id='$user->id' AND( meetings_users.accept_status IS NULL OR meetings_users.accept_status='none') AND meetings_users.deleted=0"; |
|
| 654 | + $result = $this->db->query($query, true); |
|
| 655 | + $list = Array(); |
|
| 656 | + |
|
| 657 | + while($row = $this->db->fetchByAssoc($result)) { |
|
| 658 | + $record = $template->retrieve($row['meeting_id']); |
|
| 659 | + $template->required = $row['required']; |
|
| 660 | + $template->accept_status = $row['accept_status']; |
|
| 661 | + |
|
| 662 | + |
|
| 663 | + if($record != null) |
|
| 664 | + { |
|
| 665 | + // this copies the object into the array |
|
| 666 | + $list[] = $template; |
|
| 667 | + } |
|
| 668 | + } |
|
| 669 | + return $list; |
|
| 670 | + } |
|
| 671 | + |
|
| 672 | + |
|
| 673 | + function set_accept_status(&$user,$status) |
|
| 674 | + { |
|
| 675 | + if($user->object_name == 'User') |
|
| 676 | + { |
|
| 677 | + $relate_values = array('user_id'=>$user->id,'meeting_id'=>$this->id); |
|
| 678 | + $data_values = array('accept_status'=>$status); |
|
| 679 | + $this->set_relationship($this->rel_users_table, $relate_values, true, true,$data_values); |
|
| 680 | + global $current_user; |
|
| 681 | + |
|
| 682 | + if($this->update_vcal) |
|
| 683 | + { |
|
| 684 | + vCal::cache_sugar_vcal($user); |
|
| 685 | + } |
|
| 686 | + } |
|
| 687 | + else if($user->object_name == 'Contact') |
|
| 688 | + { |
|
| 689 | + $relate_values = array('contact_id'=>$user->id,'meeting_id'=>$this->id); |
|
| 690 | + $data_values = array('accept_status'=>$status); |
|
| 691 | + $this->set_relationship($this->rel_contacts_table, $relate_values, true, true,$data_values); |
|
| 692 | + } |
|
| 693 | 693 | else if($user->object_name == 'Lead') |
| 694 | - { |
|
| 695 | - $relate_values = array('lead_id'=>$user->id,'meeting_id'=>$this->id); |
|
| 696 | - $data_values = array('accept_status'=>$status); |
|
| 697 | - $this->set_relationship($this->rel_leads_table, $relate_values, true, true,$data_values); |
|
| 698 | - } |
|
| 699 | - } |
|
| 694 | + { |
|
| 695 | + $relate_values = array('lead_id'=>$user->id,'meeting_id'=>$this->id); |
|
| 696 | + $data_values = array('accept_status'=>$status); |
|
| 697 | + $this->set_relationship($this->rel_leads_table, $relate_values, true, true,$data_values); |
|
| 698 | + } |
|
| 699 | + } |
|
| 700 | 700 | |
| 701 | 701 | |
| 702 | - function get_notification_recipients() { |
|
| 703 | - if($this->special_notification) { |
|
| 704 | - return parent::get_notification_recipients(); |
|
| 705 | - } |
|
| 702 | + function get_notification_recipients() { |
|
| 703 | + if($this->special_notification) { |
|
| 704 | + return parent::get_notification_recipients(); |
|
| 705 | + } |
|
| 706 | 706 | |
| 707 | - $list = array(); |
|
| 708 | - if(!is_array($this->contacts_arr)) { |
|
| 709 | - $this->contacts_arr = array(); |
|
| 710 | - } |
|
| 707 | + $list = array(); |
|
| 708 | + if(!is_array($this->contacts_arr)) { |
|
| 709 | + $this->contacts_arr = array(); |
|
| 710 | + } |
|
| 711 | 711 | |
| 712 | - if(!is_array($this->users_arr)) { |
|
| 713 | - $this->users_arr = array(); |
|
| 714 | - } |
|
| 712 | + if(!is_array($this->users_arr)) { |
|
| 713 | + $this->users_arr = array(); |
|
| 714 | + } |
|
| 715 | 715 | |
| 716 | 716 | if(!is_array($this->leads_arr)) { |
| 717 | - $this->leads_arr = array(); |
|
| 718 | - } |
|
| 719 | - |
|
| 720 | - foreach($this->users_arr as $user_id) { |
|
| 721 | - $notify_user = new User(); |
|
| 722 | - $notify_user->retrieve($user_id); |
|
| 723 | - $notify_user->new_assigned_user_name = $notify_user->full_name; |
|
| 724 | - $GLOBALS['log']->info("Notifications: recipient is $notify_user->new_assigned_user_name"); |
|
| 725 | - $list[$notify_user->id] = $notify_user; |
|
| 726 | - } |
|
| 727 | - |
|
| 728 | - foreach($this->contacts_arr as $contact_id) { |
|
| 729 | - $notify_user = new Contact(); |
|
| 730 | - $notify_user->retrieve($contact_id); |
|
| 731 | - $notify_user->new_assigned_user_name = $notify_user->full_name; |
|
| 732 | - $GLOBALS['log']->info("Notifications: recipient is $notify_user->new_assigned_user_name"); |
|
| 733 | - $list[$notify_user->id] = $notify_user; |
|
| 734 | - } |
|
| 717 | + $this->leads_arr = array(); |
|
| 718 | + } |
|
| 719 | + |
|
| 720 | + foreach($this->users_arr as $user_id) { |
|
| 721 | + $notify_user = new User(); |
|
| 722 | + $notify_user->retrieve($user_id); |
|
| 723 | + $notify_user->new_assigned_user_name = $notify_user->full_name; |
|
| 724 | + $GLOBALS['log']->info("Notifications: recipient is $notify_user->new_assigned_user_name"); |
|
| 725 | + $list[$notify_user->id] = $notify_user; |
|
| 726 | + } |
|
| 727 | + |
|
| 728 | + foreach($this->contacts_arr as $contact_id) { |
|
| 729 | + $notify_user = new Contact(); |
|
| 730 | + $notify_user->retrieve($contact_id); |
|
| 731 | + $notify_user->new_assigned_user_name = $notify_user->full_name; |
|
| 732 | + $GLOBALS['log']->info("Notifications: recipient is $notify_user->new_assigned_user_name"); |
|
| 733 | + $list[$notify_user->id] = $notify_user; |
|
| 734 | + } |
|
| 735 | 735 | |
| 736 | 736 | foreach($this->leads_arr as $lead_id) { |
| 737 | - $notify_user = new Lead(); |
|
| 738 | - $notify_user->retrieve($lead_id); |
|
| 739 | - $notify_user->new_assigned_user_name = $notify_user->full_name; |
|
| 740 | - $GLOBALS['log']->info("Notifications: recipient is $notify_user->new_assigned_user_name"); |
|
| 741 | - $list[$notify_user->id] = $notify_user; |
|
| 742 | - } |
|
| 743 | - |
|
| 744 | - global $sugar_config; |
|
| 745 | - if(isset($sugar_config['disable_notify_current_user']) && $sugar_config['disable_notify_current_user']) { |
|
| 746 | - global $current_user; |
|
| 747 | - if(isset($list[$current_user->id])) |
|
| 748 | - unset($list[$current_user->id]); |
|
| 749 | - } |
|
| 750 | - return $list; |
|
| 751 | - } |
|
| 752 | - |
|
| 753 | - |
|
| 754 | - function bean_implements($interface) { |
|
| 755 | - switch($interface) { |
|
| 756 | - case 'ACL':return true; |
|
| 757 | - } |
|
| 758 | - return false; |
|
| 759 | - } |
|
| 760 | - |
|
| 761 | - function listviewACLHelper() { |
|
| 762 | - $array_assign = parent::listviewACLHelper(); |
|
| 763 | - $is_owner = false; |
|
| 764 | - $in_group = false; //SECURITY GROUPS |
|
| 765 | - if(!empty($this->parent_name)) { |
|
| 766 | - |
|
| 767 | - if(!empty($this->parent_name_owner)) { |
|
| 768 | - global $current_user; |
|
| 769 | - $is_owner = $current_user->id == $this->parent_name_owner; |
|
| 770 | - } |
|
| 771 | - /* BEGIN - SECURITY GROUPS */ |
|
| 772 | - //parent_name_owner not being set for whatever reason so we need to figure this out |
|
| 773 | - else if(!empty($this->parent_type) && !empty($this->parent_id)) { |
|
| 774 | - global $current_user; |
|
| 737 | + $notify_user = new Lead(); |
|
| 738 | + $notify_user->retrieve($lead_id); |
|
| 739 | + $notify_user->new_assigned_user_name = $notify_user->full_name; |
|
| 740 | + $GLOBALS['log']->info("Notifications: recipient is $notify_user->new_assigned_user_name"); |
|
| 741 | + $list[$notify_user->id] = $notify_user; |
|
| 742 | + } |
|
| 743 | + |
|
| 744 | + global $sugar_config; |
|
| 745 | + if(isset($sugar_config['disable_notify_current_user']) && $sugar_config['disable_notify_current_user']) { |
|
| 746 | + global $current_user; |
|
| 747 | + if(isset($list[$current_user->id])) |
|
| 748 | + unset($list[$current_user->id]); |
|
| 749 | + } |
|
| 750 | + return $list; |
|
| 751 | + } |
|
| 752 | + |
|
| 753 | + |
|
| 754 | + function bean_implements($interface) { |
|
| 755 | + switch($interface) { |
|
| 756 | + case 'ACL':return true; |
|
| 757 | + } |
|
| 758 | + return false; |
|
| 759 | + } |
|
| 760 | + |
|
| 761 | + function listviewACLHelper() { |
|
| 762 | + $array_assign = parent::listviewACLHelper(); |
|
| 763 | + $is_owner = false; |
|
| 764 | + $in_group = false; //SECURITY GROUPS |
|
| 765 | + if(!empty($this->parent_name)) { |
|
| 766 | + |
|
| 767 | + if(!empty($this->parent_name_owner)) { |
|
| 768 | + global $current_user; |
|
| 769 | + $is_owner = $current_user->id == $this->parent_name_owner; |
|
| 770 | + } |
|
| 771 | + /* BEGIN - SECURITY GROUPS */ |
|
| 772 | + //parent_name_owner not being set for whatever reason so we need to figure this out |
|
| 773 | + else if(!empty($this->parent_type) && !empty($this->parent_id)) { |
|
| 774 | + global $current_user; |
|
| 775 | 775 | $parent_bean = BeanFactory::getBean($this->parent_type,$this->parent_id); |
| 776 | 776 | if($parent_bean !== false) { |
| 777 | - $is_owner = $current_user->id == $parent_bean->assigned_user_id; |
|
| 777 | + $is_owner = $current_user->id == $parent_bean->assigned_user_id; |
|
| 778 | 778 | } |
| 779 | - } |
|
| 780 | - require_once("modules/SecurityGroups/SecurityGroup.php"); |
|
| 781 | - $in_group = SecurityGroup::groupHasAccess($this->parent_type, $this->parent_id, 'view'); |
|
| 782 | - /* END - SECURITY GROUPS */ |
|
| 783 | - } |
|
| 784 | - |
|
| 785 | - /* BEGIN - SECURITY GROUPS */ |
|
| 786 | - /** |
|
| 779 | + } |
|
| 780 | + require_once("modules/SecurityGroups/SecurityGroup.php"); |
|
| 781 | + $in_group = SecurityGroup::groupHasAccess($this->parent_type, $this->parent_id, 'view'); |
|
| 782 | + /* END - SECURITY GROUPS */ |
|
| 783 | + } |
|
| 784 | + |
|
| 785 | + /* BEGIN - SECURITY GROUPS */ |
|
| 786 | + /** |
|
| 787 | 787 | if(!ACLController::moduleSupportsACL($this->parent_type) || ACLController::checkAccess($this->parent_type, 'view', $is_owner)) { |
| 788 | - */ |
|
| 789 | - if(!ACLController::moduleSupportsACL($this->parent_type) || ACLController::checkAccess($this->parent_type, 'view', $is_owner, 'module', $in_group)){ |
|
| 788 | + */ |
|
| 789 | + if(!ACLController::moduleSupportsACL($this->parent_type) || ACLController::checkAccess($this->parent_type, 'view', $is_owner, 'module', $in_group)){ |
|
| 790 | 790 | /* END - SECURITY GROUPS */ |
| 791 | - $array_assign['PARENT'] = 'a'; |
|
| 792 | - } else { |
|
| 793 | - $array_assign['PARENT'] = 'span'; |
|
| 794 | - } |
|
| 795 | - |
|
| 796 | - $is_owner = false; |
|
| 797 | - $in_group = false; //SECURITY GROUPS |
|
| 798 | - |
|
| 799 | - if(!empty($this->contact_name)) { |
|
| 800 | - if(!empty($this->contact_name_owner)) { |
|
| 801 | - global $current_user; |
|
| 802 | - $is_owner = $current_user->id == $this->contact_name_owner; |
|
| 803 | - } |
|
| 804 | - /* BEGIN - SECURITY GROUPS */ |
|
| 805 | - //contact_name_owner not being set for whatever reason so we need to figure this out |
|
| 806 | - else { |
|
| 807 | - global $current_user; |
|
| 791 | + $array_assign['PARENT'] = 'a'; |
|
| 792 | + } else { |
|
| 793 | + $array_assign['PARENT'] = 'span'; |
|
| 794 | + } |
|
| 795 | + |
|
| 796 | + $is_owner = false; |
|
| 797 | + $in_group = false; //SECURITY GROUPS |
|
| 798 | + |
|
| 799 | + if(!empty($this->contact_name)) { |
|
| 800 | + if(!empty($this->contact_name_owner)) { |
|
| 801 | + global $current_user; |
|
| 802 | + $is_owner = $current_user->id == $this->contact_name_owner; |
|
| 803 | + } |
|
| 804 | + /* BEGIN - SECURITY GROUPS */ |
|
| 805 | + //contact_name_owner not being set for whatever reason so we need to figure this out |
|
| 806 | + else { |
|
| 807 | + global $current_user; |
|
| 808 | 808 | $parent_bean = BeanFactory::getBean('Contacts',$this->contact_id); |
| 809 | 809 | if($parent_bean !== false) { |
| 810 | - $is_owner = $current_user->id == $parent_bean->assigned_user_id; |
|
| 810 | + $is_owner = $current_user->id == $parent_bean->assigned_user_id; |
|
| 811 | 811 | } |
| 812 | - } |
|
| 813 | - require_once("modules/SecurityGroups/SecurityGroup.php"); |
|
| 814 | - $in_group = SecurityGroup::groupHasAccess('Contacts', $this->contact_id, 'view'); |
|
| 815 | - /* END - SECURITY GROUPS */ |
|
| 816 | - } |
|
| 817 | - |
|
| 818 | - /* BEGIN - SECURITY GROUPS */ |
|
| 819 | - /** |
|
| 812 | + } |
|
| 813 | + require_once("modules/SecurityGroups/SecurityGroup.php"); |
|
| 814 | + $in_group = SecurityGroup::groupHasAccess('Contacts', $this->contact_id, 'view'); |
|
| 815 | + /* END - SECURITY GROUPS */ |
|
| 816 | + } |
|
| 817 | + |
|
| 818 | + /* BEGIN - SECURITY GROUPS */ |
|
| 819 | + /** |
|
| 820 | 820 | if(ACLController::checkAccess('Contacts', 'view', $is_owner)) { |
| 821 | - */ |
|
| 822 | - if(ACLController::checkAccess('Contacts', 'view', $is_owner, 'module', $in_group)) { |
|
| 821 | + */ |
|
| 822 | + if(ACLController::checkAccess('Contacts', 'view', $is_owner, 'module', $in_group)) { |
|
| 823 | 823 | /* END - SECURITY GROUPS */ |
| 824 | - $array_assign['CONTACT'] = 'a'; |
|
| 825 | - } else { |
|
| 826 | - $array_assign['CONTACT'] = 'span'; |
|
| 827 | - } |
|
| 828 | - return $array_assign; |
|
| 829 | - } |
|
| 830 | - |
|
| 831 | - |
|
| 832 | - function save_relationship_changes($is_update, $exclude = array()) { |
|
| 833 | - if(empty($this->in_workflow)) { |
|
| 834 | - if(empty($this->in_import)){//if a meeting is being imported then contact_id should not be excluded |
|
| 835 | - //if the global soap_server_object variable is not empty (as in from a soap/OPI call), then process the assigned_user_id relationship, otherwise |
|
| 836 | - //add assigned_user_id to exclude list and let the logic from MeetingFormBase determine whether assigned user id gets added to the relationship |
|
| 837 | - if(!empty($GLOBALS['soap_server_object'])){ |
|
| 838 | - $exclude = array('contact_id', 'user_id'); |
|
| 839 | - }else{ |
|
| 840 | - $exclude = array('contact_id', 'user_id','assigned_user_id'); |
|
| 841 | - } |
|
| 842 | - } |
|
| 843 | - else{ |
|
| 844 | - $exclude = array('user_id'); |
|
| 845 | - } |
|
| 846 | - } |
|
| 847 | - parent::save_relationship_changes($is_update, $exclude); |
|
| 848 | - } |
|
| 849 | - |
|
| 850 | - |
|
| 851 | - /** |
|
| 852 | - * @see SugarBean::afterImportSave() |
|
| 853 | - */ |
|
| 854 | - public function afterImportSave() |
|
| 855 | - { |
|
| 856 | - if ( $this->parent_type == 'Contacts' ) { |
|
| 857 | - $this->load_relationship('contacts'); |
|
| 858 | - if ( !$this->contacts->relationship_exists('contacts',array('id'=>$this->parent_id)) ) |
|
| 859 | - $this->contacts->add($this->parent_id); |
|
| 860 | - } |
|
| 861 | - elseif ( $this->parent_type == 'Leads' ) { |
|
| 862 | - $this->load_relationship('leads'); |
|
| 863 | - if ( !$this->leads->relationship_exists('leads',array('id'=>$this->parent_id)) ) |
|
| 864 | - $this->leads->add($this->parent_id); |
|
| 865 | - } |
|
| 866 | - |
|
| 867 | - parent::afterImportSave(); |
|
| 868 | - } |
|
| 824 | + $array_assign['CONTACT'] = 'a'; |
|
| 825 | + } else { |
|
| 826 | + $array_assign['CONTACT'] = 'span'; |
|
| 827 | + } |
|
| 828 | + return $array_assign; |
|
| 829 | + } |
|
| 830 | + |
|
| 831 | + |
|
| 832 | + function save_relationship_changes($is_update, $exclude = array()) { |
|
| 833 | + if(empty($this->in_workflow)) { |
|
| 834 | + if(empty($this->in_import)){//if a meeting is being imported then contact_id should not be excluded |
|
| 835 | + //if the global soap_server_object variable is not empty (as in from a soap/OPI call), then process the assigned_user_id relationship, otherwise |
|
| 836 | + //add assigned_user_id to exclude list and let the logic from MeetingFormBase determine whether assigned user id gets added to the relationship |
|
| 837 | + if(!empty($GLOBALS['soap_server_object'])){ |
|
| 838 | + $exclude = array('contact_id', 'user_id'); |
|
| 839 | + }else{ |
|
| 840 | + $exclude = array('contact_id', 'user_id','assigned_user_id'); |
|
| 841 | + } |
|
| 842 | + } |
|
| 843 | + else{ |
|
| 844 | + $exclude = array('user_id'); |
|
| 845 | + } |
|
| 846 | + } |
|
| 847 | + parent::save_relationship_changes($is_update, $exclude); |
|
| 848 | + } |
|
| 849 | + |
|
| 850 | + |
|
| 851 | + /** |
|
| 852 | + * @see SugarBean::afterImportSave() |
|
| 853 | + */ |
|
| 854 | + public function afterImportSave() |
|
| 855 | + { |
|
| 856 | + if ( $this->parent_type == 'Contacts' ) { |
|
| 857 | + $this->load_relationship('contacts'); |
|
| 858 | + if ( !$this->contacts->relationship_exists('contacts',array('id'=>$this->parent_id)) ) |
|
| 859 | + $this->contacts->add($this->parent_id); |
|
| 860 | + } |
|
| 861 | + elseif ( $this->parent_type == 'Leads' ) { |
|
| 862 | + $this->load_relationship('leads'); |
|
| 863 | + if ( !$this->leads->relationship_exists('leads',array('id'=>$this->parent_id)) ) |
|
| 864 | + $this->leads->add($this->parent_id); |
|
| 865 | + } |
|
| 866 | + |
|
| 867 | + parent::afterImportSave(); |
|
| 868 | + } |
|
| 869 | 869 | |
| 870 | 870 | public function getDefaultStatus() |
| 871 | 871 | { |
| 872 | - $def = $this->field_defs['status']; |
|
| 873 | - if (isset($def['default'])) { |
|
| 874 | - return $def['default']; |
|
| 875 | - } else { |
|
| 872 | + $def = $this->field_defs['status']; |
|
| 873 | + if (isset($def['default'])) { |
|
| 874 | + return $def['default']; |
|
| 875 | + } else { |
|
| 876 | 876 | $app = return_app_list_strings_language($GLOBALS['current_language']); |
| 877 | 877 | if (isset($def['options']) && isset($app[$def['options']])) { |
| 878 | 878 | $keys = array_keys($app[$def['options']]); |
@@ -888,9 +888,9 @@ discard block |
||
| 888 | 888 | //TODO: do we really need focus, name and view params for this function |
| 889 | 889 | function getMeetingsExternalApiDropDown($focus = null, $name = null, $value = null, $view = null) |
| 890 | 890 | { |
| 891 | - global $dictionary, $app_list_strings; |
|
| 891 | + global $dictionary, $app_list_strings; |
|
| 892 | 892 | |
| 893 | - $cacheKeyName = 'meetings_type_drop_down'; |
|
| 893 | + $cacheKeyName = 'meetings_type_drop_down'; |
|
| 894 | 894 | |
| 895 | 895 | $apiList = sugar_cache_retrieve($cacheKeyName); |
| 896 | 896 | if ($apiList === null) |
@@ -902,17 +902,17 @@ discard block |
||
| 902 | 902 | sugar_cache_put($cacheKeyName, $apiList); |
| 903 | 903 | } |
| 904 | 904 | |
| 905 | - if(!empty($value) && empty($apiList[$value])) |
|
| 906 | - { |
|
| 907 | - $apiList[$value] = $value; |
|
| 905 | + if(!empty($value) && empty($apiList[$value])) |
|
| 906 | + { |
|
| 907 | + $apiList[$value] = $value; |
|
| 908 | 908 | } |
| 909 | - //bug 46294: adding list of options to dropdown list (if it is not the default list) |
|
| 909 | + //bug 46294: adding list of options to dropdown list (if it is not the default list) |
|
| 910 | 910 | if ($dictionary['Meeting']['fields']['type']['options'] != "eapm_list") |
| 911 | 911 | { |
| 912 | 912 | $apiList = array_merge(getMeetingTypeOptions($dictionary, $app_list_strings), $apiList); |
| 913 | 913 | } |
| 914 | 914 | |
| 915 | - return $apiList; |
|
| 915 | + return $apiList; |
|
| 916 | 916 | } |
| 917 | 917 | |
| 918 | 918 | /** |
@@ -923,20 +923,20 @@ discard block |
||
| 923 | 923 | */ |
| 924 | 924 | function getMeetingTypeOptions($dictionary, $app_list_strings) |
| 925 | 925 | { |
| 926 | - $result = array(); |
|
| 926 | + $result = array(); |
|
| 927 | 927 | |
| 928 | 928 | // getting name of meeting type to fill dropdown list by its values |
| 929 | 929 | if (isset($dictionary['Meeting']['fields']['type']['options'])) |
| 930 | - { |
|
| 931 | - $typeName = $dictionary['Meeting']['fields']['type']['options']; |
|
| 930 | + { |
|
| 931 | + $typeName = $dictionary['Meeting']['fields']['type']['options']; |
|
| 932 | 932 | |
| 933 | 933 | if (!empty($app_list_strings[$typeName])) |
| 934 | - { |
|
| 935 | - $typeList = $app_list_strings[$typeName]; |
|
| 934 | + { |
|
| 935 | + $typeList = $app_list_strings[$typeName]; |
|
| 936 | 936 | |
| 937 | 937 | foreach ($typeList as $key => $value) |
| 938 | - { |
|
| 939 | - $result[$value] = $value; |
|
| 938 | + { |
|
| 939 | + $result[$value] = $value; |
|
| 940 | 940 | } |
| 941 | 941 | } |
| 942 | 942 | } |
@@ -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. |
@@ -133,8 +135,7 @@ discard block |
||
| 133 | 135 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 134 | 136 | if(isset($GLOBALS['log'])) { |
| 135 | 137 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 136 | - } |
|
| 137 | - else { |
|
| 138 | + } else { |
|
| 138 | 139 | trigger_error($deprecatedMessage, E_USER_DEPRECATED); |
| 139 | 140 | } |
| 140 | 141 | self::__construct(); |
@@ -221,8 +222,9 @@ discard block |
||
| 221 | 222 | }*/ |
| 222 | 223 | |
| 223 | 224 | // prevent a mass mailing for recurring meetings created in Calendar module |
| 224 | - if(empty($this->id) && !empty($_REQUEST['module']) && $_REQUEST['module'] == "Calendar" && !empty($_REQUEST['repeat_type']) && !empty($this->repeat_parent_id)) |
|
| 225 | - $check_notify = false; |
|
| 225 | + if(empty($this->id) && !empty($_REQUEST['module']) && $_REQUEST['module'] == "Calendar" && !empty($_REQUEST['repeat_type']) && !empty($this->repeat_parent_id)) { |
|
| 226 | + $check_notify = false; |
|
| 227 | + } |
|
| 226 | 228 | |
| 227 | 229 | if (empty($this->status) ) { |
| 228 | 230 | $this->status = $this->getDefaultStatus(); |
@@ -326,10 +328,11 @@ discard block |
||
| 326 | 328 | |
| 327 | 329 | $query .= $custom_join['join']; |
| 328 | 330 | |
| 329 | - if($where != "") |
|
| 330 | - $query .= " where $where AND ".$where_auto; |
|
| 331 | - else |
|
| 332 | - $query .= " where ".$where_auto; |
|
| 331 | + if($where != "") { |
|
| 332 | + $query .= " where $where AND ".$where_auto; |
|
| 333 | + } else { |
|
| 334 | + $query .= " where ".$where_auto; |
|
| 335 | + } |
|
| 333 | 336 | |
| 334 | 337 | $order_by = $this->process_order_by($order_by); |
| 335 | 338 | if (!empty($order_by)) { |
@@ -419,15 +422,18 @@ discard block |
||
| 419 | 422 | } |
| 420 | 423 | |
| 421 | 424 | //setting default date and time |
| 422 | - if (is_null($this->date_start)) |
|
| 423 | - $this->date_start = $timedate->now(); |
|
| 424 | - if (is_null($this->time_start)) |
|
| 425 | - $this->time_start = $timedate->to_display_time(TimeDate::getInstance()->nowDb(), true); |
|
| 425 | + if (is_null($this->date_start)) { |
|
| 426 | + $this->date_start = $timedate->now(); |
|
| 427 | + } |
|
| 428 | + if (is_null($this->time_start)) { |
|
| 429 | + $this->time_start = $timedate->to_display_time(TimeDate::getInstance()->nowDb(), true); |
|
| 430 | + } |
|
| 426 | 431 | if (is_null($this->duration_hours)) { |
| 427 | 432 | $this->duration_hours = "0"; |
| 428 | 433 | } |
| 429 | - if (is_null($this->duration_minutes)) |
|
| 430 | - $this->duration_minutes = "1"; |
|
| 434 | + if (is_null($this->duration_minutes)) { |
|
| 435 | + $this->duration_minutes = "1"; |
|
| 436 | + } |
|
| 431 | 437 | |
| 432 | 438 | if(empty($this->id) && !empty($_REQUEST['date_start'])){ |
| 433 | 439 | $this->date_start = $_REQUEST['date_start']; |
@@ -446,8 +452,7 @@ discard block |
||
| 446 | 452 | $td = $td->modify("+{$this->duration_minutes} mins"); |
| 447 | 453 | } |
| 448 | 454 | $this->date_end = $td->format($GLOBALS['timedate']->get_date_time_format()); |
| 449 | - } |
|
| 450 | - else |
|
| 455 | + } else |
|
| 451 | 456 | { |
| 452 | 457 | $GLOBALS['log']->fatal("Meeting::save: Bad date {$this->date_start} for format ".$GLOBALS['timedate']->get_date_time_format()); |
| 453 | 458 | } |
@@ -469,8 +474,9 @@ discard block |
||
| 469 | 474 | |
| 470 | 475 | if ( empty($this->id) ) { |
| 471 | 476 | $reminder_t = $GLOBALS['current_user']->getPreference('reminder_time'); |
| 472 | - if ( isset($reminder_t) ) |
|
| 473 | - $this->reminder_time = $reminder_t; |
|
| 477 | + if ( isset($reminder_t) ) { |
|
| 478 | + $this->reminder_time = $reminder_t; |
|
| 479 | + } |
|
| 474 | 480 | } |
| 475 | 481 | $this->reminder_checked = $this->reminder_time == -1 ? false : true; |
| 476 | 482 | |
@@ -479,8 +485,9 @@ discard block |
||
| 479 | 485 | } |
| 480 | 486 | if(empty($this->id)){ |
| 481 | 487 | $reminder_t = $GLOBALS['current_user']->getPreference('email_reminder_time'); |
| 482 | - if(isset($reminder_t)) |
|
| 483 | - $this->email_reminder_time = $reminder_t; |
|
| 488 | + if(isset($reminder_t)) { |
|
| 489 | + $this->email_reminder_time = $reminder_t; |
|
| 490 | + } |
|
| 484 | 491 | } |
| 485 | 492 | $this->email_reminder_checked = $this->email_reminder_time == -1 ? false : true; |
| 486 | 493 | |
@@ -496,12 +503,14 @@ discard block |
||
| 496 | 503 | $meeting_fields = $this->get_list_view_array(); |
| 497 | 504 | |
| 498 | 505 | global $app_list_strings, $focus, $action, $currentModule; |
| 499 | - if(isset($this->parent_type)) |
|
| 500 | - $meeting_fields['PARENT_MODULE'] = $this->parent_type; |
|
| 506 | + if(isset($this->parent_type)) { |
|
| 507 | + $meeting_fields['PARENT_MODULE'] = $this->parent_type; |
|
| 508 | + } |
|
| 501 | 509 | if($this->status == "Planned") { |
| 502 | 510 | //cn: added this if() to deal with sequential Closes in Meetings. this is a hack to a hack(formbase.php->handleRedirect) |
| 503 | - if(empty($action)) |
|
| 504 | - $action = "index"; |
|
| 511 | + if(empty($action)) { |
|
| 512 | + $action = "index"; |
|
| 513 | + } |
|
| 505 | 514 | $setCompleteUrl = "<a id='{$this->id}' onclick='SUGAR.util.closeActivityPanel.show(\"{$this->module_dir}\",\"{$this->id}\",\"Held\",\"listview\",\"1\");'>"; |
| 506 | 515 | if ($this->ACLAccess('edit')) { |
| 507 | 516 | $meeting_fields['SET_COMPLETE'] = $setCompleteUrl . SugarThemeRegistry::current()->getImage("close_inline"," border='0'",null,null,'.gif',translate('LBL_CLOSEINLINE'))."</a>"; |
@@ -516,7 +525,7 @@ discard block |
||
| 516 | 525 | $date_db = $timedate->to_db($mergeTime); |
| 517 | 526 | if($date_db < $today ) { |
| 518 | 527 | $meeting_fields['DATE_START']= "<font class='overdueTask'>".$meeting_fields['DATE_START']."</font>"; |
| 519 | - }else if($date_db < $nextday) { |
|
| 528 | + } else if($date_db < $nextday) { |
|
| 520 | 529 | $meeting_fields['DATE_START'] = "<font class='todaysTask'>".$meeting_fields['DATE_START']."</font>"; |
| 521 | 530 | } else { |
| 522 | 531 | $meeting_fields['DATE_START'] = "<font class='futureTask'>".$meeting_fields['DATE_START']."</font>"; |
@@ -683,14 +692,12 @@ discard block |
||
| 683 | 692 | { |
| 684 | 693 | vCal::cache_sugar_vcal($user); |
| 685 | 694 | } |
| 686 | - } |
|
| 687 | - else if($user->object_name == 'Contact') |
|
| 695 | + } else if($user->object_name == 'Contact') |
|
| 688 | 696 | { |
| 689 | 697 | $relate_values = array('contact_id'=>$user->id,'meeting_id'=>$this->id); |
| 690 | 698 | $data_values = array('accept_status'=>$status); |
| 691 | 699 | $this->set_relationship($this->rel_contacts_table, $relate_values, true, true,$data_values); |
| 692 | - } |
|
| 693 | - else if($user->object_name == 'Lead') |
|
| 700 | + } else if($user->object_name == 'Lead') |
|
| 694 | 701 | { |
| 695 | 702 | $relate_values = array('lead_id'=>$user->id,'meeting_id'=>$this->id); |
| 696 | 703 | $data_values = array('accept_status'=>$status); |
@@ -744,8 +751,9 @@ discard block |
||
| 744 | 751 | global $sugar_config; |
| 745 | 752 | if(isset($sugar_config['disable_notify_current_user']) && $sugar_config['disable_notify_current_user']) { |
| 746 | 753 | global $current_user; |
| 747 | - if(isset($list[$current_user->id])) |
|
| 748 | - unset($list[$current_user->id]); |
|
| 754 | + if(isset($list[$current_user->id])) { |
|
| 755 | + unset($list[$current_user->id]); |
|
| 756 | + } |
|
| 749 | 757 | } |
| 750 | 758 | return $list; |
| 751 | 759 | } |
@@ -836,11 +844,10 @@ discard block |
||
| 836 | 844 | //add assigned_user_id to exclude list and let the logic from MeetingFormBase determine whether assigned user id gets added to the relationship |
| 837 | 845 | if(!empty($GLOBALS['soap_server_object'])){ |
| 838 | 846 | $exclude = array('contact_id', 'user_id'); |
| 839 | - }else{ |
|
| 847 | + } else{ |
|
| 840 | 848 | $exclude = array('contact_id', 'user_id','assigned_user_id'); |
| 841 | 849 | } |
| 842 | - } |
|
| 843 | - else{ |
|
| 850 | + } else{ |
|
| 844 | 851 | $exclude = array('user_id'); |
| 845 | 852 | } |
| 846 | 853 | } |
@@ -855,13 +862,14 @@ discard block |
||
| 855 | 862 | { |
| 856 | 863 | if ( $this->parent_type == 'Contacts' ) { |
| 857 | 864 | $this->load_relationship('contacts'); |
| 858 | - if ( !$this->contacts->relationship_exists('contacts',array('id'=>$this->parent_id)) ) |
|
| 859 | - $this->contacts->add($this->parent_id); |
|
| 860 | - } |
|
| 861 | - elseif ( $this->parent_type == 'Leads' ) { |
|
| 865 | + if ( !$this->contacts->relationship_exists('contacts',array('id'=>$this->parent_id)) ) { |
|
| 866 | + $this->contacts->add($this->parent_id); |
|
| 867 | + } |
|
| 868 | + } elseif ( $this->parent_type == 'Leads' ) { |
|
| 862 | 869 | $this->load_relationship('leads'); |
| 863 | - if ( !$this->leads->relationship_exists('leads',array('id'=>$this->parent_id)) ) |
|
| 864 | - $this->leads->add($this->parent_id); |
|
| 870 | + if ( !$this->leads->relationship_exists('leads',array('id'=>$this->parent_id)) ) { |
|
| 871 | + $this->leads->add($this->parent_id); |
|
| 872 | + } |
|
| 865 | 873 | } |
| 866 | 874 | |
| 867 | 875 | parent::afterImportSave(); |
@@ -1,6 +1,8 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
| 3 | +if (!defined('sugarEntry') || !sugarEntry) { |
|
| 4 | + die('Not A Valid Entry Point'); |
|
| 5 | +} |
|
| 4 | 6 | |
| 5 | 7 | class MeetingsJjwg_MapsLogicHook |
| 6 | 8 | { |
@@ -19,8 +21,7 @@ discard block |
||
| 19 | 21 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 20 | 22 | if(isset($GLOBALS['log'])) { |
| 21 | 23 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 22 | - } |
|
| 23 | - else { |
|
| 24 | + } else { |
|
| 24 | 25 | trigger_error($deprecatedMessage, E_USER_DEPRECATED); |
| 25 | 26 | } |
| 26 | 27 | self::__construct(); |