@@ -102,7 +102,7 @@ discard block  | 
                                                    ||
| 102 | 102 | public function __construct(Func_App $app, $id = null, Widget_Layout $layout = null)  | 
                                                        
| 103 | 103 |      { | 
                                                        
| 104 | 104 | parent::__construct($app);  | 
                                                        
| 105 | - // We simulate inheritance from Widget_VBoxLayout.  | 
                                                        |
| 105 | + // We simulate inheritance from Widget_VBoxLayout.  | 
                                                        |
| 106 | 106 | $W = $this->widgets = bab_Widgets();  | 
                                                        
| 107 | 107 | |
| 108 | 108 | |
@@ -307,9 +307,9 @@ discard block  | 
                                                    ||
| 307 | 307 |              $cancelLabel = isset($this->cancelLabel) ? $this->cancelLabel : $App->translate('Cancel'); | 
                                                        
| 308 | 308 | $this->addButton(  | 
                                                        
| 309 | 309 | $W->SubmitButton(/*'cancel'*/)  | 
                                                        
| 310 | -                     ->addClass('widget-close-dialog') | 
                                                        |
| 310 | +                        ->addClass('widget-close-dialog') | 
                                                        |
| 311 | 311 | ->setAction($this->cancelAction)  | 
                                                        
| 312 | - ->setLabel($cancelLabel)  | 
                                                        |
| 312 | + ->setLabel($cancelLabel)  | 
                                                        |
| 313 | 313 | );  | 
                                                        
| 314 | 314 | }  | 
                                                        
| 315 | 315 | |
@@ -1148,21 +1148,21 @@ discard block  | 
                                                    ||
| 1148 | 1148 | |
| 1149 | 1149 | |
| 1150 | 1150 | |
| 1151 | - protected function addCustomFields(app_RecordSet $recordSet)  | 
                                                        |
| 1152 | -	{ | 
                                                        |
| 1153 | - $customFields = $recordSet->getCustomFields();  | 
                                                        |
| 1151 | + protected function addCustomFields(app_RecordSet $recordSet)  | 
                                                        |
| 1152 | +    { | 
                                                        |
| 1153 | + $customFields = $recordSet->getCustomFields();  | 
                                                        |
| 1154 | 1154 | |
| 1155 | 1155 |          foreach ($customFields as $customField) { | 
                                                        
| 1156 | 1156 | $fieldname = $customField->fieldname;  | 
                                                        
| 1157 | 1157 | $this->addColumn(  | 
                                                        
| 1158 | 1158 | widget_TableModelViewColumn($recordSet->$fieldname, $customField->name)  | 
                                                        
| 1159 | - ->setSortable(true)  | 
                                                        |
| 1160 | - ->setExportable(true)  | 
                                                        |
| 1161 | - ->setSearchable($customField->searchable)  | 
                                                        |
| 1162 | - ->setVisible($customField->visible)  | 
                                                        |
| 1159 | + ->setSortable(true)  | 
                                                        |
| 1160 | + ->setExportable(true)  | 
                                                        |
| 1161 | + ->setSearchable($customField->searchable)  | 
                                                        |
| 1162 | + ->setVisible($customField->visible)  | 
                                                        |
| 1163 | 1163 | );  | 
                                                        
| 1164 | 1164 | }  | 
                                                        
| 1165 | - }  | 
                                                        |
| 1165 | + }  | 
                                                        |
| 1166 | 1166 | |
| 1167 | 1167 | |
| 1168 | 1168 | /**  | 
                                                        
@@ -26,7 +26,7 @@ discard block  | 
                                                    ||
| 26 | 26 |  bab_Widgets()->includePhpClass('widget_InputWidget'); | 
                                                        
| 27 | 27 |  bab_Widgets()->includePhpClass('widget_TableModelView'); | 
                                                        
| 28 | 28 | |
| 29 | -require_once dirname(__FILE__) . '/ui.helpers.php';  | 
                                                        |
| 29 | +require_once dirname(__FILE__).'/ui.helpers.php';  | 
                                                        |
| 30 | 30 | |
| 31 | 31 | /**  | 
                                                        
| 32 | 32 | * @return Widget_Form  | 
                                                        
@@ -669,7 +669,7 @@ discard block  | 
                                                    ||
| 669 | 669 | continue;  | 
                                                        
| 670 | 670 | }  | 
                                                        
| 671 | 671 | |
| 672 | -            list(, , $nbCol) = explode('-', $customSection->sizePolicy); | 
                                                        |
| 672 | +            list(,, $nbCol) = explode('-', $customSection->sizePolicy); | 
                                                        |
| 673 | 673 | |
| 674 | 674 |              if ($currentColumn + $nbCol > 12) { | 
                                                        
| 675 | 675 | $this->addItem($row);  | 
                                                        
@@ -697,7 +697,7 @@ discard block  | 
                                                    ||
| 697 | 697 | $parameters = $displayField['parameters'];  | 
                                                        
| 698 | 698 | $classname = isset($parameters['classname']) ? $parameters['classname'] : '';  | 
                                                        
| 699 | 699 | $label = isset($parameters['label']) && $parameters['label'] !== '__' ? $parameters['label'] : '';  | 
                                                        
| 700 | - $displayFieldMethod = '_' . $displayFieldName;  | 
                                                        |
| 700 | + $displayFieldMethod = '_'.$displayFieldName;  | 
                                                        |
| 701 | 701 | |
| 702 | 702 |                  if (method_exists($this, $displayFieldMethod)) { | 
                                                        
| 703 | 703 | $widget = $this->$displayFieldMethod($customSection);  | 
                                                        
@@ -724,7 +724,7 @@ discard block  | 
                                                    ||
| 724 | 724 | }  | 
                                                        
| 725 | 725 | }  | 
                                                        
| 726 | 726 | |
| 727 | -        if ($currentColumn + $nbCol> 0) { | 
                                                        |
| 727 | +        if ($currentColumn + $nbCol > 0) { | 
                                                        |
| 728 | 728 | $this->addItem($row);  | 
                                                        
| 729 | 729 | }  | 
                                                        
| 730 | 730 | }  | 
                                                        
@@ -757,7 +757,7 @@ discard block  | 
                                                    ||
| 757 | 757 | $parameters = $displayField['parameters'];  | 
                                                        
| 758 | 758 | $classname = isset($parameters['classname']) ? $parameters['classname'] : '';  | 
                                                        
| 759 | 759 | $label = isset($parameters['label']) && $parameters['label'] !== '__' ? $parameters['label'] : '';  | 
                                                        
| 760 | - $displayFieldMethod = '_' . $displayFieldName;  | 
                                                        |
| 760 | + $displayFieldMethod = '_'.$displayFieldName;  | 
                                                        |
| 761 | 761 | |
| 762 | 762 |              if (method_exists($this, $displayFieldMethod)) { | 
                                                        
| 763 | 763 | $widget = $this->$displayFieldMethod($customSection);  | 
                                                        
@@ -996,7 +996,7 @@ discard block  | 
                                                    ||
| 996 | 996 |          $row = $W->Items()->setSizePolicy('row'); | 
                                                        
| 997 | 997 |          foreach ($customSections as $customSection) { | 
                                                        
| 998 | 998 | |
| 999 | -            list(, , $nbCol) = explode('-', $customSection->sizePolicy); | 
                                                        |
| 999 | +            list(,, $nbCol) = explode('-', $customSection->sizePolicy); | 
                                                        |
| 1000 | 1000 | |
| 1001 | 1001 |              if ($currentColumn + $nbCol > 12) { | 
                                                        
| 1002 | 1002 | $this->addItem($row);  | 
                                                        
@@ -1023,7 +1023,7 @@ discard block  | 
                                                    ||
| 1023 | 1023 | $parameters = $displayField['parameters'];  | 
                                                        
| 1024 | 1024 | $classname = isset($parameters['classname']) ? $parameters['classname'] : '';  | 
                                                        
| 1025 | 1025 | $label = isset($parameters['label']) ? $parameters['label'] : '';  | 
                                                        
| 1026 | - $displayFieldMethod = '_' . $displayFieldName;  | 
                                                        |
| 1026 | + $displayFieldMethod = '_'.$displayFieldName;  | 
                                                        |
| 1027 | 1027 | |
| 1028 | 1028 |                  if (method_exists($this, $displayFieldMethod)) { | 
                                                        
| 1029 | 1029 | $value = $this->$displayFieldMethod($customSection);  | 
                                                        
@@ -1048,7 +1048,7 @@ discard block  | 
                                                    ||
| 1048 | 1048 | }  | 
                                                        
| 1049 | 1049 | }  | 
                                                        
| 1050 | 1050 | |
| 1051 | -        if ($currentColumn + $nbCol> 0) { | 
                                                        |
| 1051 | +        if ($currentColumn + $nbCol > 0) { | 
                                                        |
| 1052 | 1052 | $this->addItem($row);  | 
                                                        
| 1053 | 1053 | }  | 
                                                        
| 1054 | 1054 | }  | 
                                                        
@@ -1070,14 +1070,14 @@ discard block  | 
                                                    ||
| 1070 | 1070 | |
| 1071 | 1071 | $fileSize = filesize($file->getFilePath()->tostring());  | 
                                                        
| 1072 | 1072 |      if ($fileSize > 1024 * 1024) { | 
                                                        
| 1073 | -        $fileSizeText = round($fileSize / (1024 * 1024), 1) . ' ' . $App->translate('MB'); | 
                                                        |
| 1073 | +        $fileSizeText = round($fileSize / (1024 * 1024), 1).' '.$App->translate('MB'); | 
                                                        |
| 1074 | 1074 |      } elseif ($fileSize > 1024) { | 
                                                        
| 1075 | -        $fileSizeText = round($fileSize / 1024) . ' ' . $App->translate('KB'); | 
                                                        |
| 1075 | +        $fileSizeText = round($fileSize / 1024).' '.$App->translate('KB'); | 
                                                        |
| 1076 | 1076 |      } else { | 
                                                        
| 1077 | -        $fileSizeText = $fileSize . ' ' . $App->translate('Bytes'); | 
                                                        |
| 1077 | +        $fileSizeText = $fileSize.' '.$App->translate('Bytes'); | 
                                                        |
| 1078 | 1078 | }  | 
                                                        
| 1079 | 1079 | |
| 1080 | - $fileIcon = $W->FileIcon($file->toString() . "\n" . $fileSizeText, $file->getFilePath())  | 
                                                        |
| 1080 | + $fileIcon = $W->FileIcon($file->toString()."\n".$fileSizeText, $file->getFilePath())  | 
                                                        |
| 1081 | 1081 | ->setThumbnailSize($width, $height);  | 
                                                        
| 1082 | 1082 | |
| 1083 | 1083 | return $fileIcon;  | 
                                                        
@@ -1140,7 +1140,7 @@ discard block  | 
                                                    ||
| 1140 | 1140 | // we try to select one according to the classname prefix.  | 
                                                        
| 1141 | 1141 |              list($prefix) = explode('_', get_class($this)); | 
                                                        
| 1142 | 1142 | $functionalityName = ucwords($prefix);  | 
                                                        
| 1143 | -            $this->app = @bab_functionality::get('App/' . $functionalityName); | 
                                                        |
| 1143 | +            $this->app = @bab_functionality::get('App/'.$functionalityName); | 
                                                        |
| 1144 | 1144 |              if (!$this->app) { | 
                                                        
| 1145 | 1145 |                  $this->app = @bab_functionality::get('App'); | 
                                                        
| 1146 | 1146 | }  | 
                                                        
@@ -1201,7 +1201,7 @@ discard block  | 
                                                    ||
| 1201 | 1201 | $this->setCurrentPage(isset($filter['pageNumber']) ? $filter['pageNumber'] : $pageNumber);  | 
                                                        
| 1202 | 1202 | |
| 1203 | 1203 |          if (isset($name)) { | 
                                                        
| 1204 | - $this->sortParameterName = $name . '[filter][sort]';  | 
                                                        |
| 1204 | + $this->sortParameterName = $name.'[filter][sort]';  | 
                                                        |
| 1205 | 1205 |          } else { | 
                                                        
| 1206 | 1206 | $this->sortParameterName = 'filter[sort]';  | 
                                                        
| 1207 | 1207 | }  | 
                                                        
@@ -1353,11 +1353,11 @@ discard block  | 
                                                    ||
| 1353 | 1353 | |
| 1354 | 1354 |          foreach ($columns as $fieldName => $column) { | 
                                                        
| 1355 | 1355 | $field = $column->getField();  | 
                                                        
| 1356 | -            if (! $column->isSearchable()) { | 
                                                        |
| 1356 | +            if (!$column->isSearchable()) { | 
                                                        |
| 1357 | 1357 | continue;  | 
                                                        
| 1358 | 1358 | }  | 
                                                        
| 1359 | 1359 | |
| 1360 | -            if (! ($field instanceof ORM_Field)) { | 
                                                        |
| 1360 | +            if (!($field instanceof ORM_Field)) { | 
                                                        |
| 1361 | 1361 | $field = null;  | 
                                                        
| 1362 | 1362 | }  | 
                                                        
| 1363 | 1363 | |
@@ -1374,7 +1374,7 @@ discard block  | 
                                                    ||
| 1374 | 1374 | |
| 1375 | 1375 | $formItem = $this->handleFilterLabel($label, $input);  | 
                                                        
| 1376 | 1376 |                  $formItem->setSizePolicy('col-lg-2 col-md-3 col-sm-6 col-xs-12'); | 
                                                        
| 1377 | -                $formItem->addClass('field_' . $fieldName); | 
                                                        |
| 1377 | +                $formItem->addClass('field_'.$fieldName); | 
                                                        |
| 1378 | 1378 | |
| 1379 | 1379 | $mainSearch = (method_exists($column, 'isMainSearch') && $column->isMainSearch());  | 
                                                        
| 1380 | 1380 | |
@@ -1387,7 +1387,7 @@ discard block  | 
                                                    ||
| 1387 | 1387 | }  | 
                                                        
| 1388 | 1388 | |
| 1389 | 1389 | |
| 1390 | -        if (! $this->submit) { | 
                                                        |
| 1390 | +        if (!$this->submit) { | 
                                                        |
| 1391 | 1391 | $this->submit = $W->SubmitButton();  | 
                                                        
| 1392 | 1392 |              $this->submit->setLabel(widget_translate('Filter')); | 
                                                        
| 1393 | 1393 | }  | 
                                                        
@@ -1460,7 +1460,7 @@ discard block  | 
                                                    ||
| 1460 | 1460 | // $this->setCurrentPage(isset($filter['pageNumber']) ? $filter['pageNumber'] : $pageNumber);  | 
                                                        
| 1461 | 1461 | |
| 1462 | 1462 |          if (isset($name)) { | 
                                                        
| 1463 | - $this->sortParameterName = $name . '[filter][sort]';  | 
                                                        |
| 1463 | + $this->sortParameterName = $name.'[filter][sort]';  | 
                                                        |
| 1464 | 1464 |          } else { | 
                                                        
| 1465 | 1465 | $this->sortParameterName = 'filter[sort]';  | 
                                                        
| 1466 | 1466 | }  | 
                                                        
@@ -1525,7 +1525,7 @@ discard block  | 
                                                    ||
| 1525 | 1525 | |
| 1526 | 1526 | $tableview->setCurrentPage(isset($filterValues['pageNumber']) ? $filterValues['pageNumber'] : 0);  | 
                                                        
| 1527 | 1527 | |
| 1528 | - $tableview->sortParameterName = $name . '[filter][sort]';  | 
                                                        |
| 1528 | + $tableview->sortParameterName = $name.'[filter][sort]';  | 
                                                        |
| 1529 | 1529 | |
| 1530 | 1530 |      if (isset($filterValues['sort'])) { | 
                                                        
| 1531 | 1531 | $tableview->setSortField($filterValues['sort']);  | 
                                                        
@@ -1811,7 +1811,7 @@ discard block  | 
                                                    ||
| 1811 | 1811 | continue;  | 
                                                        
| 1812 | 1812 | }  | 
                                                        
| 1813 | 1813 | |
| 1814 | -            list(, , $nbCol) = explode('-', $customSection->sizePolicy); | 
                                                        |
| 1814 | +            list(,, $nbCol) = explode('-', $customSection->sizePolicy); | 
                                                        |
| 1815 | 1815 | |
| 1816 | 1816 |              if ($currentColumn + $nbCol > 12) { | 
                                                        
| 1817 | 1817 | $this->addItem($row);  | 
                                                        
@@ -1853,7 +1853,7 @@ discard block  | 
                                                    ||
| 1853 | 1853 | $classname = isset($parameters['classname']) ? $parameters['classname'] : '';  | 
                                                        
| 1854 | 1854 | $label = isset($parameters['label']) ? $parameters['label'] : null;  | 
                                                        
| 1855 | 1855 | |
| 1856 | - $displayFieldMethod = '_' . $displayFieldName;  | 
                                                        |
| 1856 | + $displayFieldMethod = '_'.$displayFieldName;  | 
                                                        |
| 1857 | 1857 |                  if (method_exists($this, $displayFieldMethod)) { | 
                                                        
| 1858 | 1858 | $item = $this->$displayFieldMethod($customSection, $label);  | 
                                                        
| 1859 | 1859 |                  } else { | 
                                                        
@@ -1882,7 +1882,7 @@ discard block  | 
                                                    ||
| 1882 | 1882 | }  | 
                                                        
| 1883 | 1883 | }  | 
                                                        
| 1884 | 1884 | |
| 1885 | -        if ($currentColumn + $nbCol> 0) { | 
                                                        |
| 1885 | +        if ($currentColumn + $nbCol > 0) { | 
                                                        |
| 1886 | 1886 | $this->addItem($row);  | 
                                                        
| 1887 | 1887 | }  | 
                                                        
| 1888 | 1888 | }  | 
                                                        
@@ -1996,7 +1996,7 @@ discard block  | 
                                                    ||
| 1996 | 1996 | |
| 1997 | 1997 | $displayable = $field->output($value);  | 
                                                        
| 1998 | 1998 | |
| 1999 | -        switch(true) { | 
                                                        |
| 1999 | +        switch (true) { | 
                                                        |
| 2000 | 2000 | case ($field instanceof ORM_TextField):  | 
                                                        
| 2001 | 2001 | $displayable = $W->RichText($displayable)->setRenderingOptions(BAB_HTML_ALL ^ BAB_HTML_P);  | 
                                                        
| 2002 | 2002 | break;  | 
                                                        
@@ -286,7 +286,7 @@ discard block  | 
                                                    ||
| 286 | 286 | |
| 287 | 287 | // all widget have static id to not change id of others widgets in page  | 
                                                        
| 288 | 288 | |
| 289 | - $infoMessages = $_SESSION['app_msginfo'];  | 
                                                        |
| 289 | + $infoMessages = $_SESSION['app_msginfo'];  | 
                                                        |
| 290 | 290 |              foreach ($infoMessages as $infoLine) { | 
                                                        
| 291 | 291 | $this->App()->Controller()->addMessage($infoLine);  | 
                                                        
| 292 | 292 | }  | 
                                                        
@@ -304,6 +304,6 @@ discard block  | 
                                                    ||
| 304 | 304 | * @see app.jquery.js#window.babAddonLibApp.numberFormat  | 
                                                        
| 305 | 305 | */  | 
                                                        
