Changeset 736


Ignore:
Timestamp:
Apr 6, 2015, 11:08:10 PM (10 years ago)
Author:
chronos
Message:
Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Application/FormClasses.php

    r723 r736  
    304304    'Filter' => '1',
    305305  ),
    306   'TNetworkLinkListInterface1' => array(
    307     'Type' => 'ManyToOne',
    308     'Table' => 'NetworkLink',
    309     'Id' => 'Id',
    310     'Ref' => 'Interface1',
    311     'Filter' => '1',
    312   ),
    313   'TNetworkLinkListInterface2' => array(
    314     'Type' => 'ManyToOne',
    315     'Table' => 'NetworkLink',
    316     'Id' => 'Id',
    317     'Ref' => 'Interface2',
    318     'Filter' => '1',
    319   ),
    320   'TNetworkInterfaceUpDown' => array(
    321     'Type' => 'ManyToOne',
    322     'Table' => 'NetworkInterfaceUpDown',
    323     'Id' => 'Id',
    324     'Ref' => 'Interface',
    325     'Filter' => '1',
    326   ),
    327306  'TNetworkSignalListInterface' => array(
    328307    'Type' => 'ManyToOne',
  • trunk/Application/Version.php

    r735 r736  
    11<?php
    22
    3 $Revision = 735; // Subversion revision
    4 $DatabaseRevision = 735; // SQL structure revision
     3$Revision = 736; // Subversion revision
     4$DatabaseRevision = 736; // SQL structure revision
    55$ReleaseTime = strtotime('2015-04-06');
  • trunk/Common/Setup/Updates.php

    r735 r736  
    13301330                1, '.$ActionId.', "", NULL, "", 5);');
    13311331        $Manager->Execute('ALTER TABLE `Scheduler` CHANGE `ScheduledTime` `ScheduledTime` DATETIME NULL;');
     1332}
     1333
     1334function UpdateTo736($Manager)
     1335{
     1336        $Manager->Execute('CREATE TABLE IF NOT EXISTS `NetworkLinkType` (
     1337`Id` int(11) NOT NULL,
     1338`Name` varchar(255) NOT NULL
     1339) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;');
     1340
     1341  $Manager->Execute('ALTER TABLE `NetworkLinkType` ADD PRIMARY KEY (`Id`);');
     1342
     1343  $Manager->Execute('ALTER TABLE `NetworkLinkType`
     1344MODIFY `Id` int(11) NOT NULL AUTO_INCREMENT;');
    13321345}
    13331346
     
    13971410        730 => array('Revision' => 731, 'Function' => 'UpdateTo731'),
    13981411        731 => array('Revision' => 735, 'Function' => 'UpdateTo735'),
     1412        735 => array('Revision' => 736, 'Function' => 'UpdateTo736'),
    13991413    ));
    14001414  }
  • trunk/Modules/Employee/Employee.php

    r711 r736  
    4242        'Table' => 'Employee',
    4343        'Id' => 'Id',
    44         'Name' => 'CONCAT(FirstName, " ", SecondName)',
     44        'Name' => 'CONCAT_WS(" ", NULLIF(`FirstName`, ""), NULLIF(`SecondName`, ""))',
    4545        'Filter' => '1',
    4646    ));   
  • trunk/Modules/IS/IS.php

    r732 r736  
    353353    if(defined('NEW_PERMISSION') and !$this->System->User->CheckPermission($this->TableToModule($Table), 'Read'))
    354354      return('Nemáte oprávnění');
    355 
     355   
     356    $FormClass = $this->System->FormManager->Classes[$Table];
     357    if(array_key_exists('BaseTable', $FormClass)) $TableModify = $FormClass['BaseTable'];
     358      else $TableModify = $Table;
     359   
    356360    $Form = new Form($this->System->FormManager);
    357361    $Form->SetClass($Table);
     
    363367    {
    364368    $Actions = array(
    365       $this->ShowAction('Upravit', '?a=edit&amp;t='.$Table.'&amp;i='.$Id,
     369      $this->ShowAction('Upravit', '?a=edit&amp;t='.$TableModify.'&amp;i='.$Id,
    366370        $this->System->Link('/images/edit.png')),
    367371      $this->ShowAction('Seznam', '?a=list&amp;t='.$Table,
     
    369373      $this->ShowAction('Odstranit', '?a=delete&amp;t='.$Table.'&amp;i='.$Id,
    370374        $this->System->Link('/images/delete.png'), 'Opravdu smazat položku?'),
    371       $this->ShowAction('Přidat', '?a=add&amp;t='.$Table,
     375      $this->ShowAction('Přidat', '?a=add&amp;t='.$TableModify,
    372376        $this->System->Link('/images/add.png'))
    373377    );
     
    625629    if(defined('NEW_PERMISSION') and !$this->System->User->CheckPermission($this->TableToModule($Table), 'Read'))
    626630      return('Nemáte oprávnění');
     631    $FormClass = $this->System->FormManager->Classes[$Table];
     632    if(array_key_exists('BaseTable', $FormClass)) $TableModify = $FormClass['BaseTable'];
     633      else $TableModify = $Table;
     634   
    627635    $RowActions = '<a href="?a=view&amp;t='.$Table.'&amp;i=#RowId"><img alt="Ukázat" title="Ukázat" src="'.
    628636      $this->System->Link('/images/view.png').'"/></a>'.
    629       '<a href="?a=edit&amp;t='.$Table.'&amp;i=#RowId"><img alt="Upravit" title="Upravit" src="'.
     637      '<a href="?a=edit&amp;t='.$TableModify.'&amp;i=#RowId"><img alt="Upravit" title="Upravit" src="'.
    630638      $this->System->Link('/images/edit.png').'"/></a>'.
    631639      '<a href="?a=delete&amp;t='.$Table.'&amp;i=#RowId"><img alt="Smazat" title="Smazat" src="'.
     
    634642      $FormClass = $this->System->FormManager->Classes[$Table];
    635643      else return($this->SystemMessage('Chyba', 'Tabulka '.$Table.' nenalezena'));
    636     $this->ShortTitle .= ' - '.$FormClass['Title'];
     644    if($ExcludeColumn == '') $this->ShortTitle .= ' - '.$FormClass['Title'];
    637645    if(array_key_exists('ItemActions', $FormClass))
    638646    {
     
    646654    $Output .= '<div style="text-align: center;">'.$FormClass['Title'].'</div>';
    647655    $Output .= '<ul class="ActionMenu">';
    648     $Output .= '<li>'.$this->ShowAction('Přidat', '?a=add&amp;t='.$Table.'&amp;preset'.$ExcludeColumn.'='.$ExcludeValue, $this->System->Link('/images/add.png')).'</li>';
     656    $Output .= '<li>'.$this->ShowAction('Přidat', '?a=add&amp;t='.$TableModify.'&amp;preset'.$ExcludeColumn.'='.$ExcludeValue, $this->System->Link('/images/add.png')).'</li>';
    649657    $Output .= '<li>'.$this->ShowAction('Seznam', '?a=list&amp;t='.$Table, $this->System->Link('/images/list.png')).'</li>';
    650658    $MI = 0;
  • trunk/Modules/Network/Availability.php

    r687 r736  
    8585
    8686    $DbResult2 = $this->Database->query('SELECT `NetworkInterface`.`Name` AS `InterfaceName`'.$Columns.', '.
    87       'CONCAT(`NetworkDevice`.`Name`, "-", `NetworkInterface`.`Name`) AS `Name`, `NetworkDevice`.`Name` AS `DeviceName` FROM `NetworkInterface` '.
     87      'CONCAT_WS("-", `NetworkDevice`.`Name`, NULLIF(`NetworkInterface`.`Name`, "")) AS `Name`, `NetworkDevice`.`Name` AS `DeviceName` FROM `NetworkInterface` '.
    8888      $Join.' JOIN `NetworkDevice` ON `NetworkInterface`.`Device` = `NetworkDevice`.`Id` WHERE `NetworkDevice`.`Used` = 1 AND `NetworkDevice`.`PermanentOnline`=1'.
    8989      $Order['SQL'].$PageList['SQLLimit']);
  • trunk/Modules/Network/Network.php

    r731 r736  
    186186        'Online' => array('Type' => 'TOnlineState', 'Caption' => 'Běží', 'Default' => '0', 'ReadOnly' => true),
    187187        'LastOnline' => array('Type' => 'DateTime', 'Caption' => 'Naposledy běželo', 'Default' => '', 'ReadOnly' => true),
    188         'Links1' => array('Type' => 'TNetworkLinkListInterface1', 'Caption' => 'Propojení 1', 'Default' => ''),
    189         'Links2' => array('Type' => 'TNetworkLinkListInterface2', 'Caption' => 'Propojení 2', 'Default' => ''),
     188        'Links' => array('Type' => 'TNetworkLinkListInterface', 'Caption' => 'Propojení', 'Default' => ''),
    190189        'UpDown' => array('Type' => 'TNetworkInterfaceUpDown', 'Caption' => 'Změny stavu', 'Default' => ''),
    191190        'Signal' => array('Type' => 'TNetworkSignalListInterface', 'Caption' => 'Signál', 'Default' => ''),
     
    193192
    194193      ),
    195     ));
     194    ));   
    196195    $this->System->FormManager->RegisterClass('NetworkInterfaceType', array(
    197196      'Title' => 'Typ síťového rozhraní',
     
    229228      'Table' => 'NetworkLink',
    230229      'Items' => array(
    231         'Type' => array('Type' => 'Integer', 'Caption' => 'Typ', 'Default' => '1'),
     230        'Type' => array('Type' => 'TNetworkLinkType', 'Caption' => 'Typ', 'Default' => '1'),
    232231        'Interface1' => array('Type' => 'TNetworkInterface', 'Caption' => 'Rozhraní 1', 'Default' => ''),
    233232        'Interface2' => array('Type' => 'TNetworkInterface', 'Caption' => 'Rozhraní 2', 'Default' => ''),
     233      ),
     234    ));
     235    $this->System->FormManager->RegisterClass('NetworkLinkUnion', array(
     236      'Title' => 'Síťové propojení',
     237        'BaseTable' => 'NetworkLink',
     238      'SQL' => '(SELECT `Id`, `Type`, `Interface1` AS `Interface`, `Interface2` AS `InterfaceOther` FROM `NetworkLink`) '.
     239                'UNION (SELECT `Id`, `Type`, `Interface2` AS `Interface`, `Interface1` AS `InterfaceOther` FROM `NetworkLink`)',
     240      'Items' => array(
     241        'Type' => array('Type' => 'TNetworkLinkType', 'Caption' => 'Typ', 'Default' => '1', 'ReadOnly' => true),
     242        'Interface' => array('Type' => 'TNetworkInterface', 'Caption' => 'Rozhraní 1', 'Default' => '', 'ReadOnly' => true),
     243                'InterfaceOther' => array('Type' => 'TNetworkInterface', 'Caption' => 'Rozhraní 2', 'Default' => '', 'ReadOnly' => true),
     244      ),
     245    ));
     246   
     247    $this->System->FormManager->RegisterClass('NetworkLinkType', array(
     248      'Title' => 'Typ síťového propojení',
     249      'Table' => 'NetworkLinkType',
     250      'Items' => array(
     251        'Name' => array('Type' => 'String', 'Caption' => 'Název', 'Default' => ''),
    234252      ),
    235253    ));
     
    369387        'Type' => 'Reference',
    370388        'Table' => 'NetworkInterface',
    371         'View' => '(SELECT NetworkInterface.*, CONCAT(NetworkDevice.Name, "-", NetworkInterface.Name) AS DeviceName FROM NetworkInterface '.
     389        'View' => '(SELECT NetworkInterface.*, CONCAT_WS("-", NetworkDevice.Name, NULLIF(NetworkInterface.Name, "")) AS DeviceName FROM NetworkInterface '.
    372390        'LEFT JOIN NetworkDevice ON NetworkDevice.Id = NetworkInterface.Device) AS T',
    373391        'Id' => 'Id',
     
    396414      'Filter' => '1',
    397415    ));
     416    $this->System->FormManager->RegisterFormType('TNetworkLinkType', array(
     417      'Type' => 'Reference',
     418        'Table' => 'NetworkLinkType',
     419        'Id' => 'Id',
     420        'Name' => 'Name',
     421        'Filter' => '1',
     422    ));   
    398423    $this->System->FormManager->RegisterFormType('TDeviceAPIType', array(
    399424      'Type' => 'Reference',
     
    417442      'Filter' => '1',
    418443    ));
     444    $this->System->FormManager->RegisterFormType('TNetworkLinkListInterface', array(
     445      'Type' => 'ManyToOne',
     446      'Table' => 'NetworkLinkUnion',
     447        'Id' => 'Id',
     448        'Ref' => 'Interface',
     449        'Filter' => '1',
     450    ));
     451    $this->System->FormManager->RegisterFormType('TNetworkLinkListInterface1', array(
     452        'Type' => 'ManyToOne',
     453        'Table' => 'NetworkLink',
     454        'Id' => 'Id',
     455        'Ref' => 'Interface1',
     456        'Filter' => '1',
     457    ));
     458    $this->System->FormManager->RegisterFormType('TNetworkLinkListInterface2', array(
     459        'Type' => 'ManyToOne',
     460        'Table' => 'NetworkLink',
     461        'Id' => 'Id',
     462        'Ref' => 'Interface2',
     463        'Filter' => '1',
     464    ));
     465    $this->System->FormManager->RegisterFormType('TNetworkInterfaceUpDown', array(
     466        'Type' => 'ManyToOne',
     467        'Table' => 'NetworkInterfaceUpDown',
     468        'Id' => 'Id',
     469        'Ref' => 'Interface',
     470        'Filter' => '1',
     471    ));
     472   
    419473  }
    420474
  • trunk/Modules/Stock/Stock.php

    r715 r736  
    6868          'ReadOnly' => true, 'SQL' => '(SELECT SUM(`SellPrice`) FROM `StockSerialNumber` WHERE '.
    6969          '(`StockSerialNumber`.`Stock`=#Id) AND (`StockSerialNumber`.`TimeElimination` IS NULL))', 'Suffix' => 'Kč'),
     70        'Moves' => array('Type' => 'TStockMoveStock', 'Caption' => 'Pohyby', 'Default' => ''),
    7071      ),
    7172    ));
     
    8384        'Price' => array('Type' => 'Float', 'Caption' => 'Cena', 'Default' => '',
    8485          'ReadOnly' => true, 'Suffix' => 'Kč', 'SQL' => '(SELECT SUM(`StockMoveItem`.`UnitPrice` * `StockMoveItem`.`Amount`) FROM `StockMoveItem` '.
     86          'WHERE `StockMoveItem`.`StockMove`=#Id)'),
     87        'Items' => array('Type' => 'TStockMoveItemListStockMove', 'Caption' => 'Položky', 'Default' => ''),
     88      ),       
     89      'BeforeInsert' => array($this, 'BeforeInsertStockMove'),
     90    ));
     91    $this->System->FormManager->RegisterClass('StockMoveUnion', array(
     92      'Title' => 'Skladový pohyb',
     93      'BaseTable' => 'StockMove',
     94      'DefaultSortColumn' => 'Time',
     95        'SQL' => '(SELECT *, -1 AS `Direction`, `StockFrom` AS `Stock`, `StockTo` AS `StockOther` FROM `StockMove`) '.
     96                'UNION (SELECT *, 1 AS `Direction`, `StockTo` AS `Stock`, `StockFrom` AS `StockOther` FROM `StockMove`)',
     97      'Items' => array(
     98        'DocumentLine' => array('Type' => 'TDocumentLine', 'Caption' => 'Dokladová řada', 'Default' => ''),
     99        'BillCode' => array('Type' => 'String', 'Caption' => 'Označení', 'Default' => ''),
     100        'Time' => array('Type' => 'DateTime', 'Caption' => 'Čas', 'Default' => ''),
     101        'Stock' => array('Type' => 'TStock', 'Caption' => 'První sklad', 'Default' => '', 'Null' => true),
     102        'StockOther' => array('Type' => 'TStock', 'Caption' => 'Druhý sklad', 'Default' => '', 'Null' => true),
     103        'File' => array('Type' => 'TFile', 'Caption' => 'Doklad', 'Default' => '', 'Null' => true),
     104        'Price' => array('Type' => 'Float', 'Caption' => 'Cena', 'Default' => '',
     105          'ReadOnly' => true, 'Suffix' => 'Kč', 'SQL' => '(SELECT `TX`.`Direction` * SUM(`StockMoveItem`.`UnitPrice` * `StockMoveItem`.`Amount`) FROM `StockMoveItem` '.
    85106          'WHERE `StockMoveItem`.`StockMove`=#Id)'),
    86107        'Items' => array('Type' => 'TStockMoveItemListStockMove', 'Caption' => 'Položky', 'Default' => ''),
     
    107128      'Filter' => '1',
    108129    )); 
     130    $this->System->FormManager->RegisterFormType('TStockMoveStock', array(
     131      'Type' => 'ManyToOne',
     132      'Table' => 'StockMoveUnion',
     133      'Id' => 'Id',
     134      'Ref' => 'Stock',
     135      'Filter' => '1',
     136    ));     
    109137    $this->System->FormManager->RegisterFormType('TStockMove', array(
    110138      'Type' => 'Reference',
Note: See TracChangeset for help on using the changeset viewer.