@@ -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 | ?> |
@@ -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,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\'> |
@@ -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 | } |
@@ -52,44 +52,44 @@ discard block |
||
52 | 52 | |
53 | 53 | // Contact is used to store customer information. |
54 | 54 | class ContactOpportunityRelationship extends SugarBean { |
55 | - // Stored fields |
|
56 | - var $id; |
|
57 | - var $contact_id; |
|
58 | - var $contact_role; |
|
59 | - var $opportunity_id; |
|
60 | - |
|
61 | - // Related fields |
|
62 | - var $contact_name; |
|
63 | - var $opportunity_name; |
|
64 | - |
|
65 | - var $table_name = "opportunities_contacts"; |
|
66 | - var $object_name = "ContactOpportunityRelationship"; |
|
67 | - var $column_fields = Array("id" |
|
68 | - ,"contact_id" |
|
69 | - ,"opportunity_id" |
|
70 | - ,"contact_role" |
|
71 | - ,'date_modified' |
|
72 | - ); |
|
73 | - |
|
74 | - var $new_schema = true; |
|
75 | - |
|
76 | - var $additional_column_fields = Array(); |
|
77 | - var $field_defs = array ( |
|
78 | - 'id'=>array('name' =>'id', 'type' =>'char', 'len'=>'36', 'default'=>'') |
|
79 | - , 'contact_id'=>array('name' =>'contact_id', 'type' =>'char', 'len'=>'36', ) |
|
80 | - , 'opportunity_id'=>array('name' =>'opportunity_id', 'type' =>'char', 'len'=>'36',) |
|
81 | - , 'contact_role'=>array('name' =>'contact_role', 'type' =>'char', 'len'=>'50') |
|
82 | - , 'date_modified'=>array ('name' => 'date_modified','type' => 'datetime') |
|
83 | - , 'deleted'=>array('name' =>'deleted', 'type' =>'bool', 'len'=>'1', 'default'=>'0', 'required'=>true) |
|
84 | - ); |
|
85 | - function __construct() { |
|
55 | + // Stored fields |
|
56 | + var $id; |
|
57 | + var $contact_id; |
|
58 | + var $contact_role; |
|
59 | + var $opportunity_id; |
|
60 | + |
|
61 | + // Related fields |
|
62 | + var $contact_name; |
|
63 | + var $opportunity_name; |
|
64 | + |
|
65 | + var $table_name = "opportunities_contacts"; |
|
66 | + var $object_name = "ContactOpportunityRelationship"; |
|
67 | + var $column_fields = Array("id" |
|
68 | + ,"contact_id" |
|
69 | + ,"opportunity_id" |
|
70 | + ,"contact_role" |
|
71 | + ,'date_modified' |
|
72 | + ); |
|
73 | + |
|
74 | + var $new_schema = true; |
|
75 | + |
|
76 | + var $additional_column_fields = Array(); |
|
77 | + var $field_defs = array ( |
|
78 | + 'id'=>array('name' =>'id', 'type' =>'char', 'len'=>'36', 'default'=>'') |
|
79 | + , 'contact_id'=>array('name' =>'contact_id', 'type' =>'char', 'len'=>'36', ) |
|
80 | + , 'opportunity_id'=>array('name' =>'opportunity_id', 'type' =>'char', 'len'=>'36',) |
|
81 | + , 'contact_role'=>array('name' =>'contact_role', 'type' =>'char', 'len'=>'50') |
|
82 | + , 'date_modified'=>array ('name' => 'date_modified','type' => 'datetime') |
|
83 | + , 'deleted'=>array('name' =>'deleted', 'type' =>'bool', 'len'=>'1', 'default'=>'0', 'required'=>true) |
|
84 | + ); |
|
85 | + function __construct() { |
|
86 | 86 | parent::__construct(); |
87 | - $this->db = DBManagerFactory::getInstance(); |
|
87 | + $this->db = DBManagerFactory::getInstance(); |
|
88 | 88 | $this->dbManager = DBManagerFactory::getInstance(); |
89 | 89 | |
90 | - $this->disable_row_level_security =true; |
|
90 | + $this->disable_row_level_security =true; |
|
91 | 91 | |
92 | - } |
|
92 | + } |
|
93 | 93 | |
94 | 94 | /** |
95 | 95 | * @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 |
@@ -106,36 +106,36 @@ discard block |
||
106 | 106 | } |
107 | 107 | |
108 | 108 | |
109 | - function fill_in_additional_detail_fields() |
|
110 | - { |
|
111 | - global $locale; |
|
112 | - if(isset($this->contact_id) && $this->contact_id != "") |
|
113 | - { |
|
114 | - $query = "SELECT first_name, last_name from contacts where id='$this->contact_id' AND deleted=0"; |
|
115 | - $result =$this->db->query($query,true," Error filling in additional detail fields: "); |
|
116 | - // Get the id and the name. |
|
117 | - $row = $this->db->fetchByAssoc($result); |
|
118 | - |
|
119 | - if($row != null) |
|
120 | - { |
|
121 | - $this->contact_name = $locale->getLocaleFormattedName($row['first_name'], $row['last_name']); |
|
122 | - } |
|
123 | - } |
|
124 | - |
|
125 | - if(isset($this->opportunity_id) && $this->opportunity_id != "") |
|
126 | - { |
|
127 | - $query = "SELECT name from opportunities where id='$this->opportunity_id' AND deleted=0"; |
|
128 | - $result =$this->db->query($query,true," Error filling in additional detail fields: "); |
|
129 | - // Get the id and the name. |
|
130 | - $row = $this->db->fetchByAssoc($result); |
|
131 | - |
|
132 | - if($row != null) |
|
133 | - { |
|
134 | - $this->opportunity_name = $row['name']; |
|
135 | - } |
|
136 | - } |
|
137 | - |
|
138 | - } |
|
109 | + function fill_in_additional_detail_fields() |
|
110 | + { |
|
111 | + global $locale; |
|
112 | + if(isset($this->contact_id) && $this->contact_id != "") |
|
113 | + { |
|
114 | + $query = "SELECT first_name, last_name from contacts where id='$this->contact_id' AND deleted=0"; |
|
115 | + $result =$this->db->query($query,true," Error filling in additional detail fields: "); |
|
116 | + // Get the id and the name. |
|
117 | + $row = $this->db->fetchByAssoc($result); |
|
118 | + |
|
119 | + if($row != null) |
|
120 | + { |
|
121 | + $this->contact_name = $locale->getLocaleFormattedName($row['first_name'], $row['last_name']); |
|
122 | + } |
|
123 | + } |
|
124 | + |
|
125 | + if(isset($this->opportunity_id) && $this->opportunity_id != "") |
|
126 | + { |
|
127 | + $query = "SELECT name from opportunities where id='$this->opportunity_id' AND deleted=0"; |
|
128 | + $result =$this->db->query($query,true," Error filling in additional detail fields: "); |
|
129 | + // Get the id and the name. |
|
130 | + $row = $this->db->fetchByAssoc($result); |
|
131 | + |
|
132 | + if($row != null) |
|
133 | + { |
|
134 | + $this->opportunity_name = $row['name']; |
|
135 | + } |
|
136 | + } |
|
137 | + |
|
138 | + } |
|
139 | 139 | } |
140 | 140 | |
141 | 141 |
@@ -2,43 +2,43 @@ discard block |
||
2 | 2 | if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
3 | 3 | |
4 | 4 | class SecurityGroupMessage extends Basic { |
5 | - var $new_schema = true; |
|
6 | - var $module_dir = 'SecurityGroups'; |
|
7 | - var $object_name = 'SecurityGroupMessage'; |
|
8 | - var $table_name = 'securitygroups_message'; |
|
9 | - var $importable = false; |
|
10 | - |
|
11 | - var $id; |
|
12 | - var $name; |
|
13 | - var $date_entered; |
|
14 | - var $date_modified; |
|
15 | - var $modified_user_id; |
|
16 | - var $modified_by_name; |
|
17 | - var $created_by; |
|
18 | - var $created_by_name; |
|
19 | - var $description; |
|
20 | - var $deleted; |
|
21 | - var $created_by_link; |
|
22 | - var $modified_user_link; |
|
23 | - |
|
24 | - |
|
25 | - var $additional_column_fields = Array(); |
|
26 | - var $field_defs = array ( |
|
27 | - 'id'=>array('name' =>'id', 'type' =>'char', 'len'=>'36', 'default'=>'') |
|
28 | - , 'name'=>array('name' =>'name', 'type' =>'varchar', 'len'=>'255', ) |
|
29 | - , 'date_entered'=>array ('name' => 'date_entered','type' => 'datetime') |
|
30 | - , 'date_modified'=>array ('name' => 'date_modified','type' => 'datetime') |
|
31 | - , 'modified_user_id'=>array('name' =>'modified_user_id', 'type' =>'char', 'len'=>'36',) |
|
32 | - , 'created_by'=>array('name' =>'created_by', 'type' =>'char', 'len'=>'36',) |
|
33 | - , 'description'=>array('name' =>'description', 'type' =>'text', 'len'=>'',) |
|
34 | - , 'deleted'=>array('name' =>'deleted', 'type' =>'bool', 'len'=>'1', 'default'=>'0', 'required'=>true) |
|
35 | - , 'securitygroup_id'=>array('name' =>'securitygroup_id', 'type' =>'char', 'len'=>'36',) |
|
5 | + var $new_schema = true; |
|
6 | + var $module_dir = 'SecurityGroups'; |
|
7 | + var $object_name = 'SecurityGroupMessage'; |
|
8 | + var $table_name = 'securitygroups_message'; |
|
9 | + var $importable = false; |
|
10 | + |
|
11 | + var $id; |
|
12 | + var $name; |
|
13 | + var $date_entered; |
|
14 | + var $date_modified; |
|
15 | + var $modified_user_id; |
|
16 | + var $modified_by_name; |
|
17 | + var $created_by; |
|
18 | + var $created_by_name; |
|
19 | + var $description; |
|
20 | + var $deleted; |
|
21 | + var $created_by_link; |
|
22 | + var $modified_user_link; |
|
23 | + |
|
24 | + |
|
25 | + var $additional_column_fields = Array(); |
|
26 | + var $field_defs = array ( |
|
27 | + 'id'=>array('name' =>'id', 'type' =>'char', 'len'=>'36', 'default'=>'') |
|
28 | + , 'name'=>array('name' =>'name', 'type' =>'varchar', 'len'=>'255', ) |
|
29 | + , 'date_entered'=>array ('name' => 'date_entered','type' => 'datetime') |
|
30 | + , 'date_modified'=>array ('name' => 'date_modified','type' => 'datetime') |
|
31 | + , 'modified_user_id'=>array('name' =>'modified_user_id', 'type' =>'char', 'len'=>'36',) |
|
32 | + , 'created_by'=>array('name' =>'created_by', 'type' =>'char', 'len'=>'36',) |
|
33 | + , 'description'=>array('name' =>'description', 'type' =>'text', 'len'=>'',) |
|
34 | + , 'deleted'=>array('name' =>'deleted', 'type' =>'bool', 'len'=>'1', 'default'=>'0', 'required'=>true) |
|
35 | + , 'securitygroup_id'=>array('name' =>'securitygroup_id', 'type' =>'char', 'len'=>'36',) |
|
36 | 36 | ); |
37 | 37 | |
38 | 38 | |
39 | - function __construct(){ |
|
40 | - parent::__construct(); |
|
41 | - } |
|
39 | + function __construct(){ |
|
40 | + parent::__construct(); |
|
41 | + } |
|
42 | 42 | |
43 | 43 | /** |
44 | 44 | * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead |
@@ -56,130 +56,130 @@ discard block |
||
56 | 56 | |
57 | 57 | |
58 | 58 | |
59 | - function get_list_view_data(){ |
|
60 | - $data = parent::get_list_view_data(); |
|
61 | - $delete = ''; |
|
62 | - |
|
63 | - $group_owner = false; |
|
64 | - $securitygroup_name = ""; |
|
65 | - if(empty($data['SECURITYGROUP_ID'])) { |
|
66 | - $securitygroup_name = "All"; |
|
67 | - } else { |
|
68 | - require_once('modules/SecurityGroups/SecurityGroup.php'); |
|
69 | - $securitygroup = new SecurityGroup(); |
|
70 | - $securitygroup->retrieve($data['SECURITYGROUP_ID']); |
|
71 | - $securitygroup_name = $securitygroup->name; |
|
72 | - |
|
73 | - if($securitygroup->assigned_user_id == $GLOBALS['current_user']->id) { |
|
74 | - $group_owner = true; |
|
75 | - } |
|
76 | - } |
|
77 | - |
|
78 | - if(is_admin($GLOBALS['current_user']) || $data['CREATED_BY'] == $GLOBALS['current_user']->id || $group_owner) { |
|
79 | - $delete = SugarThemeRegistry::current()->getImage( 'delete_inline', 'width="12" height="12" border="0" align="absmiddle" style="vertical-align: bottom;" onclick=\'Message.deleteMessage("'. $data['ID'] . '", "{this.id}")\'',null,null,'.gif',''); |
|
80 | - } |
|
81 | - |
|
82 | - $username = ""; |
|
83 | - if(empty($data['CREATED_BY'])) { |
|
84 | - $username = "Unknown"; |
|
85 | - } else { |
|
86 | - require_once('modules/Users/User.php'); |
|
87 | - $user = new User(); |
|
88 | - $user->retrieve($data['CREATED_BY']); |
|
89 | - $username = $user->user_name; |
|
90 | - } |
|
91 | - |
|
92 | - $data['NAME'] = $data['DESCRIPTION']; |
|
93 | - $data['NAME'] = '<div class="list view" style="padding:5px;border:none;">' . html_entity_decode($data['NAME']); |
|
59 | + function get_list_view_data(){ |
|
60 | + $data = parent::get_list_view_data(); |
|
61 | + $delete = ''; |
|
62 | + |
|
63 | + $group_owner = false; |
|
64 | + $securitygroup_name = ""; |
|
65 | + if(empty($data['SECURITYGROUP_ID'])) { |
|
66 | + $securitygroup_name = "All"; |
|
67 | + } else { |
|
68 | + require_once('modules/SecurityGroups/SecurityGroup.php'); |
|
69 | + $securitygroup = new SecurityGroup(); |
|
70 | + $securitygroup->retrieve($data['SECURITYGROUP_ID']); |
|
71 | + $securitygroup_name = $securitygroup->name; |
|
72 | + |
|
73 | + if($securitygroup->assigned_user_id == $GLOBALS['current_user']->id) { |
|
74 | + $group_owner = true; |
|
75 | + } |
|
76 | + } |
|
77 | + |
|
78 | + if(is_admin($GLOBALS['current_user']) || $data['CREATED_BY'] == $GLOBALS['current_user']->id || $group_owner) { |
|
79 | + $delete = SugarThemeRegistry::current()->getImage( 'delete_inline', 'width="12" height="12" border="0" align="absmiddle" style="vertical-align: bottom;" onclick=\'Message.deleteMessage("'. $data['ID'] . '", "{this.id}")\'',null,null,'.gif',''); |
|
80 | + } |
|
81 | + |
|
82 | + $username = ""; |
|
83 | + if(empty($data['CREATED_BY'])) { |
|
84 | + $username = "Unknown"; |
|
85 | + } else { |
|
86 | + require_once('modules/Users/User.php'); |
|
87 | + $user = new User(); |
|
88 | + $user->retrieve($data['CREATED_BY']); |
|
89 | + $username = $user->user_name; |
|
90 | + } |
|
91 | + |
|
92 | + $data['NAME'] = $data['DESCRIPTION']; |
|
93 | + $data['NAME'] = '<div class="list view" style="padding:5px;border:none;">' . html_entity_decode($data['NAME']); |
|
94 | 94 | $data['NAME'] .= '<div class="byLineBox" style="padding-top: 2px"><span class="byLineLeft">'.$username.' ['.$securitygroup_name.']'; |
95 | - $data['NAME'] .= ' </span><span style="cursor: pointer;" class="byLineRight"> '. $this->getTimeLapse($data['DATE_ENTERED']) . ' ' .$delete. '</span></div>'; |
|
96 | - return $data ; |
|
97 | - } |
|
98 | - |
|
99 | - |
|
100 | - static function saveMessage($text, $securitygroup_id) { |
|
101 | - //if no security group id then must be admin. Otherwise, make sure the user is a member of the group |
|
102 | - global $current_user; |
|
103 | - if(empty($securitygroup_id) && !is_admin($current_user)) { |
|
104 | - return; |
|
105 | - } else if(empty($securitygroup_id)) { |
|
106 | - $securitygroup_id = null; //6.4.0 |
|
107 | - } |
|
108 | - $message = new SecurityGroupMessage(); |
|
109 | - if(empty($text)) return; // || !$feed->ACLAccess('save', true) )return; |
|
110 | - |
|
111 | - $text = strip_tags($text); |
|
112 | - $message->name = ''; |
|
113 | - $message->description = $text; |
|
114 | - $message->securitygroup_id = $securitygroup_id; |
|
115 | - $message->save(); |
|
116 | - } |
|
117 | - |
|
118 | - function getTimeLapse($startDate) |
|
119 | - { |
|
120 | - $startDate = $GLOBALS['timedate']->to_db($startDate); |
|
121 | - $start = array(); |
|
122 | - preg_match('/(\d+)\-(\d+)\-(\d+) (\d+)\:(\d+)\:(\d+)/', $startDate, $start); |
|
123 | - $end = gmdate('Y-m-d H:i:s'); |
|
124 | - $start_time = gmmktime($start[4],$start[5], $start[6], $start[2], $start[3], $start[1] ); |
|
125 | - $seconds = time()- $start_time; |
|
126 | - $minutes = $seconds/60; |
|
127 | - $seconds = $seconds % 60; |
|
128 | - $hours = floor( $minutes / 60); |
|
129 | - $minutes = $minutes % 60; |
|
130 | - $days = floor( $hours / 24); |
|
131 | - $hours = $hours % 24; |
|
132 | - $weeks = floor( $days / 7); |
|
133 | - $days = $days % 7; |
|
134 | - $result = ''; |
|
135 | - if($weeks == 1){ |
|
136 | - $result = translate('LBL_TIME_LAST_WEEK','SugarFeed').' '; |
|
137 | - return $result; |
|
138 | - }else if($weeks > 1){ |
|
139 | - $result .= $weeks . ' '.translate('LBL_TIME_WEEKS','SugarFeed').' '; |
|
140 | - if($days > 0) { |
|
95 | + $data['NAME'] .= ' </span><span style="cursor: pointer;" class="byLineRight"> '. $this->getTimeLapse($data['DATE_ENTERED']) . ' ' .$delete. '</span></div>'; |
|
96 | + return $data ; |
|
97 | + } |
|
98 | + |
|
99 | + |
|
100 | + static function saveMessage($text, $securitygroup_id) { |
|
101 | + //if no security group id then must be admin. Otherwise, make sure the user is a member of the group |
|
102 | + global $current_user; |
|
103 | + if(empty($securitygroup_id) && !is_admin($current_user)) { |
|
104 | + return; |
|
105 | + } else if(empty($securitygroup_id)) { |
|
106 | + $securitygroup_id = null; //6.4.0 |
|
107 | + } |
|
108 | + $message = new SecurityGroupMessage(); |
|
109 | + if(empty($text)) return; // || !$feed->ACLAccess('save', true) )return; |
|
110 | + |
|
111 | + $text = strip_tags($text); |
|
112 | + $message->name = ''; |
|
113 | + $message->description = $text; |
|
114 | + $message->securitygroup_id = $securitygroup_id; |
|
115 | + $message->save(); |
|
116 | + } |
|
117 | + |
|
118 | + function getTimeLapse($startDate) |
|
119 | + { |
|
120 | + $startDate = $GLOBALS['timedate']->to_db($startDate); |
|
121 | + $start = array(); |
|
122 | + preg_match('/(\d+)\-(\d+)\-(\d+) (\d+)\:(\d+)\:(\d+)/', $startDate, $start); |
|
123 | + $end = gmdate('Y-m-d H:i:s'); |
|
124 | + $start_time = gmmktime($start[4],$start[5], $start[6], $start[2], $start[3], $start[1] ); |
|
125 | + $seconds = time()- $start_time; |
|
126 | + $minutes = $seconds/60; |
|
127 | + $seconds = $seconds % 60; |
|
128 | + $hours = floor( $minutes / 60); |
|
129 | + $minutes = $minutes % 60; |
|
130 | + $days = floor( $hours / 24); |
|
131 | + $hours = $hours % 24; |
|
132 | + $weeks = floor( $days / 7); |
|
133 | + $days = $days % 7; |
|
134 | + $result = ''; |
|
135 | + if($weeks == 1){ |
|
136 | + $result = translate('LBL_TIME_LAST_WEEK','SugarFeed').' '; |
|
137 | + return $result; |
|
138 | + }else if($weeks > 1){ |
|
139 | + $result .= $weeks . ' '.translate('LBL_TIME_WEEKS','SugarFeed').' '; |
|
140 | + if($days > 0) { |
|
141 | 141 | $result .= $days . ' '.translate('LBL_TIME_DAYS','SugarFeed').' '; |
142 | 142 | } |
143 | - }else{ |
|
144 | - if($days == 1){ |
|
145 | - $result = translate('LBL_TIME_YESTERDAY','SugarFeed').' '; |
|
146 | - return $result; |
|
147 | - }else if($days > 1){ |
|
148 | - $result .= $days . ' '. translate('LBL_TIME_DAYS','SugarFeed').' '; |
|
149 | - }else{ |
|
150 | - if($hours == 1) { |
|
143 | + }else{ |
|
144 | + if($days == 1){ |
|
145 | + $result = translate('LBL_TIME_YESTERDAY','SugarFeed').' '; |
|
146 | + return $result; |
|
147 | + }else if($days > 1){ |
|
148 | + $result .= $days . ' '. translate('LBL_TIME_DAYS','SugarFeed').' '; |
|
149 | + }else{ |
|
150 | + if($hours == 1) { |
|
151 | 151 | $result .= $hours . ' '.translate('LBL_TIME_HOUR','SugarFeed').' '; |
152 | 152 | } else { |
153 | 153 | $result .= $hours . ' '.translate('LBL_TIME_HOURS','SugarFeed').' '; |
154 | 154 | } |
155 | - if($hours < 6){ |
|
156 | - if($minutes == 1) { |
|
155 | + if($hours < 6){ |
|
156 | + if($minutes == 1) { |
|
157 | 157 | $result .= $minutes . ' ' . translate('LBL_TIME_MINUTE','SugarFeed'). ' '; |
158 | 158 | } else { |
159 | 159 | $result .= $minutes . ' ' . translate('LBL_TIME_MINUTES','SugarFeed'). ' '; |
160 | 160 | } |
161 | - } |
|
162 | - if($hours == 0 && $minutes == 0) { |
|
161 | + } |
|
162 | + if($hours == 0 && $minutes == 0) { |
|
163 | 163 | if($seconds == 1 ) { |
164 | 164 | $result = $seconds . ' ' . translate('LBL_TIME_SECOND','SugarFeed'); |
165 | 165 | } else { |
166 | 166 | $result = $seconds . ' ' . translate('LBL_TIME_SECONDS','SugarFeed'); |
167 | 167 | } |
168 | 168 | } |
169 | - } |
|
170 | - } |
|
171 | - return $result . ' ' . translate('LBL_TIME_AGO','SugarFeed'); |
|
169 | + } |
|
170 | + } |
|
171 | + return $result . ' ' . translate('LBL_TIME_AGO','SugarFeed'); |
|
172 | 172 | |
173 | 173 | |
174 | 174 | |
175 | 175 | } |
176 | 176 | |
177 | - function bean_implements($interface){ |
|
178 | - switch($interface){ |
|
179 | - case 'ACL':return false; |
|
180 | - } |
|
181 | - return false; |
|
182 | - } |
|
177 | + function bean_implements($interface){ |
|
178 | + switch($interface){ |
|
179 | + case 'ACL':return false; |
|
180 | + } |
|
181 | + return false; |
|
182 | + } |
|
183 | 183 | |
184 | 184 | } |
185 | 185 | ?> |
186 | 186 | \ No newline at end of file |
@@ -2,33 +2,33 @@ discard block |
||
2 | 2 | |
3 | 3 | |
4 | 4 | class SecurityGroup_sugar extends Basic { |
5 | - var $new_schema = true; |
|
6 | - var $module_dir = 'SecurityGroups'; |
|
7 | - var $object_name = 'SecurityGroup'; |
|
8 | - var $table_name = 'securitygroups'; |
|
9 | - var $id; |
|
10 | - var $name; |
|
11 | - var $date_entered; |
|
12 | - var $date_modified; |
|
13 | - var $modified_user_id; |
|
14 | - var $modified_by_name; |
|
15 | - var $created_by; |
|
16 | - var $created_by_name; |
|
17 | - var $description; |
|
18 | - var $deleted; |
|
19 | - var $created_by_link; |
|
20 | - var $modified_user_link; |
|
21 | - var $assigned_user_id; |
|
22 | - var $assigned_user_name; |
|
23 | - var $assigned_user_link; |
|
24 | - |
|
25 | - |
|
26 | - |
|
27 | - |
|
28 | - |
|
29 | - public function __construct(){ |
|
30 | - parent::__construct(); |
|
31 | - } |
|
5 | + var $new_schema = true; |
|
6 | + var $module_dir = 'SecurityGroups'; |
|
7 | + var $object_name = 'SecurityGroup'; |
|
8 | + var $table_name = 'securitygroups'; |
|
9 | + var $id; |
|
10 | + var $name; |
|
11 | + var $date_entered; |
|
12 | + var $date_modified; |
|
13 | + var $modified_user_id; |
|
14 | + var $modified_by_name; |
|
15 | + var $created_by; |
|
16 | + var $created_by_name; |
|
17 | + var $description; |
|
18 | + var $deleted; |
|
19 | + var $created_by_link; |
|
20 | + var $modified_user_link; |
|
21 | + var $assigned_user_id; |
|
22 | + var $assigned_user_name; |
|
23 | + var $assigned_user_link; |
|
24 | + |
|
25 | + |
|
26 | + |
|
27 | + |
|
28 | + |
|
29 | + public function __construct(){ |
|
30 | + parent::__construct(); |
|
31 | + } |
|
32 | 32 | |
33 | 33 | /** |
34 | 34 | * @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 |
@@ -45,11 +45,11 @@ discard block |
||
45 | 45 | } |
46 | 46 | |
47 | 47 | |
48 | - function bean_implements($interface){ |
|
49 | - switch($interface){ |
|
50 | - case 'ACL': return true; |
|
51 | - } |
|
52 | - return false; |
|
48 | + function bean_implements($interface){ |
|
49 | + switch($interface){ |
|
50 | + case 'ACL': return true; |
|
51 | + } |
|
52 | + return false; |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | } |
@@ -47,176 +47,176 @@ discard block |
||
47 | 47 | ********************************************************************************/ |
48 | 48 | |
49 | 49 | class Call extends SugarBean { |
50 | - var $field_name_map; |
|
51 | - // Stored fields |
|
52 | - var $id; |
|
53 | - var $json_id; |
|
54 | - var $date_entered; |
|
55 | - var $date_modified; |
|
56 | - var $assigned_user_id; |
|
57 | - var $modified_user_id; |
|
58 | - var $description; |
|
59 | - var $name; |
|
60 | - var $status; |
|
61 | - var $date_start; |
|
62 | - var $time_start; |
|
63 | - var $duration_hours; |
|
64 | - var $duration_minutes; |
|
65 | - var $date_end; |
|
66 | - var $parent_type; |
|
67 | - var $parent_type_options; |
|
68 | - var $parent_id; |
|
69 | - var $contact_id; |
|
70 | - var $user_id; |
|
71 | - var $lead_id; |
|
72 | - var $direction; |
|
73 | - var $reminder_time; |
|
74 | - var $reminder_time_options; |
|
75 | - var $reminder_checked; |
|
76 | - var $email_reminder_time; |
|
77 | - var $email_reminder_checked; |
|
78 | - var $email_reminder_sent; |
|
79 | - var $required; |
|
80 | - var $accept_status; |
|
81 | - var $created_by; |
|
82 | - var $created_by_name; |
|
83 | - var $modified_by_name; |
|
84 | - var $parent_name; |
|
85 | - var $contact_name; |
|
86 | - var $contact_phone; |
|
87 | - var $contact_email; |
|
88 | - var $account_id; |
|
89 | - var $opportunity_id; |
|
90 | - var $case_id; |
|
91 | - var $assigned_user_name; |
|
92 | - var $note_id; |
|
50 | + var $field_name_map; |
|
51 | + // Stored fields |
|
52 | + var $id; |
|
53 | + var $json_id; |
|
54 | + var $date_entered; |
|
55 | + var $date_modified; |
|
56 | + var $assigned_user_id; |
|
57 | + var $modified_user_id; |
|
58 | + var $description; |
|
59 | + var $name; |
|
60 | + var $status; |
|
61 | + var $date_start; |
|
62 | + var $time_start; |
|
63 | + var $duration_hours; |
|
64 | + var $duration_minutes; |
|
65 | + var $date_end; |
|
66 | + var $parent_type; |
|
67 | + var $parent_type_options; |
|
68 | + var $parent_id; |
|
69 | + var $contact_id; |
|
70 | + var $user_id; |
|
71 | + var $lead_id; |
|
72 | + var $direction; |
|
73 | + var $reminder_time; |
|
74 | + var $reminder_time_options; |
|
75 | + var $reminder_checked; |
|
76 | + var $email_reminder_time; |
|
77 | + var $email_reminder_checked; |
|
78 | + var $email_reminder_sent; |
|
79 | + var $required; |
|
80 | + var $accept_status; |
|
81 | + var $created_by; |
|
82 | + var $created_by_name; |
|
83 | + var $modified_by_name; |
|
84 | + var $parent_name; |
|
85 | + var $contact_name; |
|
86 | + var $contact_phone; |
|
87 | + var $contact_email; |
|
88 | + var $account_id; |
|
89 | + var $opportunity_id; |
|
90 | + var $case_id; |
|
91 | + var $assigned_user_name; |
|
92 | + var $note_id; |
|
93 | 93 | var $outlook_id; |
94 | - var $update_vcal = true; |
|
95 | - var $contacts_arr; |
|
96 | - var $users_arr; |
|
97 | - var $leads_arr; |
|
98 | - var $default_call_name_values = array('Assemble catalogs', 'Make travel arrangements', 'Send a letter', 'Send contract', 'Send fax', 'Send a follow-up letter', 'Send literature', 'Send proposal', 'Send quote'); |
|
99 | - var $minutes_value_default = 15; |
|
100 | - var $minutes_values = array('0'=>'00','15'=>'15','30'=>'30','45'=>'45'); |
|
101 | - var $table_name = "calls"; |
|
102 | - var $rel_users_table = "calls_users"; |
|
103 | - var $rel_contacts_table = "calls_contacts"; |
|
94 | + var $update_vcal = true; |
|
95 | + var $contacts_arr; |
|
96 | + var $users_arr; |
|
97 | + var $leads_arr; |
|
98 | + var $default_call_name_values = array('Assemble catalogs', 'Make travel arrangements', 'Send a letter', 'Send contract', 'Send fax', 'Send a follow-up letter', 'Send literature', 'Send proposal', 'Send quote'); |
|
99 | + var $minutes_value_default = 15; |
|
100 | + var $minutes_values = array('0'=>'00','15'=>'15','30'=>'30','45'=>'45'); |
|
101 | + var $table_name = "calls"; |
|
102 | + var $rel_users_table = "calls_users"; |
|
103 | + var $rel_contacts_table = "calls_contacts"; |
|
104 | 104 | var $rel_leads_table = "calls_leads"; |
105 | - var $module_dir = 'Calls'; |
|
106 | - var $object_name = "Call"; |
|
107 | - var $new_schema = true; |
|
108 | - var $importable = true; |
|
109 | - var $syncing = false; |
|
110 | - var $recurring_source; |
|
111 | - |
|
112 | - // This is used to retrieve related fields from form posts. |
|
113 | - var $additional_column_fields = array('assigned_user_name', 'assigned_user_id', 'contact_id', 'user_id', 'contact_name'); |
|
114 | - var $relationship_fields = array( 'account_id' => 'accounts', |
|
115 | - 'opportunity_id' => 'opportunities', |
|
116 | - 'contact_id' => 'contacts', |
|
117 | - 'case_id' => 'cases', |
|
118 | - 'user_id' => 'users', |
|
119 | - 'assigned_user_id' => 'users', |
|
120 | - 'note_id' => 'notes', |
|
105 | + var $module_dir = 'Calls'; |
|
106 | + var $object_name = "Call"; |
|
107 | + var $new_schema = true; |
|
108 | + var $importable = true; |
|
109 | + var $syncing = false; |
|
110 | + var $recurring_source; |
|
111 | + |
|
112 | + // This is used to retrieve related fields from form posts. |
|
113 | + var $additional_column_fields = array('assigned_user_name', 'assigned_user_id', 'contact_id', 'user_id', 'contact_name'); |
|
114 | + var $relationship_fields = array( 'account_id' => 'accounts', |
|
115 | + 'opportunity_id' => 'opportunities', |
|
116 | + 'contact_id' => 'contacts', |
|
117 | + 'case_id' => 'cases', |
|
118 | + 'user_id' => 'users', |
|
119 | + 'assigned_user_id' => 'users', |
|
120 | + 'note_id' => 'notes', |
|
121 | 121 | 'lead_id' => 'leads', |
122 | - ); |
|
123 | - |
|
124 | - public function __construct() { |
|
125 | - parent::__construct(); |
|
126 | - global $app_list_strings; |
|
127 | - |
|
128 | - $this->setupCustomFields('Calls'); |
|
129 | - |
|
130 | - foreach ($this->field_defs as $field) { |
|
131 | - $this->field_name_map[$field['name']] = $field; |
|
132 | - } |
|
133 | - |
|
134 | - |
|
135 | - |
|
136 | - |
|
137 | - if(!empty($GLOBALS['app_list_strings']['duration_intervals'])) |
|
138 | - $this->minutes_values = $GLOBALS['app_list_strings']['duration_intervals']; |
|
139 | - } |
|
140 | - |
|
141 | - /** |
|
142 | - * @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 |
|
143 | - */ |
|
144 | - public function Call(){ |
|
145 | - $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
|
146 | - if(isset($GLOBALS['log'])) { |
|
147 | - $GLOBALS['log']->deprecated($deprecatedMessage); |
|
148 | - } |
|
149 | - else { |
|
150 | - trigger_error($deprecatedMessage, E_USER_DEPRECATED); |
|
151 | - } |
|
152 | - self::__construct(); |
|
153 | - } |
|
154 | - |
|
155 | - /** |
|
156 | - * Disable edit if call is recurring and source is not Sugar. It should be edited only from Outlook. |
|
157 | - * @param $view string |
|
158 | - * @param $is_owner bool |
|
159 | - */ |
|
160 | - function ACLAccess($view,$is_owner='not_set',$in_group='not_set'){ |
|
161 | - // don't check if call is being synced from Outlook |
|
162 | - if($this->syncing == false){ |
|
163 | - $view = strtolower($view); |
|
164 | - switch($view){ |
|
165 | - case 'edit': |
|
166 | - case 'save': |
|
167 | - case 'editview': |
|
168 | - case 'delete': |
|
169 | - if(!empty($this->recurring_source) && $this->recurring_source != "Sugar"){ |
|
170 | - return false; |
|
171 | - } |
|
172 | - } |
|
173 | - } |
|
174 | - return parent::ACLAccess($view,$is_owner,$in_group); |
|
175 | - } |
|
122 | + ); |
|
123 | + |
|
124 | + public function __construct() { |
|
125 | + parent::__construct(); |
|
126 | + global $app_list_strings; |
|
127 | + |
|
128 | + $this->setupCustomFields('Calls'); |
|
129 | + |
|
130 | + foreach ($this->field_defs as $field) { |
|
131 | + $this->field_name_map[$field['name']] = $field; |
|
132 | + } |
|
133 | + |
|
134 | + |
|
135 | + |
|
136 | + |
|
137 | + if(!empty($GLOBALS['app_list_strings']['duration_intervals'])) |
|
138 | + $this->minutes_values = $GLOBALS['app_list_strings']['duration_intervals']; |
|
139 | + } |
|
140 | + |
|
141 | + /** |
|
142 | + * @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 |
|
143 | + */ |
|
144 | + public function Call(){ |
|
145 | + $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
|
146 | + if(isset($GLOBALS['log'])) { |
|
147 | + $GLOBALS['log']->deprecated($deprecatedMessage); |
|
148 | + } |
|
149 | + else { |
|
150 | + trigger_error($deprecatedMessage, E_USER_DEPRECATED); |
|
151 | + } |
|
152 | + self::__construct(); |
|
153 | + } |
|
154 | + |
|
155 | + /** |
|
156 | + * Disable edit if call is recurring and source is not Sugar. It should be edited only from Outlook. |
|
157 | + * @param $view string |
|
158 | + * @param $is_owner bool |
|
159 | + */ |
|
160 | + function ACLAccess($view,$is_owner='not_set',$in_group='not_set'){ |
|
161 | + // don't check if call is being synced from Outlook |
|
162 | + if($this->syncing == false){ |
|
163 | + $view = strtolower($view); |
|
164 | + switch($view){ |
|
165 | + case 'edit': |
|
166 | + case 'save': |
|
167 | + case 'editview': |
|
168 | + case 'delete': |
|
169 | + if(!empty($this->recurring_source) && $this->recurring_source != "Sugar"){ |
|
170 | + return false; |
|
171 | + } |
|
172 | + } |
|
173 | + } |
|
174 | + return parent::ACLAccess($view,$is_owner,$in_group); |
|
175 | + } |
|
176 | 176 | // save date_end by calculating user input |
177 | 177 | // this is for calendar |
178 | - function save($check_notify = FALSE) { |
|
179 | - global $timedate,$current_user; |
|
178 | + function save($check_notify = FALSE) { |
|
179 | + global $timedate,$current_user; |
|
180 | 180 | |
181 | - if(isset($this->date_start) && isset($this->duration_hours) && isset($this->duration_minutes)) |
|
181 | + if(isset($this->date_start) && isset($this->duration_hours) && isset($this->duration_minutes)) |
|
182 | 182 | { |
183 | - $td = $timedate->fromDb($this->date_start); |
|
184 | - if($td) |
|
185 | - { |
|
186 | - $this->date_end = $td->modify("+{$this->duration_hours} hours {$this->duration_minutes} mins")->asDb(); |
|
187 | - } |
|
183 | + $td = $timedate->fromDb($this->date_start); |
|
184 | + if($td) |
|
185 | + { |
|
186 | + $this->date_end = $td->modify("+{$this->duration_hours} hours {$this->duration_minutes} mins")->asDb(); |
|
187 | + } |
|
188 | 188 | } |
189 | 189 | |
190 | - if(!empty($_REQUEST['send_invites']) && $_REQUEST['send_invites'] == '1') { |
|
191 | - $check_notify = true; |
|
190 | + if(!empty($_REQUEST['send_invites']) && $_REQUEST['send_invites'] == '1') { |
|
191 | + $check_notify = true; |
|
192 | 192 | } else { |
193 | - $check_notify = false; |
|
194 | - } |
|
195 | - if(empty($_REQUEST['send_invites'])) { |
|
196 | - if(!empty($this->id)) { |
|
197 | - $old_record = new Call(); |
|
198 | - $old_record->retrieve($this->id); |
|
199 | - $old_assigned_user_id = $old_record->assigned_user_id; |
|
200 | - } |
|
201 | - 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']) ){ |
|
202 | - $this->special_notification = true; |
|
203 | - if(!isset($GLOBALS['resavingRelatedBeans']) || $GLOBALS['resavingRelatedBeans'] == false) { |
|
204 | - $check_notify = true; |
|
205 | - } |
|
193 | + $check_notify = false; |
|
194 | + } |
|
195 | + if(empty($_REQUEST['send_invites'])) { |
|
196 | + if(!empty($this->id)) { |
|
197 | + $old_record = new Call(); |
|
198 | + $old_record->retrieve($this->id); |
|
199 | + $old_assigned_user_id = $old_record->assigned_user_id; |
|
200 | + } |
|
201 | + 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']) ){ |
|
202 | + $this->special_notification = true; |
|
203 | + if(!isset($GLOBALS['resavingRelatedBeans']) || $GLOBALS['resavingRelatedBeans'] == false) { |
|
204 | + $check_notify = true; |
|
205 | + } |
|
206 | 206 | if(isset($_REQUEST['assigned_user_name'])) { |
207 | 207 | $this->new_assigned_user_name = $_REQUEST['assigned_user_name']; |
208 | 208 | } |
209 | - } |
|
210 | - } |
|
209 | + } |
|
210 | + } |
|
211 | 211 | if (empty($this->status) ) { |
212 | 212 | $this->status = $this->getDefaultStatus(); |
213 | 213 | } |
214 | 214 | |
215 | - // prevent a mass mailing for recurring meetings created in Calendar module |
|
216 | - if (empty($this->id) && !empty($_REQUEST['module']) && $_REQUEST['module'] == "Calendar" && !empty($_REQUEST['repeat_type']) && !empty($this->repeat_parent_id)) { |
|
217 | - $check_notify = false; |
|
218 | - } |
|
219 | - /*nsingh 7/3/08 commenting out as bug #20814 is invalid |
|
215 | + // prevent a mass mailing for recurring meetings created in Calendar module |
|
216 | + if (empty($this->id) && !empty($_REQUEST['module']) && $_REQUEST['module'] == "Calendar" && !empty($_REQUEST['repeat_type']) && !empty($this->repeat_parent_id)) { |
|
217 | + $check_notify = false; |
|
218 | + } |
|
219 | + /*nsingh 7/3/08 commenting out as bug #20814 is invalid |
|
220 | 220 | if($current_user->getPreference('reminder_time')!= -1 && isset($_POST['reminder_checked']) && isset($_POST['reminder_time']) && $_POST['reminder_checked']==0 && $_POST['reminder_time']==-1){ |
221 | 221 | $this->reminder_checked = '1'; |
222 | 222 | $this->reminder_time = $current_user->getPreference('reminder_time'); |
@@ -227,87 +227,87 @@ discard block |
||
227 | 227 | |
228 | 228 | |
229 | 229 | if($this->update_vcal) { |
230 | - vCal::cache_sugar_vcal($current_user); |
|
230 | + vCal::cache_sugar_vcal($current_user); |
|
231 | 231 | } |
232 | 232 | |
233 | - if(isset($_REQUEST['reminders_data'])) { |
|
234 | - Reminder::saveRemindersDataJson('Calls', $return_id, html_entity_decode($_REQUEST['reminders_data'])); |
|
235 | - } |
|
233 | + if(isset($_REQUEST['reminders_data'])) { |
|
234 | + Reminder::saveRemindersDataJson('Calls', $return_id, html_entity_decode($_REQUEST['reminders_data'])); |
|
235 | + } |
|
236 | 236 | |
237 | 237 | return $return_id; |
238 | - } |
|
238 | + } |
|
239 | 239 | |
240 | - /** Returns a list of the associated contacts |
|
241 | - * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.. |
|
242 | - * All Rights Reserved.. |
|
243 | - * Contributor(s): ______________________________________.. |
|
244 | - */ |
|
245 | - function get_contacts() |
|
246 | - { |
|
247 | - // First, get the list of IDs. |
|
248 | - $query = "SELECT contact_id as id from calls_contacts where call_id='$this->id' AND deleted=0"; |
|
240 | + /** Returns a list of the associated contacts |
|
241 | + * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.. |
|
242 | + * All Rights Reserved.. |
|
243 | + * Contributor(s): ______________________________________.. |
|
244 | + */ |
|
245 | + function get_contacts() |
|
246 | + { |
|
247 | + // First, get the list of IDs. |
|
248 | + $query = "SELECT contact_id as id from calls_contacts where call_id='$this->id' AND deleted=0"; |
|
249 | 249 | |
250 | - return $this->build_related_list($query, new Contact()); |
|
251 | - } |
|
250 | + return $this->build_related_list($query, new Contact()); |
|
251 | + } |
|
252 | 252 | |
253 | 253 | |
254 | - function get_summary_text() |
|
255 | - { |
|
256 | - return "$this->name"; |
|
257 | - } |
|
254 | + function get_summary_text() |
|
255 | + { |
|
256 | + return "$this->name"; |
|
257 | + } |
|
258 | 258 | |
259 | - function create_list_query($order_by, $where, $show_deleted=0) |
|
260 | - { |
|
259 | + function create_list_query($order_by, $where, $show_deleted=0) |
|
260 | + { |
|
261 | 261 | $custom_join = $this->getCustomJoin(); |
262 | 262 | $query = "SELECT "; |
263 | - $query .= " |
|
263 | + $query .= " |
|
264 | 264 | calls.*,"; |
265 | - if ( preg_match("/calls_users\.user_id/",$where)) |
|
266 | - { |
|
267 | - $query .= "calls_users.required, |
|
265 | + if ( preg_match("/calls_users\.user_id/",$where)) |
|
266 | + { |
|
267 | + $query .= "calls_users.required, |
|
268 | 268 | calls_users.accept_status,"; |
269 | - } |
|
269 | + } |
|
270 | 270 | |
271 | - $query .= " |
|
271 | + $query .= " |
|
272 | 272 | users.user_name as assigned_user_name"; |
273 | 273 | $query .= $custom_join['select']; |
274 | 274 | |
275 | - // this line will help generate a GMT-metric to compare to a locale's timezone |
|
275 | + // this line will help generate a GMT-metric to compare to a locale's timezone |
|
276 | 276 | |
277 | - if ( preg_match("/contacts/",$where)){ |
|
278 | - $query .= ", contacts.first_name, contacts.last_name"; |
|
279 | - $query .= ", contacts.assigned_user_id contact_name_owner"; |
|
280 | - } |
|
281 | - $query .= " FROM calls "; |
|
277 | + if ( preg_match("/contacts/",$where)){ |
|
278 | + $query .= ", contacts.first_name, contacts.last_name"; |
|
279 | + $query .= ", contacts.assigned_user_id contact_name_owner"; |
|
280 | + } |
|
281 | + $query .= " FROM calls "; |
|
282 | 282 | |
283 | - if ( preg_match("/contacts/",$where)){ |
|
284 | - $query .= "LEFT JOIN calls_contacts |
|
283 | + if ( preg_match("/contacts/",$where)){ |
|
284 | + $query .= "LEFT JOIN calls_contacts |
|
285 | 285 | ON calls.id=calls_contacts.call_id |
286 | 286 | LEFT JOIN contacts |
287 | 287 | ON calls_contacts.contact_id=contacts.id "; |
288 | - } |
|
289 | - if ( preg_match('/calls_users\.user_id/',$where)) |
|
290 | - { |
|
291 | - $query .= "LEFT JOIN calls_users |
|
288 | + } |
|
289 | + if ( preg_match('/calls_users\.user_id/',$where)) |
|
290 | + { |
|
291 | + $query .= "LEFT JOIN calls_users |
|
292 | 292 | ON calls.id=calls_users.call_id and calls_users.deleted=0 "; |
293 | - } |
|
294 | - $query .= " |
|
293 | + } |
|
294 | + $query .= " |
|
295 | 295 | LEFT JOIN users |
296 | 296 | ON calls.assigned_user_id=users.id "; |
297 | 297 | $query .= $custom_join['join']; |
298 | - $where_auto = '1=1'; |
|
299 | - if($show_deleted == 0){ |
|
300 | - $where_auto = " $this->table_name.deleted=0 "; |
|
301 | - }else if($show_deleted == 1){ |
|
302 | - $where_auto = " $this->table_name.deleted=1 "; |
|
303 | - } |
|
298 | + $where_auto = '1=1'; |
|
299 | + if($show_deleted == 0){ |
|
300 | + $where_auto = " $this->table_name.deleted=0 "; |
|
301 | + }else if($show_deleted == 1){ |
|
302 | + $where_auto = " $this->table_name.deleted=1 "; |
|
303 | + } |
|
304 | 304 | |
305 | - //$where_auto .= " GROUP BY calls.id"; |
|
305 | + //$where_auto .= " GROUP BY calls.id"; |
|
306 | 306 | |
307 | - if($where != "") |
|
308 | - $query .= "where $where AND ".$where_auto; |
|
309 | - else |
|
310 | - $query .= "where ".$where_auto; |
|
307 | + if($where != "") |
|
308 | + $query .= "where $where AND ".$where_auto; |
|
309 | + else |
|
310 | + $query .= "where ".$where_auto; |
|
311 | 311 | |
312 | 312 | $order_by = $this->process_order_by($order_by); |
313 | 313 | if (empty($order_by)) { |
@@ -315,14 +315,14 @@ discard block |
||
315 | 315 | } |
316 | 316 | $query .= ' ORDER BY ' . $order_by; |
317 | 317 | |
318 | - return $query; |
|
319 | - } |
|
318 | + return $query; |
|
319 | + } |
|
320 | 320 | |
321 | 321 | function create_export_query($order_by, $where, $relate_link_join='') |
322 | 322 | { |
323 | 323 | $custom_join = $this->getCustomJoin(true, true, $where); |
324 | 324 | $custom_join['join'] .= $relate_link_join; |
325 | - $contact_required = stristr($where, "contacts"); |
|
325 | + $contact_required = stristr($where, "contacts"); |
|
326 | 326 | if($contact_required) |
327 | 327 | { |
328 | 328 | $query = "SELECT calls.*, contacts.first_name, contacts.last_name, users.user_name as assigned_user_name "; |
@@ -339,11 +339,11 @@ discard block |
||
339 | 339 | } |
340 | 340 | |
341 | 341 | |
342 | - $query .= " LEFT JOIN users ON calls.assigned_user_id=users.id "; |
|
342 | + $query .= " LEFT JOIN users ON calls.assigned_user_id=users.id "; |
|
343 | 343 | |
344 | 344 | $query .= $custom_join['join']; |
345 | 345 | |
346 | - if($where != "") |
|
346 | + if($where != "") |
|
347 | 347 | $query .= "where $where AND ".$where_auto; |
348 | 348 | else |
349 | 349 | $query .= "where ".$where_auto; |
@@ -361,199 +361,199 @@ discard block |
||
361 | 361 | |
362 | 362 | |
363 | 363 | |
364 | - function fill_in_additional_detail_fields() |
|
365 | - { |
|
366 | - global $locale; |
|
367 | - parent::fill_in_additional_detail_fields(); |
|
368 | - if (!empty($this->contact_id)) { |
|
369 | - $query = "SELECT first_name, last_name FROM contacts "; |
|
370 | - $query .= "WHERE id='$this->contact_id' AND deleted=0"; |
|
371 | - $result = $this->db->limitQuery($query,0,1,true," Error filling in additional detail fields: "); |
|
372 | - |
|
373 | - // Get the contact name. |
|
374 | - $row = $this->db->fetchByAssoc($result); |
|
375 | - $GLOBALS['log']->info("additional call fields $query"); |
|
376 | - if($row != null) |
|
377 | - { |
|
378 | - $this->contact_name = $locale->getLocaleFormattedName($row['first_name'], $row['last_name'], '', ''); |
|
379 | - $GLOBALS['log']->debug("Call($this->id): contact_name = $this->contact_name"); |
|
380 | - $GLOBALS['log']->debug("Call($this->id): contact_id = $this->contact_id"); |
|
381 | - } |
|
382 | - } |
|
383 | - if (!isset($this->duration_minutes)) { |
|
384 | - $this->duration_minutes = $this->minutes_value_default; |
|
385 | - } |
|
364 | + function fill_in_additional_detail_fields() |
|
365 | + { |
|
366 | + global $locale; |
|
367 | + parent::fill_in_additional_detail_fields(); |
|
368 | + if (!empty($this->contact_id)) { |
|
369 | + $query = "SELECT first_name, last_name FROM contacts "; |
|
370 | + $query .= "WHERE id='$this->contact_id' AND deleted=0"; |
|
371 | + $result = $this->db->limitQuery($query,0,1,true," Error filling in additional detail fields: "); |
|
372 | + |
|
373 | + // Get the contact name. |
|
374 | + $row = $this->db->fetchByAssoc($result); |
|
375 | + $GLOBALS['log']->info("additional call fields $query"); |
|
376 | + if($row != null) |
|
377 | + { |
|
378 | + $this->contact_name = $locale->getLocaleFormattedName($row['first_name'], $row['last_name'], '', ''); |
|
379 | + $GLOBALS['log']->debug("Call($this->id): contact_name = $this->contact_name"); |
|
380 | + $GLOBALS['log']->debug("Call($this->id): contact_id = $this->contact_id"); |
|
381 | + } |
|
382 | + } |
|
383 | + if (!isset($this->duration_minutes)) { |
|
384 | + $this->duration_minutes = $this->minutes_value_default; |
|
385 | + } |
|
386 | 386 | |
387 | 387 | global $timedate; |
388 | 388 | //setting default date and time |
389 | - if (is_null($this->date_start)) { |
|
390 | - $this->date_start = $timedate->now(); |
|
391 | - } |
|
392 | - |
|
393 | - if (is_null($this->duration_hours)) |
|
394 | - $this->duration_hours = "0"; |
|
395 | - if (is_null($this->duration_minutes)) |
|
396 | - $this->duration_minutes = "1"; |
|
397 | - |
|
398 | - $this->fill_in_additional_parent_fields(); |
|
399 | - |
|
400 | - global $app_list_strings; |
|
401 | - $parent_types = $app_list_strings['record_type_display']; |
|
402 | - $disabled_parent_types = ACLController::disabledModuleList($parent_types,false, 'list'); |
|
403 | - foreach($disabled_parent_types as $disabled_parent_type){ |
|
404 | - if($disabled_parent_type != $this->parent_type){ |
|
405 | - unset($parent_types[$disabled_parent_type]); |
|
406 | - } |
|
407 | - } |
|
408 | - |
|
409 | - $this->parent_type_options = get_select_options_with_id($parent_types, $this->parent_type); |
|
410 | - |
|
411 | - if (empty($this->reminder_time)) { |
|
412 | - $this->reminder_time = -1; |
|
413 | - } |
|
414 | - |
|
415 | - if ( empty($this->id) ) { |
|
416 | - $reminder_t = $GLOBALS['current_user']->getPreference('reminder_time'); |
|
417 | - if ( isset($reminder_t) ) |
|
418 | - $this->reminder_time = $reminder_t; |
|
419 | - } |
|
420 | - $this->reminder_checked = $this->reminder_time == -1 ? false : true; |
|
421 | - |
|
422 | - if (empty($this->email_reminder_time)) { |
|
423 | - $this->email_reminder_time = -1; |
|
424 | - } |
|
425 | - if(empty($this->id)){ |
|
426 | - $reminder_t = $GLOBALS['current_user']->getPreference('email_reminder_time'); |
|
427 | - if(isset($reminder_t)) |
|
428 | - $this->email_reminder_time = $reminder_t; |
|
429 | - } |
|
430 | - $this->email_reminder_checked = $this->email_reminder_time == -1 ? false : true; |
|
431 | - |
|
432 | - if (isset ($_REQUEST['parent_type']) && (!isset($_REQUEST['action']) || $_REQUEST['action'] != 'SubpanelEdits')) { |
|
433 | - $this->parent_type = $_REQUEST['parent_type']; |
|
434 | - } elseif (is_null($this->parent_type)) { |
|
435 | - $this->parent_type = $app_list_strings['record_type_default_key']; |
|
436 | - } |
|
437 | - } |
|
438 | - |
|
439 | - |
|
440 | - function get_list_view_data(){ |
|
441 | - $call_fields = $this->get_list_view_array(); |
|
442 | - global $app_list_strings, $focus, $action, $currentModule; |
|
443 | - if (isset($focus->id)) $id = $focus->id; |
|
444 | - else $id = ''; |
|
445 | - if (isset($this->parent_type) && $this->parent_type != null) |
|
446 | - { |
|
447 | - $call_fields['PARENT_MODULE'] = $this->parent_type; |
|
448 | - } |
|
449 | - if ($this->status == "Planned") { |
|
450 | - //cn: added this if() to deal with sequential Closes in Meetings. this is a hack to a hack (formbase.php->handleRedirect) |
|
451 | - if(empty($action)) |
|
452 | - $action = "index"; |
|
389 | + if (is_null($this->date_start)) { |
|
390 | + $this->date_start = $timedate->now(); |
|
391 | + } |
|
392 | + |
|
393 | + if (is_null($this->duration_hours)) |
|
394 | + $this->duration_hours = "0"; |
|
395 | + if (is_null($this->duration_minutes)) |
|
396 | + $this->duration_minutes = "1"; |
|
397 | + |
|
398 | + $this->fill_in_additional_parent_fields(); |
|
399 | + |
|
400 | + global $app_list_strings; |
|
401 | + $parent_types = $app_list_strings['record_type_display']; |
|
402 | + $disabled_parent_types = ACLController::disabledModuleList($parent_types,false, 'list'); |
|
403 | + foreach($disabled_parent_types as $disabled_parent_type){ |
|
404 | + if($disabled_parent_type != $this->parent_type){ |
|
405 | + unset($parent_types[$disabled_parent_type]); |
|
406 | + } |
|
407 | + } |
|
408 | + |
|
409 | + $this->parent_type_options = get_select_options_with_id($parent_types, $this->parent_type); |
|
410 | + |
|
411 | + if (empty($this->reminder_time)) { |
|
412 | + $this->reminder_time = -1; |
|
413 | + } |
|
414 | + |
|
415 | + if ( empty($this->id) ) { |
|
416 | + $reminder_t = $GLOBALS['current_user']->getPreference('reminder_time'); |
|
417 | + if ( isset($reminder_t) ) |
|
418 | + $this->reminder_time = $reminder_t; |
|
419 | + } |
|
420 | + $this->reminder_checked = $this->reminder_time == -1 ? false : true; |
|
421 | + |
|
422 | + if (empty($this->email_reminder_time)) { |
|
423 | + $this->email_reminder_time = -1; |
|
424 | + } |
|
425 | + if(empty($this->id)){ |
|
426 | + $reminder_t = $GLOBALS['current_user']->getPreference('email_reminder_time'); |
|
427 | + if(isset($reminder_t)) |
|
428 | + $this->email_reminder_time = $reminder_t; |
|
429 | + } |
|
430 | + $this->email_reminder_checked = $this->email_reminder_time == -1 ? false : true; |
|
431 | + |
|
432 | + if (isset ($_REQUEST['parent_type']) && (!isset($_REQUEST['action']) || $_REQUEST['action'] != 'SubpanelEdits')) { |
|
433 | + $this->parent_type = $_REQUEST['parent_type']; |
|
434 | + } elseif (is_null($this->parent_type)) { |
|
435 | + $this->parent_type = $app_list_strings['record_type_default_key']; |
|
436 | + } |
|
437 | + } |
|
438 | + |
|
439 | + |
|
440 | + function get_list_view_data(){ |
|
441 | + $call_fields = $this->get_list_view_array(); |
|
442 | + global $app_list_strings, $focus, $action, $currentModule; |
|
443 | + if (isset($focus->id)) $id = $focus->id; |
|
444 | + else $id = ''; |
|
445 | + if (isset($this->parent_type) && $this->parent_type != null) |
|
446 | + { |
|
447 | + $call_fields['PARENT_MODULE'] = $this->parent_type; |
|
448 | + } |
|
449 | + if ($this->status == "Planned") { |
|
450 | + //cn: added this if() to deal with sequential Closes in Meetings. this is a hack to a hack (formbase.php->handleRedirect) |
|
451 | + if(empty($action)) |
|
452 | + $action = "index"; |
|
453 | 453 | |
454 | 454 | $setCompleteUrl = "<a id='{$this->id}' onclick='SUGAR.util.closeActivityPanel.show(\"{$this->module_dir}\",\"{$this->id}\",\"Held\",\"listview\",\"1\");'>"; |
455 | - if ($this->ACLAccess('edit')) { |
|
455 | + if ($this->ACLAccess('edit')) { |
|
456 | 456 | $call_fields['SET_COMPLETE'] = $setCompleteUrl . SugarThemeRegistry::current()->getImage("close_inline"," border='0'",null,null,'.gif',translate('LBL_CLOSEINLINE'))."</a>"; |
457 | 457 | } else { |
458 | 458 | $call_fields['SET_COMPLETE'] = ''; |
459 | 459 | } |
460 | - } |
|
461 | - global $timedate; |
|
462 | - $today = $timedate->nowDb(); |
|
463 | - $nextday = $timedate->asDbDate($timedate->getNow()->modify("+1 day")); |
|
464 | - $mergeTime = $call_fields['DATE_START']; //$timedate->merge_date_time($call_fields['DATE_START'], $call_fields['TIME_START']); |
|
465 | - $date_db = $timedate->to_db($mergeTime); |
|
466 | - if( $date_db < $today){ |
|
467 | - $call_fields['DATE_START']= "<font class='overdueTask'>".$call_fields['DATE_START']."</font>"; |
|
468 | - }else if($date_db < $nextday){ |
|
469 | - $call_fields['DATE_START'] = "<font class='todaysTask'>".$call_fields['DATE_START']."</font>"; |
|
470 | - }else{ |
|
471 | - $call_fields['DATE_START'] = "<font class='futureTask'>".$call_fields['DATE_START']."</font>"; |
|
472 | - } |
|
473 | - $this->fill_in_additional_detail_fields(); |
|
474 | - |
|
475 | - //make sure we grab the localized version of the contact name, if a contact is provided |
|
476 | - if (!empty($this->contact_id)) { |
|
477 | - // Bug# 46125 - make first name, last name, salutation and title of Contacts respect field level ACLs |
|
460 | + } |
|
461 | + global $timedate; |
|
462 | + $today = $timedate->nowDb(); |
|
463 | + $nextday = $timedate->asDbDate($timedate->getNow()->modify("+1 day")); |
|
464 | + $mergeTime = $call_fields['DATE_START']; //$timedate->merge_date_time($call_fields['DATE_START'], $call_fields['TIME_START']); |
|
465 | + $date_db = $timedate->to_db($mergeTime); |
|
466 | + if( $date_db < $today){ |
|
467 | + $call_fields['DATE_START']= "<font class='overdueTask'>".$call_fields['DATE_START']."</font>"; |
|
468 | + }else if($date_db < $nextday){ |
|
469 | + $call_fields['DATE_START'] = "<font class='todaysTask'>".$call_fields['DATE_START']."</font>"; |
|
470 | + }else{ |
|
471 | + $call_fields['DATE_START'] = "<font class='futureTask'>".$call_fields['DATE_START']."</font>"; |
|
472 | + } |
|
473 | + $this->fill_in_additional_detail_fields(); |
|
474 | + |
|
475 | + //make sure we grab the localized version of the contact name, if a contact is provided |
|
476 | + if (!empty($this->contact_id)) { |
|
477 | + // Bug# 46125 - make first name, last name, salutation and title of Contacts respect field level ACLs |
|
478 | 478 | $contact_temp = BeanFactory::getBean("Contacts", $this->contact_id); |
479 | 479 | if(!empty($contact_temp)) { |
480 | 480 | $contact_temp->_create_proper_name_field(); |
481 | 481 | $this->contact_name = $contact_temp->full_name; |
482 | 482 | } |
483 | - } |
|
483 | + } |
|
484 | 484 | |
485 | 485 | $call_fields['CONTACT_ID'] = $this->contact_id; |
486 | 486 | $call_fields['CONTACT_NAME'] = $this->contact_name; |
487 | - $call_fields['PARENT_NAME'] = $this->parent_name; |
|
487 | + $call_fields['PARENT_NAME'] = $this->parent_name; |
|
488 | 488 | $call_fields['REMINDER_CHECKED'] = $this->reminder_time==-1 ? false : true; |
489 | - $call_fields['EMAIL_REMINDER_CHECKED'] = $this->email_reminder_time==-1 ? false : true; |
|
489 | + $call_fields['EMAIL_REMINDER_CHECKED'] = $this->email_reminder_time==-1 ? false : true; |
|
490 | 490 | |
491 | - return $call_fields; |
|
492 | - } |
|
491 | + return $call_fields; |
|
492 | + } |
|
493 | 493 | |
494 | - function set_notification_body($xtpl, $call) { |
|
495 | - global $sugar_config; |
|
496 | - global $app_list_strings; |
|
497 | - global $current_user; |
|
498 | - global $app_list_strings; |
|
499 | - global $timedate; |
|
494 | + function set_notification_body($xtpl, $call) { |
|
495 | + global $sugar_config; |
|
496 | + global $app_list_strings; |
|
497 | + global $current_user; |
|
498 | + global $app_list_strings; |
|
499 | + global $timedate; |
|
500 | 500 | |
501 | 501 | // rrs: bug 42684 - passing a contact breaks this call |
502 | - $notifyUser =($call->current_notify_user->object_name == 'User') ? $call->current_notify_user : $current_user; |
|
503 | - |
|
504 | - |
|
505 | - // Assumes $call dates are in user format |
|
506 | - $calldate = $timedate->fromDb($call->date_start); |
|
507 | - $xOffset = $timedate->asUser($calldate, $notifyUser).' '.$timedate->userTimezoneSuffix($calldate, $notifyUser); |
|
508 | - |
|
509 | - if ( strtolower(get_class($call->current_notify_user)) == 'contact' ) { |
|
510 | - $xtpl->assign("ACCEPT_URL", $sugar_config['site_url']. |
|
511 | - '/index.php?entryPoint=acceptDecline&module=Calls&contact_id='.$call->current_notify_user->id.'&record='.$call->id); |
|
512 | - } elseif ( strtolower(get_class($call->current_notify_user)) == 'lead' ) { |
|
513 | - $xtpl->assign("ACCEPT_URL", $sugar_config['site_url']. |
|
514 | - '/index.php?entryPoint=acceptDecline&module=Calls&lead_id='.$call->current_notify_user->id.'&record='.$call->id); |
|
515 | - } else { |
|
516 | - $xtpl->assign("ACCEPT_URL", $sugar_config['site_url']. |
|
517 | - '/index.php?entryPoint=acceptDecline&module=Calls&user_id='.$call->current_notify_user->id.'&record='.$call->id); |
|
518 | - } |
|
519 | - |
|
520 | - $xtpl->assign("CALL_TO", $call->current_notify_user->new_assigned_user_name); |
|
521 | - $xtpl->assign("CALL_SUBJECT", $call->name); |
|
522 | - $xtpl->assign("CALL_STARTDATE", $xOffset); |
|
523 | - $xtpl->assign("CALL_HOURS", $call->duration_hours); |
|
524 | - $xtpl->assign("CALL_MINUTES", $call->duration_minutes); |
|
525 | - $xtpl->assign("CALL_STATUS", ((isset($call->status))?$app_list_strings['call_status_dom'][$call->status] : "")); |
|
526 | - $xtpl->assign("CALL_DESCRIPTION", $call->description); |
|
527 | - |
|
528 | - return $xtpl; |
|
529 | - } |
|
530 | - |
|
531 | - |
|
532 | - function get_call_users() { |
|
533 | - $template = new User(); |
|
534 | - // First, get the list of IDs. |
|
535 | - $query = "SELECT calls_users.required, calls_users.accept_status, calls_users.user_id from calls_users where calls_users.call_id='$this->id' AND calls_users.deleted=0"; |
|
536 | - $GLOBALS['log']->debug("Finding linked records $this->object_name: ".$query); |
|
537 | - $result = $this->db->query($query, true); |
|
538 | - $list = Array(); |
|
539 | - |
|
540 | - while($row = $this->db->fetchByAssoc($result)) { |
|
541 | - $template = new User(); // PHP 5 will retrieve by reference, always over-writing the "old" one |
|
542 | - $record = $template->retrieve($row['user_id']); |
|
543 | - $template->required = $row['required']; |
|
544 | - $template->accept_status = $row['accept_status']; |
|
545 | - |
|
546 | - if($record != null) { |
|
547 | - // this copies the object into the array |
|
548 | - $list[] = $template; |
|
549 | - } |
|
550 | - } |
|
551 | - return $list; |
|
552 | - } |
|
553 | - |
|
554 | - |
|
555 | - function get_invite_calls(&$user) |
|
556 | - { |
|
502 | + $notifyUser =($call->current_notify_user->object_name == 'User') ? $call->current_notify_user : $current_user; |
|
503 | + |
|
504 | + |
|
505 | + // Assumes $call dates are in user format |
|
506 | + $calldate = $timedate->fromDb($call->date_start); |
|
507 | + $xOffset = $timedate->asUser($calldate, $notifyUser).' '.$timedate->userTimezoneSuffix($calldate, $notifyUser); |
|
508 | + |
|
509 | + if ( strtolower(get_class($call->current_notify_user)) == 'contact' ) { |
|
510 | + $xtpl->assign("ACCEPT_URL", $sugar_config['site_url']. |
|
511 | + '/index.php?entryPoint=acceptDecline&module=Calls&contact_id='.$call->current_notify_user->id.'&record='.$call->id); |
|
512 | + } elseif ( strtolower(get_class($call->current_notify_user)) == 'lead' ) { |
|
513 | + $xtpl->assign("ACCEPT_URL", $sugar_config['site_url']. |
|
514 | + '/index.php?entryPoint=acceptDecline&module=Calls&lead_id='.$call->current_notify_user->id.'&record='.$call->id); |
|
515 | + } else { |
|
516 | + $xtpl->assign("ACCEPT_URL", $sugar_config['site_url']. |
|
517 | + '/index.php?entryPoint=acceptDecline&module=Calls&user_id='.$call->current_notify_user->id.'&record='.$call->id); |
|
518 | + } |
|
519 | + |
|
520 | + $xtpl->assign("CALL_TO", $call->current_notify_user->new_assigned_user_name); |
|
521 | + $xtpl->assign("CALL_SUBJECT", $call->name); |
|
522 | + $xtpl->assign("CALL_STARTDATE", $xOffset); |
|
523 | + $xtpl->assign("CALL_HOURS", $call->duration_hours); |
|
524 | + $xtpl->assign("CALL_MINUTES", $call->duration_minutes); |
|
525 | + $xtpl->assign("CALL_STATUS", ((isset($call->status))?$app_list_strings['call_status_dom'][$call->status] : "")); |
|
526 | + $xtpl->assign("CALL_DESCRIPTION", $call->description); |
|
527 | + |
|
528 | + return $xtpl; |
|
529 | + } |
|
530 | + |
|
531 | + |
|
532 | + function get_call_users() { |
|
533 | + $template = new User(); |
|
534 | + // First, get the list of IDs. |
|
535 | + $query = "SELECT calls_users.required, calls_users.accept_status, calls_users.user_id from calls_users where calls_users.call_id='$this->id' AND calls_users.deleted=0"; |
|
536 | + $GLOBALS['log']->debug("Finding linked records $this->object_name: ".$query); |
|
537 | + $result = $this->db->query($query, true); |
|
538 | + $list = Array(); |
|
539 | + |
|
540 | + while($row = $this->db->fetchByAssoc($result)) { |
|
541 | + $template = new User(); // PHP 5 will retrieve by reference, always over-writing the "old" one |
|
542 | + $record = $template->retrieve($row['user_id']); |
|
543 | + $template->required = $row['required']; |
|
544 | + $template->accept_status = $row['accept_status']; |
|
545 | + |
|
546 | + if($record != null) { |
|
547 | + // this copies the object into the array |
|
548 | + $list[] = $template; |
|
549 | + } |
|
550 | + } |
|
551 | + return $list; |
|
552 | + } |
|
553 | + |
|
554 | + |
|
555 | + function get_invite_calls(&$user) |
|
556 | + { |
|
557 | 557 | $template = $this; |
558 | 558 | // First, get the list of IDs. |
559 | 559 | $query = "SELECT calls_users.required, calls_users.accept_status, calls_users.call_id from calls_users where calls_users.user_id='$user->id' AND ( calls_users.accept_status IS NULL OR calls_users.accept_status='none') AND calls_users.deleted=0"; |
@@ -568,182 +568,182 @@ discard block |
||
568 | 568 | |
569 | 569 | while($row = $this->db->fetchByAssoc($result)) |
570 | 570 | { |
571 | - $record = $template->retrieve($row['call_id']); |
|
572 | - $template->required = $row['required']; |
|
573 | - $template->accept_status = $row['accept_status']; |
|
571 | + $record = $template->retrieve($row['call_id']); |
|
572 | + $template->required = $row['required']; |
|
573 | + $template->accept_status = $row['accept_status']; |
|
574 | 574 | |
575 | 575 | |
576 | - if($record != null) |
|
577 | - { |
|
576 | + if($record != null) |
|
577 | + { |
|
578 | 578 | // this copies the object into the array |
579 | 579 | $list[] = $template; |
580 | - } |
|
580 | + } |
|
581 | 581 | } |
582 | 582 | return $list; |
583 | 583 | |
584 | - } |
|
584 | + } |
|
585 | 585 | |
586 | 586 | |
587 | - function set_accept_status(&$user,$status) |
|
588 | - { |
|
587 | + function set_accept_status(&$user,$status) |
|
588 | + { |
|
589 | 589 | if ( $user->object_name == 'User') |
590 | 590 | { |
591 | - $relate_values = array('user_id'=>$user->id,'call_id'=>$this->id); |
|
592 | - $data_values = array('accept_status'=>$status); |
|
593 | - $this->set_relationship($this->rel_users_table, $relate_values, true, true,$data_values); |
|
594 | - global $current_user; |
|
591 | + $relate_values = array('user_id'=>$user->id,'call_id'=>$this->id); |
|
592 | + $data_values = array('accept_status'=>$status); |
|
593 | + $this->set_relationship($this->rel_users_table, $relate_values, true, true,$data_values); |
|
594 | + global $current_user; |
|
595 | 595 | |
596 | - if ( $this->update_vcal ) |
|
597 | - { |
|
596 | + if ( $this->update_vcal ) |
|
597 | + { |
|
598 | 598 | vCal::cache_sugar_vcal($user); |
599 | - } |
|
599 | + } |
|
600 | 600 | } |
601 | 601 | else if ( $user->object_name == 'Contact') |
602 | 602 | { |
603 | - $relate_values = array('contact_id'=>$user->id,'call_id'=>$this->id); |
|
604 | - $data_values = array('accept_status'=>$status); |
|
605 | - $this->set_relationship($this->rel_contacts_table, $relate_values, true, true,$data_values); |
|
603 | + $relate_values = array('contact_id'=>$user->id,'call_id'=>$this->id); |
|
604 | + $data_values = array('accept_status'=>$status); |
|
605 | + $this->set_relationship($this->rel_contacts_table, $relate_values, true, true,$data_values); |
|
606 | 606 | } |
607 | 607 | else if ( $user->object_name == 'Lead') |
608 | 608 | { |
609 | - $relate_values = array('lead_id'=>$user->id,'call_id'=>$this->id); |
|
610 | - $data_values = array('accept_status'=>$status); |
|
611 | - $this->set_relationship($this->rel_leads_table, $relate_values, true, true,$data_values); |
|
609 | + $relate_values = array('lead_id'=>$user->id,'call_id'=>$this->id); |
|
610 | + $data_values = array('accept_status'=>$status); |
|
611 | + $this->set_relationship($this->rel_leads_table, $relate_values, true, true,$data_values); |
|
612 | + } |
|
612 | 613 | } |
613 | - } |
|
614 | 614 | |
615 | 615 | |
616 | 616 | |
617 | - function get_notification_recipients() { |
|
618 | - if($this->special_notification) { |
|
619 | - return parent::get_notification_recipients(); |
|
620 | - } |
|
617 | + function get_notification_recipients() { |
|
618 | + if($this->special_notification) { |
|
619 | + return parent::get_notification_recipients(); |
|
620 | + } |
|
621 | 621 | |
622 | 622 | // $GLOBALS['log']->debug('Call.php->get_notification_recipients():'.print_r($this,true)); |
623 | - $list = array(); |
|
623 | + $list = array(); |
|
624 | 624 | if(!is_array($this->contacts_arr)) { |
625 | - $this->contacts_arr = array(); |
|
626 | - } |
|
625 | + $this->contacts_arr = array(); |
|
626 | + } |
|
627 | 627 | |
628 | - if(!is_array($this->users_arr)) { |
|
629 | - $this->users_arr = array(); |
|
630 | - } |
|
628 | + if(!is_array($this->users_arr)) { |
|
629 | + $this->users_arr = array(); |
|
630 | + } |
|
631 | 631 | |
632 | 632 | if(!is_array($this->leads_arr)) { |
633 | - $this->leads_arr = array(); |
|
634 | - } |
|
635 | - |
|
636 | - foreach($this->users_arr as $user_id) { |
|
637 | - $notify_user = new User(); |
|
638 | - $notify_user->retrieve($user_id); |
|
639 | - $notify_user->new_assigned_user_name = $notify_user->full_name; |
|
640 | - $GLOBALS['log']->info("Notifications: recipient is $notify_user->new_assigned_user_name"); |
|
641 | - $list[$notify_user->id] = $notify_user; |
|
642 | - } |
|
643 | - |
|
644 | - foreach($this->contacts_arr as $contact_id) { |
|
645 | - $notify_user = new Contact(); |
|
646 | - $notify_user->retrieve($contact_id); |
|
647 | - $notify_user->new_assigned_user_name = $notify_user->full_name; |
|
648 | - $GLOBALS['log']->info("Notifications: recipient is $notify_user->new_assigned_user_name"); |
|
649 | - $list[$notify_user->id] = $notify_user; |
|
650 | - } |
|
633 | + $this->leads_arr = array(); |
|
634 | + } |
|
635 | + |
|
636 | + foreach($this->users_arr as $user_id) { |
|
637 | + $notify_user = new User(); |
|
638 | + $notify_user->retrieve($user_id); |
|
639 | + $notify_user->new_assigned_user_name = $notify_user->full_name; |
|
640 | + $GLOBALS['log']->info("Notifications: recipient is $notify_user->new_assigned_user_name"); |
|
641 | + $list[$notify_user->id] = $notify_user; |
|
642 | + } |
|
643 | + |
|
644 | + foreach($this->contacts_arr as $contact_id) { |
|
645 | + $notify_user = new Contact(); |
|
646 | + $notify_user->retrieve($contact_id); |
|
647 | + $notify_user->new_assigned_user_name = $notify_user->full_name; |
|
648 | + $GLOBALS['log']->info("Notifications: recipient is $notify_user->new_assigned_user_name"); |
|
649 | + $list[$notify_user->id] = $notify_user; |
|
650 | + } |
|
651 | 651 | |
652 | 652 | foreach($this->leads_arr as $lead_id) { |
653 | - $notify_user = new Lead(); |
|
654 | - $notify_user->retrieve($lead_id); |
|
655 | - $notify_user->new_assigned_user_name = $notify_user->full_name; |
|
656 | - $GLOBALS['log']->info("Notifications: recipient is $notify_user->new_assigned_user_name"); |
|
657 | - $list[$notify_user->id] = $notify_user; |
|
658 | - } |
|
659 | - global $sugar_config; |
|
660 | - if(isset($sugar_config['disable_notify_current_user']) && $sugar_config['disable_notify_current_user']) { |
|
661 | - global $current_user; |
|
662 | - if(isset($list[$current_user->id])) |
|
663 | - unset($list[$current_user->id]); |
|
664 | - } |
|
653 | + $notify_user = new Lead(); |
|
654 | + $notify_user->retrieve($lead_id); |
|
655 | + $notify_user->new_assigned_user_name = $notify_user->full_name; |
|
656 | + $GLOBALS['log']->info("Notifications: recipient is $notify_user->new_assigned_user_name"); |
|
657 | + $list[$notify_user->id] = $notify_user; |
|
658 | + } |
|
659 | + global $sugar_config; |
|
660 | + if(isset($sugar_config['disable_notify_current_user']) && $sugar_config['disable_notify_current_user']) { |
|
661 | + global $current_user; |
|
662 | + if(isset($list[$current_user->id])) |
|
663 | + unset($list[$current_user->id]); |
|
664 | + } |
|
665 | 665 | // $GLOBALS['log']->debug('Call.php->get_notification_recipients():'.print_r($list,true)); |
666 | - return $list; |
|
667 | - } |
|
666 | + return $list; |
|
667 | + } |
|
668 | 668 | |
669 | 669 | function bean_implements($interface){ |
670 | - switch($interface){ |
|
671 | - case 'ACL':return true; |
|
672 | - } |
|
673 | - return false; |
|
674 | - } |
|
675 | - |
|
676 | - function listviewACLHelper(){ |
|
677 | - $array_assign = parent::listviewACLHelper(); |
|
678 | - $is_owner = false; |
|
679 | - $in_group = false; //SECURITY GROUPS |
|
680 | - if(!empty($this->parent_name)){ |
|
681 | - |
|
682 | - if(!empty($this->parent_name_owner)){ |
|
683 | - global $current_user; |
|
684 | - $is_owner = $current_user->id == $this->parent_name_owner; |
|
685 | - } |
|
686 | - /* BEGIN - SECURITY GROUPS */ |
|
687 | - //parent_name_owner not being set for whatever reason so we need to figure this out |
|
688 | - else if(!empty($this->parent_type) && !empty($this->parent_id)) { |
|
689 | - global $current_user; |
|
670 | + switch($interface){ |
|
671 | + case 'ACL':return true; |
|
672 | + } |
|
673 | + return false; |
|
674 | + } |
|
675 | + |
|
676 | + function listviewACLHelper(){ |
|
677 | + $array_assign = parent::listviewACLHelper(); |
|
678 | + $is_owner = false; |
|
679 | + $in_group = false; //SECURITY GROUPS |
|
680 | + if(!empty($this->parent_name)){ |
|
681 | + |
|
682 | + if(!empty($this->parent_name_owner)){ |
|
683 | + global $current_user; |
|
684 | + $is_owner = $current_user->id == $this->parent_name_owner; |
|
685 | + } |
|
686 | + /* BEGIN - SECURITY GROUPS */ |
|
687 | + //parent_name_owner not being set for whatever reason so we need to figure this out |
|
688 | + else if(!empty($this->parent_type) && !empty($this->parent_id)) { |
|
689 | + global $current_user; |
|
690 | 690 | $parent_bean = BeanFactory::getBean($this->parent_type,$this->parent_id); |
691 | 691 | if($parent_bean !== false) { |
692 | - $is_owner = $current_user->id == $parent_bean->assigned_user_id; |
|
692 | + $is_owner = $current_user->id == $parent_bean->assigned_user_id; |
|
693 | 693 | } |
694 | - } |
|
695 | - require_once("modules/SecurityGroups/SecurityGroup.php"); |
|
696 | - $in_group = SecurityGroup::groupHasAccess($this->parent_type, $this->parent_id, 'view'); |
|
697 | - /* END - SECURITY GROUPS */ |
|
698 | - } |
|
699 | - |
|
700 | - /* BEGIN - SECURITY GROUPS */ |
|
701 | - /** |
|
694 | + } |
|
695 | + require_once("modules/SecurityGroups/SecurityGroup.php"); |
|
696 | + $in_group = SecurityGroup::groupHasAccess($this->parent_type, $this->parent_id, 'view'); |
|
697 | + /* END - SECURITY GROUPS */ |
|
698 | + } |
|
699 | + |
|
700 | + /* BEGIN - SECURITY GROUPS */ |
|
701 | + /** |
|
702 | 702 | if(!ACLController::moduleSupportsACL($this->parent_type) || ACLController::checkAccess($this->parent_type, 'view', $is_owner)){ |
703 | - */ |
|
704 | - if(!ACLController::moduleSupportsACL($this->parent_type) || ACLController::checkAccess($this->parent_type, 'view', $is_owner, 'module', $in_group)){ |
|
705 | - /* END - SECURITY GROUPS */ |
|
706 | - $array_assign['PARENT'] = 'a'; |
|
707 | - }else{ |
|
708 | - $array_assign['PARENT'] = 'span'; |
|
709 | - } |
|
710 | - $is_owner = false; |
|
711 | - $in_group = false; //SECURITY GROUPS |
|
712 | - if(!empty($this->contact_name)){ |
|
713 | - |
|
714 | - if(!empty($this->contact_name_owner)){ |
|
715 | - global $current_user; |
|
716 | - $is_owner = $current_user->id == $this->contact_name_owner; |
|
717 | - } |
|
718 | - /* BEGIN - SECURITY GROUPS */ |
|
719 | - //contact_name_owner not being set for whatever reason so we need to figure this out |
|
720 | - else { |
|
721 | - global $current_user; |
|
703 | + */ |
|
704 | + if(!ACLController::moduleSupportsACL($this->parent_type) || ACLController::checkAccess($this->parent_type, 'view', $is_owner, 'module', $in_group)){ |
|
705 | + /* END - SECURITY GROUPS */ |
|
706 | + $array_assign['PARENT'] = 'a'; |
|
707 | + }else{ |
|
708 | + $array_assign['PARENT'] = 'span'; |
|
709 | + } |
|
710 | + $is_owner = false; |
|
711 | + $in_group = false; //SECURITY GROUPS |
|
712 | + if(!empty($this->contact_name)){ |
|
713 | + |
|
714 | + if(!empty($this->contact_name_owner)){ |
|
715 | + global $current_user; |
|
716 | + $is_owner = $current_user->id == $this->contact_name_owner; |
|
717 | + } |
|
718 | + /* BEGIN - SECURITY GROUPS */ |
|
719 | + //contact_name_owner not being set for whatever reason so we need to figure this out |
|
720 | + else { |
|
721 | + global $current_user; |
|
722 | 722 | $parent_bean = BeanFactory::getBean('Contacts',$this->contact_id); |
723 | 723 | if($parent_bean !== false) { |
724 | - $is_owner = $current_user->id == $parent_bean->assigned_user_id; |
|
724 | + $is_owner = $current_user->id == $parent_bean->assigned_user_id; |
|
725 | 725 | } |
726 | - } |
|
727 | - require_once("modules/SecurityGroups/SecurityGroup.php"); |
|
728 | - $in_group = SecurityGroup::groupHasAccess('Contacts', $this->contact_id, 'view'); |
|
729 | - /* END - SECURITY GROUPS */ |
|
730 | - } |
|
731 | - /* BEGIN - SECURITY GROUPS */ |
|
732 | - /** |
|
726 | + } |
|
727 | + require_once("modules/SecurityGroups/SecurityGroup.php"); |
|
728 | + $in_group = SecurityGroup::groupHasAccess('Contacts', $this->contact_id, 'view'); |
|
729 | + /* END - SECURITY GROUPS */ |
|
730 | + } |
|
731 | + /* BEGIN - SECURITY GROUPS */ |
|
732 | + /** |
|
733 | 733 | if( ACLController::checkAccess('Contacts', 'view', $is_owner)){ |
734 | - */ |
|
735 | - if( ACLController::checkAccess('Contacts', 'view', $is_owner, 'module', $in_group)){ |
|
736 | - /* END - SECURITY GROUPS */ |
|
737 | - $array_assign['CONTACT'] = 'a'; |
|
738 | - }else{ |
|
739 | - $array_assign['CONTACT'] = 'span'; |
|
740 | - } |
|
741 | - |
|
742 | - return $array_assign; |
|
743 | - } |
|
744 | - |
|
745 | - function save_relationship_changes($is_update, $exclude = array()) { |
|
746 | - if(empty($this->in_workflow)) |
|
734 | + */ |
|
735 | + if( ACLController::checkAccess('Contacts', 'view', $is_owner, 'module', $in_group)){ |
|
736 | + /* END - SECURITY GROUPS */ |
|
737 | + $array_assign['CONTACT'] = 'a'; |
|
738 | + }else{ |
|
739 | + $array_assign['CONTACT'] = 'span'; |
|
740 | + } |
|
741 | + |
|
742 | + return $array_assign; |
|
743 | + } |
|
744 | + |
|
745 | + function save_relationship_changes($is_update, $exclude = array()) { |
|
746 | + if(empty($this->in_workflow)) |
|
747 | 747 | { |
748 | 748 | if(empty($this->in_import)) |
749 | 749 | { |
@@ -751,12 +751,12 @@ discard block |
||
751 | 751 | //add assigned_user_id to exclude list and let the logic from MeetingFormBase determine whether assigned user id gets added to the relationship |
752 | 752 | if(!empty($GLOBALS['soap_server_object'])) |
753 | 753 | { |
754 | - $exclude = array('lead_id', 'contact_id', 'user_id'); |
|
755 | - } |
|
754 | + $exclude = array('lead_id', 'contact_id', 'user_id'); |
|
755 | + } |
|
756 | 756 | else |
757 | 757 | { |
758 | - $exclude = array('lead_id', 'contact_id', 'user_id', 'assigned_user_id'); |
|
759 | - } |
|
758 | + $exclude = array('lead_id', 'contact_id', 'user_id', 'assigned_user_id'); |
|
759 | + } |
|
760 | 760 | } |
761 | 761 | else |
762 | 762 | { |
@@ -765,15 +765,15 @@ discard block |
||
765 | 765 | |
766 | 766 | |
767 | 767 | } |
768 | - parent::save_relationship_changes($is_update, $exclude); |
|
769 | - } |
|
768 | + parent::save_relationship_changes($is_update, $exclude); |
|
769 | + } |
|
770 | 770 | |
771 | 771 | public function getDefaultStatus() |
772 | 772 | { |
773 | - $def = $this->field_defs['status']; |
|
774 | - if (isset($def['default'])) { |
|
775 | - return $def['default']; |
|
776 | - } else { |
|
773 | + $def = $this->field_defs['status']; |
|
774 | + if (isset($def['default'])) { |
|
775 | + return $def['default']; |
|
776 | + } else { |
|
777 | 777 | $app = return_app_list_strings_language($GLOBALS['current_language']); |
778 | 778 | if (isset($def['options']) && isset($app[$def['options']])) { |
779 | 779 | $keys = array_keys($app[$def['options']]); |
@@ -50,13 +50,13 @@ discard block |
||
50 | 50 | { |
51 | 51 | |
52 | 52 | |
53 | - /* |
|
53 | + /* |
|
54 | 54 | * |
55 | 55 | */ |
56 | - function __construct() |
|
57 | - { |
|
56 | + function __construct() |
|
57 | + { |
|
58 | 58 | |
59 | - } |
|
59 | + } |
|
60 | 60 | |
61 | 61 | /** |
62 | 62 | * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead |
@@ -73,91 +73,91 @@ discard block |
||
73 | 73 | } |
74 | 74 | |
75 | 75 | |
76 | - /* |
|
77 | - * |
|
78 | - */ |
|
79 | - function _get_where_clause() |
|
80 | - { |
|
81 | - $where = ''; |
|
82 | - if(isset($_REQUEST['query'])) |
|
83 | - { |
|
84 | - $where_clauses = array(); |
|
85 | - append_where_clause($where_clauses, "name", "acl_roles.name"); |
|
86 | - $where = generate_where_statement($where_clauses); |
|
87 | - } |
|
88 | - |
|
89 | - return $where; |
|
90 | - } |
|
91 | - |
|
92 | - /** |
|
76 | + /* |
|
93 | 77 | * |
94 | 78 | */ |
95 | - function process_page() |
|
96 | - { |
|
97 | - global $mod_strings; |
|
98 | - global $app_strings; |
|
99 | - global $currentModule; |
|
100 | - global $sugar_version, $sugar_config; |
|
101 | - |
|
102 | - $output_html = ''; |
|
103 | - $where = ''; |
|
104 | - |
|
105 | - $where = $this->_get_where_clause(); |
|
106 | - |
|
107 | - $name = empty($_REQUEST['name']) ? '' : $_REQUEST['name']; |
|
108 | - $request_data = empty($_REQUEST['request_data']) ? '' : $_REQUEST['request_data']; |
|
109 | - $hide_clear_button = empty($_REQUEST['hide_clear_button']) ? false : true; |
|
110 | - |
|
111 | - $button = "<form action='index.php' method='post' name='form' id='form'>\n"; |
|
112 | - if(!$hide_clear_button) |
|
113 | - { |
|
114 | - $button .= "<input type='button' name='button' class='button' onclick=\"send_back('','');\" title='" |
|
115 | - .$app_strings['LBL_CLEAR_BUTTON_TITLE']."' value=' " |
|
116 | - .$app_strings['LBL_CLEAR_BUTTON_LABEL']." ' />\n"; |
|
117 | - } |
|
118 | - $button .= "<input type='submit' name='button' class='button' onclick=\"window.close();\" title='" |
|
119 | - .$app_strings['LBL_CANCEL_BUTTON_TITLE']."' value=' " |
|
120 | - .$app_strings['LBL_CANCEL_BUTTON_LABEL']." ' />\n"; |
|
121 | - $button .= "</form>\n"; |
|
122 | - |
|
123 | - $form = new XTemplate('modules/ACLRoles/Popup_picker.html'); |
|
124 | - $form->assign('MOD', $mod_strings); |
|
125 | - $form->assign('APP', $app_strings); |
|
126 | - $form->assign('MODULE_NAME', $currentModule); |
|
127 | - $form->assign('NAME', $name); |
|
128 | - $form->assign('request_data', $request_data); |
|
129 | - |
|
130 | - ob_start(); |
|
131 | - insert_popup_header(); |
|
132 | - $output_html .= ob_get_contents(); |
|
133 | - ob_end_clean(); |
|
134 | - |
|
135 | - $output_html .= get_form_header($mod_strings['LBL_SEARCH_FORM_TITLE'], '', false); |
|
136 | - |
|
137 | - $form->parse('main.SearchHeader'); |
|
138 | - $output_html .= $form->text('main.SearchHeader'); |
|
139 | - |
|
140 | - // Reset the sections that are already in the page so that they do not print again later. |
|
141 | - $form->reset('main.SearchHeader'); |
|
142 | - |
|
143 | - // create the listview |
|
144 | - $seed_bean = new ACLRole(); |
|
145 | - $ListView = new ListView(); |
|
146 | - $ListView->show_export_button = false; |
|
147 | - $ListView->process_for_popups = true; |
|
148 | - $ListView->setXTemplate($form); |
|
149 | - $ListView->setHeaderTitle($mod_strings['LBL_ROLE']); |
|
150 | - $ListView->setHeaderText($button); |
|
151 | - $ListView->setQuery($where, '', 'name', 'ROLE'); |
|
152 | - $ListView->setModStrings($mod_strings); |
|
153 | - |
|
154 | - ob_start(); |
|
155 | - $ListView->processListView($seed_bean, 'main', 'ROLE'); |
|
156 | - $output_html .= ob_get_contents(); |
|
157 | - ob_end_clean(); |
|
158 | - |
|
159 | - $output_html .= insert_popup_footer(); |
|
160 | - return $output_html; |
|
161 | - } |
|
79 | + function _get_where_clause() |
|
80 | + { |
|
81 | + $where = ''; |
|
82 | + if(isset($_REQUEST['query'])) |
|
83 | + { |
|
84 | + $where_clauses = array(); |
|
85 | + append_where_clause($where_clauses, "name", "acl_roles.name"); |
|
86 | + $where = generate_where_statement($where_clauses); |
|
87 | + } |
|
88 | + |
|
89 | + return $where; |
|
90 | + } |
|
91 | + |
|
92 | + /** |
|
93 | + * |
|
94 | + */ |
|
95 | + function process_page() |
|
96 | + { |
|
97 | + global $mod_strings; |
|
98 | + global $app_strings; |
|
99 | + global $currentModule; |
|
100 | + global $sugar_version, $sugar_config; |
|
101 | + |
|
102 | + $output_html = ''; |
|
103 | + $where = ''; |
|
104 | + |
|
105 | + $where = $this->_get_where_clause(); |
|
106 | + |
|
107 | + $name = empty($_REQUEST['name']) ? '' : $_REQUEST['name']; |
|
108 | + $request_data = empty($_REQUEST['request_data']) ? '' : $_REQUEST['request_data']; |
|
109 | + $hide_clear_button = empty($_REQUEST['hide_clear_button']) ? false : true; |
|
110 | + |
|
111 | + $button = "<form action='index.php' method='post' name='form' id='form'>\n"; |
|
112 | + if(!$hide_clear_button) |
|
113 | + { |
|
114 | + $button .= "<input type='button' name='button' class='button' onclick=\"send_back('','');\" title='" |
|
115 | + .$app_strings['LBL_CLEAR_BUTTON_TITLE']."' value=' " |
|
116 | + .$app_strings['LBL_CLEAR_BUTTON_LABEL']." ' />\n"; |
|
117 | + } |
|
118 | + $button .= "<input type='submit' name='button' class='button' onclick=\"window.close();\" title='" |
|
119 | + .$app_strings['LBL_CANCEL_BUTTON_TITLE']."' value=' " |
|
120 | + .$app_strings['LBL_CANCEL_BUTTON_LABEL']." ' />\n"; |
|
121 | + $button .= "</form>\n"; |
|
122 | + |
|
123 | + $form = new XTemplate('modules/ACLRoles/Popup_picker.html'); |
|
124 | + $form->assign('MOD', $mod_strings); |
|
125 | + $form->assign('APP', $app_strings); |
|
126 | + $form->assign('MODULE_NAME', $currentModule); |
|
127 | + $form->assign('NAME', $name); |
|
128 | + $form->assign('request_data', $request_data); |
|
129 | + |
|
130 | + ob_start(); |
|
131 | + insert_popup_header(); |
|
132 | + $output_html .= ob_get_contents(); |
|
133 | + ob_end_clean(); |
|
134 | + |
|
135 | + $output_html .= get_form_header($mod_strings['LBL_SEARCH_FORM_TITLE'], '', false); |
|
136 | + |
|
137 | + $form->parse('main.SearchHeader'); |
|
138 | + $output_html .= $form->text('main.SearchHeader'); |
|
139 | + |
|
140 | + // Reset the sections that are already in the page so that they do not print again later. |
|
141 | + $form->reset('main.SearchHeader'); |
|
142 | + |
|
143 | + // create the listview |
|
144 | + $seed_bean = new ACLRole(); |
|
145 | + $ListView = new ListView(); |
|
146 | + $ListView->show_export_button = false; |
|
147 | + $ListView->process_for_popups = true; |
|
148 | + $ListView->setXTemplate($form); |
|
149 | + $ListView->setHeaderTitle($mod_strings['LBL_ROLE']); |
|
150 | + $ListView->setHeaderText($button); |
|
151 | + $ListView->setQuery($where, '', 'name', 'ROLE'); |
|
152 | + $ListView->setModStrings($mod_strings); |
|
153 | + |
|
154 | + ob_start(); |
|
155 | + $ListView->processListView($seed_bean, 'main', 'ROLE'); |
|
156 | + $output_html .= ob_get_contents(); |
|
157 | + ob_end_clean(); |
|
158 | + |
|
159 | + $output_html .= insert_popup_footer(); |
|
160 | + return $output_html; |
|
161 | + } |
|
162 | 162 | } // end of class Popup_Picker |
163 | 163 | ?> |
164 | 164 | \ No newline at end of file |