| 306 | 306 |          $this->setMetadata('numberFormatSeparator', mb_substr($str, 1, 1)); | 
                                                        
| 307 | -        $this->setMetadata('numberFormatPrecision', mb_strlen($str) -2); | 
                                                        |
| 307 | +        $this->setMetadata('numberFormatPrecision', mb_strlen($str) - 2); | 
                                                        |
| 308 | 308 | }  | 
                                                        
| 309 | 309 | }  | 
                                                        
@@ -1642,7 +1642,7 @@  | 
                                                    ||
| 1642 | 1642 | $W->SubmitButton()  | 
                                                        
| 1643 | 1643 | ->setAjaxAction($confirmedAction)  | 
                                                        
| 1644 | 1644 |                  ->setLabel($App->translate('Delete')) | 
                                                        
| 1645 | - );  | 
                                                        |
| 1645 | + );  | 
                                                        |
| 1646 | 1646 |          $form->addButton($W->SubmitButton()->setLabel($App->translate('Cancel'))->addClass('widget-close-dialog')); | 
                                                        
| 1647 | 1647 | $page->addItem($form);  | 
                                                        
| 1648 | 1648 | |
@@ -21,7 +21,7 @@ discard block  | 
                                                    ||
| 21 | 21 |   * @copyright Copyright (c) 2006 by CANTICO ({@link http://www.cantico.fr}) | 
                                                        
| 22 | 22 | */  | 
                                                        
| 23 | 23 | |
| 24 | -require_once dirname(__FILE__) . '/controller.class.php';  | 
                                                        |
| 24 | +require_once dirname(__FILE__).'/controller.class.php';  | 
                                                        |
| 25 | 25 | |
| 26 | 26 | |
| 27 | 27 | |
@@ -52,7 +52,7 @@ discard block  | 
                                                    ||
| 52 | 52 |      { | 
                                                        
| 53 | 53 | $App = $this->App();  | 
                                                        
| 54 | 54 | $recordClassname = $this->getRecordClassName();  | 
                                                        
| 55 | - $recordSetClassname = $recordClassname . 'Set';  | 
                                                        |
| 55 | + $recordSetClassname = $recordClassname.'Set';  | 
                                                        |
| 56 | 56 | |
| 57 | 57 | $recordSet = $App->$recordSetClassname();  | 
                                                        
| 58 | 58 | return $recordSet;  | 
                                                        
@@ -103,7 +103,7 @@ discard block  | 
                                                    ||
| 103 | 103 |              if ($showLabel) { | 
                                                        
| 104 | 104 | $text = $actions->getTitle();  | 
                                                        
| 105 | 105 | }  | 
                                                        
| 106 | - $html = '<li><a class="icon ' . $actions->getIcon() . '"href="' . $actions->url() . '">' . $text . '</a></li>';  | 
                                                        |
| 106 | + $html = '<li><a class="icon '.$actions->getIcon().'"href="'.$actions->url().'">'.$text.'</a></li>';  | 
                                                        |
| 107 | 107 |          } elseif (is_array($actions)) { | 
                                                        
| 108 | 108 |              if (isset($actions['items'])) { | 
                                                        
| 109 | 109 | $items = $actions['items'];  | 
                                                        
@@ -116,10 +116,10 @@ discard block  | 
                                                    ||
| 116 | 116 |              if (isset($actions['icon'])) { | 
                                                        
| 117 | 117 | |
| 118 | 118 | $html = '<li class="dropdown">'  | 
                                                        
| 119 | - . '<a href="#" class="' . $actions['icon'] . ' icon dropdown-toogle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">'  | 
                                                        |
| 119 | + . '<a href="#" class="'.$actions['icon'].' icon dropdown-toogle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">'  | 
                                                        |
| 120 | 120 | . ($actions['icon'] === 'actions-context-menu'/*Func_Icons::ACTIONS_CONTEXT_MENU*/ ? '' : '<span class="caret"></span>')  | 
                                                        
| 121 | 121 | . '</a>'  | 
                                                        
| 122 | - . '<ul class="dropdown-menu dropdown-menu-right ' . Func_Icons::ICON_LEFT_SYMBOLIC . '">'  | 
                                                        |
| 122 | + . '<ul class="dropdown-menu dropdown-menu-right '.Func_Icons::ICON_LEFT_SYMBOLIC.'">'  | 
                                                        |
| 123 | 123 | . $html  | 
                                                        
| 124 | 124 | . '</ul>';  | 
                                                        
| 125 | 125 | }  | 
                                                        
@@ -142,7 +142,7 @@ discard block  | 
                                                    ||
| 142 | 142 | |
| 143 | 143 | $recordClassname = $this->getRecordClassName();  | 
                                                        
| 144 | 144 | |
| 145 | - $viewClassname = $recordClassname . 'TableView';  | 
                                                        |
| 145 | + $viewClassname = $recordClassname.'TableView';  | 
                                                        |
| 146 | 146 |          if (method_exists($Ui, $viewClassname)) { | 
                                                        
| 147 | 147 | $types['table'] = array(  | 
                                                        
| 148 | 148 | 'classname' => $viewClassname,  | 
                                                        
@@ -151,7 +151,7 @@ discard block  | 
                                                    ||
| 151 | 151 | );  | 
                                                        
| 152 | 152 | }  | 
                                                        
| 153 | 153 | |
| 154 | - $viewClassname = $recordClassname . 'CardsView';  | 
                                                        |
| 154 | + $viewClassname = $recordClassname.'CardsView';  | 
                                                        |
| 155 | 155 |          if (method_exists($Ui, $viewClassname)) { | 
                                                        
| 156 | 156 | $types['cards'] = array(  | 
                                                        
| 157 | 157 | 'classname' => $viewClassname,  | 
                                                        
@@ -160,7 +160,7 @@ discard block  | 
                                                    ||
| 160 | 160 | );  | 
                                                        
| 161 | 161 | }  | 
                                                        
| 162 | 162 | |
| 163 | - $viewClassname = $recordClassname . 'MapView';  | 
                                                        |
| 163 | + $viewClassname = $recordClassname.'MapView';  | 
                                                        |
| 164 | 164 |          if (method_exists($Ui, $viewClassname)) { | 
                                                        
| 165 | 165 | $types['map'] = array(  | 
                                                        
| 166 | 166 | 'classname' => $viewClassname,  | 
                                                        
@@ -232,7 +232,7 @@ discard block  | 
                                                    ||
| 232 | 232 |          foreach ($allViewSections as $viewSection) { | 
                                                        
| 233 | 233 | $fields = $viewSection->getFields();  | 
                                                        
| 234 | 234 |              foreach ($fields as $field) { | 
                                                        
| 235 | - $allViewFieldNames[$field['fieldname']] = $viewSection->view . ',' . $viewSection->rank . ',' . $viewSection->id;  | 
                                                        |
| 235 | + $allViewFieldNames[$field['fieldname']] = $viewSection->view.','.$viewSection->rank.','.$viewSection->id;  | 
                                                        |
| 236 | 236 | }  | 
                                                        
| 237 | 237 | }  | 
                                                        
| 238 | 238 | |
@@ -256,7 +256,7 @@ discard block  | 
                                                    ||
| 256 | 256 | bab_Sort::asort($availableFields, 'description', bab_Sort::CASE_INSENSITIVE);  | 
                                                        
| 257 | 257 | |
| 258 | 258 |          foreach ($availableFields as $field) { | 
                                                        
| 259 | - $fieldName = $field['name'];  | 
                                                        |
| 259 | + $fieldName = $field['name'];  | 
                                                        |
| 260 | 260 | $fieldDescription = $field['description'];  | 
                                                        
| 261 | 261 | |
| 262 | 262 | $used = isset($allViewFieldNames[$fieldName]);  | 
                                                        
@@ -450,7 +450,7 @@ discard block  | 
                                                    ||
| 450 | 450 | $nbCol = 0;  | 
                                                        
| 451 | 451 |          foreach ($customSections as $customSection) { | 
                                                        
| 452 | 452 | |
| 453 | -            list(, , $nbCol) = explode('-', $customSection->sizePolicy); | 
                                                        |
| 453 | +            list(,, $nbCol) = explode('-', $customSection->sizePolicy); | 
                                                        |
| 454 | 454 | |
| 455 | 455 |  //             if ($currentColumn + $nbCol > 12) { | 
                                                        
| 456 | 456 | // $sectionsSection->addItem($row);  | 
                                                        
@@ -461,8 +461,8 @@ discard block  | 
                                                    ||
| 461 | 461 | $currentColumn += $nbCol;  | 
                                                        
| 462 | 462 | |
| 463 | 463 | $sectionSection = $W->Section(  | 
                                                        
| 464 | -                $customSection->name . ' (' . $customSection->rank . ')', | 
                                                        |
| 465 | -                $sectionBox = $W->VBoxItems($W->Hidden()->setName('#' . $customSection->id)) | 
                                                        |
| 464 | +                $customSection->name.' ('.$customSection->rank.')', | 
                                                        |
| 465 | +                $sectionBox = $W->VBoxItems($W->Hidden()->setName('#'.$customSection->id)) | 
                                                        |
| 466 | 466 |  //                     ->addClass('widget-dockable-content') | 
                                                        
| 467 | 467 | );  | 
                                                        
| 468 | 468 |              $sectionSection->addClass('crm-custom-section'); | 
                                                        
@@ -507,16 +507,16 @@ discard block  | 
                                                    ||
| 507 | 507 | }  | 
                                                        
| 508 | 508 | |
| 509 | 509 | $fieldItem = $W->FlowItems(  | 
                                                        
| 510 | - $W->Label($fieldDescription)->setSizePolicy(Func_Icons::ICON_LEFT_16 . ' widget-80pc' ),  | 
                                                        |
| 510 | + $W->Label($fieldDescription)->setSizePolicy(Func_Icons::ICON_LEFT_16.' widget-80pc'),  | 
                                                        |
| 511 | 511 | $W->FlowItems(  | 
                                                        
| 512 | - $W->Hidden()->setName($customSection->id . '.' . $fieldId)->setValue($field['name']),  | 
                                                        |
| 512 | + $W->Hidden()->setName($customSection->id.'.'.$fieldId)->setValue($field['name']),  | 
                                                        |
| 513 | 513 |                          $W->Link('', $this->proxy()->editDisplayField($customSection->id, $field['name'])) | 
                                                        
| 514 | 514 |                              ->addClass('icon', Func_Icons::ACTIONS_DOCUMENT_EDIT) | 
                                                        
| 515 | 515 | ->setOpenMode(Widget_Link::OPEN_DIALOG),  | 
                                                        
| 516 | 516 |                          $W->Link('', $this->proxy()->removeDisplayField($customSection->id, $field['name'])) | 
                                                        
| 517 | 517 |                              ->addClass('icon', Func_Icons::ACTIONS_LIST_REMOVE) | 
                                                        
| 518 | 518 | ->setAjaxAction()  | 
                                                        
| 519 | - )->setSizePolicy(Func_Icons::ICON_LEFT_16 . ' widget-20pc widget-align-right widget-actions' )  | 
                                                        |
| 519 | + )->setSizePolicy(Func_Icons::ICON_LEFT_16.' widget-20pc widget-align-right widget-actions')  | 
                                                        |
| 520 | 520 |                  )->setSizePolicy('widget-list-element  widget-actions-target'); | 
                                                        
| 521 | 521 | |
| 522 | 522 | $sectionBox->addItem($fieldItem);  | 
                                                        
@@ -589,7 +589,7 @@ discard block  | 
                                                    ||
| 589 | 589 | }  | 
                                                        
| 590 | 590 | |
| 591 | 591 |          header('Content-type: application/json'); | 
                                                        
| 592 | -        header('Content-Disposition: attachment; filename="' . $objectName . '.' . ($view === '' ? 'default' : $view) . '.json"'."\n"); | 
                                                        |
| 592 | +        header('Content-Disposition: attachment; filename="'.$objectName.'.'.($view === '' ? 'default' : $view).'.json"'."\n"); | 
                                                        |
| 593 | 593 | |
| 594 | 594 | $json = bab_json_encode($sectionsValues);  | 
                                                        
| 595 | 595 | $json = bab_convertStringFromDatabase($json, bab_charset::UTF_8);  | 
                                                        
@@ -833,11 +833,11 @@ discard block  | 
                                                    ||
| 833 | 833 | $recordSet = $this->getEditRecordSet();  | 
                                                        
| 834 | 834 | |
| 835 | 835 | $recordClassname = $this->getRecordClassName();  | 
                                                        
| 836 | - $editorClassname = $recordClassname . 'SectionEditor';  | 
                                                        |
| 836 | + $editorClassname = $recordClassname.'SectionEditor';  | 
                                                        |
| 837 | 837 | /* @var $editor app_RecordEditor */  | 
                                                        
| 838 | 838 | $editor = $Ui->$editorClassname();  | 
                                                        
| 839 | 839 |          if (!isset($itemId)) { | 
                                                        
| 840 | - $itemId = $this->getClass() . '.' . __FUNCTION__;  | 
                                                        |
| 840 | + $itemId = $this->getClass().'.'.__FUNCTION__;  | 
                                                        |
| 841 | 841 | }  | 
                                                        
| 842 | 842 | $editor->setId($itemId);  | 
                                                        
| 843 | 843 |          $editor->setHiddenValue('tg', $App->controllerTg); | 
                                                        
@@ -880,7 +880,7 @@ discard block  | 
                                                    ||
| 880 | 880 | public function getModelViewDefaultId($itemId = null)  | 
                                                        
| 881 | 881 |      { | 
                                                        
| 882 | 882 |          if (!isset($itemId)) { | 
                                                        
| 883 | - $itemId = $this->getClass() . '.modelView';  | 
                                                        |
| 883 | + $itemId = $this->getClass().'.modelView';  | 
                                                        |
| 884 | 884 | }  | 
                                                        
| 885 | 885 | |
| 886 | 886 | return $itemId;  | 
                                                        
@@ -914,16 +914,16 @@ discard block  | 
                                                    ||
| 914 | 914 | |
| 915 | 915 |          switch ($type) { | 
                                                        
| 916 | 916 | case 'cards':  | 
                                                        
| 917 | - $tableviewClassname = $recordClassname . 'CardsView';  | 
                                                        |
| 917 | + $tableviewClassname = $recordClassname.'CardsView';  | 
                                                        |
| 918 | 918 | break;  | 
                                                        
| 919 | 919 | |
| 920 | 920 | case 'map':  | 
                                                        
| 921 | - $tableviewClassname = $recordClassname . 'MapView';  | 
                                                        |
| 921 | + $tableviewClassname = $recordClassname.'MapView';  | 
                                                        |
| 922 | 922 | break;  | 
                                                        
| 923 | 923 | |
| 924 | 924 | case 'table':  | 
                                                        
| 925 | 925 | default:  | 
                                                        
| 926 | - $tableviewClassname = $recordClassname . 'TableView';  | 
                                                        |
| 926 | + $tableviewClassname = $recordClassname.'TableView';  | 
                                                        |
| 927 | 927 | break;  | 
                                                        
| 928 | 928 | }  | 
                                                        
| 929 | 929 | |
@@ -989,10 +989,10 @@ discard block  | 
                                                    ||
| 989 | 989 | $Ui = $App->Ui();  | 
                                                        
| 990 | 990 | |
| 991 | 991 | $recordClassname = $this->getRecordClassName();  | 
                                                        
| 992 | - $editorClassname = $recordClassname . 'Editor';  | 
                                                        |
| 992 | + $editorClassname = $recordClassname.'Editor';  | 
                                                        |
| 993 | 993 | $editor = $Ui->$editorClassname();  | 
                                                        
| 994 | 994 |          if (!isset($itemId)) { | 
                                                        
| 995 | - $itemId = $this->getClass() . '_' . __FUNCTION__;  | 
                                                        |
| 995 | + $itemId = $this->getClass().'_'.__FUNCTION__;  | 
                                                        |
| 996 | 996 | }  | 
                                                        
| 997 | 997 | $editor->setId($itemId);  | 
                                                        
| 998 | 998 |          $editor->setHiddenValue('tg', $App->controllerTg); | 
                                                        
@@ -1037,7 +1037,7 @@ discard block  | 
                                                    ||
| 1037 | 1037 | $W->Link(  | 
                                                        
| 1038 | 1038 | '',  | 
                                                        
| 1039 | 1039 | $proxy->setFilteredViewType($tableView->getId(), $viewTypeId)  | 
                                                        
| 1040 | -                    )->addClass('icon', $viewType['icon'] . ($filteredViewType=== $viewTypeId ? ' active' : '')) | 
                                                        |
| 1040 | +                    )->addClass('icon', $viewType['icon'].($filteredViewType === $viewTypeId ? ' active' : '')) | 
                                                        |
| 1041 | 1041 |  //                    ->setSizePolicy('btn btn-xs btn-default ' . ($filteredViewType === $viewTypeId ? 'active' : '')) | 
                                                        
| 1042 | 1042 | ->setTitle($viewType['label'])  | 
                                                        
| 1043 | 1043 | ->setAjaxAction()  | 
                                                        
@@ -1081,7 +1081,7 @@ discard block  | 
                                                    ||
| 1081 | 1081 | |
| 1082 | 1082 | $filterVisibility = $this->getFilterVisibility($itemId);  | 
                                                        
| 1083 | 1083 | $filterVisibility = !$filterVisibility;  | 
                                                        
| 1084 | - $W->setUserConfiguration($itemId . '/filterVisibility', $filterVisibility);  | 
                                                        |
| 1084 | + $W->setUserConfiguration($itemId.'/filterVisibility', $filterVisibility);  | 
                                                        |
| 1085 | 1085 | |
| 1086 | 1086 | return true;  | 
                                                        
| 1087 | 1087 | }  | 
                                                        
@@ -1094,10 +1094,10 @@ discard block  | 
                                                    ||
| 1094 | 1094 | protected function getFilterVisibility($itemId)  | 
                                                        
| 1095 | 1095 |      { | 
                                                        
| 1096 | 1096 | $W = bab_Widgets();  | 
                                                        
| 1097 | - $filterVisibility = $W->getUserConfiguration($itemId . '/filterVisibility');  | 
                                                        |
| 1097 | + $filterVisibility = $W->getUserConfiguration($itemId.'/filterVisibility');  | 
                                                        |
| 1098 | 1098 |          if (!isset($filterVisibility)) { | 
                                                        
| 1099 | 1099 | $filterVisibility = false;  | 
                                                        
| 1100 | - $W->setUserConfiguration($itemId . '/filterVisibility', $filterVisibility);  | 
                                                        |
| 1100 | + $W->setUserConfiguration($itemId.'/filterVisibility', $filterVisibility);  | 
                                                        |
| 1101 | 1101 | }  | 
                                                        
| 1102 | 1102 | return $filterVisibility;  | 
                                                        
| 1103 | 1103 | }  | 
                                                        
@@ -1111,7 +1111,7 @@ discard block  | 
                                                    ||
| 1111 | 1111 | protected function getFilteredViewType($itemId)  | 
                                                        
| 1112 | 1112 |      { | 
                                                        
| 1113 | 1113 | $W = bab_Widgets();  | 
                                                        
| 1114 | - $type = $W->getUserConfiguration($itemId . '/viewType');  | 
                                                        |
| 1114 | + $type = $W->getUserConfiguration($itemId.'/viewType');  | 
                                                        |
| 1115 | 1115 |          if (!isset($type)) { | 
                                                        
| 1116 | 1116 | $type = 'table';  | 
                                                        
| 1117 | 1117 | }  | 
                                                        
@@ -1127,7 +1127,7 @@ discard block  | 
                                                    ||
| 1127 | 1127 | public function setFilteredViewType($itemId, $type = null)  | 
                                                        
| 1128 | 1128 |      { | 
                                                        
| 1129 | 1129 | $W = bab_Widgets();  | 
                                                        
| 1130 | - $W->setUserConfiguration($itemId . '/viewType', $type);  | 
                                                        |
| 1130 | + $W->setUserConfiguration($itemId.'/viewType', $type);  | 
                                                        |
| 1131 | 1131 | |
| 1132 | 1132 | return true;  | 
                                                        
| 1133 | 1133 | }  | 
                                                        
@@ -1272,14 +1272,14 @@ discard block  | 
                                                    ||
| 1272 | 1272 | |
| 1273 | 1273 |          switch ($format) { | 
                                                        
| 1274 | 1274 | case 'xlsx':  | 
                                                        
| 1275 | - $tableview->downloadXlsx($filename . '.xlsx');  | 
                                                        |
| 1275 | + $tableview->downloadXlsx($filename.'.xlsx');  | 
                                                        |
| 1276 | 1276 | case 'xls':  | 
                                                        
| 1277 | - $tableview->downloadExcel($filename . '.xls');  | 
                                                        |
| 1277 | + $tableview->downloadExcel($filename.'.xls');  | 
                                                        |
| 1278 | 1278 | case 'ssv':  | 
                                                        
| 1279 | - $tableview->downloadCsv($filename . '.csv', ';', $inline, 'Windows-1252');  | 
                                                        |
| 1279 | + $tableview->downloadCsv($filename.'.csv', ';', $inline, 'Windows-1252');  | 
                                                        |
| 1280 | 1280 | case 'csv':  | 
                                                        
| 1281 | 1281 | default:  | 
                                                        
| 1282 | - $tableview->downloadCsv($filename . '.csv', ',', $inline, bab_charset::getIso());  | 
                                                        |
| 1282 | + $tableview->downloadCsv($filename.'.csv', ',', $inline, bab_charset::getIso());  | 
                                                        |
| 1283 | 1283 | }  | 
                                                        
| 1284 | 1284 | }  | 
                                                        
| 1285 | 1285 | |
@@ -1307,7 +1307,7 @@ discard block  | 
                                                    ||
| 1307 | 1307 | $Ui = $App->Ui();  | 
                                                        
| 1308 | 1308 | |
| 1309 | 1309 | $recordClassname = $this->getRecordClassName();  | 
                                                        
| 1310 | - $fullFrameClassname = $recordClassname . 'FullFrame';  | 
                                                        |
| 1310 | + $fullFrameClassname = $recordClassname.'FullFrame';  | 
                                                        |
| 1311 | 1311 | $fullFrame = $Ui->$fullFrameClassname($record, $view);  | 
                                                        
| 1312 | 1312 | |
| 1313 | 1313 | |
@@ -1470,7 +1470,7 @@ discard block  | 
                                                    ||
| 1470 | 1470 | |
| 1471 | 1471 | $recordTitle = $record->getRecordTitle();  | 
                                                        
| 1472 | 1472 | |
| 1473 | -        $message = sprintf($App->translate('%s has been deleted'), $App->translate($recordSet->getDescription()) . ' "' . $recordTitle . '"'); | 
                                                        |
| 1473 | +        $message = sprintf($App->translate('%s has been deleted'), $App->translate($recordSet->getDescription()).' "'.$recordTitle.'"'); | 
                                                        |
| 1474 | 1474 | return $message;  | 
                                                        
| 1475 | 1475 | }  | 
                                                        
| 1476 | 1476 | |
@@ -1597,7 +1597,7 @@ discard block  | 
                                                    ||
| 1597 | 1597 | $this->addMessage($deletedMessage);  | 
                                                        
| 1598 | 1598 | }  | 
                                                        
| 1599 | 1599 | |
| 1600 | -        $this->addReloadSelector('.depends-' . strtolower($record->getClassName())); | 
                                                        |
| 1600 | +        $this->addReloadSelector('.depends-'.strtolower($record->getClassName())); | 
                                                        |
| 1601 | 1601 | |
| 1602 | 1602 | return true;  | 
                                                        
| 1603 | 1603 | }  | 
                                                        
@@ -1628,7 +1628,7 @@ discard block  | 
                                                    ||
| 1628 | 1628 | |
| 1629 | 1629 | $recordTitle = $record->getRecordTitle();  | 
                                                        
| 1630 | 1630 | |
| 1631 | - $subTitle = $App->translate($recordSet->getDescription()) . ' "' . $recordTitle . '"';  | 
                                                        |
| 1631 | + $subTitle = $App->translate($recordSet->getDescription()).' "'.$recordTitle.'"';  | 
                                                        |
| 1632 | 1632 | $form->addItem($W->Title($subTitle, 5));  | 
                                                        
| 1633 | 1633 | |
| 1634 | 1634 |          $form->addItem($W->Title($App->translate('Confirm delete?'), 6)); | 
                                                        
@@ -47,78 +47,78 @@ discard block  | 
                                                    ||
| 47 | 47 | /**  | 
                                                        
| 48 | 48 | * @param Func_App $App  | 
                                                        
| 49 | 49 | */  | 
                                                        
| 50 | - public function __construct(Func_App $App = null)  | 
                                                        |
| 51 | -	{ | 
                                                        |
| 52 | - parent::__construct($App);  | 
                                                        |
| 53 | -  | 
                                                        |
| 54 | -		$this->setDescription('Custom field'); | 
                                                        |
| 55 | -  | 
                                                        |
| 56 | -		$this->setPrimaryKey('id'); | 
                                                        |
| 57 | -  | 
                                                        |
| 58 | - $this->addFields(  | 
                                                        |
| 59 | -			ORM_StringField('name') | 
                                                        |
| 60 | -				->setDescription('Name of field used for display'), | 
                                                        |
| 61 | -			ORM_StringField('fieldname') | 
                                                        |
| 62 | -				->setDescription('Name of field used in table, not modifiable'), | 
                                                        |
| 63 | -			ORM_TextField('description') | 
                                                        |
| 64 | -				->setDescription('Optional description'), | 
                                                        |
| 65 | -			ORM_EnumField('object', $this->getObjects()) | 
                                                        |
| 66 | -				->setDescription('Name of object in App ex : Article, Contact, Organization...'), | 
                                                        |
| 67 | -			ORM_EnumField('fieldtype', $this->getFieldTypes()) | 
                                                        |
| 68 | -				->setDescription('Name of ORM field ex : Enum, String, Text, Bool...'), | 
                                                        |
| 69 | -			ORM_TextField('enumvalues') | 
                                                        |
| 70 | -				->setDescription('serialized array of values for enum fields'), | 
                                                        |
| 71 | -			ORM_BoolField('mandatory') | 
                                                        |
| 72 | -				->setDescription('Mandatory') | 
                                                        |
| 73 | - );  | 
                                                        |
| 74 | -  | 
                                                        |
| 75 | -		if ($App->onlineShop) { | 
                                                        |
| 76 | - $this->addFields(  | 
                                                        |
| 77 | -				ORM_BoolField('visible_in_shop') | 
                                                        |
| 78 | - );  | 
                                                        |
| 79 | - }  | 
                                                        |
| 80 | - }  | 
                                                        |
| 81 | -  | 
                                                        |
| 82 | -  | 
                                                        |
| 83 | -  | 
                                                        |
| 84 | - /**  | 
                                                        |
| 85 | - * List of objects where custom fields are applicable.  | 
                                                        |
| 86 | - *  | 
                                                        |
| 87 | - * @return string[]  | 
                                                        |
| 88 | - */  | 
                                                        |
| 89 | - public function getObjects()  | 
                                                        |
| 90 | -	{ | 
                                                        |
| 91 | - $App = $this->App();  | 
                                                        |
| 92 | -  | 
                                                        |
| 93 | - $arr = array();  | 
                                                        |
| 94 | -  | 
                                                        |
| 95 | -		if (isset($App->Article)) { | 
                                                        |
| 96 | -			$arr['Article'] = $App->translate('Products database'); | 
                                                        |
| 97 | - }  | 
                                                        |
| 98 | -  | 
                                                        |
| 99 | - return $arr;  | 
                                                        |
| 100 | - }  | 
                                                        |
| 101 | -  | 
                                                        |
| 102 | - /**  | 
                                                        |
| 103 | - * list of ORM fields to use for a custom field  | 
                                                        |
| 104 | - */  | 
                                                        |
| 105 | - public function getFieldTypes()  | 
                                                        |
| 106 | -	{ | 
                                                        |
| 107 | - $App = $this->App();  | 
                                                        |
| 108 | -  | 
                                                        |
| 109 | - return array(  | 
                                                        |
| 110 | -			'String' 	=> $App->translate('Line edit'), | 
                                                        |
| 111 | -			'Text'		=> $App->translate('Text edit'), | 
                                                        |
| 112 | -			'Bool'		=> $App->translate('Checkbox'), | 
                                                        |
| 113 | -			'Int'		=> $App->translate('Integer number'), | 
                                                        |
| 114 | -			'Decimal'	=> $App->translate('Decimal number'), | 
                                                        |
| 115 | -			'Date'		=> $App->translate('Date'), | 
                                                        |
| 116 | -			'DateTime'	=> $App->translate('Date and time'), | 
                                                        |
| 117 | -			'Enum' 		=> $App->translate('Selection list'), | 
                                                        |
| 118 | -			'Url' 		=> $App->translate('Url'), | 
                                                        |
| 119 | -			'Email' 	=> $App->translate('Email address'), | 
                                                        |
| 120 | - );  | 
                                                        |
| 121 | - }  | 
                                                        |
| 50 | + public function __construct(Func_App $App = null)  | 
                                                        |
| 51 | +    { | 
                                                        |
| 52 | + parent::__construct($App);  | 
                                                        |
| 53 | +  | 
                                                        |
| 54 | +        $this->setDescription('Custom field'); | 
                                                        |
| 55 | +  | 
                                                        |
| 56 | +        $this->setPrimaryKey('id'); | 
                                                        |
| 57 | +  | 
                                                        |
| 58 | + $this->addFields(  | 
                                                        |
| 59 | +            ORM_StringField('name') | 
                                                        |
| 60 | +                ->setDescription('Name of field used for display'), | 
                                                        |
| 61 | +            ORM_StringField('fieldname') | 
                                                        |
| 62 | +                ->setDescription('Name of field used in table, not modifiable'), | 
                                                        |
| 63 | +            ORM_TextField('description') | 
                                                        |
| 64 | +                ->setDescription('Optional description'), | 
                                                        |
| 65 | +            ORM_EnumField('object', $this->getObjects()) | 
                                                        |
| 66 | +                ->setDescription('Name of object in App ex : Article, Contact, Organization...'), | 
                                                        |
| 67 | +            ORM_EnumField('fieldtype', $this->getFieldTypes()) | 
                                                        |
| 68 | +                ->setDescription('Name of ORM field ex : Enum, String, Text, Bool...'), | 
                                                        |
| 69 | +            ORM_TextField('enumvalues') | 
                                                        |
| 70 | +                ->setDescription('serialized array of values for enum fields'), | 
                                                        |
| 71 | +            ORM_BoolField('mandatory') | 
                                                        |
| 72 | +                ->setDescription('Mandatory') | 
                                                        |
| 73 | + );  | 
                                                        |
| 74 | +  | 
                                                        |
| 75 | +        if ($App->onlineShop) { | 
                                                        |
| 76 | + $this->addFields(  | 
                                                        |
| 77 | +                ORM_BoolField('visible_in_shop') | 
                                                        |
| 78 | + );  | 
                                                        |
| 79 | + }  | 
                                                        |
| 80 | + }  | 
                                                        |
| 81 | +  | 
                                                        |
| 82 | +  | 
                                                        |
| 83 | +  | 
                                                        |
| 84 | + /**  | 
                                                        |
| 85 | + * List of objects where custom fields are applicable.  | 
                                                        |
| 86 | + *  | 
                                                        |
| 87 | + * @return string[]  | 
                                                        |
| 88 | + */  | 
                                                        |
| 89 | + public function getObjects()  | 
                                                        |
| 90 | +    { | 
                                                        |
| 91 | + $App = $this->App();  | 
                                                        |
| 92 | +  | 
                                                        |
| 93 | + $arr = array();  | 
                                                        |
| 94 | +  | 
                                                        |
| 95 | +        if (isset($App->Article)) { | 
                                                        |
| 96 | +            $arr['Article'] = $App->translate('Products database'); | 
                                                        |
| 97 | + }  | 
                                                        |
| 98 | +  | 
                                                        |
| 99 | + return $arr;  | 
                                                        |
| 100 | + }  | 
                                                        |
| 101 | +  | 
                                                        |
| 102 | + /**  | 
                                                        |
| 103 | + * list of ORM fields to use for a custom field  | 
                                                        |
| 104 | + */  | 
                                                        |
| 105 | + public function getFieldTypes()  | 
                                                        |
| 106 | +    { | 
                                                        |
| 107 | + $App = $this->App();  | 
                                                        |
| 108 | +  | 
                                                        |
| 109 | + return array(  | 
                                                        |
| 110 | +            'String' 	=> $App->translate('Line edit'), | 
                                                        |
| 111 | +            'Text'		=> $App->translate('Text edit'), | 
                                                        |
| 112 | +            'Bool'		=> $App->translate('Checkbox'), | 
                                                        |
| 113 | +            'Int'		=> $App->translate('Integer number'), | 
                                                        |
| 114 | +            'Decimal'	=> $App->translate('Decimal number'), | 
                                                        |
| 115 | +            'Date'		=> $App->translate('Date'), | 
                                                        |
| 116 | +            'DateTime'	=> $App->translate('Date and time'), | 
                                                        |
| 117 | +            'Enum' 		=> $App->translate('Selection list'), | 
                                                        |
| 118 | +            'Url' 		=> $App->translate('Url'), | 
                                                        |
| 119 | +            'Email' 	=> $App->translate('Email address'), | 
                                                        |
| 120 | + );  | 
                                                        |
| 121 | + }  | 
                                                        |
| 122 | 122 | |
| 123 | 123 | /**  | 
                                                        
| 124 | 124 | * @return ORM_Criteria  | 
                                                        
@@ -183,7 +183,7 @@ discard block  | 
                                                    ||
| 183 | 183 | case 'Bool':  | 
                                                        
| 184 | 184 | $field = ORM_BoolField($this->fieldname);  | 
                                                        
| 185 | 185 | $field->setOutputOptions(  | 
                                                        
| 186 | -                       $this->App()->translate('No'), | 
                                                        |
| 186 | +                        $this->App()->translate('No'), | 
                                                        |
| 187 | 187 |                      $this->App()->translate('Yes') | 
                                                        
| 188 | 188 | );  | 
                                                        
| 189 | 189 | break;  | 
                                                        
@@ -200,80 +200,80 @@ discard block  | 
                                                    ||
| 200 | 200 | }  | 
                                                        
| 201 | 201 | |
| 202 | 202 | |
| 203 | - /**  | 
                                                        |
| 204 | - * @return string[]  | 
                                                        |
| 205 | - */  | 
                                                        |
| 206 | - public function getEnumValues()  | 
                                                        |
| 207 | -	{ | 
                                                        |
| 208 | - return unserialize($this->enumvalues);  | 
                                                        |
| 209 | - }  | 
                                                        |
| 210 | -  | 
                                                        |
| 211 | -  | 
                                                        |
| 212 | - /**  | 
                                                        |
| 213 | - * @return Widget_LabelledWidget  | 
                                                        |
| 214 | - */  | 
                                                        |
| 215 | - public function getWidget()  | 
                                                        |
| 216 | -	{ | 
                                                        |
| 217 | - $W = bab_Widgets();  | 
                                                        |
| 218 | - $App = $this->App();  | 
                                                        |
| 219 | -  | 
                                                        |
| 220 | -		switch ($this->fieldtype) { | 
                                                        |
| 221 | - case 'Text':  | 
                                                        |
| 222 | - $widget = $W->TextEdit()->setLines(3)->setColumns(70);  | 
                                                        |
| 223 | - break;  | 
                                                        |
| 224 | -  | 
                                                        |
| 225 | - case 'Bool':  | 
                                                        |
| 226 | - $widget = $W->Checkbox();  | 
                                                        |
| 227 | - break;  | 
                                                        |
| 228 | -  | 
                                                        |
| 229 | - case 'Enum':  | 
                                                        |
| 230 | -				$options = array('' => '') + $this->getEnumValues(); | 
                                                        |
| 231 | - $widget = $W->Select()->setOptions($options);  | 
                                                        |
| 232 | - break;  | 
                                                        |
| 233 | -  | 
                                                        |
| 234 | - case 'Date':  | 
                                                        |
| 235 | - $widget = $W->DatePicker();  | 
                                                        |
| 236 | - break;  | 
                                                        |
| 237 | -  | 
                                                        |
| 238 | - case 'DateTime':  | 
                                                        |
| 239 | - $widget = $W->DateTimePicker();  | 
                                                        |
| 240 | - break;  | 
                                                        |
| 241 | -  | 
                                                        |
| 242 | - case 'Int':  | 
                                                        |
| 243 | - $widget = $W->RegExpLineEdit();  | 
                                                        |
| 244 | - $widget->setRegExp(Widget_RegExpLineEdit::INT_FORMAT)  | 
                                                        |
| 245 | -					->setSubmitMessage(sprintf($App->translate('The field %s should be a integer number'), $this->name)) | 
                                                        |
| 246 | - ->setSize(10);  | 
                                                        |
| 247 | - break;  | 
                                                        |
| 248 | -  | 
                                                        |
| 249 | - case 'Decimal':  | 
                                                        |
| 250 | - $widget = $W->RegExpLineEdit();  | 
                                                        |
| 251 | - $widget->setRegExp(Widget_RegExpLineEdit::FLOAT_FORMAT)  | 
                                                        |
| 252 | -					->setSubmitMessage(sprintf($App->translate('The field %s should be a decimal number'), $this->name)) | 
                                                        |
| 253 | - ->setSize(10);  | 
                                                        |
| 254 | - break;  | 
                                                        |
| 255 | -  | 
                                                        |
| 256 | - case 'Url':  | 
                                                        |
| 257 | - $widget = $W->UrlLineEdit();  | 
                                                        |
| 258 | - break;  | 
                                                        |
| 259 | -  | 
                                                        |
| 260 | - case 'Email':  | 
                                                        |
| 261 | - $widget = $W->EmailLineEdit();  | 
                                                        |
| 262 | - break;  | 
                                                        |
| 263 | -  | 
                                                        |
| 264 | - default:  | 
                                                        |
| 265 | - case 'String':  | 
                                                        |
| 266 | - $widget = $W->LineEdit()->setSize(70)->setMaxSize(255);  | 
                                                        |
| 267 | - break;  | 
                                                        |
| 268 | - }  | 
                                                        |
| 269 | -  | 
                                                        |
| 270 | - $labelledItem = $W->LabelledWidget($this->name, $widget, null);  | 
                                                        |
| 271 | - $labelledItem->setName($this->fieldname);  | 
                                                        |
| 272 | -  | 
                                                        |
| 273 | -		if (!empty($this->description)) { | 
                                                        |
| 274 | - $labelledItem->setDescription($this->description);  | 
                                                        |
| 275 | - }  | 
                                                        |
| 276 | -  | 
                                                        |
| 277 | - return $labelledItem;  | 
                                                        |
| 278 | - }  | 
                                                        |
| 203 | + /**  | 
                                                        |
| 204 | + * @return string[]  | 
                                                        |
| 205 | + */  | 
                                                        |
| 206 | + public function getEnumValues()  | 
                                                        |
| 207 | +    { | 
                                                        |
| 208 | + return unserialize($this->enumvalues);  | 
                                                        |
| 209 | + }  | 
                                                        |
| 210 | +  | 
                                                        |
| 211 | +  | 
                                                        |
| 212 | + /**  | 
                                                        |
| 213 | + * @return Widget_LabelledWidget  | 
                                                        |
| 214 | + */  | 
                                                        |
| 215 | + public function getWidget()  | 
                                                        |
| 216 | +    { | 
                                                        |
| 217 | + $W = bab_Widgets();  | 
                                                        |
| 218 | + $App = $this->App();  | 
                                                        |
| 219 | +  | 
                                                        |
| 220 | +        switch ($this->fieldtype) { | 
                                                        |
| 221 | + case 'Text':  | 
                                                        |
| 222 | + $widget = $W->TextEdit()->setLines(3)->setColumns(70);  | 
                                                        |
| 223 | + break;  | 
                                                        |
| 224 | +  | 
                                                        |
| 225 | + case 'Bool':  | 
                                                        |
| 226 | + $widget = $W->Checkbox();  | 
                                                        |
| 227 | + break;  | 
                                                        |
| 228 | +  | 
                                                        |
| 229 | + case 'Enum':  | 
                                                        |
| 230 | +                $options = array('' => '') + $this->getEnumValues(); | 
                                                        |
| 231 | + $widget = $W->Select()->setOptions($options);  | 
                                                        |
| 232 | + break;  | 
                                                        |
| 233 | +  | 
                                                        |
| 234 | + case 'Date':  | 
                                                        |
| 235 | + $widget = $W->DatePicker();  | 
                                                        |
| 236 | + break;  | 
                                                        |
| 237 | +  | 
                                                        |
| 238 | + case 'DateTime':  | 
                                                        |
| 239 | + $widget = $W->DateTimePicker();  | 
                                                        |
| 240 | + break;  | 
                                                        |
| 241 | +  | 
                                                        |
| 242 | + case 'Int':  | 
                                                        |
| 243 | + $widget = $W->RegExpLineEdit();  | 
                                                        |
| 244 | + $widget->setRegExp(Widget_RegExpLineEdit::INT_FORMAT)  | 
                                                        |
| 245 | +                    ->setSubmitMessage(sprintf($App->translate('The field %s should be a integer number'), $this->name)) | 
                                                        |
| 246 | + ->setSize(10);  | 
                                                        |
| 247 | + break;  | 
                                                        |
| 248 | +  | 
                                                        |
| 249 | + case 'Decimal':  | 
                                                        |
| 250 | + $widget = $W->RegExpLineEdit();  | 
                                                        |
| 251 | + $widget->setRegExp(Widget_RegExpLineEdit::FLOAT_FORMAT)  | 
                                                        |
| 252 | +                    ->setSubmitMessage(sprintf($App->translate('The field %s should be a decimal number'), $this->name)) | 
                                                        |
| 253 | + ->setSize(10);  | 
                                                        |
| 254 | + break;  | 
                                                        |
| 255 | +  | 
                                                        |
| 256 | + case 'Url':  | 
                                                        |
| 257 | + $widget = $W->UrlLineEdit();  | 
                                                        |
| 258 | + break;  | 
                                                        |
| 259 | +  | 
                                                        |
| 260 | + case 'Email':  | 
                                                        |
| 261 | + $widget = $W->EmailLineEdit();  | 
                                                        |
| 262 | + break;  | 
                                                        |
| 263 | +  | 
                                                        |
| 264 | + default:  | 
                                                        |
| 265 | + case 'String':  | 
                                                        |
| 266 | + $widget = $W->LineEdit()->setSize(70)->setMaxSize(255);  | 
                                                        |
| 267 | + break;  | 
                                                        |
| 268 | + }  | 
                                                        |
| 269 | +  | 
                                                        |
| 270 | + $labelledItem = $W->LabelledWidget($this->name, $widget, null);  | 
                                                        |
| 271 | + $labelledItem->setName($this->fieldname);  | 
                                                        |
| 272 | +  | 
                                                        |
| 273 | +        if (!empty($this->description)) { | 
                                                        |
| 274 | + $labelledItem->setDescription($this->description);  | 
                                                        |
| 275 | + }  | 
                                                        |
| 276 | +  | 
                                                        |
| 277 | + return $labelledItem;  | 
                                                        |
| 278 | + }  | 
                                                        |
| 279 | 279 | }  | 
                                                        
