Changeset 742


Ignore:
Timestamp:
Jul 7, 2015, 12:12:12 AM (9 years ago)
Author:
chronos
Message:
Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Application/FormClasses.php

    r740 r742  
    3030      'Shortcut' => array('Type' => 'String', 'Caption' => 'Kód', 'Default' => ''),
    3131      'Sequence' => array('Type' => 'TDocumentLineSequenceListLine', 'Caption' => 'Čísleníky', 'Default' => ''),
     32        'Codes' => array('Type' => 'TDocumentLineCodeList', 'Caption' => 'Kódy', 'Default' => ''),
    3233    ),
    3334  ),
     
    4344      'Operations' => array('Type' => 'TFinanceOperationListDocumentLine', 'Caption' => 'Finanční operace', 'Default' => ''),
    4445      'Invoices' => array('Type' => 'TFinanceInvoiceListDocumentLine', 'Caption' => 'Faktury', 'Default' => ''),
     46    ),
     47  ),
     48  'DocumentLineCode' => array(
     49    'Title' => 'Kód dokladových řad',
     50    'Table' => 'DocumentLineCode',
     51    'DefaultSortColumn' => 'Name',
     52    'Items' => array(
     53      'DocumentLine' => array('Type' => 'TDocumentLine', 'Caption' => 'Dokladová řada', 'Default' => ''),
     54      'Name' => array('Type' => 'String', 'Caption' => 'Název', 'Default' => ''),     
    4555    ),
    4656  ),
     
    164174    'Filter' => '1',
    165175  ),
    166   'TStockSerialNumberListStock' => array(
     176  'TDocumentLineCode' => array(
     177    'Type' => 'Reference',
     178    'Table' => 'DocumentLineCode',
     179    'Id' => 'Id',
     180    'Name' => 'Name',
     181    'Filter' => '1',
     182  ),
     183        'TStockSerialNumberListStock' => array(
    167184    'Type' => 'ManyToOne',
    168185    'Table' => 'StockSerialNumber',
     
    210227    'Table' => 'FinanceInvoice',
    211228    'Id' => 'Id',
    212     'Name' => 'BillCode',
     229    'Name' => '(SELECT `DocumentLineCode`.`Name` FROM `DocumentLineCode` WHERE `Id`=`FinanceInvoice`.`BillCode`)',
    213230    'Filter' => '1',
    214231  ),
     
    217234    'Table' => 'FinanceOperation',
    218235    'Id' => 'Id',
    219     'Name' => 'BillCode',
     236    'Name' => '(SELECT `DocumentLineCode`.`Name` FROM `DocumentLineCode` WHERE `Id`=`FinanceOperation`.`BillCode`)',
    220237    'Filter' => '1',
    221238  ),
     
    241258    'Filter' => '1',
    242259  ),
    243   'TUserCustomerRelListUser' => array(
     260  'TDocumentLineCodeList' => array(
     261    'Type' => 'ManyToOne',
     262    'Table' => 'DocumentLineCode',
     263    'Id' => 'Id',
     264    'Ref' => 'DocumentLine',
     265    'Filter' => '1',
     266  ),
     267        'TUserCustomerRelListUser' => array(
    244268    'Type' => 'ManyToOne',
    245269    'Table' => 'UserCustomerRel',
  • trunk/Application/Version.php

    r741 r742  
    11<?php
    22
    3 $Revision = 741; // Subversion revision
    4 $DatabaseRevision = 741; // SQL structure revision
     3$Revision = 742; // Subversion revision
     4$DatabaseRevision = 742; // SQL structure revision
    55$ReleaseTime = strtotime('2015-07-05');
  • trunk/Common/Setup/Updates.php

    r741 r742  
    14351435  $Manager->Execute('UPDATE `FinanceInvoice` SET `Direction` = 1 WHERE ValueSign=1');
    14361436}
     1437
     1438function UpdateTo742($Manager)
     1439{
     1440  $Manager->Execute('CREATE TABLE IF NOT EXISTS `DocumentLineCode` (
     1441  `Id` int(11) NOT NULL AUTO_INCREMENT,
     1442  `DocumentLine` int(11) NULL,
     1443  `Name` varchar(255) NOT NULL,
     1444        PRIMARY KEY (`Id`),
     1445        UNIQUE KEY `Name` (`Name`),
     1446  KEY `DocumentLine` (`DocumentLine`)
     1447) ENGINE=InnoDB DEFAULT CHARSET=utf8;');
     1448  $Manager->Execute('ALTER TABLE `DocumentLineCode`
     1449ADD CONSTRAINT `DocumentLineCode_ibfk_1` FOREIGN KEY (`DocumentLine`) REFERENCES `DocumentLine` (`Id`);');
     1450 
     1451  // Transform finance operations
     1452  $Manager->Execute('ALTER TABLE `FinanceOperation` CHANGE `BillCode` `BillCodeText` VARCHAR(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL');
     1453  $Manager->Execute('ALTER TABLE `FinanceOperation` ADD `BillCode` INT NULL AFTER `BillCodeText`, ADD INDEX (`BillCode`)');
     1454  $Manager->Execute('ALTER TABLE `FinanceOperation` ADD FOREIGN KEY (`BillCode`) REFERENCES `DocumentLineCode`(`Id`) ON DELETE RESTRICT ON UPDATE RESTRICT;');
     1455  $DbResult = $Manager->Execute('SELECT `FinanceOperation`.`Id`, `FinanceOperation`.`BillCodeText`, `FinanceOperationGroup`.`DocumentLine` '.
     1456    'FROM `FinanceInvoice` '.
     1457    'LEFT JOIN `FinanceOperationGroup` ON `FinanceOperationGroup`.`Id` = `FinanceOperation`.`Group` '.
     1458    'WHERE `FinanceOperation`.`BillCodeText`!=""');
     1459  while($DbRow = $DbResult->fetch_assoc())
     1460  {
     1461    if($DbRow['DocumentLine'] == '') $DbRow['DocumentLine'] = 'NULL';
     1462    $Manager->Execute('INSERT INTO `DocumentLineCode` (`Id` ,`DocumentLine` ,`Name`) '.
     1463      'VALUES (NULL , '.$DbRow['DocumentLine'].', "'.$DbRow['BillCodeText'].'");');
     1464    $CodeId = $Manager->Database->insert_id;
     1465    $Manager->Execute('UPDATE `FinanceOperation` SET `BillCode`='.$CodeId.' WHERE `Id`='.$DbRow['Id']);
     1466  }
     1467  $Manager->Execute('ALTER TABLE `FinanceOperation` DROP `BillCodeText`;');
     1468 
     1469  // Transform invoices
     1470  $Manager->Execute('ALTER TABLE `FinanceInvoice` CHANGE `BillCode` `BillCodeText` VARCHAR(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL');
     1471  $Manager->Execute('ALTER TABLE `FinanceInvoice` ADD `BillCode` INT NULL AFTER `BillCodeText`, ADD INDEX (`BillCode`)');
     1472  $Manager->Execute('ALTER TABLE `FinanceInvoice` ADD FOREIGN KEY (`BillCode`) REFERENCES `DocumentLineCode`(`Id`) ON DELETE RESTRICT ON UPDATE RESTRICT;');
     1473  $DbResult = $Manager->Execute('SELECT `FinanceInvoice`.`Id`, `FinanceInvoice`.`BillCodeText`, `FinanceInvoiceGroup`.`DocumentLine` '.
     1474    'FROM `FinanceInvoice` '.
     1475    'LEFT JOIN `FinanceInvoiceGroup` ON `FinanceInvoiceGroup`.`Id` = `FinanceInvoice`.`Group` '.
     1476    'WHERE `FinanceInvoice`.`BillCodeText`!=""');
     1477  while($DbRow = $DbResult->fetch_assoc())
     1478  {
     1479    if($DbRow['DocumentLine'] == '') $DbRow['DocumentLine'] = 'NULL';
     1480        $Manager->Execute('INSERT INTO `DocumentLineCode` (`Id` ,`DocumentLine` ,`Name`) '.
     1481      'VALUES (NULL , '.$DbRow['DocumentLine'].', "'.$DbRow['BillCodeText'].'");');
     1482    $CodeId = $Manager->Database->insert_id;
     1483    $Manager->Execute('UPDATE `FinanceInvoice` SET `BillCode`='.$CodeId.' WHERE `Id`='.$DbRow['Id']);
     1484  }
     1485  $Manager->Execute('ALTER TABLE `FinanceInvoice` DROP `BillCodeText`;');
     1486 
     1487        //$Manager->Execute('RENAME TABLE `FinanceOperationGroup` TO `FinanceOperationTemplate`');
     1488        //$Manager->Execute('RENAME TABLE `FinanceInvoiceGroup` TO `FinanceInvoiceTemplate`');
     1489}
     1490
    14371491
    14381492class Updates
     
    15031557      735 => array('Revision' => 736, 'Function' => 'UpdateTo736'),
    15041558      736 => array('Revision' => 739, 'Function' => 'UpdateTo739'),
    1505         739 => array('Revision' => 740, 'Function' => 'UpdateTo740'),
    1506         740 => array('Revision' => 741, 'Function' => 'UpdateTo741'),
     1559          739 => array('Revision' => 740, 'Function' => 'UpdateTo740'),
     1560      740 => array('Revision' => 741, 'Function' => 'UpdateTo741'),
     1561      741 => array('Revision' => 742, 'Function' => 'UpdateTo742'),
    15071562    ));
    15081563  }
  • trunk/Modules/Finance/Finance.php

    r741 r742  
    215215      'Items' => array(
    216216        'Group' => array('Type' => 'TFinanceOperationGroup', 'Caption' => 'Skupina', 'Default' => ''),
    217         'BillCode' => array('Type' => 'String', 'Caption' => 'Označení', 'Default' => '', 'ReadOnly' => true),
     217        'BillCode' => array('Type' => 'TDocumentLineCode', 'Caption' => 'Označení', 'Default' => '', 'ReadOnly' => true),
    218218        'Subject' => array('Type' => 'TSubject', 'Caption' => 'Subjekt', 'Default' => ''),
    219219        'Time' => array('Type' => 'Date', 'Caption' => 'Čas realizace', 'Default' => ''),
     
    306306      'Items' => array(
    307307        'Group' => array('Type' => 'TFinanceInvoiceGroup', 'Caption' => 'Skupina', 'Default' => ''),
    308         'BillCode' => array('Type' => 'String', 'Caption' => 'Označení', 'Default' => '', 'ReadOnly' => true),
     308        'BillCode' => array('Type' => 'TDocumentLineCode', 'Caption' => 'Označení', 'Default' => '', 'ReadOnly' => true),
    309309        'Subject' => array('Type' => 'TSubject', 'Caption' => 'Subjekt', 'Default' => ''),
    310310        'Time' => array('Type' => 'Date', 'Caption' => 'Čas vytvoření', 'Default' => ''),
Note: See TracChangeset for help on using the changeset viewer.