Changeset 646


Ignore:
Timestamp:
Mar 25, 2014, 12:35:46 PM (11 years ago)
Author:
chronos
Message:
  • Přidáno: Tabulka Smlouvy.
Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Application/Version.php

    r645 r646  
    11<?php
    22
    3 $Revision = 645; // Subversion revision
    4 $DatabaseRevision = 645; // SQL structure revision
    5 $ReleaseTime = strtotime('2014-03-24');
     3$Revision = 646; // Subversion revision
     4$DatabaseRevision = 646; // SQL structure revision
     5$ReleaseTime = strtotime('2014-03-25');
  • trunk/Common/Setup/Updates.php

    r645 r646  
    576576}
    577577
     578function UpdateTo646($Manager)
     579{
     580        $Manager->Execute('CREATE TABLE IF NOT EXISTS `Contract` (
     581  `Id` int(11) NOT NULL AUTO_INCREMENT,
     582  `BillCode` varchar(255) NOT NULL,
     583  `Subject` int(11) NOT NULL,
     584  `DocumentLine` int(11) NOT NULL,
     585  `ValidFrom` date NOT NULL,
     586  `ValidTo` date DEFAULT NULL,
     587  `File` int(11) DEFAULT NULL,
     588  PRIMARY KEY (`Id`),
     589  KEY `Subject` (`Subject`),
     590  KEY `DocumentLine` (`DocumentLine`),
     591  KEY `File` (`File`)
     592) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;');
     593  $Manager->Execute('ALTER TABLE `Contract`
     594  ADD CONSTRAINT `Contract_ibfk_3` FOREIGN KEY (`File`) REFERENCES `File` (`Id`),
     595  ADD CONSTRAINT `Contract_ibfk_1` FOREIGN KEY (`Subject`) REFERENCES `Subject` (`Id`),
     596  ADD CONSTRAINT `Contract_ibfk_2` FOREIGN KEY (`DocumentLine`) REFERENCES `DocumentLine` (`Id`);
     597');
     598  $Manager->Execute("INSERT INTO `Action` (
     599`Id` ,`Name` ,`Title` ,`Type` ,`URL` ,`Group` ,`Icon` ,`PermissionOperation` ,
     600`Enable`) VALUES (NULL , '', 'Smlouvy', '1', '/is/?t=Contract&a=list', NULL , NULL , NULL , '1'
     601);");
     602  $ActionId = $Manager->Database->insert_id;
     603  $Manager->Execute("INSERT INTO `MenuItem` (`Id` ,`Name` ,`Parent` ,`Action` ,`Menu`) ".
     604    "VALUES (NULL , 'Smlouvy', '2', '".$ActionId."', '1');");
     605  $Manager->Execute("INSERT INTO `Action` (
     606`Id` ,`Name` ,`Title` ,`Type` ,`URL` ,`Group` ,`Icon` ,`PermissionOperation` ,
     607`Enable`) VALUES (NULL , '', 'Sazby DPH', '1', '/is/?t=FinanceVAT&a=list', NULL , NULL , NULL , '1'
     608);");
     609  $ActionId = $Manager->Database->insert_id;
     610  $Manager->Execute("INSERT INTO `MenuItem` (`Id` ,`Name` ,`Parent` ,`Action` ,`Menu`) ".
     611    "VALUES (NULL , 'Sazby DPH', '2', '".$ActionId."', '1');");
     612}
     613
    578614
    579615class Updates
     
    614650      632 => array('Revision' => 633, 'Function' => 'UpdateTo633'),
    615651      633 => array('Revision' => 645, 'Function' => 'UpdateTo645'),
     652      645 => array('Revision' => 646, 'Function' => 'UpdateTo646'),
    616653    ));
    617654  }
  • trunk/Modules/Finance/Finance.php

    r645 r646  
    489489      ),
    490490    ));
     491    $this->System->FormManager->RegisterClass('Contract', array(
     492      'Title' => 'Smlouvy',
     493      'Table' => 'Contract',
     494      'Items' => array(
     495        'DocumentLine' => array('Type' => 'TDocumentLine', 'Caption' => 'Dokladová řada', 'Default' => ''),
     496        'BillCode' => array('Type' => 'String', 'Caption' => 'Kód', 'Default' => ''),
     497        'Subject' => array('Type' => 'TSubject', 'Caption' => 'Subjekt', 'Default' => ''),
     498        'ValidFrom' => array('Type' => 'Date', 'Caption' => 'Platnost od', 'Default' => ''),
     499        'ValidTo' => array('Type' => 'Date', 'Caption' => 'Platnost do', 'Default' => '', 'Null' => true),
     500        'File' => array('Type' => 'TFile', 'Caption' => 'Soubor', 'Default' => '', 'Null' => true),
     501      ),
     502      'BeforeInsert' => array($this, 'BeforeInsertFinanceOperation'),
     503    ));
    491504
    492505    $this->System->AddModule(new Bill($this->System));
     
    502515  function BeforeInsertFinanceOperation($Form)
    503516  {
    504         $Year = date("Y", $Form->Values['Time']);
     517        if(array_key_exists('Time', $Form->Values)) $Year = date("Y", $Form->Values['Time']);
     518          else $Year = date("Y", $Form->Values['ValidFrom']);
    505519    $DocumentLine = $Form->Values['DocumentLine'];
    506520    $Form->Values['BillCode'] = $this->System->Modules['Finance']->GetNextDocumentLineNumber($DocumentLine, $Year);
  • trunk/Modules/IS/IS.php

    r639 r646  
    494494      '<a href="?a=delete&amp;t='.$Table.'&amp;i=#RowId"><img alt="Smazat" title="Smazat" src="'.
    495495      $this->System->Link('/images/delete.png').'" onclick="return confirmAction(\'Opravdu smazat položku?\');"/></a>';
    496     if($Table != '') $FormClass = $this->System->FormManager->Classes[$Table];
    497       else return($this->SystemMessage('Chyba', 'Tabulka nenalezena'));
     496    if(($Table != '') and (array_key_exists($Table, $this->System->FormManager->Classes))) $FormClass = $this->System->FormManager->Classes[$Table];
     497      else return($this->SystemMessage('Chyba', 'Tabulka '.$Table.' nenalezena'));
    498498    if(array_key_exists('ItemActions', $FormClass))
    499499    {
Note: See TracChangeset for help on using the changeset viewer.