@@ -94,13 +94,13 @@ discard block  | 
                                                    ||
| 94 | 94 | |
| 95 | 95 | |
| 96 | 96 | |
| 97 | - /**  | 
                                                        |
| 98 | - * @return Widget_Page  | 
                                                        |
| 99 | - */  | 
                                                        |
| 100 | - public function edit($customfield = null)  | 
                                                        |
| 101 | -	{ | 
                                                        |
| 102 | - $W = bab_Widgets();  | 
                                                        |
| 103 | - $App = $this->App();  | 
                                                        |
| 97 | + /**  | 
                                                        |
| 98 | + * @return Widget_Page  | 
                                                        |
| 99 | + */  | 
                                                        |
| 100 | + public function edit($customfield = null)  | 
                                                        |
| 101 | +    { | 
                                                        |
| 102 | + $W = bab_Widgets();  | 
                                                        |
| 103 | + $App = $this->App();  | 
                                                        |
| 104 | 104 | // $access = $Crm->Access();  | 
                                                        
| 105 | 105 | |
| 106 | 106 |  // 		if (!$access->viewShopAdmin()) { | 
                                                        
@@ -109,134 +109,134 @@ discard block  | 
                                                    ||
| 109 | 109 | |
| 110 | 110 |  // 		crm_BreadCrumbs::setCurrentPosition($this->proxy()->edit($customfield), $Crm->translate('Edit custom field')); | 
                                                        
| 111 | 111 | |
| 112 | - /* @var $Ui app_Ui */  | 
                                                        |
| 113 | - $Ui = $App->Ui();  | 
                                                        |
| 114 | - $page = $Ui->Page();  | 
                                                        |
| 112 | + /* @var $Ui app_Ui */  | 
                                                        |
| 113 | + $Ui = $App->Ui();  | 
                                                        |
| 114 | + $page = $Ui->Page();  | 
                                                        |
| 115 | 115 | |
| 116 | -		$page->addClass('app-page-editor'); | 
                                                        |
| 117 | -		$page->setTitle($App->translate('Edit custom field')); | 
                                                        |
| 116 | +        $page->addClass('app-page-editor'); | 
                                                        |
| 117 | +        $page->setTitle($App->translate('Edit custom field')); | 
                                                        |
| 118 | 118 | |
| 119 | -		if (null !== $customfield) { | 
                                                        |
| 120 | - $set = $App->CustomFieldSet();  | 
                                                        |
| 121 | - $customfield = $set->request($customfield);  | 
                                                        |
| 122 | - }  | 
                                                        |
| 119 | +        if (null !== $customfield) { | 
                                                        |
| 120 | + $set = $App->CustomFieldSet();  | 
                                                        |
| 121 | + $customfield = $set->request($customfield);  | 
                                                        |
| 122 | + }  | 
                                                        |
| 123 | 123 | |
| 124 | 124 | |
| 125 | 125 | |
| 126 | - $form = $Ui->CustomFieldEditor($customfield);  | 
                                                        |
| 126 | + $form = $Ui->CustomFieldEditor($customfield);  | 
                                                        |
| 127 | 127 | |
| 128 | - $page->addItem($form);  | 
                                                        |
| 128 | + $page->addItem($form);  | 
                                                        |
| 129 | 129 | |
| 130 | -		if ($customfield instanceof app_CustomField) { | 
                                                        |
| 131 | - $actionsFrame = $page->ActionsFrame();  | 
                                                        |
| 132 | - $page->addContextItem($actionsFrame);  | 
                                                        |
| 130 | +        if ($customfield instanceof app_CustomField) { | 
                                                        |
| 131 | + $actionsFrame = $page->ActionsFrame();  | 
                                                        |
| 132 | + $page->addContextItem($actionsFrame);  | 
                                                        |
| 133 | 133 | |
| 134 | -			$actionsFrame->addItem($W->Link($W->Icon($App->translate('Delete'), Func_Icons::ACTIONS_EDIT_DELETE), $this->proxy()->delete($customfield->id))); | 
                                                        |
| 135 | - }  | 
                                                        |
| 134 | +            $actionsFrame->addItem($W->Link($W->Icon($App->translate('Delete'), Func_Icons::ACTIONS_EDIT_DELETE), $this->proxy()->delete($customfield->id))); | 
                                                        |
| 135 | + }  | 
                                                        |
| 136 | 136 | |
| 137 | - return $page;  | 
                                                        |
| 138 | - }  | 
                                                        |
| 137 | + return $page;  | 
                                                        |
| 138 | + }  | 
                                                        |
