Changeset 452


Ignore:
Timestamp:
Oct 28, 2012, 10:20:32 AM (12 years ago)
Author:
chronos
Message:
  • Opraveno: Zobrazování odkazů v aktualitách.
  • Upraveno: Tabulka Product rozdělena na Product a StockItem. Upravena struktura.
Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Common/Global.php

    r442 r452  
    213213  global $Config, $Database, $System, $ScriptTimeStart, $ConfigFileName, $Mail, $Type;
    214214 
     215  date_default_timezone_set('Europe/Prague');
    215216  $ScriptTimeStart = GetMicrotime();
    216217  // SQL injection hack protection
  • trunk/aktuality/news.php

    r440 r452  
    2222    {
    2323      $I = strpos($Content, 'http://');
    24       if(($I > 0) and ($Content{$I - 1} != '"'))
     24      if((($I == 0)) or
     25      (($I > 0) and ($Content{$I - 1} != '"')))
    2526      {
    2627        $Result .= substr($Content, 0, $I);
    2728        $Content = substr($Content, $I);
    28         if(strpos($Content, ' ') !== false)
    29           $URL = substr($Content, 0, strpos($Content, ' '));
    30           else $URL = substr($Content, 0);
    31         if(strpos($Content, '<') !== false)
    32           $URL = substr($Content, 0, strpos($Content, '<'));
    33           else $URL = substr($Content, 0);
     29        $URL = $Content;
     30        if(strpos($URL, '<') !== false) $URL = substr($URL, 0, strpos($URL, '<'));
     31        if(strpos($URL, ' ') !== false) $URL = substr($URL, 0, strpos($URL, ' '));
    3432        $Result .= '<a href="'.$URL.'">'.$URL.'</a>';
    3533        $Content = substr($Content, strlen($URL));
  • trunk/finance/spotreba.php

    r438 r452  
    1616    $CelkovaSpotreba = 0;
    1717    $DbResult = $this->Database->query('SELECT * FROM NetworkSegment');
    18     while($Segment = $DbResult->fetch_array())
     18    while($Segment = $DbResult->fetch_assoc())
    1919    {
    20       $DbResult2 = $this->Database->query('SELECT SUM(Consumption) FROM Product WHERE Segment='.$Segment['Id'].' AND Used=1');
    21       $Row2 = $DbResult2->fetch_array();
    22       $CelkovaSpotreba = $CelkovaSpotreba + $Row2[0];
    23       $Output .= '<tr><td>'.$Segment['Name'].'</td><td align="right">'.$Row2[0].'</td><td align="right">'.$this->System->Modules['Finance']->W2Kc($Row2[0]).'</td></tr>';
     20      $DbResult2 = $this->Database->query('SELECT SUM(Product.Consumption) AS Consumption FROM StockItem JOIN Product ON Product.Id = StockItem.Product WHERE (StockItem.Segment='.$Segment['Id'].') AND (StockItem.TimeElimination IS NULL)');
     21      $Row2 = $DbResult2->fetch_assoc();
     22      $CelkovaSpotreba = $CelkovaSpotreba + $Row2['Consumption'];
     23      $Output .= '<tr><td>'.$Segment['Name'].'</td><td align="right">'.$Row2['Consumption'].'</td><td align="right">'.$this->System->Modules['Finance']->W2Kc($Row2['Consumption']).'</td></tr>';
    2424    }
    2525    $Output .= '<tr style="font-weight: Bold;"><td><strong>Celkem</strong></td><td align="right">'.$CelkovaSpotreba.'</td><td align="right">'.$this->System->Modules['Finance']->W2Kc($CelkovaSpotreba).'</td></tr>';
  • trunk/finance/tarify.php

    r438 r452  
    6262
    6363    $Output .= '<br />Tarif na další období si lze nastavit po přihlášení do systému pomocí nastavení domácnosti přes pravé užifatelské menu.<br />';
    64     $Output .= '<a href="http://centrala.zdechov.net/forum/viewtopic.php?t=50">Diskuse</a><br />';
     64    $Output .= '<a href="http://forum.zdechov.net/viewtopic.php?t=50">Diskuse</a><br />';
    6565    return($Output);
    6666  }
  • trunk/finance/zarizeni.php

    r438 r452  
    1111  {
    1212    // Seznam segmentů a zařízení
     13    $Price = 0;
    1314    $Output = 'Seznam segmentů a zařízení:<br><table style="font-size: smaller;" class="WideTable"><tr><th>Název</th><th>Spotřeba<br>[W]</th><th>Datum<br>zakoupení</th><th>Cena [Kč]</th></tr>';
    1415    $DbResult = $this->Database->query('SELECT * FROM NetworkSegment');   
    15     while($Segment = $DbResult->fetch_array())
     16    while($Segment = $DbResult->fetch_assoc())
    1617    {
    1718      $Output .= '<tr><td style="text-align: left" colspan="3"><strong>Segment: '.$Segment['Name'].' ('.$Segment['Users'].')</strong></td><td style="font-weight: Bold;" align="right">'.$Segment['Price'].'</td></tr>';
    18       $DbResult2 = $this->Database->query('SELECT * FROM Product WHERE Segment='.$Segment['Id'].' AND used=1');
    19       while($Row = $DbResult2->fetch_array())
     19      $DbResult2 = $this->Database->query('SELECT Product.Consumption AS Consumption, Product.Name AS Name, '.
     20         'StockItem.BuyPrice AS Price, StockItem.TimeEnlistment AS Date '.
     21         'FROM StockItem JOIN Product ON Product.Id = StockItem.Product WHERE (StockItem.Segment='.$Segment['Id'].') AND (StockItem.TimeElimination IS NULL)');
     22      while($Row = $DbResult2->fetch_assoc())
    2023      {
    21         $Output .= '<tr><td style="text-align: left; padding-left: 20px;">'.$Row['Name'].'</td><td align="right">'.$Row['Consumption'].'</td><td align="right">'.HumanDate($Row['Date']).'</td><td align="right">'.$Row['Price'].'</td></tr>';
     24        $Output .= '<tr><td style="text-align: left; padding-left: 20px;">'.
     25          $Row['Name'].'</td><td align="right">'.$Row['Consumption'].'</td><td align="right">'.
     26          HumanDate($Row['Date']).'</td><td align="right">'.$Row['Price'].'</td></tr>';
    2227      }
     28      $Price = $Price + $Row['Price'];
    2329    }
    24     $DbResult = $this->Database->query('SELECT SUM(Price) FROM Product WHERE Used=1');
    25     $Row = $DbResult->fetch_array();
    26     $Output .= '<tr><td colspan="3"><strong>Celkem:</strong></td><td align="right"><strong>'.$Row[0].'</strong></td></tr>';
     30    $Output .= '<tr><td colspan="3"><strong>Celkem:</strong></td><td align="right"><strong>'.
     31      $Price.'</strong></td></tr>';
    2732    $Output .= '</table>';
    2833    return($Output);
  • trunk/form_classes.php

    r451 r452  
    7676      'TimeCreate' => array('Type' => 'Date', 'Caption' => 'Datum zadání', 'Default' => ''),
    7777      'TimeDue' => array('Type' => 'Date', 'Caption' => 'Termín', 'Default' => ''),
    78       'TimeClose' => array('Type' => 'Date', 'Caption' => 'Datum uzavření', 'Default' => ''),
     78      'TimeClose' => array('Type' => 'Date', 'Caption' => 'Datum uzavření', 'Default' => '', 'Null' => true),
    7979      'Priority' => array('Type' => 'TPriority', 'Caption' => 'Důležitost', 'Default' => '0'),
    8080      'Conclusion' => array('Type' => 'Text', 'Caption' => 'Vyhodnocení', 'Default' => ''),
  • trunk/sql/updates/446.sql

    r451 r452  
    1 ALTER TABLE SystemVersion CHANGE COLUMN Rev441 Rev445 bit;
     1ALTER TABLE SystemVersion CHANGE COLUMN Rev445 Rev446 bit;
    22
    33RENAME TABLE `Product` TO `ProductOld` ;
     
    1313  `Product` int(11) NOT NULL,
    1414  `TimeEnlistment` date NOT NULL,
    15   `TimeElimination` date NOT NULL,
    16   `Amount` float NOT NULL,
     15  `TimeElimination` date NULL,
     16  `BuyPrice` DECIMAL NOT NULL,
     17  `SellPrice` DECIMAL NOT NULL,
    1718  `SerialNumber` varchar(255) COLLATE utf8_czech_ci NOT NULL,
    1819  `Location` int(11) DEFAULT NULL COMMENT 'Member',
    19   `Segment` int(11) NOT NULL,
     20  `Segment` int(11) NULL,
     21  `Info` TEXT NOT NULL,
    2022  PRIMARY KEY (`Id`),
    21   KEY `Location` (`Location`),
    2223  KEY `Product` (`Product`),
    2324  KEY `Stock` (`Stock`),
    24   KEY `Segment` (`Segment`)
     25  KEY `Segment` (`Segment`),
     26  KEY `Location` (`Location`)
    2527) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=3 ;
    2628
     
    3032  ADD CONSTRAINT `StockItem_ibfk_3` FOREIGN KEY (`Location`) REFERENCES `Member` (`Id`),
    3133  ADD CONSTRAINT `StockItem_ibfk_5` FOREIGN KEY (`Product`) REFERENCES `Product` (`Id`);
    32 ALTER TABLE `StockItem` CHANGE `Segment` `Segment` INT( 11 ) NULL;
    33 ALTER TABLE `StockItem` ADD `Info` TEXT NOT NULL ;
    34 ALTER TABLE `StockItem` CHANGE `TimeElimination` `TimeElimination` DATE NULL;
    3534
    36 ALTER TABLE `Stock` ADD `Location` INT NULL , ADD INDEX ( `Location` );
     35ALTER TABLE `Stock` ADD `Location` INT NULL ;
    3736ALTER TABLE `Stock` ADD FOREIGN KEY ( `Location` ) REFERENCES `Member` (`Id`) ON DELETE RESTRICT ON UPDATE RESTRICT ;
    38 
    39 
    40 
    4137
    4238
     
    4642  PRIMARY KEY (`Id`)
    4743) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;
     44
     45INSERT INTO `Language` (`Id`, `Name`) VALUES
     46(1, 'Česky'),
     47(2, 'Slovensky'),
     48(3, 'Anglicky'),
     49(4, 'Německy'),
     50(5, 'Slovensky'),
     51(6, 'Polsky');
     52
    4853
    4954UPDATE `TV` SET Language=1 WHERE Language="česky";
     
    5560ALTER TABLE `TV` CHANGE `Language` `Language` INT( 11 ) NULL ;
    5661UPDATE `TV` SET Language=NULL WHERE Language=0;
    57 ALTER TABLE `TV` ADD INDEX ( `Language` );
    58 ALTER TABLE `TV` DROP INDEX ( `ShortName_2` );
     62ALTER TABLE `TV` ADD INDEX  `Language` ;
     63ALTER TABLE `TV` DROP INDEX `ShortName_2` ;
    5964ALTER TABLE `TV` ADD FOREIGN KEY ( `Language` ) REFERENCES `Language` (`Id`) ON DELETE RESTRICT ON UPDATE RESTRICT ;
    6065
     
    8489ALTER TABLE `TV` ADD INDEX ( `Category` );
    8590ALTER TABLE `TV` ADD FOREIGN KEY ( `Category` ) REFERENCES `TVGroup` (`Id`) ON DELETE RESTRICT ON UPDATE RESTRICT ;
     91
     92TRUNCATE TABLE `ISMenuItem`;
     93INSERT INTO `ISMenuItem` (`Id`, `Name`, `Parent`, `Table`) VALUES
     94(1, 'Síť', NULL, ''),
     95(2, 'Finance', NULL, ''),
     96(12, 'Obecné', NULL, ''),
     97(23, 'Systém', NULL, ''),
     98(27, 'Sklad', NULL, ''),
     99(3, 'Zařízení', 1, 'NetworkDevice'),
     100(4, 'Rozhraní', 1, 'NetworkInterface'),
     101(5, 'Příjmy a výdaje', 2, 'FinanceOperation'),
     102(6, 'Závazky a pohledávky', 2, 'FinanceClaimsLiabilities'),
     103(7, 'Typ zařízení', 1, 'NetworkDeviceType'),
     104(8, 'Typ rozhraní', 1, 'NetworkInterfaceType'),
     105(9, 'Doménové aliasy', 1, 'NetworkDomainAlias'),
     106(10, 'Bankovní účty', 2, 'FinanceBankAccount'),
     107(11, 'Pokladny', 2, 'FinanceTreasury'),
     108(13, 'Uživatelé', 12, 'User'),
     109(14, 'Subjekty', 12, 'Subject'),
     110(15, 'Země', 12, 'Country'),
     111(16, 'Produkty', 27, 'Product'),
     112(17, 'Sklady', 27, 'Stock'),
     113(18, 'Platební období', 2, 'FinanceBillingPeriod'),
     114(19, 'Tarify', 2, 'FinanceTariff'),
     115(20, 'Zákazníci', 2, 'Member'),
     116(22, 'Podsítě', 1, 'NetworkSubnet'),
     117(24, 'Záznamy', 23, 'Log'),
     118(25, 'Úkoly', 12, 'Task'),
     119(26, 'Kategorie úkolů', 12, 'TaskGroup'),
     120(28, 'Měrné jednotky', 27, 'UnitOfMeasure'),
     121(29, 'Skladové položky', 27, 'StockItem'),
     122(30, 'TV kanály', 12, 'TV'),
     123(31, 'Jazyky', 12, 'Language'),
     124(32, 'Kategorie TV kanálů', 12, 'TVGroup'),
     125(33, 'Účetní roky', 2, 'FinanceYear'),
     126(34, 'Dokladové řady', 2, 'DocumentLine'),
     127(35, 'Čísleník dokladové řady', 2, 'DocumentLineSequence');
  • trunk/temp/product.php

    r451 r452  
    1212  echo($DbRow['Name'].', ');
    1313 
    14   $System->Database->insert('Product', array('Name' => $DbRow['Name'], 'SellPrice' => $DbRow['Price'],
    15     'BuyPrice' => $DbRow['Price'],
     14  $System->Database->insert('Product', array('Name' => $DbRow['Name'],
     15    'SellPrice' => $DbRow['Price'], 'BuyPrice' => $DbRow['Price'],
    1616    'Consumption' => $DbRow['Consumption'], 'UnitOfMeasure' => 1, 'VAT' => 20));
    1717  $ProductId = $System->Database->insert_id;
     18  if($DbRow['Used'] == 1) $Elimination = 'NULL';
     19    else $Elimination = $DbRow['TimeElimination'];
    1820  $Database->insert('StockItem', array('Stock' => 1, 'Product' => $ProductId, 'Amount' => $DbRow['Count'],
    19     'Segment' => $DbRow['Segment'], 'TimeEnlistment' => $DbRow['Date'], 'SerialNumber' => $DbRow['DeviceId'],
     21    'Segment' => $DbRow['Segment'], 'TimeEnlistment' => $DbRow['Date'], 'TimeElimination' => $Elimination,
     22    'SerialNumber' => $DbRow['DeviceId'], 'BuyPrice' => $DbRow['Price'], 'SellPrice' => $DbRow['Price'],
    2023    'Location' => $DbRow['User'], 'Info' => $DbRow['Info']));
    2124}
Note: See TracChangeset for help on using the changeset viewer.