@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | public static $definitionKeys = array ( |
60 | 60 | // atttributes of this relationship - here in the definition so they are preserved across saves and loads |
61 | 61 | 'for_activities', |
62 | - 'is_custom', |
|
62 | + 'is_custom', |
|
63 | 63 | 'from_studio', |
64 | 64 | 'readonly' , // a readonly relationship cannot be Built by subclasses of AbstractRelationships |
65 | 65 | 'deleted' , // a deleted relationship will not be built, and if it had been built previously the built relationship will be removed |
@@ -221,48 +221,48 @@ discard block |
||
221 | 221 | $labelDefinitions = array ( ) ; |
222 | 222 | if (!$this->relationship_only) |
223 | 223 | { |
224 | - if(!$this->is_custom && $update && file_exists("modules/{$this->rhs_module}/metadata/subpaneldefs.php")){ |
|
225 | - include("modules/{$this->rhs_module}/metadata/subpaneldefs.php"); |
|
226 | - if(isset($layout_defs[$this->rhs_module]['subpanel_setup'][strtolower($this->lhs_module)]['title_key'])){ |
|
227 | - $rightSysLabel = $layout_defs[$this->rhs_module]['subpanel_setup'][strtolower($this->lhs_module)]['title_key']; |
|
228 | - } |
|
229 | - $layout_defs = array(); |
|
230 | - } |
|
231 | - if(!$this->is_custom && $update && file_exists("modules/{$this->lhs_module}/metadata/subpaneldefs.php")){ |
|
232 | - include("modules/{$this->lhs_module}/metadata/subpaneldefs.php"); |
|
233 | - if(isset($layout_defs[$this->lhs_module]['subpanel_setup'][strtolower($this->rhs_module)]['title_key'])){ |
|
234 | - $leftSysLabel = $layout_defs[$this->lhs_module]['subpanel_setup'][strtolower($this->rhs_module)]['title_key']; |
|
235 | - } |
|
236 | - $layout_defs = array(); |
|
237 | - } |
|
238 | - $labelDefinitions [] = array ( |
|
239 | - 'module' => $this->rhs_module , |
|
240 | - 'system_label' => isset($rightSysLabel)?$rightSysLabel : 'LBL_' . strtoupper ( $this->relationship_name . '_FROM_' . $this->getLeftModuleSystemLabel() ) . '_TITLE' , |
|
241 | - 'display_label' => ($update && !empty($_REQUEST [ 'lhs_label' ] ))?$_REQUEST [ 'lhs_label' ] :(empty($this->lhs_label) ? translate ( $this->lhs_module ) : $this->lhs_label), |
|
242 | - ) ; |
|
224 | + if(!$this->is_custom && $update && file_exists("modules/{$this->rhs_module}/metadata/subpaneldefs.php")){ |
|
225 | + include("modules/{$this->rhs_module}/metadata/subpaneldefs.php"); |
|
226 | + if(isset($layout_defs[$this->rhs_module]['subpanel_setup'][strtolower($this->lhs_module)]['title_key'])){ |
|
227 | + $rightSysLabel = $layout_defs[$this->rhs_module]['subpanel_setup'][strtolower($this->lhs_module)]['title_key']; |
|
228 | + } |
|
229 | + $layout_defs = array(); |
|
230 | + } |
|
231 | + if(!$this->is_custom && $update && file_exists("modules/{$this->lhs_module}/metadata/subpaneldefs.php")){ |
|
232 | + include("modules/{$this->lhs_module}/metadata/subpaneldefs.php"); |
|
233 | + if(isset($layout_defs[$this->lhs_module]['subpanel_setup'][strtolower($this->rhs_module)]['title_key'])){ |
|
234 | + $leftSysLabel = $layout_defs[$this->lhs_module]['subpanel_setup'][strtolower($this->rhs_module)]['title_key']; |
|
235 | + } |
|
236 | + $layout_defs = array(); |
|
237 | + } |
|
238 | + $labelDefinitions [] = array ( |
|
239 | + 'module' => $this->rhs_module , |
|
240 | + 'system_label' => isset($rightSysLabel)?$rightSysLabel : 'LBL_' . strtoupper ( $this->relationship_name . '_FROM_' . $this->getLeftModuleSystemLabel() ) . '_TITLE' , |
|
241 | + 'display_label' => ($update && !empty($_REQUEST [ 'lhs_label' ] ))?$_REQUEST [ 'lhs_label' ] :(empty($this->lhs_label) ? translate ( $this->lhs_module ) : $this->lhs_label), |
|
242 | + ) ; |
|
243 | 243 | $labelDefinitions [] = array ( |
244 | - 'module' => $this->lhs_module , |
|
245 | - 'system_label' => isset($leftSysLabel)?$leftSysLabel :'LBL_' . strtoupper ( $this->relationship_name . '_FROM_' . $this->getRightModuleSystemLabel() ) . '_TITLE' , |
|
246 | - 'display_label' => ($update && !empty($_REQUEST [ 'rhs_label' ] ))?$_REQUEST [ 'rhs_label' ] :(empty($this->rhs_label) ? translate ( $this->rhs_module ) : $this->rhs_label), |
|
244 | + 'module' => $this->lhs_module , |
|
245 | + 'system_label' => isset($leftSysLabel)?$leftSysLabel :'LBL_' . strtoupper ( $this->relationship_name . '_FROM_' . $this->getRightModuleSystemLabel() ) . '_TITLE' , |
|
246 | + 'display_label' => ($update && !empty($_REQUEST [ 'rhs_label' ] ))?$_REQUEST [ 'rhs_label' ] :(empty($this->rhs_label) ? translate ( $this->rhs_module ) : $this->rhs_label), |
|
247 | 247 | ) ; |
248 | 248 | } |
249 | 249 | return $labelDefinitions ; |
250 | 250 | } |
251 | 251 | |
252 | - function getLeftModuleSystemLabel() |
|
252 | + function getLeftModuleSystemLabel() |
|
253 | 253 | { |
254 | - if($this->lhs_module == $this->rhs_module){ |
|
255 | - return $this->lhs_module.'_L'; |
|
256 | - } |
|
257 | - return $this->lhs_module; |
|
254 | + if($this->lhs_module == $this->rhs_module){ |
|
255 | + return $this->lhs_module.'_L'; |
|
256 | + } |
|
257 | + return $this->lhs_module; |
|
258 | 258 | } |
259 | 259 | |
260 | 260 | function getRightModuleSystemLabel() |
261 | 261 | { |
262 | - if($this->lhs_module == $this->rhs_module){ |
|
263 | - return $this->rhs_module.'_R'; |
|
264 | - } |
|
265 | - return $this->rhs_module; |
|
262 | + if($this->lhs_module == $this->rhs_module){ |
|
263 | + return $this->rhs_module.'_R'; |
|
264 | + } |
|
265 | + return $this->rhs_module; |
|
266 | 266 | } |
267 | 267 | |
268 | 268 | /** |
@@ -298,24 +298,24 @@ discard block |
||
298 | 298 | protected function getSubpanelDefinition ($relationshipName , $sourceModule , $subpanelName, $titleKeyName = '', $source = "") |
299 | 299 | { |
300 | 300 | if (empty($source)) |
301 | - $source = $this->getValidDBName($relationshipName); |
|
302 | - $subpanelDefinition = array ( ) ; |
|
301 | + $source = $this->getValidDBName($relationshipName); |
|
302 | + $subpanelDefinition = array ( ) ; |
|
303 | 303 | $subpanelDefinition [ 'order' ] = 100 ; |
304 | 304 | $subpanelDefinition [ 'module' ] = $sourceModule ; |
305 | 305 | $subpanelDefinition [ 'subpanel_name' ] = $subpanelName ; |
306 | 306 | // following two lines are required for the subpanel pagination code in ListView.php->processUnionBeans() to correctly determine the relevant field for sorting |
307 | 307 | $subpanelDefinition [ 'sort_order' ] = 'asc' ; |
308 | 308 | $subpanelDefinition [ 'sort_by' ] = 'id' ; |
309 | - if(!empty($titleKeyName)){ |
|
310 | - $subpanelDefinition [ 'title_key' ] = 'LBL_' . strtoupper ( $relationshipName . '_FROM_' . $titleKeyName ) . '_TITLE' ; |
|
311 | - }else{ |
|
312 | - $subpanelDefinition [ 'title_key' ] = 'LBL_' . strtoupper ( $relationshipName . '_FROM_' . $sourceModule ) . '_TITLE' ; |
|
313 | - } |
|
309 | + if(!empty($titleKeyName)){ |
|
310 | + $subpanelDefinition [ 'title_key' ] = 'LBL_' . strtoupper ( $relationshipName . '_FROM_' . $titleKeyName ) . '_TITLE' ; |
|
311 | + }else{ |
|
312 | + $subpanelDefinition [ 'title_key' ] = 'LBL_' . strtoupper ( $relationshipName . '_FROM_' . $sourceModule ) . '_TITLE' ; |
|
313 | + } |
|
314 | 314 | $subpanelDefinition [ 'get_subpanel_data' ] = $source ; |
315 | 315 | $subpanelDefinition [ 'top_buttons' ] = array( |
316 | - array('widget_class' => "SubPanelTopButtonQuickCreate"), |
|
317 | - array('widget_class' => 'SubPanelTopSelectButton', 'mode'=>'MultiSelect') |
|
318 | - ); |
|
316 | + array('widget_class' => "SubPanelTopButtonQuickCreate"), |
|
317 | + array('widget_class' => 'SubPanelTopSelectButton', 'mode'=>'MultiSelect') |
|
318 | + ); |
|
319 | 319 | |
320 | 320 | return array ( $subpanelDefinition ); |
321 | 321 | } |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | $vardef [ 'module' ] = $sourceModule ; |
340 | 340 | $vardef [ 'bean_name' ] = BeanFactory::getObjectName($sourceModule) ; |
341 | 341 | if ($right_side) |
342 | - $vardef [ 'side' ] = 'right' ; |
|
342 | + $vardef [ 'side' ] = 'right' ; |
|
343 | 343 | if (!empty($vname)) |
344 | 344 | $vardef [ 'vname' ] = $vname; |
345 | 345 | if (!empty($id_name)) |
@@ -364,11 +364,11 @@ discard block |
||
364 | 364 | $vardef [ 'type' ] = 'link' ; |
365 | 365 | $vardef [ 'relationship' ] = $relationshipName ; |
366 | 366 | $vardef [ 'source' ] = 'non-db' ; |
367 | - $vardef ['reportable'] = false; |
|
367 | + $vardef ['reportable'] = false; |
|
368 | 368 | if ($right_side) |
369 | - $vardef [ 'side' ] = 'right' ; |
|
369 | + $vardef [ 'side' ] = 'right' ; |
|
370 | 370 | else |
371 | - $vardef [ 'side' ] = 'left' ; |
|
371 | + $vardef [ 'side' ] = 'left' ; |
|
372 | 372 | if (!empty($vname)) |
373 | 373 | $vardef [ 'vname' ] = $vname; |
374 | 374 | |
@@ -389,11 +389,11 @@ discard block |
||
389 | 389 | $vardef [ 'type' ] = 'relate' ; |
390 | 390 | |
391 | 391 | $vardef [ 'source' ] = 'non-db' ; |
392 | - if(!empty($vnameLabel)){ |
|
393 | - $vardef [ 'vname' ] = 'LBL_' . strtoupper ( $relationshipName . '_FROM_' . $vnameLabel ) . '_TITLE' ; |
|
394 | - }else{ |
|
395 | - $vardef [ 'vname' ] = 'LBL_' . strtoupper ( $relationshipName . '_FROM_' . $sourceModule ) . '_TITLE' ; |
|
396 | - } |
|
392 | + if(!empty($vnameLabel)){ |
|
393 | + $vardef [ 'vname' ] = 'LBL_' . strtoupper ( $relationshipName . '_FROM_' . $vnameLabel ) . '_TITLE' ; |
|
394 | + }else{ |
|
395 | + $vardef [ 'vname' ] = 'LBL_' . strtoupper ( $relationshipName . '_FROM_' . $sourceModule ) . '_TITLE' ; |
|
396 | + } |
|
397 | 397 | |
398 | 398 | $vardef [ 'save' ] = true; // the magic value to tell SugarBean to save this relate field even though it is not listed in the $relationship_fields array |
399 | 399 | |
@@ -421,7 +421,7 @@ discard block |
||
421 | 421 | if (in_array( 'file' , array_keys ( $module->config [ 'templates' ] ) ) ){ |
422 | 422 | $vardef [ 'rname' ] = 'document_name' ; |
423 | 423 | }elseif(in_array ( 'person' , array_keys ( $module->config [ 'templates' ] ) ) ){ |
424 | - $vardef [ 'db_concat_fields' ] = array( 0 =>'first_name', 1 =>'last_name') ; |
|
424 | + $vardef [ 'db_concat_fields' ] = array( 0 =>'first_name', 1 =>'last_name') ; |
|
425 | 425 | } |
426 | 426 | } |
427 | 427 | else |
@@ -450,11 +450,11 @@ discard block |
||
450 | 450 | require_once ( $GLOBALS ['beanFiles'] [ $object ] ); |
451 | 451 | $bean = new $object(); |
452 | 452 | if ( isset ( $GLOBALS [ 'dictionary' ] [ $object ] [ 'templates'] )){ |
453 | - if(in_array ( 'file' , $GLOBALS [ 'dictionary' ] [ $object ] [ 'templates'] )){ |
|
454 | - $vardef [ 'rname' ] = 'document_name' ; |
|
455 | - }elseif(in_array ( 'person' , $GLOBALS [ 'dictionary' ] [ $object ] [ 'templates'] )){ |
|
456 | - $vardef [ 'db_concat_fields' ] = array( 0 =>'first_name', 1 =>'last_name') ; |
|
457 | - } |
|
453 | + if(in_array ( 'file' , $GLOBALS [ 'dictionary' ] [ $object ] [ 'templates'] )){ |
|
454 | + $vardef [ 'rname' ] = 'document_name' ; |
|
455 | + }elseif(in_array ( 'person' , $GLOBALS [ 'dictionary' ] [ $object ] [ 'templates'] )){ |
|
456 | + $vardef [ 'db_concat_fields' ] = array( 0 =>'first_name', 1 =>'last_name') ; |
|
457 | + } |
|
458 | 458 | } |
459 | 459 | |
460 | 460 | } |
@@ -634,7 +634,7 @@ discard block |
||
634 | 634 | function getJoinKeyLHS() |
635 | 635 | { |
636 | 636 | if (!isset($this->joinKeyLHS)) |
637 | - $this->joinKeyLHS = $this->getValidDBName ( $this->relationship_name . $this->lhs_module . "_ida" , true) ; |
|
637 | + $this->joinKeyLHS = $this->getValidDBName ( $this->relationship_name . $this->lhs_module . "_ida" , true) ; |
|
638 | 638 | |
639 | 639 | return $this->joinKeyLHS; |
640 | 640 | } |
@@ -642,7 +642,7 @@ discard block |
||
642 | 642 | function getJoinKeyRHS() |
643 | 643 | { |
644 | 644 | if (!isset($this->joinKeyRHS)) |
645 | - $this->joinKeyRHS = $this->getValidDBName ( $this->relationship_name . $this->rhs_module . "_idb" , true) ; |
|
645 | + $this->joinKeyRHS = $this->getValidDBName ( $this->relationship_name . $this->rhs_module . "_idb" , true) ; |
|
646 | 646 | |
647 | 647 | return $this->joinKeyRHS; |
648 | 648 | } |
@@ -674,32 +674,32 @@ discard block |
||
674 | 674 | } |
675 | 675 | |
676 | 676 | public function getTitleKey($left=false){ |
677 | - if(!$this->is_custom && !$left && file_exists("modules/{$this->rhs_module}/metadata/subpaneldefs.php")){ |
|
678 | - include("modules/{$this->rhs_module}/metadata/subpaneldefs.php"); |
|
679 | - if(isset($layout_defs[$this->rhs_module]['subpanel_setup'][strtolower($this->lhs_module)]['title_key'])){ |
|
680 | - return $layout_defs[$this->rhs_module]['subpanel_setup'][strtolower($this->lhs_module)]['title_key']; |
|
681 | - } |
|
682 | - }else if(!$this->is_custom && file_exists("modules/{$this->lhs_module}/metadata/subpaneldefs.php")){ |
|
683 | - include("modules/{$this->lhs_module}/metadata/subpaneldefs.php"); |
|
684 | - if(isset($layout_defs[$this->lhs_module]['subpanel_setup'][strtolower($this->rhs_module)]['title_key'])){ |
|
685 | - return $layout_defs[$this->lhs_module]['subpanel_setup'][strtolower($this->rhs_module)]['title_key']; |
|
686 | - } |
|
687 | - } |
|
677 | + if(!$this->is_custom && !$left && file_exists("modules/{$this->rhs_module}/metadata/subpaneldefs.php")){ |
|
678 | + include("modules/{$this->rhs_module}/metadata/subpaneldefs.php"); |
|
679 | + if(isset($layout_defs[$this->rhs_module]['subpanel_setup'][strtolower($this->lhs_module)]['title_key'])){ |
|
680 | + return $layout_defs[$this->rhs_module]['subpanel_setup'][strtolower($this->lhs_module)]['title_key']; |
|
681 | + } |
|
682 | + }else if(!$this->is_custom && file_exists("modules/{$this->lhs_module}/metadata/subpaneldefs.php")){ |
|
683 | + include("modules/{$this->lhs_module}/metadata/subpaneldefs.php"); |
|
684 | + if(isset($layout_defs[$this->lhs_module]['subpanel_setup'][strtolower($this->rhs_module)]['title_key'])){ |
|
685 | + return $layout_defs[$this->lhs_module]['subpanel_setup'][strtolower($this->rhs_module)]['title_key']; |
|
686 | + } |
|
687 | + } |
|
688 | 688 | |
689 | - if($left){ |
|
690 | - $titleKeyName = $this->getRightModuleSystemLabel(); |
|
691 | - $sourceModule = $this->rhs_module; |
|
692 | - }else{ |
|
693 | - $titleKeyName = $this->getLeftModuleSystemLabel(); |
|
694 | - $sourceModule = $this->lhs_module; |
|
695 | - } |
|
689 | + if($left){ |
|
690 | + $titleKeyName = $this->getRightModuleSystemLabel(); |
|
691 | + $sourceModule = $this->rhs_module; |
|
692 | + }else{ |
|
693 | + $titleKeyName = $this->getLeftModuleSystemLabel(); |
|
694 | + $sourceModule = $this->lhs_module; |
|
695 | + } |
|
696 | 696 | |
697 | - if(!empty($titleKeyName)){ |
|
698 | - $title_key = 'LBL_' . strtoupper ( $this->relationship_name . '_FROM_' . $titleKeyName ) . '_TITLE' ; |
|
699 | - }else{ |
|
700 | - $title_key = 'LBL_' . strtoupper ( $this->relationship_name . '_FROM_' . $sourceModule ) . '_TITLE' ; |
|
701 | - } |
|
697 | + if(!empty($titleKeyName)){ |
|
698 | + $title_key = 'LBL_' . strtoupper ( $this->relationship_name . '_FROM_' . $titleKeyName ) . '_TITLE' ; |
|
699 | + }else{ |
|
700 | + $title_key = 'LBL_' . strtoupper ( $this->relationship_name . '_FROM_' . $sourceModule ) . '_TITLE' ; |
|
701 | + } |
|
702 | 702 | |
703 | - return $title_key; |
|
704 | - } |
|
703 | + return $title_key; |
|
704 | + } |
|
705 | 705 | } |
706 | 706 | \ No newline at end of file |
@@ -66,15 +66,15 @@ discard block |
||
66 | 66 | // have different actual relationship names other than <relationshipName> |
67 | 67 | // e.g $dictionary[ 'quotes_accounts' ] has two relationships: quotes_billto_accounts, quotes_shipto_accounts |
68 | 68 | protected $specialCaseBaseNames = array( 'quotes_accounts', |
69 | - 'quotes_contacts', |
|
70 | - 'emails_beans', |
|
71 | - 'linked_documents', |
|
72 | - 'project_relation', |
|
73 | - 'prospect_lists_prospects', |
|
74 | - 'queues_beans', |
|
75 | - 'queues_queue', |
|
76 | - 'tracker_sessions' |
|
77 | - ); |
|
69 | + 'quotes_contacts', |
|
70 | + 'emails_beans', |
|
71 | + 'linked_documents', |
|
72 | + 'project_relation', |
|
73 | + 'prospect_lists_prospects', |
|
74 | + 'queues_beans', |
|
75 | + 'queues_queue', |
|
76 | + 'tracker_sessions' |
|
77 | + ); |
|
78 | 78 | /* |
79 | 79 | * Find all deployed modules that can participate in a relationship |
80 | 80 | * Return a list of modules with associated subpanels |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | protected function build ($basepath , $installDefPrefix , $relationships ) |
334 | 334 | { |
335 | 335 | global $sugar_config; |
336 | - // keep the relationships data separate from any other build data by ading /relationships to the basepath |
|
336 | + // keep the relationships data separate from any other build data by ading /relationships to the basepath |
|
337 | 337 | $basepath .= '/relationships' ; |
338 | 338 | |
339 | 339 | $installDefs = array ( ) ; |
@@ -393,34 +393,34 @@ discard block |
||
393 | 393 | { |
394 | 394 | global $sugar_config; |
395 | 395 | |
396 | - mkdir_recursive ( "$basepath/language" ) ; |
|
396 | + mkdir_recursive ( "$basepath/language" ) ; |
|
397 | 397 | |
398 | - $headerString = "<?php\n//THIS FILE IS AUTO GENERATED, DO NOT MODIFY\n" ; |
|
398 | + $headerString = "<?php\n//THIS FILE IS AUTO GENERATED, DO NOT MODIFY\n" ; |
|
399 | 399 | $installDefs = array ( ) ; |
400 | 400 | foreach ( $labelDefinitions as $definition ) |
401 | 401 | { |
402 | - $mod_strings = array(); |
|
403 | - $app_list_strings = array(); |
|
402 | + $mod_strings = array(); |
|
403 | + $app_list_strings = array(); |
|
404 | 404 | |
405 | - $out = $headerString; |
|
405 | + $out = $headerString; |
|
406 | 406 | |
407 | - $filename = "{$basepath}/language/{$definition['module']}.php" ; |
|
407 | + $filename = "{$basepath}/language/{$definition['module']}.php" ; |
|
408 | 408 | |
409 | - if (file_exists ( $filename )) |
|
410 | - include ($filename); |
|
409 | + if (file_exists ( $filename )) |
|
410 | + include ($filename); |
|
411 | 411 | |
412 | 412 | |
413 | 413 | //Check for app strings |
414 | 414 | $GLOBALS [ 'log' ]->debug ( get_class ( $this ) . "->saveLabels(): saving the following to {$filename}" |
415 | - . print_r ( $definition, true ) ) ; |
|
415 | + . print_r ( $definition, true ) ) ; |
|
416 | 416 | if ($definition['module'] == 'application') { |
417 | - $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); |
|
417 | + $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); |
|
420 | 420 | } else { |
421 | - $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); |
|
421 | + $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); |
|
424 | 424 | } |
425 | 425 | |
426 | 426 | $fh = fopen ( $filename, 'w' ) ; |
@@ -430,17 +430,17 @@ discard block |
||
430 | 430 | |
431 | 431 | foreach($sugar_config['languages'] as $lk => $lv) |
432 | 432 | { |
433 | - $installDefs [ $definition [ 'module' ] . "_$lk" ] = array ( |
|
434 | - 'from' => "{$installDefPrefix}/relationships/language/{$definition [ 'module' ]}.php" , |
|
435 | - 'to_module' => $definition [ 'module' ] , |
|
436 | - 'language' => $lk |
|
437 | - ) ; |
|
433 | + $installDefs [ $definition [ 'module' ] . "_$lk" ] = array ( |
|
434 | + 'from' => "{$installDefPrefix}/relationships/language/{$definition [ 'module' ]}.php" , |
|
435 | + 'to_module' => $definition [ 'module' ] , |
|
436 | + 'language' => $lk |
|
437 | + ) ; |
|
438 | 438 | } |
439 | 439 | |
440 | 440 | /* do not use the following write_array_to_file method to write the label file - |
441 | 441 | * module installer appends each of the label files together (as it does for all files) |
442 | 442 | * into a combined label file and so the last $mod_strings is the only one received by the application */ |
443 | - // write_array_to_file ( 'mod_strings', array ( $definition [ 'system_label' ] => $definition [ 'display_label' ] ), $filename, "a" ) ; |
|
443 | + // write_array_to_file ( 'mod_strings', array ( $definition [ 'system_label' ] => $definition [ 'display_label' ] ), $filename, "a" ) ; |
|
444 | 444 | } |
445 | 445 | |
446 | 446 | return $installDefs ; |
@@ -534,11 +534,11 @@ discard block |
||
534 | 534 | $relName = $moduleName; |
535 | 535 | foreach ( $definitions as $definition ) |
536 | 536 | { |
537 | - if (!empty($definition['relationship'])) |
|
538 | - { |
|
539 | - $relName = $definition['relationship']; |
|
540 | - break; |
|
541 | - } |
|
537 | + if (!empty($definition['relationship'])) |
|
538 | + { |
|
539 | + $relName = $definition['relationship']; |
|
540 | + break; |
|
541 | + } |
|
542 | 542 | } |
543 | 543 | |
544 | 544 | $filename = "$basepath/vardefs/{$relName}_{$moduleName}.php" ; |
@@ -547,14 +547,14 @@ discard block |
||
547 | 547 | foreach ( $definitions as $definition ) |
548 | 548 | { |
549 | 549 | $GLOBALS [ 'log' ]->debug ( get_class ( $this ) . "->saveVardefs(): saving the following to {$filename}" . print_r ( $definition, true ) ) ; |
550 | - $out .= '$dictionary["' . $object . '"]["fields"]["' . $definition [ 'name' ] . '"] = ' |
|
551 | - . var_export_helper($definition) . ";\n"; |
|
550 | + $out .= '$dictionary["' . $object . '"]["fields"]["' . $definition [ 'name' ] . '"] = ' |
|
551 | + . var_export_helper($definition) . ";\n"; |
|
552 | 552 | } |
553 | 553 | file_put_contents($filename, $out); |
554 | 554 | |
555 | 555 | $installDefs [ $moduleName ] = array ( |
556 | - 'from' => "{$installDefPrefix}/relationships/vardefs/{$relName}_{$moduleName}.php" , |
|
557 | - 'to_module' => $moduleName |
|
556 | + 'from' => "{$installDefPrefix}/relationships/vardefs/{$relName}_{$moduleName}.php" , |
|
557 | + 'to_module' => $moduleName |
|
558 | 558 | ) ; |
559 | 559 | } |
560 | 560 |
@@ -284,8 +284,8 @@ discard block |
||
284 | 284 | } |
285 | 285 | $module->setAppListStrings ( 'en_us', $appStrings ) ; |
286 | 286 | $module->save () ; |
287 | - //Bug42170================================ |
|
288 | - } |
|
287 | + //Bug42170================================ |
|
288 | + } |
|
289 | 289 | |
290 | 290 | // use an installDefPrefix of <basepath>/SugarModules for compatibility with the rest of ModuleBuilder |
291 | 291 | $this->installDefs = parent::build ( $basepath, "<basepath>/SugarModules", $relationships ) ; |
@@ -418,7 +418,7 @@ discard block |
||
418 | 418 | $fieldsToAdd [$deployedModuleName] = $fieldName; |
419 | 419 | } |
420 | 420 | } |
421 | - } |
|
421 | + } |
|
422 | 422 | } |
423 | 423 | return array(array('additional_fields' => $fieldsToAdd)); |
424 | 424 | } |
@@ -104,13 +104,13 @@ discard block |
||
104 | 104 | |
105 | 105 | |
106 | 106 | if (! empty ( $dictionary ) && ! empty ( $dictionary [ $name ] ) ) { |
107 | - if (! empty ( $dictionary [ $name ] [ 'true_relationship_type' ] )) { |
|
108 | - $definition [ 'relationship_type' ] = $dictionary [ $name ] [ 'true_relationship_type' ] ; |
|
109 | - } |
|
107 | + if (! empty ( $dictionary [ $name ] [ 'true_relationship_type' ] )) { |
|
108 | + $definition [ 'relationship_type' ] = $dictionary [ $name ] [ 'true_relationship_type' ] ; |
|
109 | + } |
|
110 | 110 | if (! empty ( $dictionary [ $name ] [ 'from_studio' ] )) { |
111 | 111 | $definition [ 'from_studio' ] = $dictionary [ $name ] [ 'from_studio' ] ; |
112 | 112 | } |
113 | - $definition [ 'is_custom' ] = true; |
|
113 | + $definition [ 'is_custom' ] = true; |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | |
@@ -155,23 +155,23 @@ discard block |
||
155 | 155 | */ |
156 | 156 | function delete ($rel_name) |
157 | 157 | { |
158 | - //Remove any fields from layouts |
|
158 | + //Remove any fields from layouts |
|
159 | 159 | $rel = $this->get($rel_name); |
160 | 160 | if (!empty($rel)) |
161 | 161 | { |
162 | 162 | $this->removeFieldsFromDeployedLayout($rel); |
163 | 163 | } |
164 | 164 | require_once("ModuleInstall/ModuleInstaller.php"); |
165 | - require_once ('modules/Administration/QuickRepairAndRebuild.php') ; |
|
166 | - $mi = new ModuleInstaller(); |
|
167 | - $mi->silent = true; |
|
165 | + require_once ('modules/Administration/QuickRepairAndRebuild.php') ; |
|
166 | + $mi = new ModuleInstaller(); |
|
167 | + $mi->silent = true; |
|
168 | 168 | $mi->id_name = 'custom' . $rel_name; // provide the moduleinstaller with a unique name for this relationship - normally this value is set to the package key... |
169 | - $mi->uninstall_relationship("custom/metadata/{$rel_name}MetaData.php"); |
|
169 | + $mi->uninstall_relationship("custom/metadata/{$rel_name}MetaData.php"); |
|
170 | 170 | $mi->uninstallLabels('custom/Extension/modules/relationships/language/',$rel->buildLabels()); |
171 | 171 | $mi->uninstallExtLabels($rel->buildLabels()); |
172 | 172 | |
173 | - // now clear all caches so that our changes are visible |
|
174 | - Relationship::delete_cache(); |
|
173 | + // now clear all caches so that our changes are visible |
|
174 | + Relationship::delete_cache(); |
|
175 | 175 | $mi->rebuild_tabledictionary(); |
176 | 176 | |
177 | 177 | $MBmodStrings = $GLOBALS [ 'mod_strings' ]; |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | foreach ( $this->relationships as $name => $relationship ) |
314 | 314 | { |
315 | 315 | $relationship->setFromStudio(); |
316 | - $GLOBALS [ 'mod_strings' ] = $MBModStrings ; |
|
316 | + $GLOBALS [ 'mod_strings' ] = $MBModStrings ; |
|
317 | 317 | $installDefs = parent::build ( $basepath, "<basepath>", array ($name => $relationship ) ) ; |
318 | 318 | |
319 | 319 | // and mark as built so that the next time we come through we'll know and won't build again |
@@ -407,7 +407,7 @@ discard block |
||
407 | 407 | * @param $relationship The relationship that is getting deleted |
408 | 408 | * return null |
409 | 409 | */ |
410 | - private function removeFieldsFromDeployedLayout ($relationship) |
|
410 | + private function removeFieldsFromDeployedLayout ($relationship) |
|
411 | 411 | { |
412 | 412 | |
413 | 413 | // many-to-many relationships don't have fields so if we have a many-to-many we can just skip this... |
@@ -54,9 +54,9 @@ |
||
54 | 54 | if (! isset ( $definition [ 'relationship_type' ] )) |
55 | 55 | $definition [ 'relationship_type' ] = MB_MANYTOMANY ; |
56 | 56 | |
57 | - if (!empty ($definition['for_activities']) && $definition['for_activities'] == true) { |
|
58 | - require_once 'modules/ModuleBuilder/parsers/relationships/ActivitiesRelationship.php'; |
|
59 | - return new ActivitiesRelationship ($definition); |
|
57 | + if (!empty ($definition['for_activities']) && $definition['for_activities'] == true) { |
|
58 | + require_once 'modules/ModuleBuilder/parsers/relationships/ActivitiesRelationship.php'; |
|
59 | + return new ActivitiesRelationship ($definition); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | switch ( strtolower ( $definition [ 'relationship_type' ] )) |
@@ -99,13 +99,13 @@ discard block |
||
99 | 99 | $source = ""; |
100 | 100 | if ($this->rhs_module == $this->lhs_module) |
101 | 101 | { |
102 | - $source = $this->getJoinKeyLHS(); |
|
102 | + $source = $this->getJoinKeyLHS(); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | return array( |
106 | - $this->lhs_module => $this->getSubpanelDefinition ( |
|
107 | - $this->relationship_name, $this->rhs_module, $this->rhs_subpanel , $this->getRightModuleSystemLabel() , $source |
|
108 | - ) |
|
106 | + $this->lhs_module => $this->getSubpanelDefinition ( |
|
107 | + $this->relationship_name, $this->rhs_module, $this->rhs_subpanel , $this->getRightModuleSystemLabel() , $source |
|
108 | + ) |
|
109 | 109 | ); |
110 | 110 | } |
111 | 111 | |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | /* |
114 | 114 | * @return array An array of field definitions, ready for the vardefs, keyed by module |
115 | 115 | */ |
116 | - function buildVardefs ( ) |
|
116 | + function buildVardefs ( ) |
|
117 | 117 | { |
118 | 118 | $vardefs = array ( ) ; |
119 | 119 | |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | ) ; |
124 | 124 | if ($this->rhs_module != $this->lhs_module ) |
125 | 125 | { |
126 | - $vardefs [ $this->lhs_module ] [] = $this->getLinkFieldDefinition ( $this->rhs_module, $this->relationship_name, true, |
|
126 | + $vardefs [ $this->lhs_module ] [] = $this->getLinkFieldDefinition ( $this->rhs_module, $this->relationship_name, true, |
|
127 | 127 | 'LBL_' . strtoupper ( $this->relationship_name . '_FROM_' . $this->getRightModuleSystemLabel() ) . '_TITLE'); |
128 | 128 | } |
129 | 129 | if (! $this->relationship_only) |
@@ -60,21 +60,21 @@ discard block |
||
60 | 60 | function __construct ($definition) |
61 | 61 | { |
62 | 62 | |
63 | - parent::__construct ( $definition ) ; |
|
64 | - $onetomanyDef = array_merge($definition, array( |
|
65 | - 'rhs_label' => isset($definition['lhs_label']) ? $definition['lhs_label'] : null, |
|
66 | - 'lhs_label' => isset($definition['rhs_label']) ? $definition['rhs_label'] : null, |
|
67 | - 'lhs_subpanel' => isset($definition['rhs_subpanel']) ? $definition['rhs_subpanel'] : null, |
|
68 | - 'rhs_subpanel' => isset($definition['lhs_subpanel']) ? $definition['lhs_subpanel'] : null, |
|
69 | - 'lhs_module' => isset($definition['rhs_module']) ? $definition['rhs_module'] : null, |
|
70 | - 'lhs_table' => isset($definition['rhs_table']) ? $definition['rhs_table'] : null, |
|
71 | - 'lhs_key' => isset($definition['rhs_key']) ? $definition['rhs_key'] : null, |
|
72 | - 'rhs_module' => isset($definition['lhs_module']) ? $definition['lhs_module'] : null, |
|
73 | - 'rhs_table' => isset($definition['lhs_table']) ? $definition['lhs_table'] : null, |
|
74 | - 'rhs_key' => isset($definition['lhs_key']) ? $definition['lhs_key'] : null, |
|
75 | - 'join_key_lhs' => isset($definition['join_key_rhs']) ? $definition['join_key_rhs'] : null, |
|
76 | - 'join_key_rhs' => isset($definition['join_key_lhs']) ? $definition['join_key_lhs'] : null, |
|
77 | - 'relationship_type' => MB_ONETOMANY, |
|
63 | + parent::__construct ( $definition ) ; |
|
64 | + $onetomanyDef = array_merge($definition, array( |
|
65 | + 'rhs_label' => isset($definition['lhs_label']) ? $definition['lhs_label'] : null, |
|
66 | + 'lhs_label' => isset($definition['rhs_label']) ? $definition['rhs_label'] : null, |
|
67 | + 'lhs_subpanel' => isset($definition['rhs_subpanel']) ? $definition['rhs_subpanel'] : null, |
|
68 | + 'rhs_subpanel' => isset($definition['lhs_subpanel']) ? $definition['lhs_subpanel'] : null, |
|
69 | + 'lhs_module' => isset($definition['rhs_module']) ? $definition['rhs_module'] : null, |
|
70 | + 'lhs_table' => isset($definition['rhs_table']) ? $definition['rhs_table'] : null, |
|
71 | + 'lhs_key' => isset($definition['rhs_key']) ? $definition['rhs_key'] : null, |
|
72 | + 'rhs_module' => isset($definition['lhs_module']) ? $definition['lhs_module'] : null, |
|
73 | + 'rhs_table' => isset($definition['lhs_table']) ? $definition['lhs_table'] : null, |
|
74 | + 'rhs_key' => isset($definition['lhs_key']) ? $definition['lhs_key'] : null, |
|
75 | + 'join_key_lhs' => isset($definition['join_key_rhs']) ? $definition['join_key_rhs'] : null, |
|
76 | + 'join_key_rhs' => isset($definition['join_key_lhs']) ? $definition['join_key_lhs'] : null, |
|
77 | + 'relationship_type' => MB_ONETOMANY, |
|
78 | 78 | )); |
79 | 79 | $this->one_to_many = new OneToManyRelationship($onetomanyDef); |
80 | 80 | } |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | * BUILD methods called during the build |
84 | 84 | */ |
85 | 85 | |
86 | - function buildLabels () |
|
86 | + function buildLabels () |
|
87 | 87 | { |
88 | 88 | return $this->one_to_many->buildLabels(); |
89 | 89 | } |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | */ |
105 | 105 | function buildVardefs ( ) |
106 | 106 | { |
107 | - return $this->one_to_many->buildVardefs(); |
|
107 | + return $this->one_to_many->buildVardefs(); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | /* |
@@ -130,19 +130,19 @@ discard block |
||
130 | 130 | public function setName ($relationshipName) |
131 | 131 | { |
132 | 132 | parent::setName($relationshipName); |
133 | - $this->one_to_many->setname($relationshipName); |
|
133 | + $this->one_to_many->setname($relationshipName); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | public function setReadonly () |
137 | 137 | { |
138 | 138 | parent::setReadonly(); |
139 | - $this->one_to_many->setReadonly(); |
|
139 | + $this->one_to_many->setReadonly(); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | public function delete () |
143 | 143 | { |
144 | 144 | parent::delete(); |
145 | - $this->one_to_many->delete(); |
|
145 | + $this->one_to_many->delete(); |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | public function setRelationship_only () |
@@ -72,10 +72,10 @@ discard block |
||
72 | 72 | class ActivitiesRelationship extends OneToManyRelationship |
73 | 73 | { |
74 | 74 | |
75 | - protected static $subpanelsAdded = array(); |
|
76 | - protected static $labelsAdded = array(); |
|
75 | + protected static $subpanelsAdded = array(); |
|
76 | + protected static $labelsAdded = array(); |
|
77 | 77 | |
78 | - /* |
|
78 | + /* |
|
79 | 79 | * Constructor |
80 | 80 | * @param array $definition Parameters passed in as array defined in parent::$definitionKeys |
81 | 81 | * The lhs_module value is for the One side; the rhs_module value is for the Many |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | * BUILD methods called during the build |
90 | 90 | */ |
91 | 91 | |
92 | - /* |
|
92 | + /* |
|
93 | 93 | * Define the labels to be added to the module for the new relationships |
94 | 94 | * @return array An array of system value => display value |
95 | 95 | */ |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | } |
141 | 141 | |
142 | 142 | |
143 | - /* |
|
143 | + /* |
|
144 | 144 | * @return array An array of field definitions, ready for the vardefs, keyed by module |
145 | 145 | */ |
146 | 146 | function buildVardefs ( ) |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | return $vardefs ; |
155 | 155 | } |
156 | 156 | |
157 | - protected function getLinkFieldDefinition ($sourceModule , $relationshipName) |
|
157 | + protected function getLinkFieldDefinition ($sourceModule , $relationshipName) |
|
158 | 158 | { |
159 | 159 | $vardef = array ( ) ; |
160 | 160 | $vardef [ 'name' ] = $relationshipName; |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | return array( $this->rhs_module => $this->relationship_name . "_name" ) ; // this must match the name of the relate field from buildVardefs |
180 | 180 | } |
181 | 181 | |
182 | - function buildSubpanelDefinitions () |
|
182 | + function buildSubpanelDefinitions () |
|
183 | 183 | { |
184 | 184 | if ($this->relationship_only || isset(ActivitiesRelationship::$subpanelsAdded[$this->lhs_module])) |
185 | 185 | return array () ; |
@@ -187,9 +187,9 @@ discard block |
||
187 | 187 | ActivitiesRelationship::$subpanelsAdded[$this->lhs_module] = true; |
188 | 188 | $relationshipName = substr($this->relationship_name, 0, strrpos($this->relationship_name, '_')); |
189 | 189 | return array( $this->lhs_module => array ( |
190 | - 'activities' => $this->buildActivitiesSubpanelDefinition ( $relationshipName ), |
|
191 | - 'history' => $this->buildHistorySubpanelDefinition ( $relationshipName ) , |
|
192 | - )); |
|
190 | + 'activities' => $this->buildActivitiesSubpanelDefinition ( $relationshipName ), |
|
191 | + 'history' => $this->buildHistorySubpanelDefinition ( $relationshipName ) , |
|
192 | + )); |
|
193 | 193 | } |
194 | 194 | |
195 | 195 | /* |
@@ -209,10 +209,10 @@ discard block |
||
209 | 209 | $relMetadata ['relationship_role_column'] = 'parent_type'; |
210 | 210 | $relMetadata ['relationship_role_column_value'] = $this->definition [ 'lhs_module' ] ; |
211 | 211 | |
212 | - return array( $this->lhs_module => array( |
|
213 | - 'relationships' => array ($relationshipName => $relMetadata), |
|
214 | - 'fields' => '', 'indices' => '', 'table' => '') |
|
215 | - ) ; |
|
212 | + return array( $this->lhs_module => array( |
|
213 | + 'relationships' => array ($relationshipName => $relMetadata), |
|
214 | + 'fields' => '', 'indices' => '', 'table' => '') |
|
215 | + ) ; |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | /* |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | */ |
222 | 222 | protected function buildActivitiesSubpanelDefinition ( $relationshipName ) |
223 | 223 | { |
224 | - return array ( |
|
224 | + return array ( |
|
225 | 225 | 'order' => 10 , |
226 | 226 | 'sort_order' => 'desc' , |
227 | 227 | 'sort_by' => 'date_start' , |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | 'module' => 'History' , |
266 | 266 | 'top_buttons' => array ( |
267 | 267 | array ( 'widget_class' => 'SubPanelTopCreateNoteButton' ) , |
268 | - array ( 'widget_class' => 'SubPanelTopArchiveEmailButton'), |
|
268 | + array ( 'widget_class' => 'SubPanelTopArchiveEmailButton'), |
|
269 | 269 | array ( 'widget_class' => 'SubPanelTopSummaryButton' ) ) , |
270 | 270 | 'collection_list' => array ( |
271 | 271 | 'meetings' => array ( |
@@ -67,6 +67,6 @@ |
||
67 | 67 | |
68 | 68 | class MBConstants |
69 | 69 | { |
70 | - static $EMPTY = array ( 'name' => '(empty)' , 'label' => '(empty)' ) ; |
|
71 | - static $FILLER = array ( 'name' => '(filler)' , 'label' => 'LBL_FILLER' ) ; // would prefer to have label => translate('LBL_FILLER') but can't be done in a static, and don't want to require instantiating a new object to get these constants |
|
70 | + static $EMPTY = array ( 'name' => '(empty)' , 'label' => '(empty)' ) ; |
|
71 | + static $FILLER = array ( 'name' => '(filler)' , 'label' => 'LBL_FILLER' ) ; // would prefer to have label => translate('LBL_FILLER') but can't be done in a static, and don't want to require instantiating a new object to get these constants |
|
72 | 72 | } |