| 139 | 139 | |
| 140 | 140 | |
| 141 | - /**  | 
                                                        |
| 142 | - * @return bool  | 
                                                        |
| 143 | - */  | 
                                                        |
| 144 | - public function save($customfield = null)  | 
                                                        |
| 145 | -	{ | 
                                                        |
| 146 | - $App = $this->App();  | 
                                                        |
| 141 | + /**  | 
                                                        |
| 142 | + * @return bool  | 
                                                        |
| 143 | + */  | 
                                                        |
| 144 | + public function save($customfield = null)  | 
                                                        |
| 145 | +    { | 
                                                        |
| 146 | + $App = $this->App();  | 
                                                        |
| 147 | 147 | // $access = $Crm->Access();  | 
                                                        
| 148 | 148 | |
| 149 | 149 |  // 		if (!$access->viewShopAdmin()) { | 
                                                        
| 150 | 150 |  // 			throw new crm_AccessException($Crm->translate('Access denied to online shop administration')); | 
                                                        
| 151 | 151 | // }  | 
                                                        
| 152 | 152 | |
| 153 | - $set = $App->CustomFieldSet();  | 
                                                        |
| 153 | + $set = $App->CustomFieldSet();  | 
                                                        |
| 154 | 154 | |
| 155 | -		if (empty($customfield['id'])) { | 
                                                        |
| 156 | - $record = $set->newRecord();  | 
                                                        |
| 157 | -		} else { | 
                                                        |
| 158 | - $record = $set->get($customfield['id']);  | 
                                                        |
| 155 | +        if (empty($customfield['id'])) { | 
                                                        |
| 156 | + $record = $set->newRecord();  | 
                                                        |
| 157 | +        } else { | 
                                                        |
| 158 | + $record = $set->get($customfield['id']);  | 
                                                        |
| 159 | 159 |  // 			if (null == $record) { | 
                                                        
| 160 | 160 |  // 				throw new crm_SaveException($Crm->translate('This custom field does not exists')); | 
                                                        
| 161 | 161 | // }  | 
                                                        
| 162 | - }  | 
                                                        |
| 162 | + }  | 
                                                        |
| 163 | 163 | |
| 164 | -		if ('Enum' === $customfield['fieldtype'] || 'Set' === $customfield['fieldtype']) { | 
                                                        |
| 165 | - $enumvalues = array();  | 
                                                        |
| 166 | -		    foreach ($customfield['enumvalues'] as $enumkey => $enumvalue) { | 
                                                        |
| 167 | - $enumvalues[$enumkey] = $set->enumvalues->input($enumvalue);  | 
                                                        |
| 168 | - }  | 
                                                        |
| 169 | - $record->enumvalues = serialize($enumvalues);  | 
                                                        |
| 170 | -		} else { | 
                                                        |
| 171 | - $record->enumvalues = '';  | 
                                                        |
| 172 | - }  | 
                                                        |
| 164 | +        if ('Enum' === $customfield['fieldtype'] || 'Set' === $customfield['fieldtype']) { | 
                                                        |
| 165 | + $enumvalues = array();  | 
                                                        |
| 166 | +            foreach ($customfield['enumvalues'] as $enumkey => $enumvalue) { | 
                                                        |
| 167 | + $enumvalues[$enumkey] = $set->enumvalues->input($enumvalue);  | 
                                                        |
| 168 | + }  | 
                                                        |
| 169 | + $record->enumvalues = serialize($enumvalues);  | 
                                                        |
| 170 | +        } else { | 
                                                        |
| 171 | + $record->enumvalues = '';  | 
                                                        |
| 172 | + }  | 
                                                        |
| 173 | 173 | |
| 174 | - unset($customfield['enumvalues']);  | 
                                                        |
| 175 | - $record->setFormInputValues($customfield);  | 
                                                        |
| 174 | + unset($customfield['enumvalues']);  | 
                                                        |
| 175 | + $record->setFormInputValues($customfield);  | 
                                                        |
| 176 | 176 | |
| 177 | 177 | |
| 178 | - $record->save();  | 
                                                        |
| 178 | + $record->save();  | 
                                                        |
| 179 | 179 | |
| 180 | 180 | |
| 181 | - // refresh target table structure  | 
                                                        |
| 181 | + // refresh target table structure  | 
                                                        |
| 182 | 182 | |
| 183 | - $object = $record->object.'Set';  | 
                                                        |
| 184 | - $mysqlbackend = new ORM_MySqlBackend($GLOBALS['babDB']);  | 
                                                        |
| 183 | + $object = $record->object.'Set';  | 
                                                        |
| 184 | + $mysqlbackend = new ORM_MySqlBackend($GLOBALS['babDB']);  | 
                                                        |
| 185 | 185 | |
| 186 | - $recordSet = $App->$object();  | 
                                                        |
| 187 | -		if (method_exists($recordSet, 'useLang')) { | 
                                                        |
| 188 | - // This is necessary if the recordSet constructor uses a setLang().  | 
                                                        |
| 189 | - // We need to revert to multilang fields before synchronizing.  | 
                                                        |
| 190 | - $recordSet->useLang(false);  | 
                                                        |
| 191 | - }  | 
                                                        |
| 186 | + $recordSet = $App->$object();  | 
                                                        |
| 187 | +        if (method_exists($recordSet, 'useLang')) { | 
                                                        |
| 188 | + // This is necessary if the recordSet constructor uses a setLang().  | 
                                                        |
| 189 | + // We need to revert to multilang fields before synchronizing.  | 
                                                        |
| 190 | + $recordSet->useLang(false);  | 
                                                        |
| 191 | + }  | 
                                                        |
| 192 | 192 | |
| 193 | - $sql = $mysqlbackend->setToSql($recordSet);  | 
                                                        |
| 193 | + $sql = $mysqlbackend->setToSql($recordSet);  | 
                                                        |
| 194 | 194 | |
| 195 | - require_once $GLOBALS['babInstallPath'].'utilit/devtools.php';  | 
                                                        |
| 196 | - $synchronize = new bab_synchronizeSql();  | 
                                                        |
| 197 | - $synchronize->fromSqlString($sql);  | 
                                                        |
| 195 | + require_once $GLOBALS['babInstallPath'].'utilit/devtools.php';  | 
                                                        |
| 196 | + $synchronize = new bab_synchronizeSql();  | 
                                                        |
| 197 | + $synchronize->fromSqlString($sql);  | 
                                                        |
| 198 | 198 | |
| 199 | - return true;  | 
                                                        |
| 200 | - }  | 
                                                        |
| 199 | + return true;  | 
                                                        |
| 200 | + }  | 
                                                        |
