Changeset 800


Ignore:
Timestamp:
Feb 22, 2016, 11:17:22 PM (9 years ago)
Author:
chronos
Message:
  • Modified: StockSerialNumber info transformed to separate table so multiple history items with different time can be added to track serial number history.
Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/Application/UpdateTrace.php

    r792 r800  
    18201820    $Manager->Execute('UPDATE `Contract` SET `BillCode`='.$CodeId.' WHERE `Id`='.$DbRow['Id']);
    18211821  }
    1822   //$Manager->Execute('ALTER TABLE `Contract` DROP `BillCodeText`;');
     1822  $Manager->Execute('ALTER TABLE `Contract` DROP `BillCodeText`;');
     1823  $Manager->Execute('ALTER TABLE `StockSerialNumber` DROP `Info`;');
     1824}
     1825
     1826function UpdateTo800($Manager)
     1827{
     1828  $Manager->Execute('CREATE TABLE IF NOT EXISTS `StockItemHistory` (
     1829    `Id` int(11) NOT NULL,
     1830    `StockSerialNumber` int(11) NOT NULL,
     1831    `Time` datetime NOT NULL,
     1832    `Text` varchar(255) NOT NULL,
     1833    PRIMARY KEY (`Id`),
     1834    KEY `StockSerialNumber` (`StockSerialNumber`)
     1835   ) ENGINE=InnoDB DEFAULT CHARSET=utf8;');
     1836  $Manager->Execute('ALTER TABLE `StockItemHistory` ADD FOREIGN KEY (`StockSerialNumber`) '.
     1837    'REFERENCES `StockSerialNumber`(`Id`) ON DELETE RESTRICT ON UPDATE RESTRICT;');
     1838  $Manager->Execute('INSERT INTO `StockItemHistory` (SELECT NULL AS `Id`, `Id` AS `StockSerialNumber`, '.
     1839    '"" AS `Time`, `Info` AS `Text` FROM `StockSerialNumber`)');
    18231840}
    18241841
     
    19061923      785 => array('Revision' => 786, 'Function' => 'UpdateTo786'),
    19071924      786 => array('Revision' => 792, 'Function' => 'UpdateTo792'),
     1925      792 => array('Revision' => 800, 'Function' => 'UpdateTo800'),
    19081926    ));
    19091927  }
  • TabularUnified trunk/Application/Version.php

    r799 r800  
    11<?php
    22
    3 $Revision = 799; // Subversion revision
    4 $DatabaseRevision = 792; // SQL structure revision
    5 $ReleaseTime = strtotime('2016-02-10');
     3$Revision = 800; // Subversion revision
     4$DatabaseRevision = 800; // SQL structure revision
     5$ReleaseTime = strtotime('2016-02-22');
  • TabularUnified trunk/Modules/Stock/Stock.php

    r738 r800  
    3131        'UnitOfMeasure' => array('Type' => 'TUnitOfMeasure', 'Caption' => 'Měrná jednotka', 'Default' => '', 'Null' => true),
    3232        'StockSerialNumbers' => array('Type' => 'TStockSerialNumberListProduct', 'Caption' => 'Položky na skladě', 'Default' => '', 'Suffix' => 'ks'),
     33        'StockState' => array('Type' => 'Integer', 'Caption' => 'Síťová zařízení', 'Default' => '', 'ReadOnly' => true,
     34          'SQL' => 'SELECT SUM(`Amount`) FROM `StockMoveItem` WHERE `StockMoveItem`.`Product`=#Id'),
     35        'StockMoves' => array('Type' => 'TStockMoveItemListProduct', 'Caption' => 'Pohyby na skladě', 'Default' => ''),
    3336        'NetworkDevices' => array('Type' => 'TNetworkDeviceListProduct', 'Caption' => 'Síťová zařízení', 'Default' => ''),
    3437      ),
     
    4952        'RegNumber' => array('Type' => 'String', 'Caption' => 'Evidenční číslo', 'Default' => '', 'Null' => true),
    5053        'Location' => array('Type' => 'TMember', 'Caption' => 'Umístění', 'Default' => '', 'Null' => true),
    51         'Info' => array('Type' => 'Text', 'Caption' => 'Informace', 'Default' => ''),
    5254        'Esemble' => array('Type' => 'TStockSerialNumber', 'Caption' => 'Celek', 'Default' => ''),
    5355        'Parts' => array('Type' => 'TStockSerialNumberListStockSerialNumber', 'Caption' => 'Části', 'Default' => ''),
     56        'History' => array('Type' => 'TStockItemHistoryListStockSerialNumber', 'Caption' => 'Historie', 'Default' => ''),
    5457      ),
    5558    ));
     
    121124      ),
    122125    ));
     126    $this->System->FormManager->RegisterClass('StockItemHistory', array(
     127      'Title' => 'Historie skladové položky',
     128      'Table' => 'StockItemHistory',
     129      'DefaultSortColumn' => 'Time',
     130      'Items' => array(
     131        'Time' => array('Type' => 'DateTime', 'Caption' => 'Čas', 'Default' => ''),
     132        'StockSerialNumber' => array('Type' => 'TStockSerialNumber', 'Caption' => 'Sériové číslo', 'Default' => ''),
     133        'Text' => array('Type' => 'Text', 'Caption' => 'Text', 'Default' => ''),
     134      ),
     135    ));
    123136    $this->System->FormManager->RegisterFormType('TStockMoveItemListStockMove', array(
    124137      'Type' => 'ManyToOne',
     
    128141      'Filter' => '1',
    129142    ));
     143    $this->System->FormManager->RegisterFormType('TStockMoveItemListProduct', array(
     144      'Type' => 'ManyToOne',
     145      'Table' => 'StockMoveItem',
     146      'Id' => 'Id',
     147      'Ref' => 'Product',
     148      'Filter' => '1',
     149    ));
    130150    $this->System->FormManager->RegisterFormType('TStockMoveStock', array(
    131151      'Type' => 'ManyToOne',
     
    161181      'Id' => 'Id',
    162182      'Name' => 'RegNumber',
     183      'Filter' => '1',
     184    ));
     185    $this->System->FormManager->RegisterFormType('TStockItemHistoryListStockSerialNumber', array(
     186      'Type' => 'ManyToOne',
     187      'Table' => 'StockItemHistory',
     188      'Id' => 'Id',
     189      'Ref' => 'StockSerialNumber',
    163190      'Filter' => '1',
    164191    ));
Note: See TracChangeset for help on using the changeset viewer.