@@ -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 | } |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | |
42 | 42 | require_once('modules/ModuleBuilder/parsers/ModuleBuilderParser.php'); |
43 | 43 | |
44 | - class ParserDropDown extends ModuleBuilderParser { |
|
44 | + class ParserDropDown extends ModuleBuilderParser { |
|
45 | 45 | |
46 | 46 | /** |
47 | 47 | * Takes in the request params from a save request and processes |
@@ -51,19 +51,19 @@ discard block |
||
51 | 51 | */ |
52 | 52 | function saveDropDown($params){ |
53 | 53 | require_once('modules/Administration/Common.php'); |
54 | - $emptyMarker = translate('LBL_BLANK'); |
|
55 | - $selected_lang = (!empty($params['dropdown_lang'])?$params['dropdown_lang']:$_SESSION['authenticated_user_language']); |
|
56 | - $type = $_REQUEST['view_package']; |
|
57 | - $dir = ''; |
|
58 | - $dropdown_name = $params['dropdown_name']; |
|
59 | - $json = getJSONobj(); |
|
54 | + $emptyMarker = translate('LBL_BLANK'); |
|
55 | + $selected_lang = (!empty($params['dropdown_lang'])?$params['dropdown_lang']:$_SESSION['authenticated_user_language']); |
|
56 | + $type = $_REQUEST['view_package']; |
|
57 | + $dir = ''; |
|
58 | + $dropdown_name = $params['dropdown_name']; |
|
59 | + $json = getJSONobj(); |
|
60 | 60 | |
61 | - $list_value = str_replace('"":""', '"__empty__":""', $params['list_value']); |
|
62 | - //Bug 21362 ENT_QUOTES- convert single quotes to escaped single quotes. |
|
63 | - $temp = $json->decode(html_entity_decode(rawurldecode($list_value), ENT_QUOTES) ); |
|
64 | - $dropdown = array () ; |
|
65 | - // dropdown is received as an array of (name,value) pairs - now extract to name=>value format preserving order |
|
66 | - // we rely here on PHP to preserve the order of the received name=>value pairs - associative arrays in PHP are ordered |
|
61 | + $list_value = str_replace('"":""', '"__empty__":""', $params['list_value']); |
|
62 | + //Bug 21362 ENT_QUOTES- convert single quotes to escaped single quotes. |
|
63 | + $temp = $json->decode(html_entity_decode(rawurldecode($list_value), ENT_QUOTES) ); |
|
64 | + $dropdown = array () ; |
|
65 | + // dropdown is received as an array of (name,value) pairs - now extract to name=>value format preserving order |
|
66 | + // we rely here on PHP to preserve the order of the received name=>value pairs - associative arrays in PHP are ordered |
|
67 | 67 | if(is_array($temp)) |
68 | 68 | { |
69 | 69 | foreach ( $temp as $item ) |
@@ -71,146 +71,146 @@ discard block |
||
71 | 71 | $dropdown[ SugarCleaner::stripTags(from_html($item [ 0 ]), false) ] = SugarCleaner::stripTags(from_html($item [ 1 ]), false) ; |
72 | 72 | } |
73 | 73 | } |
74 | - if(array_key_exists($emptyMarker, $dropdown)){ |
|
74 | + if(array_key_exists($emptyMarker, $dropdown)){ |
|
75 | 75 | $output=array(); |
76 | 76 | foreach($dropdown as $key => $value){ |
77 | 77 | if($emptyMarker===$key) |
78 | 78 | $output['']=''; |
79 | 79 | else |
80 | 80 | $output[$key]=$value; |
81 | - } |
|
81 | + } |
|
82 | 82 | $dropdown=$output; |
83 | - } |
|
83 | + } |
|
84 | 84 | |
85 | - if($type != 'studio'){ |
|
86 | - $mb = new ModuleBuilder(); |
|
87 | - $module = $mb->getPackageModule($params['view_package'], $params['view_module']); |
|
88 | - $this->synchMBDropDown($dropdown_name, $dropdown, $selected_lang, $module); |
|
89 | - //Can't use synch on selected lang as we want to overwrite values, not just keys |
|
90 | - $module->mblanguage->appListStrings[$selected_lang.'.lang.php'][$dropdown_name] = $dropdown; |
|
91 | - $module->mblanguage->save($module->key_name); // tyoung - key is required parameter as of |
|
92 | - }else{ |
|
93 | - $contents = return_custom_app_list_strings_file_contents($selected_lang); |
|
94 | - $my_list_strings = return_app_list_strings_language($selected_lang); |
|
95 | - if($selected_lang == $GLOBALS['current_language']){ |
|
96 | - $GLOBALS['app_list_strings'][$dropdown_name] = $dropdown; |
|
97 | - } |
|
98 | - //write to contents |
|
99 | - $contents = str_replace("?>", '', $contents); |
|
100 | - if(empty($contents))$contents = "<?php"; |
|
101 | - //add new drop down to the bottom |
|
102 | - if(!empty($params['use_push'])){ |
|
103 | - //this is for handling moduleList and such where nothing should be deleted or anything but they can be renamed |
|
104 | - foreach($dropdown as $key=>$value){ |
|
105 | - //only if the value has changed or does not exist do we want to add it this way |
|
106 | - if(!isset($my_list_strings[$dropdown_name][$key]) || strcmp($my_list_strings[$dropdown_name][$key], $value) != 0 ){ |
|
107 | - //clear out the old value |
|
108 | - $pattern_match = '/\s*\$app_list_strings\s*\[\s*\''.$dropdown_name.'\'\s*\]\[\s*\''.$key.'\'\s*\]\s*=\s*[\'\"]{1}.*?[\'\"]{1};\s*/ism'; |
|
109 | - $contents = preg_replace($pattern_match, "\n", $contents); |
|
110 | - //add the new ones |
|
111 | - $contents .= "\n\$GLOBALS['app_list_strings']['$dropdown_name']['$key']=" . var_export_helper($value) . ";"; |
|
112 | - } |
|
113 | - } |
|
114 | - }else{ |
|
115 | - //Now synch up the keys in other langauges to ensure that removed/added Drop down values work properly under all langs. |
|
116 | - $this->synchDropDown($dropdown_name, $dropdown, $selected_lang, $dir); |
|
117 | - $contents = $this->getNewCustomContents($dropdown_name, $dropdown, $selected_lang); |
|
118 | - } |
|
119 | - if(!empty($dir) && !is_dir($dir)) |
|
120 | - { |
|
121 | - $continue = mkdir_recursive($dir); |
|
122 | - } |
|
123 | - save_custom_app_list_strings_contents($contents, $selected_lang, $dir); |
|
124 | - } |
|
125 | - sugar_cache_reset(); |
|
126 | - clearAllJsAndJsLangFilesWithoutOutput(); |
|
85 | + if($type != 'studio'){ |
|
86 | + $mb = new ModuleBuilder(); |
|
87 | + $module = $mb->getPackageModule($params['view_package'], $params['view_module']); |
|
88 | + $this->synchMBDropDown($dropdown_name, $dropdown, $selected_lang, $module); |
|
89 | + //Can't use synch on selected lang as we want to overwrite values, not just keys |
|
90 | + $module->mblanguage->appListStrings[$selected_lang.'.lang.php'][$dropdown_name] = $dropdown; |
|
91 | + $module->mblanguage->save($module->key_name); // tyoung - key is required parameter as of |
|
92 | + }else{ |
|
93 | + $contents = return_custom_app_list_strings_file_contents($selected_lang); |
|
94 | + $my_list_strings = return_app_list_strings_language($selected_lang); |
|
95 | + if($selected_lang == $GLOBALS['current_language']){ |
|
96 | + $GLOBALS['app_list_strings'][$dropdown_name] = $dropdown; |
|
97 | + } |
|
98 | + //write to contents |
|
99 | + $contents = str_replace("?>", '', $contents); |
|
100 | + if(empty($contents))$contents = "<?php"; |
|
101 | + //add new drop down to the bottom |
|
102 | + if(!empty($params['use_push'])){ |
|
103 | + //this is for handling moduleList and such where nothing should be deleted or anything but they can be renamed |
|
104 | + foreach($dropdown as $key=>$value){ |
|
105 | + //only if the value has changed or does not exist do we want to add it this way |
|
106 | + if(!isset($my_list_strings[$dropdown_name][$key]) || strcmp($my_list_strings[$dropdown_name][$key], $value) != 0 ){ |
|
107 | + //clear out the old value |
|
108 | + $pattern_match = '/\s*\$app_list_strings\s*\[\s*\''.$dropdown_name.'\'\s*\]\[\s*\''.$key.'\'\s*\]\s*=\s*[\'\"]{1}.*?[\'\"]{1};\s*/ism'; |
|
109 | + $contents = preg_replace($pattern_match, "\n", $contents); |
|
110 | + //add the new ones |
|
111 | + $contents .= "\n\$GLOBALS['app_list_strings']['$dropdown_name']['$key']=" . var_export_helper($value) . ";"; |
|
112 | + } |
|
113 | + } |
|
114 | + }else{ |
|
115 | + //Now synch up the keys in other langauges to ensure that removed/added Drop down values work properly under all langs. |
|
116 | + $this->synchDropDown($dropdown_name, $dropdown, $selected_lang, $dir); |
|
117 | + $contents = $this->getNewCustomContents($dropdown_name, $dropdown, $selected_lang); |
|
118 | + } |
|
119 | + if(!empty($dir) && !is_dir($dir)) |
|
120 | + { |
|
121 | + $continue = mkdir_recursive($dir); |
|
122 | + } |
|
123 | + save_custom_app_list_strings_contents($contents, $selected_lang, $dir); |
|
124 | + } |
|
125 | + sugar_cache_reset(); |
|
126 | + clearAllJsAndJsLangFilesWithoutOutput(); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | /** |
130 | - * function synchDropDown |
|
131 | - * Ensures that the set of dropdown keys is consistant accross all languages. |
|
132 | - * |
|
133 | - * @param $dropdown_name The name of the dropdown to be synched |
|
134 | - * @param $dropdown array The dropdown currently being saved |
|
135 | - * @param $selected_lang String the language currently selected in Studio/MB |
|
136 | - * @param $saveLov String the path to the directory to save the new lang file in. |
|
137 | - */ |
|
130 | + * function synchDropDown |
|
131 | + * Ensures that the set of dropdown keys is consistant accross all languages. |
|
132 | + * |
|
133 | + * @param $dropdown_name The name of the dropdown to be synched |
|
134 | + * @param $dropdown array The dropdown currently being saved |
|
135 | + * @param $selected_lang String the language currently selected in Studio/MB |
|
136 | + * @param $saveLov String the path to the directory to save the new lang file in. |
|
137 | + */ |
|
138 | 138 | function synchDropDown($dropdown_name, $dropdown, $selected_lang, $saveLoc) { |
139 | - $allLanguages = get_languages(); |
|
139 | + $allLanguages = get_languages(); |
|
140 | 140 | foreach ($allLanguages as $lang => $langName) { |
141 | - if ($lang != $selected_lang) { |
|
142 | - $listStrings = return_app_list_strings_language($lang); |
|
143 | - $langDropDown = array(); |
|
144 | - if (isset($listStrings[$dropdown_name]) && is_array($listStrings[$dropdown_name])) |
|
145 | - { |
|
146 | - $langDropDown = $this->synchDDKeys($dropdown, $listStrings[$dropdown_name]); |
|
147 | - } else |
|
148 | - { |
|
149 | - //if the dropdown does not exist in the language, justt use what we have. |
|
150 | - $langDropDown = $dropdown; |
|
151 | - } |
|
152 | - $contents = $this->getNewCustomContents($dropdown_name, $langDropDown, $lang); |
|
153 | - save_custom_app_list_strings_contents($contents, $lang, $saveLoc); |
|
154 | - } |
|
141 | + if ($lang != $selected_lang) { |
|
142 | + $listStrings = return_app_list_strings_language($lang); |
|
143 | + $langDropDown = array(); |
|
144 | + if (isset($listStrings[$dropdown_name]) && is_array($listStrings[$dropdown_name])) |
|
145 | + { |
|
146 | + $langDropDown = $this->synchDDKeys($dropdown, $listStrings[$dropdown_name]); |
|
147 | + } else |
|
148 | + { |
|
149 | + //if the dropdown does not exist in the language, justt use what we have. |
|
150 | + $langDropDown = $dropdown; |
|
151 | + } |
|
152 | + $contents = $this->getNewCustomContents($dropdown_name, $langDropDown, $lang); |
|
153 | + save_custom_app_list_strings_contents($contents, $lang, $saveLoc); |
|
154 | + } |
|
155 | 155 | } |
156 | 156 | } |
157 | 157 | |
158 | 158 | /** |
159 | - * function synchMBDropDown |
|
160 | - * Ensures that the set of dropdown keys is consistant accross all languages in a ModuleBuilder Module |
|
161 | - * |
|
162 | - * @param $dropdown_name The name of the dropdown to be synched |
|
163 | - * @param $dropdown array The dropdown currently being saved |
|
164 | - * @param $selected_lang String the language currently selected in Studio/MB |
|
165 | - * @param $module MBModule the module to update the languages in |
|
166 | - */ |
|
159 | + * function synchMBDropDown |
|
160 | + * Ensures that the set of dropdown keys is consistant accross all languages in a ModuleBuilder Module |
|
161 | + * |
|
162 | + * @param $dropdown_name The name of the dropdown to be synched |
|
163 | + * @param $dropdown array The dropdown currently being saved |
|
164 | + * @param $selected_lang String the language currently selected in Studio/MB |
|
165 | + * @param $module MBModule the module to update the languages in |
|
166 | + */ |
|
167 | 167 | function synchMBDropDown($dropdown_name, $dropdown, $selected_lang, $module) { |
168 | - $selected_lang = $selected_lang . '.lang.php'; |
|
169 | - foreach($module->mblanguage->appListStrings as $lang => $listStrings) { |
|
170 | - if ($lang != $selected_lang) |
|
171 | - { |
|
172 | - $langDropDown = array(); |
|
173 | - if (isset($listStrings[$dropdown_name]) && is_array($listStrings[$dropdown_name])) |
|
174 | - { |
|
175 | - $langDropDown = $this->synchDDKeys($dropdown, $listStrings[$dropdown_name]); |
|
176 | - } else |
|
177 | - { |
|
178 | - $langDropDown = $dropdown; |
|
179 | - } |
|
180 | - $module->mblanguage->appListStrings[$lang][$dropdown_name] = $langDropDown; |
|
181 | - $module->mblanguage->save($module->key_name); |
|
182 | - } |
|
183 | - } |
|
168 | + $selected_lang = $selected_lang . '.lang.php'; |
|
169 | + foreach($module->mblanguage->appListStrings as $lang => $listStrings) { |
|
170 | + if ($lang != $selected_lang) |
|
171 | + { |
|
172 | + $langDropDown = array(); |
|
173 | + if (isset($listStrings[$dropdown_name]) && is_array($listStrings[$dropdown_name])) |
|
174 | + { |
|
175 | + $langDropDown = $this->synchDDKeys($dropdown, $listStrings[$dropdown_name]); |
|
176 | + } else |
|
177 | + { |
|
178 | + $langDropDown = $dropdown; |
|
179 | + } |
|
180 | + $module->mblanguage->appListStrings[$lang][$dropdown_name] = $langDropDown; |
|
181 | + $module->mblanguage->save($module->key_name); |
|
182 | + } |
|
183 | + } |
|
184 | 184 | } |
185 | 185 | |
186 | 186 | private function synchDDKeys($dom, $sub) { |
187 | - //check for extra keys |
|
187 | + //check for extra keys |
|
188 | 188 | foreach($sub as $key=>$value) { |
189 | - if (!isset($dom[$key])) { |
|
190 | - unset ($sub[$key]); |
|
191 | - } |
|
189 | + if (!isset($dom[$key])) { |
|
190 | + unset ($sub[$key]); |
|
191 | + } |
|
192 | 192 | } |
193 | 193 | //check for missing keys |
194 | 194 | foreach($dom as $key=>$value) { |
195 | - if (!isset($sub[$key])) { |
|
196 | - $sub[$key] = $value; |
|
197 | - } |
|
195 | + if (!isset($sub[$key])) { |
|
196 | + $sub[$key] = $value; |
|
197 | + } |
|
198 | 198 | } |
199 | 199 | return $sub; |
200 | 200 | } |
201 | 201 | |
202 | 202 | function getPatternMatch($dropdown_name) { |
203 | - return '/\s*\$GLOBALS\s*\[\s*\'app_list_strings\s*\'\s*\]\[\s*\'' |
|
204 | - . $dropdown_name.'\'\s*\]\s*=\s*array\s*\([^\)]*\)\s*;\s*/ism'; |
|
203 | + return '/\s*\$GLOBALS\s*\[\s*\'app_list_strings\s*\'\s*\]\[\s*\'' |
|
204 | + . $dropdown_name.'\'\s*\]\s*=\s*array\s*\([^\)]*\)\s*;\s*/ism'; |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | function getNewCustomContents($dropdown_name, $dropdown, $lang) { |
208 | - $contents = return_custom_app_list_strings_file_contents($lang); |
|
208 | + $contents = return_custom_app_list_strings_file_contents($lang); |
|
209 | 209 | $contents = str_replace("?>", '', $contents); |
210 | - if(empty($contents))$contents = "<?php"; |
|
211 | - $contents = preg_replace($this->getPatternMatch($dropdown_name), "\n", $contents); |
|
212 | - $contents .= "\n\$GLOBALS['app_list_strings']['$dropdown_name']=" . var_export_helper($dropdown) . ";"; |
|
213 | - return $contents; |
|
210 | + if(empty($contents))$contents = "<?php"; |
|
211 | + $contents = preg_replace($this->getPatternMatch($dropdown_name), "\n", $contents); |
|
212 | + $contents .= "\n\$GLOBALS['app_list_strings']['$dropdown_name']=" . var_export_helper($dropdown) . ";"; |
|
213 | + return $contents; |
|
214 | 214 | } |
215 | 215 | } |
216 | 216 | ?> |