| 201 | 201 | |
| 202 | 202 | |
| 203 | 203 | /**  | 
                                                        
| 204 | 204 |       * {@inheritDoc} | 
                                                        
| 205 | 205 | * @see app_CtrlRecord::delete()  | 
                                                        
| 206 | 206 | */  | 
                                                        
| 207 | - public function delete($customfield)  | 
                                                        |
| 208 | -	{ | 
                                                        |
| 209 | - $App = $this->App();  | 
                                                        |
| 207 | + public function delete($customfield)  | 
                                                        |
| 208 | +    { | 
                                                        |
| 209 | + $App = $this->App();  | 
                                                        |
| 210 | 210 | // $access = $Crm->Access();  | 
                                                        
| 211 | 211 | |
| 212 | 212 |  // 		if (!$access->viewShopAdmin()) { | 
                                                        
| 213 | 213 |  // 			throw new crm_AccessException($Crm->translate('Access denied to online shop administration')); | 
                                                        
| 214 | 214 | // }  | 
                                                        
| 215 | 215 | |
| 216 | - if (!$customfield)  | 
                                                        |
| 217 | -		{ | 
                                                        |
| 218 | -		    throw new app_AccessException($App->translate('Access denied')); | 
                                                        |
| 219 | - }  | 
                                                        |
| 216 | + if (!$customfield)  | 
                                                        |
| 217 | +        { | 
                                                        |
| 218 | +            throw new app_AccessException($App->translate('Access denied')); | 
                                                        |
| 219 | + }  | 
                                                        |
| 220 | 220 | |
| 221 | - $set = $App->CustomFieldSet();  | 
                                                        |
| 222 | - $record = $set->request($customfield);  | 
                                                        |
| 223 | - $object = $record->object.'Set';  | 
                                                        |
| 224 | - $set->delete($set->id->is($customfield));  | 
                                                        |
| 221 | + $set = $App->CustomFieldSet();  | 
                                                        |
| 222 | + $record = $set->request($customfield);  | 
                                                        |
| 223 | + $object = $record->object.'Set';  | 
                                                        |
| 224 | + $set->delete($set->id->is($customfield));  | 
                                                        |
| 225 | 225 | |
| 226 | - $recordSet = $App->$object();  | 
                                                        |
| 227 | -		if (method_exists($recordSet, 'useLang')) { | 
                                                        |
| 228 | - // This is necessary if the recordSet constructor uses a setLang().  | 
                                                        |
| 229 | - // We need to revert to multilang fields before synchronizing.  | 
                                                        |
| 230 | - $recordSet->useLang(false);  | 
                                                        |
| 231 | - }  | 
                                                        |
| 226 | + $recordSet = $App->$object();  | 
                                                        |
| 227 | +        if (method_exists($recordSet, 'useLang')) { | 
                                                        |
| 228 | + // This is necessary if the recordSet constructor uses a setLang().  | 
                                                        |
| 229 | + // We need to revert to multilang fields before synchronizing.  | 
                                                        |
| 230 | + $recordSet->useLang(false);  | 
                                                        |
| 231 | + }  | 
                                                        |
| 232 | 232 | |
| 233 | - $mysqlbackend = new ORM_MySqlBackend($GLOBALS['babDB']);  | 
                                                        |
| 234 | - $sql = $mysqlbackend->setToSql($recordSet);  | 
                                                        |
| 233 | + $mysqlbackend = new ORM_MySqlBackend($GLOBALS['babDB']);  | 
                                                        |
| 234 | + $sql = $mysqlbackend->setToSql($recordSet);  | 
                                                        |
| 235 | 235 | |
| 236 | - require_once $GLOBALS['babInstallPath'].'utilit/devtools.php';  | 
                                                        |
| 237 | - $synchronize = new bab_synchronizeSql();  | 
                                                        |
| 238 | - $synchronize->fromSqlString($sql);  | 
                                                        |
| 236 | + require_once $GLOBALS['babInstallPath'].'utilit/devtools.php';  | 
                                                        |
| 237 | + $synchronize = new bab_synchronizeSql();  | 
                                                        |
| 238 | + $synchronize->fromSqlString($sql);  | 
                                                        |
| 239 | 239 | |
| 240 | - return true;  | 
                                                        |
| 241 | - }  | 
                                                        |
| 240 | + return true;  | 
                                                        |
| 241 | + }  | 
                                                        |
| 242 | 242 | }  | 
                                                        
@@ -21,7 +21,7 @@ discard block  | 
                                                    ||
