Beispiel #1
0
 /**
  * @group 42169
  */
 public function testBuildLabels()
 {
     $definition = array('lhs_module' => 'lhs_module', 'lhs_label' => 'lhs_label');
     $activitiesRelationship = new ActivitiesRelationship($definition);
     $actual = $activitiesRelationship->buildLabels();
     foreach ($actual as $item) {
         if (isset($item['display_label']) == false) {
             continue;
         }
         if (is_array($item['display_label'])) {
             if (isset($item['display_label'][$definition['lhs_module']])) {
                 $this->assertEquals($definition['lhs_label'], $item['display_label'][$definition['lhs_module']], 'Label is missed');
             }
         } else {
             $this->assertEquals($definition['lhs_label'], $item['display_label'], 'Label is missed');
         }
     }
 }
 public function run()
 {
     // The Activities dashlets changed in 7.2
     if (!version_compare($this->from_version, '7.2', '<')) {
         return;
     }
     // Array of what modules and what relationship names need to be converted
     $convertModules = array();
     // Look for history files, like the ones created by ActivitiesRelationship.php
     $historyFiles = glob("modules/*/clients/base/views/history/history.php");
     foreach ($historyFiles as $filename) {
         // Need to read the contents to check for a particular comment tag
         $contents = file_get_contents($filename);
         if (strpos($contents, "/* File autogenerated by SugarCRM in ActivitesRelationship.php / buildSidecarDashletMeta */") !== false) {
             // It's a match, actually load the file and use the built array to figure
             // out the relationship
             $coreDefs = array();
             $viewdefs = array();
             require $filename;
             // Convoluted, but where this data is available.
             $moduleName = $coreDefs['dashlets'][0]['filter']['module'][0];
             // buildClientFiles() automatically trims off the _meetings
             $relName = $coreDefs['tabs'][0]['link'];
             $convertModules[$moduleName] = $relName;
         }
     }
     // Grab files first, then process them so glob() doesn't ever freak out.
     foreach ($convertModules as $moduleName => $relName) {
         require_once 'modules/ModuleBuilder/parsers/relationships/ActivitiesRelationship.php';
         $parser = new ActivitiesRelationship(array('for_activities' => true, 'is_custom' => true, 'relationship_name' => $relName, 'lhs_module' => $moduleName));
         $newFiles = $parser->buildClientFiles($relName);
         foreach ($newFiles[$moduleName] as $filepart => $contents) {
             // history.php should be there, the other files might not be so lucky
             $filename = "modules/{$moduleName}/" . $filepart;
             mkdir_recursive(dirname($filename));
             file_put_contents($filename, $contents);
         }
     }
 }
Beispiel #3
0
 public function getLinkFieldDefinition($sourceModule, $relationshipName)
 {
     return parent::getLinkFieldDefinition($sourceModule, $relationshipName);
 }