@@ -1,5 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if(!defined('sugarEntry') || !sugarEntry) { |
|
3 | + die('Not A Valid Entry Point'); |
|
4 | +} |
|
3 | 5 | /********************************************************************************* |
4 | 6 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 7 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -122,16 +124,19 @@ discard block |
||
122 | 124 | */ |
123 | 125 | function buildFieldsToLayouts () |
124 | 126 | { |
125 | - if ($this->relationship_only) |
|
126 | - return array () ; |
|
127 | + if ($this->relationship_only) { |
|
128 | + return array () ; |
|
129 | + } |
|
127 | 130 | |
128 | - if ($this->lhs_module == $this->rhs_module) // don't add in two fields on recursive relationships |
|
131 | + if ($this->lhs_module == $this->rhs_module) { |
|
132 | + // don't add in two fields on recursive relationships |
|
129 | 133 | return array ( $this->lhs_module => $this->getValidDBName($this->relationship_name . "_name") ); |
130 | - else |
|
131 | - return array ( |
|
134 | + } else { |
|
135 | + return array ( |
|
132 | 136 | $this->lhs_module => $this->getValidDBName($this->relationship_name . "_name") , |
133 | 137 | $this->rhs_module => $this->getValidDBName($this->relationship_name . "_name") |
134 | 138 | ) ; |
139 | + } |
|
135 | 140 | } |
136 | 141 | |
137 | 142 | } |
@@ -1,5 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if(!defined('sugarEntry') || !sugarEntry) { |
|
3 | + die('Not A Valid Entry Point'); |
|
4 | +} |
|
3 | 5 | /********************************************************************************* |
4 | 6 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 7 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -107,9 +109,10 @@ discard block |
||
107 | 109 | function __construct ($definition) |
108 | 110 | { |
109 | 111 | // set any undefined attributes to the default value |
110 | - foreach ( array ( 'readonly' , 'deleted' , 'relationship_only', 'for_activities', 'is_custom', 'from_studio' ) as $key ) |
|
111 | - if (! isset ( $definition [ $key ] )) |
|
112 | + foreach ( array ( 'readonly' , 'deleted' , 'relationship_only', 'for_activities', 'is_custom', 'from_studio' ) as $key ) { |
|
113 | + if (! isset ( $definition [ $key ] )) |
|
112 | 114 | $definition [ $key ] = false ; |
115 | + } |
|
113 | 116 | |
114 | 117 | foreach ( self::$definitionKeys as $key ) |
115 | 118 | { |
@@ -297,8 +300,9 @@ discard block |
||
297 | 300 | */ |
298 | 301 | protected function getSubpanelDefinition ($relationshipName , $sourceModule , $subpanelName, $titleKeyName = '', $source = "") |
299 | 302 | { |
300 | - if (empty($source)) |
|
301 | - $source = $this->getValidDBName($relationshipName); |
|
303 | + if (empty($source)) { |
|
304 | + $source = $this->getValidDBName($relationshipName); |
|
305 | + } |
|
302 | 306 | $subpanelDefinition = array ( ) ; |
303 | 307 | $subpanelDefinition [ 'order' ] = 100 ; |
304 | 308 | $subpanelDefinition [ 'module' ] = $sourceModule ; |
@@ -308,7 +312,7 @@ discard block |
||
308 | 312 | $subpanelDefinition [ 'sort_by' ] = 'id' ; |
309 | 313 | if(!empty($titleKeyName)){ |
310 | 314 | $subpanelDefinition [ 'title_key' ] = 'LBL_' . strtoupper ( $relationshipName . '_FROM_' . $titleKeyName ) . '_TITLE' ; |
311 | - }else{ |
|
315 | + } else{ |
|
312 | 316 | $subpanelDefinition [ 'title_key' ] = 'LBL_' . strtoupper ( $relationshipName . '_FROM_' . $sourceModule ) . '_TITLE' ; |
313 | 317 | } |
314 | 318 | $subpanelDefinition [ 'get_subpanel_data' ] = $source ; |
@@ -338,12 +342,15 @@ discard block |
||
338 | 342 | $vardef [ 'source' ] = 'non-db' ; |
339 | 343 | $vardef [ 'module' ] = $sourceModule ; |
340 | 344 | $vardef [ 'bean_name' ] = BeanFactory::getObjectName($sourceModule) ; |
341 | - if ($right_side) |
|
342 | - $vardef [ 'side' ] = 'right' ; |
|
343 | - if (!empty($vname)) |
|
344 | - $vardef [ 'vname' ] = $vname; |
|
345 | - if (!empty($id_name)) |
|
346 | - $vardef['id_name'] = $id_name; |
|
345 | + if ($right_side) { |
|
346 | + $vardef [ 'side' ] = 'right' ; |
|
347 | + } |
|
348 | + if (!empty($vname)) { |
|
349 | + $vardef [ 'vname' ] = $vname; |
|
350 | + } |
|
351 | + if (!empty($id_name)) { |
|
352 | + $vardef['id_name'] = $id_name; |
|
353 | + } |
|
347 | 354 | |
348 | 355 | return $vardef ; |
349 | 356 | } |
@@ -365,12 +372,14 @@ discard block |
||
365 | 372 | $vardef [ 'relationship' ] = $relationshipName ; |
366 | 373 | $vardef [ 'source' ] = 'non-db' ; |
367 | 374 | $vardef ['reportable'] = false; |
368 | - if ($right_side) |
|
369 | - $vardef [ 'side' ] = 'right' ; |
|
370 | - else |
|
371 | - $vardef [ 'side' ] = 'left' ; |
|
372 | - if (!empty($vname)) |
|
373 | - $vardef [ 'vname' ] = $vname; |
|
375 | + if ($right_side) { |
|
376 | + $vardef [ 'side' ] = 'right' ; |
|
377 | + } else { |
|
378 | + $vardef [ 'side' ] = 'left' ; |
|
379 | + } |
|
380 | + if (!empty($vname)) { |
|
381 | + $vardef [ 'vname' ] = $vname; |
|
382 | + } |
|
374 | 383 | |
375 | 384 | return $vardef ; |
376 | 385 | } |
@@ -391,7 +400,7 @@ discard block |
||
391 | 400 | $vardef [ 'source' ] = 'non-db' ; |
392 | 401 | if(!empty($vnameLabel)){ |
393 | 402 | $vardef [ 'vname' ] = 'LBL_' . strtoupper ( $relationshipName . '_FROM_' . $vnameLabel ) . '_TITLE' ; |
394 | - }else{ |
|
403 | + } else{ |
|
395 | 404 | $vardef [ 'vname' ] = 'LBL_' . strtoupper ( $relationshipName . '_FROM_' . $sourceModule ) . '_TITLE' ; |
396 | 405 | } |
397 | 406 | |
@@ -420,11 +429,10 @@ discard block |
||
420 | 429 | $module = $mb->getPackageModule ( $parsedModuleName['packageName'] , $parsedModuleName['moduleName'] ) ; |
421 | 430 | if (in_array( 'file' , array_keys ( $module->config [ 'templates' ] ) ) ){ |
422 | 431 | $vardef [ 'rname' ] = 'document_name' ; |
423 | - }elseif(in_array ( 'person' , array_keys ( $module->config [ 'templates' ] ) ) ){ |
|
432 | + } elseif(in_array ( 'person' , array_keys ( $module->config [ 'templates' ] ) ) ){ |
|
424 | 433 | $vardef [ 'db_concat_fields' ] = array( 0 =>'first_name', 1 =>'last_name') ; |
425 | 434 | } |
426 | - } |
|
427 | - else |
|
435 | + } else |
|
428 | 436 | { |
429 | 437 | switch ( strtolower( $sourceModule ) ) |
430 | 438 | { |
@@ -452,7 +460,7 @@ discard block |
||
452 | 460 | if ( isset ( $GLOBALS [ 'dictionary' ] [ $object ] [ 'templates'] )){ |
453 | 461 | if(in_array ( 'file' , $GLOBALS [ 'dictionary' ] [ $object ] [ 'templates'] )){ |
454 | 462 | $vardef [ 'rname' ] = 'document_name' ; |
455 | - }elseif(in_array ( 'person' , $GLOBALS [ 'dictionary' ] [ $object ] [ 'templates'] )){ |
|
463 | + } elseif(in_array ( 'person' , $GLOBALS [ 'dictionary' ] [ $object ] [ 'templates'] )){ |
|
456 | 464 | $vardef [ 'db_concat_fields' ] = array( 0 =>'first_name', 1 =>'last_name') ; |
457 | 465 | } |
458 | 466 | } |
@@ -513,8 +521,9 @@ discard block |
||
513 | 521 | // but as we need to display the true cardinality in Studio and ModuleBuilder we also record the actual relationship type |
514 | 522 | // this property is only used by Studio/MB |
515 | 523 | $properties [ 'true_relationship_type' ] = $relationshipType ; |
516 | - if ($this->from_studio) |
|
517 | - $properties [ 'from_studio' ] = true; |
|
524 | + if ($this->from_studio) { |
|
525 | + $properties [ 'from_studio' ] = true; |
|
526 | + } |
|
518 | 527 | |
519 | 528 | $rel_properties [ 'join_table' ] = $this->getValidDBName ( $relationshipName."_c" ) ; |
520 | 529 | // a and b are in case the module relates to itself |
@@ -525,8 +534,9 @@ discard block |
||
525 | 534 | // set the extended properties if they exist = for now, many-to-many definitions do not have to contain a role_column even if role_column_value is set; we'll just create a likely name if missing |
526 | 535 | if (isset ( $this->definition [ 'relationship_role_column_value' ] )) |
527 | 536 | { |
528 | - if (! isset ( $this->definition [ 'relationship_role_column' ] )) |
|
529 | - $this->definition [ 'relationship_role_column' ] = 'relationship_role_column' ; |
|
537 | + if (! isset ( $this->definition [ 'relationship_role_column' ] )) { |
|
538 | + $this->definition [ 'relationship_role_column' ] = 'relationship_role_column' ; |
|
539 | + } |
|
530 | 540 | $rel_properties [ 'relationship_role_column' ] = $this->definition [ 'relationship_role_column' ] ; |
531 | 541 | $rel_properties [ 'relationship_role_column_value' ] = $this->definition [ 'relationship_role_column_value' ] ; |
532 | 542 | } |
@@ -575,8 +585,10 @@ discard block |
||
575 | 585 | $alternateKeys = array ( $rel_properties [ 'join_key_lhs' ] , $rel_properties [ 'join_key_rhs' ] ) ; |
576 | 586 | } |
577 | 587 | |
578 | - if (count($alternateKeys)>0) |
|
579 | - $properties [ 'indices' ] [] = array ( 'name' => $indexBase . '_alt' , 'type' => 'alternate_key' , 'fields' => $alternateKeys ) ; // type must be set to alternate_key for Link.php to correctly update an existing record rather than inserting a copy - it uses the fields in this array as the keys to check if a duplicate record already exists |
|
588 | + if (count($alternateKeys)>0) { |
|
589 | + $properties [ 'indices' ] [] = array ( 'name' => $indexBase . '_alt' , 'type' => 'alternate_key' , 'fields' => $alternateKeys ) ; |
|
590 | + } |
|
591 | + // type must be set to alternate_key for Link.php to correctly update an existing record rather than inserting a copy - it uses the fields in this array as the keys to check if a duplicate record already exists |
|
580 | 592 | |
581 | 593 | return $properties ; |
582 | 594 | } |
@@ -623,8 +635,9 @@ discard block |
||
623 | 635 | $canonicalTypes = array ( ) ; |
624 | 636 | foreach ( array ( MB_ONETOONE , MB_ONETOMANY , MB_MANYTOMANY , MB_MANYTOONE) as $canonicalType ) |
625 | 637 | { |
626 | - if ($type == preg_replace ( '/[^\w]+/i', '', strtolower ( $canonicalType ) )) |
|
627 | - return $canonicalType ; |
|
638 | + if ($type == preg_replace ( '/[^\w]+/i', '', strtolower ( $canonicalType ) )) { |
|
639 | + return $canonicalType ; |
|
640 | + } |
|
628 | 641 | } |
629 | 642 | // ok, we give up... |
630 | 643 | return MB_MANYTOMANY ; |
@@ -633,16 +646,18 @@ discard block |
||
633 | 646 | |
634 | 647 | function getJoinKeyLHS() |
635 | 648 | { |
636 | - if (!isset($this->joinKeyLHS)) |
|
637 | - $this->joinKeyLHS = $this->getValidDBName ( $this->relationship_name . $this->lhs_module . "_ida" , true) ; |
|
649 | + if (!isset($this->joinKeyLHS)) { |
|
650 | + $this->joinKeyLHS = $this->getValidDBName ( $this->relationship_name . $this->lhs_module . "_ida" , true) ; |
|
651 | + } |
|
638 | 652 | |
639 | 653 | return $this->joinKeyLHS; |
640 | 654 | } |
641 | 655 | |
642 | 656 | function getJoinKeyRHS() |
643 | 657 | { |
644 | - if (!isset($this->joinKeyRHS)) |
|
645 | - $this->joinKeyRHS = $this->getValidDBName ( $this->relationship_name . $this->rhs_module . "_idb" , true) ; |
|
658 | + if (!isset($this->joinKeyRHS)) { |
|
659 | + $this->joinKeyRHS = $this->getValidDBName ( $this->relationship_name . $this->rhs_module . "_idb" , true) ; |
|
660 | + } |
|
646 | 661 | |
647 | 662 | return $this->joinKeyRHS; |
648 | 663 | } |
@@ -679,7 +694,7 @@ discard block |
||
679 | 694 | if(isset($layout_defs[$this->rhs_module]['subpanel_setup'][strtolower($this->lhs_module)]['title_key'])){ |
680 | 695 | return $layout_defs[$this->rhs_module]['subpanel_setup'][strtolower($this->lhs_module)]['title_key']; |
681 | 696 | } |
682 | - }else if(!$this->is_custom && file_exists("modules/{$this->lhs_module}/metadata/subpaneldefs.php")){ |
|
697 | + } else if(!$this->is_custom && file_exists("modules/{$this->lhs_module}/metadata/subpaneldefs.php")){ |
|
683 | 698 | include("modules/{$this->lhs_module}/metadata/subpaneldefs.php"); |
684 | 699 | if(isset($layout_defs[$this->lhs_module]['subpanel_setup'][strtolower($this->rhs_module)]['title_key'])){ |
685 | 700 | return $layout_defs[$this->lhs_module]['subpanel_setup'][strtolower($this->rhs_module)]['title_key']; |
@@ -689,14 +704,14 @@ discard block |
||
689 | 704 | if($left){ |
690 | 705 | $titleKeyName = $this->getRightModuleSystemLabel(); |
691 | 706 | $sourceModule = $this->rhs_module; |
692 | - }else{ |
|
707 | + } else{ |
|
693 | 708 | $titleKeyName = $this->getLeftModuleSystemLabel(); |
694 | 709 | $sourceModule = $this->lhs_module; |
695 | 710 | } |
696 | 711 | |
697 | 712 | if(!empty($titleKeyName)){ |
698 | 713 | $title_key = 'LBL_' . strtoupper ( $this->relationship_name . '_FROM_' . $titleKeyName ) . '_TITLE' ; |
699 | - }else{ |
|
714 | + } else{ |
|
700 | 715 | $title_key = 'LBL_' . strtoupper ( $this->relationship_name . '_FROM_' . $sourceModule ) . '_TITLE' ; |
701 | 716 | } |
702 | 717 |
@@ -1,6 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -if (! defined ( 'sugarEntry' ) || ! sugarEntry) |
|
2 | +if (! defined ( 'sugarEntry' ) || ! sugarEntry) { |
|
3 | 3 | die ( 'Not A Valid Entry Point' ) ; |
4 | +} |
|
4 | 5 | |
5 | 6 | /********************************************************************************* |
6 | 7 | * SugarCRM Community Edition is a customer relationship management program developed by |
@@ -97,8 +98,9 @@ discard block |
||
97 | 98 | while ( list( $moduleName , $module ) = each($browser->modules) ) |
98 | 99 | { |
99 | 100 | // do not include the submodules of Activities as already have the parent... |
100 | - if (! $includeActivitiesSubmodules && in_array ( $module->module, self::$activities )) |
|
101 | - continue ; |
|
101 | + if (! $includeActivitiesSubmodules && in_array ( $module->module, self::$activities )) { |
|
102 | + continue ; |
|
103 | + } |
|
102 | 104 | $providedSubpanels = $module->getProvidedSubpanels(); |
103 | 105 | if ( $providedSubpanels !== false ) { |
104 | 106 | $relatableModules [ $module->module ] = $providedSubpanels; |
@@ -111,8 +113,9 @@ discard block |
||
111 | 113 | |
112 | 114 | static function validSubpanel ($filename) |
113 | 115 | { |
114 | - if (! file_exists ( $filename )) |
|
115 | - return false ; |
|
116 | + if (! file_exists ( $filename )) { |
|
117 | + return false ; |
|
118 | + } |
|
116 | 119 | |
117 | 120 | include $filename ; |
118 | 121 | return (isset ( $subpanel_layout ) && (isset ( $subpanel_layout [ 'top_buttons' ] ) && isset ( $subpanel_layout [ 'list_fields' ] ))) ; |
@@ -127,8 +130,9 @@ discard block |
||
127 | 130 | $list = array ( ) ; |
128 | 131 | foreach ( $this->relationships as $name => $relationship ) |
129 | 132 | { |
130 | - if (! $relationship->deleted ()) |
|
131 | - $list [ $name ] = $name ; |
|
133 | + if (! $relationship->deleted ()) { |
|
134 | + $list [ $name ] = $name ; |
|
135 | + } |
|
132 | 136 | } |
133 | 137 | return $list ; |
134 | 138 | } |
@@ -172,8 +176,9 @@ discard block |
||
172 | 176 | if ($relationship = $this->get ( $_REQUEST [ 'relationship_name' ] )) |
173 | 177 | { |
174 | 178 | unset( $definition[ 'relationship_name' ] ) ; // in case the related modules have changed; this name is probably no longer appropriate |
175 | - if (! $relationship->readonly ()) |
|
176 | - $this->delete ( $_REQUEST [ 'relationship_name' ] ) ; |
|
179 | + if (! $relationship->readonly ()) { |
|
180 | + $this->delete ( $_REQUEST [ 'relationship_name' ] ) ; |
|
181 | + } |
|
177 | 182 | } |
178 | 183 | } |
179 | 184 | |
@@ -298,8 +303,7 @@ discard block |
||
298 | 303 | { |
299 | 304 | $name = $basename . '_1' ; |
300 | 305 | $suffix = 2 ; |
301 | - } |
|
302 | - else |
|
306 | + } else |
|
303 | 307 | { |
304 | 308 | $name = $basename ; |
305 | 309 | $suffix = 1 ; |
@@ -351,9 +355,11 @@ discard block |
||
351 | 355 | { |
352 | 356 | $metadata = $relationship->$buildMethod () ; |
353 | 357 | |
354 | - if (count ( $metadata ) > 0) // don't clutter up the filesystem with empty files... |
|
358 | + if (count ( $metadata ) > 0) { |
|
359 | + // don't clutter up the filesystem with empty files... |
|
355 | 360 | { |
356 | 361 | $GLOBALS [ 'log' ]->debug ( get_class ( $this ) . ": BUILD is running METHOD $saveMethod" ) ; |
362 | + } |
|
357 | 363 | $installDef = $this->$saveMethod ( $basepath, $installDefPrefix, $name, $metadata ) ; |
358 | 364 | |
359 | 365 | // some save methods (e.g., saveRelateFieldDefinition) handle the installDefs internally and so return null |
@@ -406,8 +412,9 @@ discard block |
||
406 | 412 | |
407 | 413 | $filename = "{$basepath}/language/{$definition['module']}.php" ; |
408 | 414 | |
409 | - if (file_exists ( $filename )) |
|
410 | - include ($filename); |
|
415 | + if (file_exists ( $filename )) { |
|
416 | + include ($filename); |
|
417 | + } |
|
411 | 418 | |
412 | 419 | |
413 | 420 | //Check for app strings |
@@ -415,12 +422,14 @@ discard block |
||
415 | 422 | . print_r ( $definition, true ) ) ; |
416 | 423 | if ($definition['module'] == 'application') { |
417 | 424 | $app_list_strings[$definition [ 'system_label' ]] = $definition [ 'display_label' ]; |
418 | - foreach ($app_list_strings as $key => $val) |
|
419 | - $out .= override_value_to_string_recursive2('app_list_strings', $key, $val); |
|
425 | + foreach ($app_list_strings as $key => $val) { |
|
426 | + $out .= override_value_to_string_recursive2('app_list_strings', $key, $val); |
|
427 | + } |
|
420 | 428 | } else { |
421 | 429 | $mod_strings[ $definition [ 'system_label' ]] = $definition [ 'display_label' ]; |
422 | - foreach ($mod_strings as $key => $val) |
|
423 | - $out .= override_value_to_string_recursive2('mod_strings', $key, $val); |
|
430 | + foreach ($mod_strings as $key => $val) { |
|
431 | + $out .= override_value_to_string_recursive2('mod_strings', $key, $val); |
|
432 | + } |
|
424 | 433 | } |
425 | 434 | |
426 | 435 | $fh = fopen ( $filename, 'w' ) ; |
@@ -1,6 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -if (! defined ( 'sugarEntry' ) || ! sugarEntry) |
|
2 | +if (! defined ( 'sugarEntry' ) || ! sugarEntry) { |
|
3 | 3 | die ( 'Not A Valid Entry Point' ) ; |
4 | +} |
|
4 | 5 | /********************************************************************************* |
5 | 6 | * SugarCRM Community Edition is a customer relationship management program developed by |
6 | 7 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -270,8 +271,7 @@ discard block |
||
270 | 271 | $module->setAppListStrings ( 'en_us', $appStrings ) ; |
271 | 272 | $module->save () ; |
272 | 273 | |
273 | - } |
|
274 | - else |
|
274 | + } else |
|
275 | 275 | { |
276 | 276 | //Bug42170================================ |
277 | 277 | $appStrings = $module->getAppListStrings () ; |
@@ -333,8 +333,9 @@ discard block |
||
333 | 333 | $appStrings = $module->getAppListStrings () ; |
334 | 334 | foreach(getTypeDisplayList() as $key) |
335 | 335 | { |
336 | - if (isset($appStrings[$key][ $module->key_name ])) |
|
337 | - unset($appStrings[$key][ $module->key_name ]); |
|
336 | + if (isset($appStrings[$key][ $module->key_name ])) { |
|
337 | + unset($appStrings[$key][ $module->key_name ]); |
|
338 | + } |
|
338 | 339 | } |
339 | 340 | $module->setAppListStrings ( 'en_us', $appStrings ) ; |
340 | 341 | $module->save () ; |
@@ -351,8 +352,9 @@ discard block |
||
351 | 352 | { |
352 | 353 | |
353 | 354 | // many-to-many relationships don't have fields so if we have a many-to-many we can just skip this... |
354 | - if ($relationship->getType () == MB_MANYTOMANY) |
|
355 | - return false ; |
|
355 | + if ($relationship->getType () == MB_MANYTOMANY) { |
|
356 | + return false ; |
|
357 | + } |
|
356 | 358 | |
357 | 359 | $successful = true ; |
358 | 360 | $layoutAdditions = $relationship->buildFieldsToLayouts () ; |
@@ -371,8 +373,7 @@ discard block |
||
371 | 373 | if (($actionAdd) ? $parser->addField ( array ( 'name' => $fieldName ) ) : $parser->removeField ( $fieldName )) |
372 | 374 | { |
373 | 375 | $parser->handleSave ( false ) ; |
374 | - } |
|
375 | - else |
|
376 | + } else |
|
376 | 377 | { |
377 | 378 | $GLOBALS [ 'log' ]->debug ( get_class ( $this ) . ": couldn't " . (($actionAdd) ? "add" : "remove") . " $fieldName on $view layout for undeployed module $deployedModuleName" ) ; |
378 | 379 | $successful = false ; |
@@ -1,6 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -if (! defined ( 'sugarEntry' ) || ! sugarEntry) |
|
2 | +if (! defined ( 'sugarEntry' ) || ! sugarEntry) { |
|
3 | 3 | die ( 'Not A Valid Entry Point' ) ; |
4 | +} |
|
4 | 5 | /********************************************************************************* |
5 | 6 | * SugarCRM Community Edition is a customer relationship management program developed by |
6 | 7 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -243,8 +244,9 @@ discard block |
||
243 | 244 | |
244 | 245 | foreach ( $module->field_defs as $field ) |
245 | 246 | { |
246 | - if ($field [ 'type' ] == 'relate' && isset ( $field [ 'module' ] ) && $field [ 'module' ] == $sourceModuleName) |
|
247 | - return $field [ 'name' ] ; |
|
247 | + if ($field [ 'type' ] == 'relate' && isset ( $field [ 'module' ] ) && $field [ 'module' ] == $sourceModuleName) { |
|
248 | + return $field [ 'name' ] ; |
|
249 | + } |
|
248 | 250 | } |
249 | 251 | return null ; |
250 | 252 | } |
@@ -389,10 +391,11 @@ discard block |
||
389 | 391 | |
390 | 392 | foreach ( $layoutAdditions as $deployedModuleName => $fieldName ) |
391 | 393 | { |
392 | - if (! in_array ( strtolower ( $deployedModuleName ), $invalidModules )) |
|
393 | - foreach ( array ( MB_EDITVIEW , MB_DETAILVIEW ) as $view ) |
|
394 | + if (! in_array ( strtolower ( $deployedModuleName ), $invalidModules )) { |
|
395 | + foreach ( array ( MB_EDITVIEW , MB_DETAILVIEW ) as $view ) |
|
394 | 396 | { |
395 | 397 | $GLOBALS [ 'log' ]->info ( get_class ( $this ) . ": adding $fieldName to $view layout for module $deployedModuleName" ) ; |
398 | + } |
|
396 | 399 | $parser = new GridLayoutMetaDataParser ( $view, $deployedModuleName ) ; |
397 | 400 | $parser->addField ( array ( 'name' => $fieldName ) ) ; |
398 | 401 | $parser->handleSave ( false ) ; |
@@ -411,8 +414,9 @@ discard block |
||
411 | 414 | { |
412 | 415 | |
413 | 416 | // many-to-many relationships don't have fields so if we have a many-to-many we can just skip this... |
414 | - if ($relationship->getType () == MB_MANYTOMANY) |
|
415 | - return false ; |
|
417 | + if ($relationship->getType () == MB_MANYTOMANY) { |
|
418 | + return false ; |
|
419 | + } |
|
416 | 420 | |
417 | 421 | $successful = true ; |
418 | 422 | $layoutAdditions = $relationship->buildFieldsToLayouts () ; |
@@ -1,5 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if(!defined('sugarEntry') || !sugarEntry) { |
|
3 | + die('Not A Valid Entry Point'); |
|
4 | +} |
|
3 | 5 | /********************************************************************************* |
4 | 6 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 7 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -51,8 +53,9 @@ discard block |
||
51 | 53 | static function newRelationship ($definition = array()) |
52 | 54 | { |
53 | 55 | // handle the case where a relationship_type is not provided - set it to Many-To-Many as this was the usual type in ModuleBuilder |
54 | - if (! isset ( $definition [ 'relationship_type' ] )) |
|
55 | - $definition [ 'relationship_type' ] = MB_MANYTOMANY ; |
|
56 | + if (! isset ( $definition [ 'relationship_type' ] )) { |
|
57 | + $definition [ 'relationship_type' ] = MB_MANYTOMANY ; |
|
58 | + } |
|
56 | 59 | |
57 | 60 | if (!empty ($definition['for_activities']) && $definition['for_activities'] == true) { |
58 | 61 | require_once 'modules/ModuleBuilder/parsers/relationships/ActivitiesRelationship.php'; |
@@ -1,5 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if(!defined('sugarEntry') || !sugarEntry) { |
|
3 | + die('Not A Valid Entry Point'); |
|
4 | +} |
|
3 | 5 | /********************************************************************************* |
4 | 6 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 7 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -93,8 +95,9 @@ discard block |
||
93 | 95 | */ |
94 | 96 | function buildSubpanelDefinitions () |
95 | 97 | { |
96 | - if ($this->relationship_only) |
|
97 | - return array () ; |
|
98 | + if ($this->relationship_only) { |
|
99 | + return array () ; |
|
100 | + } |
|
98 | 101 | |
99 | 102 | $source = ""; |
100 | 103 | if ($this->rhs_module == $this->lhs_module) |
@@ -142,8 +145,9 @@ discard block |
||
142 | 145 | */ |
143 | 146 | function buildFieldsToLayouts () |
144 | 147 | { |
145 | - if ($this->relationship_only) |
|
146 | - return array () ; |
|
148 | + if ($this->relationship_only) { |
|
149 | + return array () ; |
|
150 | + } |
|
147 | 151 | |
148 | 152 | return array( $this->rhs_module =>$this->getValidDBName($this->relationship_name . "_name")); // this must match the name of the relate field from buildVardefs |
149 | 153 | } |
@@ -1,5 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if(!defined('sugarEntry') || !sugarEntry) { |
|
3 | + die('Not A Valid Entry Point'); |
|
4 | +} |
|
3 | 5 | /********************************************************************************* |
4 | 6 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 7 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -113,8 +115,9 @@ discard block |
||
113 | 115 | */ |
114 | 116 | function buildFieldsToLayouts () |
115 | 117 | { |
116 | - if ($this->relationship_only) |
|
117 | - return array () ; |
|
118 | + if ($this->relationship_only) { |
|
119 | + return array () ; |
|
120 | + } |
|
118 | 121 | |
119 | 122 | return array( $this->lhs_module => $this->getValidDBName($this->relationship_name . "_name") ) ; // this must match the name of the relate field from buildVardefs |
120 | 123 | } |
@@ -1,5 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if(!defined('sugarEntry') || !sugarEntry) { |
|
3 | + die('Not A Valid Entry Point'); |
|
4 | +} |
|
3 | 5 | /********************************************************************************* |
4 | 6 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 7 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -173,16 +175,18 @@ discard block |
||
173 | 175 | */ |
174 | 176 | function buildFieldsToLayouts () |
175 | 177 | { |
176 | - if ($this->relationship_only) |
|
177 | - return array () ; |
|
178 | + if ($this->relationship_only) { |
|
179 | + return array () ; |
|
180 | + } |
|
178 | 181 | |
179 | 182 | return array( $this->rhs_module => $this->relationship_name . "_name" ) ; // this must match the name of the relate field from buildVardefs |
180 | 183 | } |
181 | 184 | |
182 | 185 | function buildSubpanelDefinitions () |
183 | 186 | { |
184 | - if ($this->relationship_only || isset(ActivitiesRelationship::$subpanelsAdded[$this->lhs_module])) |
|
185 | - return array () ; |
|
187 | + if ($this->relationship_only || isset(ActivitiesRelationship::$subpanelsAdded[$this->lhs_module])) { |
|
188 | + return array () ; |
|
189 | + } |
|
186 | 190 | |
187 | 191 | ActivitiesRelationship::$subpanelsAdded[$this->lhs_module] = true; |
188 | 192 | $relationshipName = substr($this->relationship_name, 0, strrpos($this->relationship_name, '_')); |