| 21 | 21 |   * @copyright Copyright (c) 2008 by CANTICO ({@link http://www.cantico.fr}) | 
                                                        
| 22 | 22 | */  | 
                                                        
| 23 | 23 | |
| 24 | -require_once APP_CTRL_PATH . '/record.ctrl.php';  | 
                                                        |
| 24 | +require_once APP_CTRL_PATH.'/record.ctrl.php';  | 
                                                        |
| 25 | 25 | |
| 26 | 26 | /**  | 
                                                        
| 27 | 27 | * This controller manages actions that can be performed on custom fields  | 
                                                        
@@ -39,7 +39,7 @@ discard block  | 
                                                    ||
| 39 | 39 | $W->Link(  | 
                                                        
| 40 | 40 |                  $App->translate('Add a custom field'), | 
                                                        
| 41 | 41 | $this->proxy()->edit()  | 
                                                        
| 42 | -            )->addClass('icon',  Func_Icons::ACTIONS_LIST_ADD) | 
                                                        |
| 42 | +            )->addClass('icon', Func_Icons::ACTIONS_LIST_ADD) | 
                                                        |
| 43 | 43 | ->setOpenMode(Widget_Link::OPEN_DIALOG_AND_RELOAD)  | 
                                                        
| 44 | 44 | );  | 
                                                        
| 45 | 45 | |
@@ -30,11 +30,11 @@  | 
                                                    ||
| 30 | 30 | |
| 31 | 31 | class app_UnknownActionException extends Exception  | 
                                                        
| 32 | 32 |  { | 
                                                        
| 33 | - public function __construct($action, $code = 0)  | 
                                                        |
| 34 | -	{ | 
                                                        |
| 35 | - $message = 'Unknown method "' . $action->getController() . '::' . $action->getMethod() . '"';  | 
                                                        |
| 36 | - parent::__construct($message, $code);  | 
                                                        |
| 37 | - }  | 
                                                        |
| 33 | + public function __construct($action, $code = 0)  | 
                                                        |
| 34 | +    { | 
                                                        |
| 35 | + $message = 'Unknown method "' . $action->getController() . '::' . $action->getMethod() . '"';  | 
                                                        |
| 36 | + parent::__construct($message, $code);  | 
                                                        |
| 37 | + }  | 
                                                        |
| 38 | 38 | }  | 
                                                        
| 39 | 39 | |
| 40 | 40 | |
@@ -21,8 +21,8 @@ discard block  | 
                                                    ||
| 21 | 21 |   * @copyright Copyright (c) 2008 by CANTICO ({@link http://www.cantico.fr}) | 
                                                        
| 22 | 22 | */  | 
                                                        
| 23 | 23 | |
| 24 | -require_once $GLOBALS['babInstallPath'] . 'utilit/controller.class.php';  | 
                                                        |
| 25 | -require_once dirname(__FILE__). '/functions.php';  | 
                                                        |
| 24 | +require_once $GLOBALS['babInstallPath'].'utilit/controller.class.php';  | 
                                                        |
| 25 | +require_once dirname(__FILE__).'/functions.php';  | 
                                                        |
| 26 | 26 | |
| 27 | 27 | $App = app_App();  | 
                                                        
| 28 | 28 | $App->includeBase();  | 
                                                        
@@ -32,7 +32,7 @@ discard block  | 
                                                    ||
| 32 | 32 |  { | 
                                                        
| 33 | 33 | public function __construct($action, $code = 0)  | 
                                                        
| 34 | 34 |  	{ | 
                                                        
| 35 | - $message = 'Unknown method "' . $action->getController() . '::' . $action->getMethod() . '"';  | 
                                                        |
| 35 | + $message = 'Unknown method "'.$action->getController().'::'.$action->getMethod().'"';  | 
                                                        |
| 36 | 36 | parent::__construct($message, $code);  | 
                                                        
| 37 | 37 | }  | 
                                                        
| 38 | 38 | }  | 
                                                        
@@ -215,11 +215,11 @@ discard block  | 
                                                    ||
| 215 | 215 | // we try to select one according to the classname prefix.  | 
                                                        
| 216 | 216 |          list($prefix) = explode('_', __CLASS__); | 
                                                        
| 217 | 217 | $functionalityName = ucwords($prefix);  | 
                                                        
| 218 | -        $App = @bab_functionality::get('App/' . $functionalityName); | 
                                                        |
| 218 | +        $App = @bab_functionality::get('App/'.$functionalityName); | 
                                                        |
| 219 | 219 | |
| 220 | 220 | if (!$App)  | 
                                                        
| 221 | 221 |          { | 
                                                        
| 222 | -            throw new app_Exception('Faild to autodetect functionality App/' . $functionalityName.', the getInstance method is deprecated, use $App->ControllerProxy() instead'); | 
                                                        |
| 222 | +            throw new app_Exception('Faild to autodetect functionality App/'.$functionalityName.', the getInstance method is deprecated, use $App->ControllerProxy() instead'); | 
                                                        |
| 223 | 223 | }  | 
                                                        
| 224 | 224 | |
| 225 | 225 | $controller = $App->ControllerProxy($classname, $proxy);  | 
                                                        
@@ -238,9 +238,9 @@ discard block  | 
                                                    ||
| 238 | 238 | static function getProxyInstance(Func_App $App, $classname)  | 
                                                        
| 239 | 239 |      { | 
                                                        
| 240 | 240 | $class = new ReflectionClass($classname);  | 
                                                        
| 241 | - $proxyClassname = $class->name . self::PROXY_CLASS_SUFFIX;  | 
                                                        |
| 241 | + $proxyClassname = $class->name.self::PROXY_CLASS_SUFFIX;  | 
                                                        |
| 242 | 242 |          if (!class_exists($proxyClassname)) { | 
                                                        
| 243 | -            $classStr = 'class ' . $proxyClassname . ' extends ' . $class->name . ' {' . "\n"; | 
                                                        |
| 243 | +            $classStr = 'class '.$proxyClassname.' extends '.$class->name.' {'."\n"; | 
                                                        |
| 244 | 244 | $methods = $class->getMethods();  | 
                                                        
| 245 | 245 | |
| 246 | 246 |              $classStr .= '	public function __construct(Func_App $App) { | 
                                                        
@@ -253,24 +253,24 @@ discard block  | 
                                                    ||
| 253 | 253 | }  | 
                                                        
| 254 | 254 | |
| 255 | 255 | |
| 256 | -                $classStr .= '	public function ' . $method->name . '('; | 
                                                        |
| 256 | +                $classStr .= '	public function '.$method->name.'('; | 
                                                        |
| 257 | 257 | $parameters = $method->getParameters();  | 
                                                        
| 258 | 258 | $parametersStr = array();  | 
                                                        
| 259 | 259 |                  foreach ($parameters as $parameter) { | 
                                                        
| 260 | 260 | |
| 261 | 261 |                      if ($parameter->isDefaultValueAvailable()) { | 
                                                        
| 262 | - $parametersStr[] = '$' . $parameter->name . ' = ' . var_export($parameter->getDefaultValue(), true);  | 
                                                        |
| 262 | + $parametersStr[] = '$'.$parameter->name.' = '.var_export($parameter->getDefaultValue(), true);  | 
                                                        |
| 263 | 263 |                      } else { | 
                                                        
| 264 | - $parametersStr[] = '$' . $parameter->name;  | 
                                                        |
| 264 | + $parametersStr[] = '$'.$parameter->name;  | 
                                                        |
| 265 | 265 | }  | 
                                                        
| 266 | 266 | }  | 
                                                        
| 267 | 267 |                  $classStr .= implode(', ', $parametersStr); | 
                                                        
| 268 | -                $classStr .= ') {' . "\n"; | 
                                                        |
| 269 | - $classStr .= ' $args = func_get_args();' . "\n";  | 
                                                        |
| 270 | - $classStr .= ' return $this->getMethodAction(__FUNCTION__, $args);' . "\n";  | 
                                                        |
| 271 | - $classStr .= ' }' . "\n";  | 
                                                        |
| 268 | +                $classStr .= ') {'."\n"; | 
                                                        |
| 269 | + $classStr .= ' $args = func_get_args();'."\n";  | 
                                                        |
| 270 | + $classStr .= ' return $this->getMethodAction(__FUNCTION__, $args);'."\n";  | 
                                                        |
| 271 | + $classStr .= ' }'."\n";  | 
                                                        |
| 272 | 272 | }  | 
                                                        
| 273 | - $classStr .= '}' . "\n";  | 
                                                        |
| 273 | + $classStr .= '}'."\n";  | 
                                                        |
| 274 | 274 | |
| 275 | 275 | // We define the proxy class  | 
                                                        
| 276 | 276 | eval($classStr);  | 
                                                        
@@ -394,7 +394,7 @@ discard block  | 
                                                    ||
| 394 | 394 | $action->setParameters($actionParams);  | 
                                                        
| 395 | 395 | |
| 396 | 396 | |
| 397 | -        list(,,$file) = explode('/', $App->controllerTg); | 
                                                        |
| 397 | +        list(,, $file) = explode('/', $App->controllerTg); | 
                                                        |
| 398 | 398 | |
| 399 | 399 |          $action->setParameter('addon', $App->getAddonName().'.'.$file); | 
                                                        
| 400 | 400 |          $action->setParameter('idx', $idx); | 
                                                        
@@ -418,7 +418,7 @@ discard block  | 
                                                    ||
| 418 | 418 | return false;  | 
                                                        
| 419 | 419 | }  | 
                                                        
| 420 | 420 | |
| 421 | -        list($objectName, ) = explode('.', $method); | 
                                                        |
| 421 | +        list($objectName,) = explode('.', $method); | 
                                                        |
| 422 | 422 | |
| 423 | 423 |          if (!method_exists($this, $objectName)) { | 
                                                        
| 424 | 424 |              header('HTTP/1.0 400 Bad Request'); | 
                                                        
@@ -426,7 +426,7 @@ discard block  | 
                                                    ||
| 426 | 426 | }  | 
                                                        
| 427 | 427 | |
| 428 | 428 |          $objectController = $this->{$objectName}(false); | 
                                                        
| 429 | -        if ( ! ($objectController instanceof app_Controller)) { | 
                                                        |
| 429 | +        if (!($objectController instanceof app_Controller)) { | 
                                                        |
| 430 | 430 | return false;  | 
                                                        
| 431 | 431 | }  | 
                                                        
| 432 | 432 | |
@@ -440,7 +440,7 @@ discard block  | 
                                                    ||
| 440 | 440 |              } else { | 
                                                        
| 441 | 441 |                  if ($this->isAjaxRequest()) { | 
                                                        
| 442 | 442 | |
| 443 | - header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden', true, 403);  | 
                                                        |
| 443 | + header($_SERVER['SERVER_PROTOCOL'].' 403 Forbidden', true, 403);  | 
                                                        |
| 444 | 444 | |
| 445 | 445 | die(  | 
                                                        
| 446 | 446 | bab_json_encode(  | 
                                                        
@@ -461,7 +461,7 @@ discard block  | 
                                                    ||
| 461 | 461 |          } catch (app_SaveException $e) { | 
                                                        
| 462 | 462 | |
| 463 | 463 |              if ($this->isAjaxRequest()) { | 
                                                        
| 464 | - header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden', true, 403);  | 
                                                        |
| 464 | + header($_SERVER['SERVER_PROTOCOL'].' 403 Forbidden', true, 403);  | 
                                                        |
| 465 | 465 |                  header('Cache-Control: no-cache, must-revalidate'); | 
                                                        
| 466 | 466 |                  header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); | 
                                                        
| 467 | 467 |                  header('Content-type: application/json'); | 
                                                        
@@ -528,7 +528,7 @@ discard block  | 
                                                    ||
| 528 | 528 |                          if (method_exists($htmlCanvas, 'sendPageTitle')) { | 
                                                        
| 529 | 529 | $htmlCanvas->sendPageTitle($pageTitle);  | 
                                                        
| 530 | 530 |                          } else { | 
                                                        
| 531 | -                            header('X-Cto-PageTitle: ' . $pageTitle); | 
                                                        |
| 531 | +                            header('X-Cto-PageTitle: '.$pageTitle); | 
                                                        |
| 532 | 532 | }  | 
                                                        
| 533 | 533 | }  | 
                                                        
| 534 | 534 | $html = $returnedValue->display($htmlCanvas);  | 
                                                        
@@ -588,7 +588,7 @@ discard block  | 
                                                    ||
| 588 | 588 | private function deletedItemPage(Widget_Action $action, app_DeletedRecordException $e)  | 
                                                        
| 589 | 589 |      { | 
                                                        
| 590 | 590 |          if ($this->isAjaxRequest()) { | 
                                                        
| 591 | - header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden', true, 403);  | 
                                                        |
| 591 | + header($_SERVER['SERVER_PROTOCOL'].' 403 Forbidden', true, 403);  | 
                                                        |
| 592 | 592 |              header('Cache-Control: no-cache, must-revalidate'); | 
                                                        
| 593 | 593 |              header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); | 
                                                        
| 594 | 594 |              header('Content-type: application/json'); | 
                                                        
@@ -605,7 +605,7 @@ discard block  | 
                                                    ||
| 605 | 605 | );  | 
                                                        
| 606 | 606 | |
| 607 | 607 | }  | 
                                                        
| 608 | - header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found', true, 404);  | 
                                                        |
| 608 | + header($_SERVER['SERVER_PROTOCOL'].' 404 Not Found', true, 404);  | 
                                                        |
| 609 | 609 | |
| 610 | 610 | $App = $this->App();  | 
                                                        
| 611 | 611 | $W = bab_Widgets();  | 
                                                        
@@ -639,7 +639,7 @@ discard block  | 
                                                    ||
| 639 | 639 | private function notFoundPage(Widget_Action $action, app_NotFoundException $e)  | 
                                                        
| 640 | 640 |      { | 
                                                        
| 641 | 641 |          if ($this->isAjaxRequest()) { | 
                                                        
| 642 | -            $message = sprintf(app_translate('This %s does not exists'), $e->getObjectTitle() . ' (' . $e->getId() . ')'); | 
                                                        |
| 642 | +            $message = sprintf(app_translate('This %s does not exists'), $e->getObjectTitle().' ('.$e->getId().')'); | 
                                                        |
| 643 | 643 | $json = array(  | 
                                                        
| 644 | 644 | 'messages' => array(  | 
                                                        
| 645 | 645 | array(  | 
                                                        
@@ -651,7 +651,7 @@ discard block  | 
                                                    ||
| 651 | 651 | echo bab_json_encode($json);  | 
                                                        
| 652 | 652 | die;  | 
                                                        
| 653 | 653 | }  | 
                                                        
| 654 | - header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found', true, 404);  | 
                                                        |
| 654 | + header($_SERVER['SERVER_PROTOCOL'].' 404 Not Found', true, 404);  | 
                                                        |
| 655 | 655 |          header('Cache-Control: no-cache, must-revalidate'); | 
                                                        
| 656 | 656 |          header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); | 
                                                        
| 657 | 657 | |
@@ -671,14 +671,14 @@ discard block  | 
                                                    ||
| 671 | 671 | |
| 672 | 672 | private function errorPage(Exception $e)  | 
                                                        
| 673 | 673 |      { | 
                                                        
| 674 | - header($_SERVER['SERVER_PROTOCOL'] . ' 500 Internal server error', true, 500);  | 
                                                        |
| 674 | + header($_SERVER['SERVER_PROTOCOL'].' 500 Internal server error', true, 500);  | 
                                                        |
| 675 | 675 | |
| 676 | - require_once $GLOBALS['babInstallPath'] . 'utilit/uiutil.php';  | 
                                                        |
| 676 | + require_once $GLOBALS['babInstallPath'].'utilit/uiutil.php';  | 
                                                        |
| 677 | 677 | $popup = new babBodyPopup();  | 
                                                        
| 678 | 678 | $popup->babEcho(  | 
                                                        
| 679 | -            '<h1>' . $this->App()->translate('There was a problem when trying to perform this operation') . '</h1>' | 
                                                        |
| 680 | -            . '<h2 class="error">' . $this->App()->translate('Additional debugging information:') . '</h2>' | 
                                                        |
| 681 | - . '<p class="error">' . $e->getMessage() . ' ' . $e->getFile() . ' ' . $e->getLine() . ' ' . $e->getTraceAsString() . '</p>'  | 
                                                        |
| 679 | +            '<h1>'.$this->App()->translate('There was a problem when trying to perform this operation').'</h1>' | 
                                                        |
| 680 | +            . '<h2 class="error">'.$this->App()->translate('Additional debugging information:').'</h2>' | 
                                                        |
| 681 | + . '<p class="error">'.$e->getMessage().' '.$e->getFile().' '.$e->getLine().' '.$e->getTraceAsString().'</p>'  | 
                                                        |
| 682 | 682 | );  | 
                                                        
| 683 | 683 | |
| 684 | 684 | |
@@ -69,205 +69,205 @@  | 
                                                    ||
| 69 | 69 | |
| 70 | 70 | |
| 71 | 71 | |
| 72 | - /**  | 
                                                        |
| 73 | - * @param string $sourceClass  | 
                                                        |
| 74 | - */  | 
                                                        |
| 75 | - public function joinSource($sourceClass)  | 
                                                        |
| 76 | -	{ | 
                                                        |
| 77 | -	    if (get_class($this->sourceId) !== $sourceClass . 'Set') { | 
                                                        |
| 78 | -    	    $this->hasOne('sourceId', $sourceClass . 'Set'); | 
                                                        |
| 79 | -    		$this->join('sourceId'); | 
                                                        |
| 80 | - }  | 
                                                        |
| 81 | - }  | 
                                                        |
| 82 | -  | 
                                                        |
| 83 | -  | 
                                                        |
| 84 | - /**  | 
                                                        |
| 85 | - * @param string $targetClass  | 
                                                        |
| 86 | - */  | 
                                                        |
| 87 | - public function joinTarget($targetClass = null)  | 
                                                        |
| 88 | -	{ | 
                                                        |
| 89 | -	    if (get_class($this->targetId) !== $targetClass . 'Set') { | 
                                                        |
| 90 | -    		$this->hasOne('targetId', $targetClass . 'Set'); | 
                                                        |
| 91 | -    		$this->join('targetId'); | 
                                                        |
| 92 | - }  | 
                                                        |
| 93 | - }  | 
                                                        |
| 94 | -  | 
                                                        |
| 95 | -  | 
                                                        |
| 96 | -  | 
                                                        |
| 97 | - public function sourceIsA($recordClass)  | 
                                                        |
| 98 | -	{ | 
                                                        |
| 99 | - return $this->sourceClass->is($recordClass);  | 
                                                        |
| 100 | - }  | 
                                                        |
| 101 | -  | 
                                                        |
| 102 | - /**  | 
                                                        |
| 103 | - *  | 
                                                        |
| 104 | - * @return ORM_Iterator  | 
                                                        |
| 105 | - */  | 
                                                        |
| 106 | - public function selectForSource(app_Record $object, $targetClass = null, $linkType = null)  | 
                                                        |
| 107 | -	{ | 
                                                        |
| 108 | - $criteria = $this->sourceId->is($object->id)  | 
                                                        |
| 72 | + /**  | 
                                                        |
| 73 | + * @param string $sourceClass  | 
                                                        |
| 74 | + */  | 
                                                        |
| 75 | + public function joinSource($sourceClass)  | 
                                                        |
| 76 | +    { | 
                                                        |
| 77 | +        if (get_class($this->sourceId) !== $sourceClass . 'Set') { | 
                                                        |
| 78 | +            $this->hasOne('sourceId', $sourceClass . 'Set'); | 
                                                        |
| 79 | +            $this->join('sourceId'); | 
                                                        |
| 80 | + }  | 
                                                        |
| 81 | + }  | 
                                                        |
| 82 | +  | 
                                                        |
| 83 | +  | 
                                                        |
| 84 | + /**  | 
                                                        |
| 85 | + * @param string $targetClass  | 
                                                        |
| 86 | + */  | 
                                                        |
| 87 | + public function joinTarget($targetClass = null)  | 
                                                        |
| 88 | +    { | 
                                                        |
| 89 | +        if (get_class($this->targetId) !== $targetClass . 'Set') { | 
                                                        |
| 90 | +            $this->hasOne('targetId', $targetClass . 'Set'); | 
                                                        |
| 91 | +            $this->join('targetId'); | 
                                                        |
| 92 | + }  | 
                                                        |
| 93 | + }  | 
                                                        |
| 94 | +  | 
                                                        |
| 95 | +  | 
                                                        |
| 96 | +  | 
                                                        |
| 97 | + public function sourceIsA($recordClass)  | 
                                                        |
| 98 | +    { | 
                                                        |
| 99 | + return $this->sourceClass->is($recordClass);  | 
                                                        |
| 100 | + }  | 
                                                        |
| 101 | +  | 
                                                        |
| 102 | + /**  | 
                                                        |
| 103 | + *  | 
                                                        |
| 104 | + * @return ORM_Iterator  | 
                                                        |
| 105 | + */  | 
                                                        |
| 106 | + public function selectForSource(app_Record $object, $targetClass = null, $linkType = null)  | 
                                                        |
| 107 | +    { | 
                                                        |
| 108 | + $criteria = $this->sourceId->is($object->id)  | 
                                                        |
| 109 | 109 | ->_AND_($this->sourceClass->is(get_class($object)));  | 
                                                        
| 110 | 110 | |
| 111 | -		if (isset($targetClass)) { | 
                                                        |
| 112 | - $this->joinTarget($targetClass);  | 
                                                        |
| 113 | - $criteria = $criteria->_AND_($this->targetClass->is($targetClass));  | 
                                                        |
| 114 | - }  | 
                                                        |
| 115 | -  | 
                                                        |
| 116 | -		if (isset($linkType)) { | 
                                                        |
| 117 | -			if (is_array($linkType)) { | 
                                                        |
| 118 | - $criteria = $criteria->_AND_($this->type->in($linkType));  | 
                                                        |
| 119 | -			} else { | 
                                                        |
| 120 | - $criteria = $criteria->_AND_($this->type->is($linkType));  | 
                                                        |
| 121 | - }  | 
                                                        |
| 122 | - }  | 
                                                        |
| 123 | -  | 
                                                        |
| 124 | -		if (is_a($this->targetId, 'app_TraceableRecordSet')) { | 
                                                        |
| 125 | - $criteria = $criteria->_AND_($this->targetId->deleted->is(false));  | 
                                                        |
| 126 | - }  | 
                                                        |
| 127 | -  | 
                                                        |
| 128 | - return $this->select($criteria);  | 
                                                        |
| 129 | - }  | 
                                                        |
| 130 | -  | 
                                                        |
| 131 | -  | 
                                                        |
| 132 | - /**  | 
                                                        |
| 133 | - *  | 
                                                        |
| 134 | - * @return ORM_Iterator  | 
                                                        |
| 135 | - */  | 
                                                        |
| 136 | - public function selectForSources($objects, $targetClass, $linkType = null)  | 
                                                        |
| 137 | -	{ | 
                                                        |
| 138 | - $sourceClass = null;  | 
                                                        |
| 139 | - $sourceIds = array();  | 
                                                        |
| 140 | -  | 
                                                        |
| 141 | -		foreach ($objects as $obj) { | 
                                                        |
| 142 | -			if (is_null($sourceClass)) { | 
                                                        |
| 143 | - $sourceClass = get_class($obj);  | 
                                                        |
| 144 | - }  | 
                                                        |
| 145 | - $sourceIds[] = $obj->id;  | 
                                                        |
| 146 | - }  | 
                                                        |
| 147 | - $criteria = $this->sourceId->in($sourceIds)  | 
                                                        |
| 148 | - ->_AND_($this->sourceClass->is($sourceClass));  | 
                                                        |
| 149 | -  | 
                                                        |
| 150 | -		if (isset($targetClass)) { | 
                                                        |
| 151 | - $this->joinTarget($targetClass);  | 
                                                        |
| 152 | - $criteria = $criteria->_AND_($this->targetClass->is($targetClass));  | 
                                                        |
| 153 | - }  | 
                                                        |
| 154 | -  | 
                                                        |
| 155 | -		if (isset($linkType)) { | 
                                                        |
| 156 | -			if (is_array($linkType)) { | 
                                                        |
| 157 | - $criteria = $criteria->_AND_($this->type->in($linkType));  | 
                                                        |
| 158 | -			} else { | 
                                                        |
| 159 | - $criteria = $criteria->_AND_($this->type->is($linkType));  | 
                                                        |
| 160 | - }  | 
                                                        |
| 161 | - }  | 
                                                        |
| 162 | - return $this->select($criteria);  | 
                                                        |
| 163 | - }  | 
                                                        |
| 164 | -  | 
                                                        |
| 165 | -  | 
                                                        |
| 166 | - /**  | 
                                                        |
| 167 | - *  | 
                                                        |
| 168 | - * @return ORM_Iterator  | 
                                                        |
| 169 | - */  | 
                                                        |
| 170 | - public function selectForTarget(app_Record $object, $sourceClass = null, $linkType = null)  | 
                                                        |
| 171 | -	{ | 
                                                        |
| 172 | - $criteria = $this->targetId->is($object->id)  | 
                                                        |
| 173 | - ->_AND_($this->targetClass->is(get_class($object)));  | 
                                                        |
| 174 | -  | 
                                                        |
| 175 | -		if (isset($sourceClass)) { | 
                                                        |
| 176 | - $this->joinSource($sourceClass);  | 
                                                        |
| 177 | - $criteria = $criteria->_AND_($this->sourceClass->is($sourceClass));  | 
                                                        |
| 178 | - }  | 
                                                        |
| 179 | -  | 
                                                        |
| 180 | -		if (isset($linkType)) { | 
                                                        |
| 181 | -			if (is_array($linkType)) { | 
                                                        |
| 182 | - $criteria = $criteria->_AND_($this->type->in($linkType));  | 
                                                        |
| 183 | -			} else { | 
                                                        |
| 184 | - $criteria = $criteria->_AND_($this->type->is($linkType));  | 
                                                        |
| 185 | - }  | 
                                                        |
| 186 | - }  | 
                                                        |
| 187 | -  | 
                                                        |
| 188 | - return $this->select($criteria);  | 
                                                        |
| 189 | - }  | 
                                                        |
| 190 | -  | 
                                                        |
| 191 | -  | 
                                                        |
| 192 | - /**  | 
                                                        |
| 193 | - *  | 
                                                        |
| 194 | - * @return ORM_Iterator  | 
                                                        |
| 195 | - */  | 
                                                        |
| 196 | - public function selectForTargets($objects, $sourceClass = null, $linkType = null)  | 
                                                        |
| 197 | -	{ | 
                                                        |
| 198 | - $targetClass = null;  | 
                                                        |
| 199 | - $targetIds = array();  | 
                                                        |
| 200 | -  | 
                                                        |
| 201 | -		foreach ($objects as $obj) { | 
                                                        |
| 202 | -			if (is_null($targetClass)) { | 
                                                        |
| 203 | - $targetClass = get_class($obj);  | 
                                                        |
| 204 | - }  | 
                                                        |
| 205 | - $targetIds[] = $obj->id;  | 
                                                        |
| 206 | - }  | 
                                                        |
| 207 | - $criteria = $this->targetId->in($targetIds)  | 
                                                        |
| 208 | - ->_AND_($this->targetClass->is($targetClass));  | 
                                                        |
| 209 | -  | 
                                                        |
| 210 | -		if (isset($sourceClass)) { | 
                                                        |
| 211 | - $this->joinSource($sourceClass);  | 
                                                        |
| 212 | - $criteria = $criteria->_AND_($this->sourceClass->is($sourceClass));  | 
                                                        |
| 213 | - }  | 
                                                        |
| 214 | -  | 
                                                        |
| 215 | -		if (isset($linkType)) { | 
                                                        |
| 216 | -			if (is_array($linkType)) { | 
                                                        |
| 217 | - $criteria = $criteria->_AND_($this->type->in($linkType));  | 
                                                        |
| 218 | -			} else { | 
                                                        |
| 219 | - $criteria = $criteria->_AND_($this->type->is($linkType));  | 
                                                        |
| 220 | - }  | 
                                                        |
| 221 | - }  | 
                                                        |
| 222 | -  | 
                                                        |
| 223 | - return $this->select($criteria);  | 
                                                        |
| 224 | - }  | 
                                                        |
| 225 | -  | 
                                                        |
| 226 | -  | 
                                                        |
| 227 | -  | 
                                                        |
| 228 | - /**  | 
                                                        |
| 229 | - * delete all links to an object  | 
                                                        |
| 230 | - *  | 
                                                        |
| 231 | - * @param app_Record $object  | 
                                                        |
| 232 | - * @param string $targetClass if target class is set, links will be deleted only for target classes  | 
                                                        |
| 233 | - * @param bool $deleteTarget if set to true, the target will be deleted to  | 
                                                        |
| 234 | - */  | 
                                                        |
| 235 | - public function deleteForSource(app_Record $object, $targetClass = null, $deleteTarget = false, $linkType = null)  | 
                                                        |
| 236 | -	{ | 
                                                        |
| 237 | - $set = clone $this;  | 
                                                        |
| 238 | - $App = $object->App();  | 
                                                        |
| 239 | -  | 
                                                        |
| 240 | - $criteria = $set->sourceId->is($object->id)->_AND_(  | 
                                                        |
| 241 | - $set->sourceClass->is(get_class($object))  | 
                                                        |
| 242 | - );  | 
                                                        |
| 243 | -  | 
                                                        |
| 244 | -		if (null !== $targetClass) { | 
                                                        |
| 245 | - $criteria = $criteria->_AND_(  | 
                                                        |
| 246 | - $set->targetClass->is($targetClass)  | 
                                                        |
| 247 | - );  | 
                                                        |
| 248 | - }  | 
                                                        |
| 249 | -		if (null !== $linkType) { | 
                                                        |
| 250 | - $criteria = $criteria->_AND_(  | 
                                                        |
| 251 | - $set->type->is($linkType)  | 
                                                        |
| 252 | - );  | 
                                                        |
| 253 | - }  | 
                                                        |
| 254 | -  | 
                                                        |
| 255 | -		if ($deleteTarget) { | 
                                                        |
| 256 | -			foreach($set->select($criteria) as $link) { | 
                                                        |
| 257 | -  | 
                                                        |
| 258 | - $className = $link->targetClass.'Set';  | 
                                                        |
| 259 | -  | 
                                                        |
| 260 | - // remove prefix  | 
                                                        |
| 261 | -  | 
                                                        |
| 262 | - $className = mb_substr($className, 1 + mb_strpos($className, '_'));  | 
                                                        |
| 263 | - $targetSet = $App->$className();  | 
                                                        |
| 264 | -  | 
                                                        |
| 265 | - $targetSet->delete($targetSet->id->is($link->targetId));  | 
                                                        |
| 266 | - }  | 
                                                        |
| 267 | - }  | 
                                                        |
| 268 | -  | 
                                                        |
| 269 | - return $set->delete($criteria);  | 
                                                        |
| 270 | - }  | 
                                                        |
| 111 | +        if (isset($targetClass)) { | 
                                                        |
| 112 | + $this->joinTarget($targetClass);  | 
                                                        |
| 113 | + $criteria = $criteria->_AND_($this->targetClass->is($targetClass));  | 
                                                        |
| 114 | + }  | 
                                                        |
| 115 | +  | 
                                                        |
| 116 | +        if (isset($linkType)) { | 
                                                        |
| 117 | +            if (is_array($linkType)) { | 
                                                        |
| 118 | + $criteria = $criteria->_AND_($this->type->in($linkType));  | 
                                                        |
| 119 | +            } else { | 
                                                        |
| 120 | + $criteria = $criteria->_AND_($this->type->is($linkType));  | 
                                                        |
| 121 | + }  | 
                                                        |
| 122 | + }  | 
                                                        |
| 123 | +  | 
                                                        |
| 124 | +        if (is_a($this->targetId, 'app_TraceableRecordSet')) { | 
                                                        |
| 125 | + $criteria = $criteria->_AND_($this->targetId->deleted->is(false));  | 
                                                        |
| 126 | + }  | 
                                                        |
| 127 | +  | 
                                                        |
| 128 | + return $this->select($criteria);  | 
                                                        |
| 129 | + }  | 
                                                        |
| 130 | +  | 
                                                        |
| 131 | +  | 
                                                        |
| 132 | + /**  | 
                                                        |
| 133 | + *  | 
                                                        |
| 134 | + * @return ORM_Iterator  | 
                                                        |
| 135 | + */  | 
                                                        |
| 136 | + public function selectForSources($objects, $targetClass, $linkType = null)  | 
                                                        |
| 137 | +    { | 
                                                        |
| 138 | + $sourceClass = null;  | 
                                                        |
| 139 | + $sourceIds = array();  | 
                                                        |
| 140 | +  | 
                                                        |
| 141 | +        foreach ($objects as $obj) { | 
                                                        |
| 142 | +            if (is_null($sourceClass)) { | 
                                                        |
| 143 | + $sourceClass = get_class($obj);  | 
                                                        |
| 144 | + }  | 
                                                        |
| 145 | + $sourceIds[] = $obj->id;  | 
                                                        |
| 146 | + }  | 
                                                        |
| 147 | + $criteria = $this->sourceId->in($sourceIds)  | 
                                                        |
| 148 | + ->_AND_($this->sourceClass->is($sourceClass));  | 
                                                        |
| 149 | +  | 
                                                        |
| 150 | +        if (isset($targetClass)) { | 
                                                        |
| 151 | + $this->joinTarget($targetClass);  | 
                                                        |
| 152 | + $criteria = $criteria->_AND_($this->targetClass->is($targetClass));  | 
                                                        |
| 153 | + }  | 
                                                        |
| 154 | +  | 
                                                        |
| 155 | +        if (isset($linkType)) { | 
                                                        |
| 156 | +            if (is_array($linkType)) { | 
                                                        |
| 157 | + $criteria = $criteria->_AND_($this->type->in($linkType));  | 
                                                        |
| 158 | +            } else { | 
                                                        |
| 159 | + $criteria = $criteria->_AND_($this->type->is($linkType));  | 
                                                        |
| 160 | + }  | 
                                                        |
| 161 | + }  | 
                                                        |
| 162 | + return $this->select($criteria);  | 
                                                        |
| 163 | + }  | 
                                                        |
| 164 | +  | 
                                                        |
| 165 | +  | 
                                                        |
| 166 | + /**  | 
                                                        |
| 167 | + *  | 
                                                        |
| 168 | + * @return ORM_Iterator  | 
                                                        |
| 169 | + */  | 
                                                        |
| 170 | + public function selectForTarget(app_Record $object, $sourceClass = null, $linkType = null)  | 
                                                        |
| 171 | +    { | 
                                                        |
| 172 | + $criteria = $this->targetId->is($object->id)  | 
                                                        |
| 173 | + ->_AND_($this->targetClass->is(get_class($object)));  | 
                                                        |
| 174 | +  | 
                                                        |
| 175 | +        if (isset($sourceClass)) { | 
                                                        |
| 176 | + $this->joinSource($sourceClass);  | 
                                                        |
| 177 | + $criteria = $criteria->_AND_($this->sourceClass->is($sourceClass));  | 
                                                        |
| 178 | + }  | 
                                                        |
| 179 | +  | 
                                                        |
| 180 | +        if (isset($linkType)) { | 
                                                        |
| 181 | +            if (is_array($linkType)) { | 
                                                        |
| 182 | + $criteria = $criteria->_AND_($this->type->in($linkType));  | 
                                                        |
| 183 | +            } else { | 
                                                        |
| 184 | + $criteria = $criteria->_AND_($this->type->is($linkType));  | 
                                                        |
| 185 | + }  | 
                                                        |
| 186 | + }  | 
                                                        |
| 187 | +  | 
                                                        |
| 188 | + return $this->select($criteria);  | 
                                                        |
| 189 | + }  | 
                                                        |
| 190 | +  | 
                                                        |
| 191 | +  | 
                                                        |
| 192 | + /**  | 
                                                        |
| 193 | + *  | 
                                                        |
| 194 | + * @return ORM_Iterator  | 
                                                        |
| 195 | + */  | 
                                                        |
| 196 | + public function selectForTargets($objects, $sourceClass = null, $linkType = null)  | 
                                                        |
| 197 | +    { | 
                                                        |
| 198 | + $targetClass = null;  | 
                                                        |
| 199 | + $targetIds = array();  | 
                                                        |
| 200 | +  | 
                                                        |
| 201 | +        foreach ($objects as $obj) { | 
                                                        |
| 202 | +            if (is_null($targetClass)) { | 
                                                        |
| 203 | + $targetClass = get_class($obj);  | 
                                                        |
| 204 | + }  | 
                                                        |
| 205 | + $targetIds[] = $obj->id;  | 
                                                        |
| 206 | + }  | 
                                                        |
| 207 | + $criteria = $this->targetId->in($targetIds)  | 
                                                        |
| 208 | + ->_AND_($this->targetClass->is($targetClass));  | 
                                                        |
| 209 | +  | 
                                                        |
| 210 | +        if (isset($sourceClass)) { | 
                                                        |
| 211 | + $this->joinSource($sourceClass);  | 
                                                        |
| 212 | + $criteria = $criteria->_AND_($this->sourceClass->is($sourceClass));  | 
                                                        |
| 213 | + }  | 
                                                        |
| 214 | +  | 
                                                        |
| 215 | +        if (isset($linkType)) { | 
                                                        |
| 216 | +            if (is_array($linkType)) { | 
                                                        |
| 217 | + $criteria = $criteria->_AND_($this->type->in($linkType));  | 
                                                        |
| 218 | +            } else { | 
                                                        |
| 219 | + $criteria = $criteria->_AND_($this->type->is($linkType));  | 
                                                        |
| 220 | + }  | 
                                                        |
| 221 | + }  | 
                                                        |
| 222 | +  | 
                                                        |
| 223 | + return $this->select($criteria);  | 
                                                        |
| 224 | + }  | 
                                                        |
| 225 | +  | 
                                                        |
| 226 | +  | 
                                                        |
| 227 | +  | 
                                                        |
| 228 | + /**  | 
                                                        |
| 229 | + * delete all links to an object  | 
                                                        |
| 230 | + *  | 
                                                        |
| 231 | + * @param app_Record $object  | 
                                                        |
| 232 | + * @param string $targetClass if target class is set, links will be deleted only for target classes  | 
                                                        |
| 233 | + * @param bool $deleteTarget if set to true, the target will be deleted to  | 
                                                        |
| 234 | + */  | 
                                                        |
| 235 | + public function deleteForSource(app_Record $object, $targetClass = null, $deleteTarget = false, $linkType = null)  | 
                                                        |
| 236 | +    { | 
                                                        |
| 237 | + $set = clone $this;  | 
                                                        |
| 238 | + $App = $object->App();  | 
                                                        |
| 239 | +  | 
                                                        |
| 240 | + $criteria = $set->sourceId->is($object->id)->_AND_(  | 
                                                        |
| 241 | + $set->sourceClass->is(get_class($object))  | 
                                                        |
| 242 | + );  | 
                                                        |
| 243 | +  | 
                                                        |
| 244 | +        if (null !== $targetClass) { | 
                                                        |
| 245 | + $criteria = $criteria->_AND_(  | 
                                                        |
| 246 | + $set->targetClass->is($targetClass)  | 
                                                        |
| 247 | + );  | 
                                                        |
| 248 | + }  | 
                                                        |
| 249 | +        if (null !== $linkType) { | 
                                                        |
| 250 | + $criteria = $criteria->_AND_(  | 
                                                        |
| 251 | + $set->type->is($linkType)  | 
                                                        |
| 252 | + );  | 
                                                        |
| 253 | + }  | 
                                                        |
| 254 | +  | 
                                                        |
| 255 | +        if ($deleteTarget) { | 
                                                        |
| 256 | +            foreach($set->select($criteria) as $link) { | 
                                                        |
| 257 | +  | 
                                                        |
| 258 | + $className = $link->targetClass.'Set';  | 
                                                        |
| 259 | +  | 
                                                        |
| 260 | + // remove prefix  | 
                                                        |
| 261 | +  | 
                                                        |
| 262 | + $className = mb_substr($className, 1 + mb_strpos($className, '_'));  | 
                                                        |
| 263 | + $targetSet = $App->$className();  | 
                                                        |
| 264 | +  | 
                                                        |
| 265 | + $targetSet->delete($targetSet->id->is($link->targetId));  | 
                                                        |
| 266 | + }  | 
                                                        |
| 267 | + }  | 
                                                        |
| 268 | +  | 
                                                        |
| 269 | + return $set->delete($criteria);  | 
                                                        |
| 270 | + }  | 
                                                        |
| 271 | 271 | |
| 272 | 272 | |
| 273 | 273 | /**  | 
                                                        
@@ -74,8 +74,8 @@ discard block  | 
                                                    ||
| 74 | 74 | */  | 
                                                        
| 75 | 75 | public function joinSource($sourceClass)  | 
                                                        
| 76 | 76 |  	{ | 
                                                        
| 77 | -	    if (get_class($this->sourceId) !== $sourceClass . 'Set') { | 
                                                        |
| 78 | -    	    $this->hasOne('sourceId', $sourceClass . 'Set'); | 
                                                        |
| 77 | +	    if (get_class($this->sourceId) !== $sourceClass.'Set') { | 
                                                        |
| 78 | +    	    $this->hasOne('sourceId', $sourceClass.'Set'); | 
                                                        |
| 79 | 79 |      		$this->join('sourceId'); | 
                                                        
| 80 | 80 | }  | 
                                                        
| 81 | 81 | }  | 
                                                        
@@ -86,8 +86,8 @@ discard block  | 
                                                    ||
| 86 | 86 | */  | 
                                                        
| 87 | 87 | public function joinTarget($targetClass = null)  | 
                                                        
| 88 | 88 |  	{ | 
                                                        
| 89 | -	    if (get_class($this->targetId) !== $targetClass . 'Set') { | 
                                                        |
| 90 | -    		$this->hasOne('targetId', $targetClass . 'Set'); | 
                                                        |
| 89 | +	    if (get_class($this->targetId) !== $targetClass.'Set') { | 
                                                        |
| 90 | +    		$this->hasOne('targetId', $targetClass.'Set'); | 
                                                        |
| 91 | 91 |      		$this->join('targetId'); | 
                                                        
| 92 | 92 | }  | 
                                                        
| 93 | 93 | }  | 
                                                        
@@ -253,7 +253,7 @@ discard block  | 
                                                    ||
| 253 | 253 | }  | 
                                                        
| 254 | 254 | |
| 255 | 255 |  		if ($deleteTarget) { | 
                                                        
| 256 | -			foreach($set->select($criteria) as $link) { | 
                                                        |
| 256 | +			foreach ($set->select($criteria) as $link) { | 
                                                        |
| 257 | 257 | |
| 258 | 258 | $className = $link->targetClass.'Set';  | 
                                                        
| 259 | 259 | |
@@ -239,7 +239,7 @@ discard block  | 
                                                    ||
| 239 | 239 | return parent::delete($criteria);  | 
                                                        
| 240 | 240 | }  | 
                                                        
| 241 | 241 | |
| 242 | - require_once $GLOBALS['babInstallPath'] . '/utilit/dateTime.php';  | 
                                                        |
| 242 | + require_once $GLOBALS['babInstallPath'].'/utilit/dateTime.php';  | 
                                                        |
| 243 | 243 | $now = BAB_DateTime::now()->getIsoDateTime();  | 
                                                        
| 244 | 244 | |
| 245 | 245 | $records = $this->select($criteria);  | 
                                                        
@@ -274,7 +274,7 @@ discard block  | 
                                                    ||
| 274 | 274 | return parent::save($record);  | 
                                                        
| 275 | 275 | }  | 
                                                        
| 276 | 276 | |
| 277 | - require_once $GLOBALS['babInstallPath'] . '/utilit/dateTime.php';  | 
                                                        |
| 277 | + require_once $GLOBALS['babInstallPath'].'/utilit/dateTime.php';  | 
                                                        |
| 278 | 278 | |
| 279 | 279 | $now = BAB_DateTime::now()->getIsoDateTime();  | 
                                                        
| 280 | 280 | |
@@ -304,11 +304,11 @@ discard block  | 
                                                    ||
| 304 | 304 | */  | 
                                                        
| 305 | 305 | private function uuid()  | 
                                                        
| 306 | 306 |      { | 
                                                        
| 307 | - return sprintf( '%04x%04x-%04x-%04x-%04x-%04x%04x%04x',  | 
                                                        |
| 308 | - mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ),  | 
                                                        |
| 309 | - mt_rand( 0, 0x0fff ) | 0x4000,  | 
                                                        |
| 310 | - mt_rand( 0, 0x3fff ) | 0x8000,  | 
                                                        |
| 311 | - mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ) );  | 
                                                        |
| 307 | +        return sprintf('%04x%04x-%04x-%04x-%04x-%04x%04x%04x', | 
                                                        |
| 308 | + mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff),  | 
                                                        |
| 309 | + mt_rand(0, 0x0fff) | 0x4000,  | 
                                                        |
| 310 | + mt_rand(0, 0x3fff) | 0x8000,  | 
                                                        |
| 311 | + mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff));  | 
                                                        |
| 312 | 312 | }  | 
                                                        
| 313 | 313 | |
| 314 | 314 | /**  | 
                                                        
@@ -398,7 +398,7 @@ discard block  | 
                                                    ||
| 398 | 398 | |
| 399 | 399 |          $linkSet->hasOne('sourceId', get_class($this)); | 
                                                        
| 400 | 400 | |
| 401 | - $criteria = $linkSet->targetClass->is(get_class($target))  | 
                                                        |
| 401 | + $criteria = $linkSet->targetClass->is(get_class($target))  | 
                                                        |
| 402 | 402 | ->_AND_($linkSet->targetId->is($target->id))  | 
                                                        
| 403 | 403 | ->_AND_($linkSet->sourceClass->is($this->getRecordClassName()));  | 
                                                        
| 404 | 404 |          if (isset($linkType)) { | 
                                                        
@@ -428,7 +428,7 @@ discard block  | 
                                                    ||
| 428 | 428 | |
| 429 | 429 |          $linkSet->hasOne('targetId', get_class($this)); | 
                                                        
| 430 | 430 | |
| 431 | - $criteria = $linkSet->sourceClass->is(get_class($source))  | 
                                                        |
| 431 | + $criteria = $linkSet->sourceClass->is(get_class($source))  | 
                                                        |
| 432 | 432 | ->_AND_($linkSet->sourceId->is($source->id))  | 
                                                        
| 433 | 433 | ->_AND_($linkSet->targetClass->is($this->getRecordClassName()));  | 
                                                        
| 434 | 434 |          if (isset($linkType)) { | 
                                                        
@@ -472,7 +472,7 @@ discard block  | 
                                                    ||
| 472 | 472 | $sourcesCriteria[] = $linkSet->sourceClass->is($sourceClass)->_AND_($linkSet->sourceId->in($sourceIds));  | 
                                                        
| 473 | 473 | }  | 
                                                        
| 474 | 474 | |
| 475 | - $criteria = $linkSet->all(  | 
                                                        |
| 475 | + $criteria = $linkSet->all(  | 
                                                        |
| 476 | 476 | $linkSet->targetClass->is($this->getRecordClassName()),  | 
                                                        
| 477 | 477 | $linkSet->any($sourcesCriteria)  | 
                                                        
| 478 | 478 | );  | 
                                                        
@@ -517,7 +517,7 @@ discard block  | 
                                                    ||
| 517 | 517 | $targetsCriteria[] = $linkSet->targetClass->is($targetClass)->_AND_($linkSet->targetId->in($targetIds));  | 
                                                        
| 518 | 518 | }  | 
                                                        
| 519 | 519 | |
| 520 | - $criteria = $linkSet->all(  | 
                                                        |
| 520 | + $criteria = $linkSet->all(  | 
                                                        |
| 521 | 521 | $linkSet->sourceClass->is($this->getRecordClassName()),  | 
                                                        
| 522 | 522 | $linkSet->any($targetsCriteria)  | 
                                                        
| 523 | 523 | );  | 
                                                        
@@ -575,7 +575,7 @@ discard block  | 
                                                    ||
| 575 | 575 |      { | 
                                                        
| 576 | 576 | $linkSet = $this->App()->LinkSet();  | 
                                                        
| 577 | 577 | |
| 578 | - $criteria = $linkSet->sourceClass->is(get_class($source))  | 
                                                        |
| 578 | + $criteria = $linkSet->sourceClass->is(get_class($source))  | 
                                                        |
| 579 | 579 | ->_AND_($linkSet->sourceId->is($source->id))  | 
                                                        
| 580 | 580 | ->_AND_($linkSet->targetClass->is(get_class($this)))  | 
                                                        
| 581 | 581 | ->_AND_($linkSet->targetId->is($this->id));  | 
                                                        
@@ -605,7 +605,7 @@ discard block  | 
                                                    ||
| 605 | 605 |      { | 
                                                        
| 606 | 606 | $linkSet = $this->App()->LinkSet();  | 
                                                        
| 607 | 607 | |
| 608 | - $criteria = $linkSet->targetClass->is(get_class($target))  | 
                                                        |
| 608 | + $criteria = $linkSet->targetClass->is(get_class($target))  | 
                                                        |
| 609 | 609 | ->_AND_($linkSet->targetId->is($target->id))  | 
                                                        
| 610 | 610 | ->_AND_($linkSet->sourceClass->is(get_class($this)))  | 
                                                        
| 611 | 611 | ->_AND_($linkSet->sourceId->is($this->id));  | 
                                                        
@@ -21,15 +21,15 @@  | 
                                                    ||
| 21 | 21 |   * @copyright Copyright (c) 2006 by CANTICO ({@link http://www.cantico.fr}) | 
                                                        
| 22 | 22 | */  | 
                                                        
| 23 | 23 | |
| 24 | -define('APP_PHP_PATH', dirname(__FILE__) . '/'); | 
                                                        |
| 25 | -define('APP_SET_PATH', dirname(__FILE__) . '/'); | 
                                                        |
| 26 | -define('APP_UI_PATH', dirname(__FILE__) . '/ui/'); | 
                                                        |
| 27 | -define('APP_CTRL_PATH', dirname(__FILE__) . '/'); | 
                                                        |
| 24 | +define('APP_PHP_PATH', dirname(__FILE__).'/'); | 
                                                        |
| 25 | +define('APP_SET_PATH', dirname(__FILE__).'/'); | 
                                                        |
| 26 | +define('APP_UI_PATH', dirname(__FILE__).'/ui/'); | 
                                                        |
| 27 | +define('APP_CTRL_PATH', dirname(__FILE__).'/'); | 
                                                        |
| 28 | 28 | |
| 29 | -require_once APP_PHP_PATH . 'base.class.php';  | 
                                                        |
| 30 | -require_once APP_UI_PATH . 'base.ui.php';  | 
                                                        |
| 29 | +require_once APP_PHP_PATH.'base.class.php';  | 
                                                        |
| 30 | +require_once APP_UI_PATH.'base.ui.php';  | 
                                                        |
| 31 | 31 | |
| 32 | -require_once $GLOBALS['babInstallPath'] . 'utilit/dateTime.php';  | 
                                                        |
| 32 | +require_once $GLOBALS['babInstallPath'].'utilit/dateTime.php';  | 
                                                        |
| 33 | 33 | |
| 34 | 34 | |
| 35 | 35 | |