Changeset 756


Ignore:
Timestamp:
Oct 25, 2015, 10:37:29 PM (9 years ago)
Author:
chronos
Message:
  • Fixed: SQL upgrade script error.
Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Application/Version.php

    r755 r756  
    11<?php
    22
    3 $Revision = 755; // Subversion revision
     3$Revision = 756; // Subversion revision
    44$DatabaseRevision = 755; // SQL structure revision
    55$ReleaseTime = strtotime('2015-10-25');
  • trunk/Common/Setup/Updates.php

    r755 r756  
    15051505  $Manager->Execute('UPDATE `FinanceInvoice` SET `Value`=`Value`*`ValueSign`');
    15061506  $Manager->Execute('ALTER TABLE `FinanceInvoice` DROP `Direction`, DROP `ValueSign`;');
    1507   // Check manual vs. calculated value from items
    1508   // SELECT * FROM (SELECT `FinanceInvoice`.`Id`, ((SELECT SUM(CEIL(`Price` * `Quantity`)) FROM `FinanceInvoiceItem` WHERE `FinanceInvoiceItem`.`FinanceInvoice`=`FinanceInvoice`.`Id`) * `FinanceInvoiceGroup`.`ValueSign`) AS `Sum`,`FinanceInvoice`.`Value` FROM `FinanceInvoice` LEFT JOIN `FinanceInvoiceGroup` ON `FinanceInvoiceGroup`.`Id`=`FinanceInvoice`.`Group`) AS `T` WHERE `Sum` != `Value`
     1507
     1508  // Check rounding manual vs. calculated value from items
     1509  // SELECT * FROM (SELECT `FinanceInvoice`.`Id`, ((SELECT ROUND(SUM(`Price` * `Quantity`)) FROM `FinanceInvoiceItem` WHERE `FinanceInvoiceItem`.`FinanceInvoice`=`FinanceInvoice`.`Id`) * `FinanceInvoiceGroup`.`ValueSign`) AS `Sum`, ((SELECT (SUM(`Price` * `Quantity`)) FROM `FinanceInvoiceItem` WHERE `FinanceInvoiceItem`.`FinanceInvoice`=`FinanceInvoice`.`Id`) * `FinanceInvoiceGroup`.`ValueSign`) AS `Sum2`, `FinanceInvoice`.`Value` FROM `FinanceInvoice` LEFT JOIN `FinanceInvoiceGroup` ON `FinanceInvoiceGroup`.`Id`=`FinanceInvoice`.`Group`) AS `T` WHERE `Sum` != `Value`
     1510  // Check sign of manual vs. calculated value from items
     1511  // SELECT * FROM (SELECT `FinanceInvoice`.`Id`, ((SELECT ROUND(SUM(`Price` * `Quantity`)) FROM `FinanceInvoiceItem` WHERE `FinanceInvoiceItem`.`FinanceInvoice`=`FinanceInvoice`.`Id`) * `FinanceInvoiceGroup`.`ValueSign`) AS `Sum`, ((SELECT (SUM(`Price` * `Quantity`)) FROM `FinanceInvoiceItem` WHERE `FinanceInvoiceItem`.`FinanceInvoice`=`FinanceInvoice`.`Id`) * `FinanceInvoiceGroup`.`ValueSign`) AS `Sum2`, `FinanceInvoice`.`Value` FROM `FinanceInvoice` LEFT JOIN `FinanceInvoiceGroup` ON `FinanceInvoiceGroup`.`Id`=`FinanceInvoice`.`Group`) AS `T` WHERE SIGN(`Sum`) != SIGN(`Value`)
    15091512}
    15101513
     
    15551558function UpdateTo755($Manager)
    15561559{
    1557   $Manager->Execute("INSERT INTO `FinanceInvoiceGroup` (`Id`, `Name`, `DocumentLine`, `ValueSign`, `Direction`) '.
    1558     'VALUES (NULL, 'Přijaté faktury - storno', '5', '1', '0'), (NULL, 'Vydané faktury - storno', '6', '-1', '1')");
    1559   $Manager->Execute("ALTER TABLE `FinanceInvoice` ADD `VisibleToUser` INT NOT NULL DEFAULT '1' AFTER `Generate`;ALTER TABLE `FinanceInvoice` ADD `VisibleToUser` INT NOT NULL DEFAULT '1' AFTER `Generate`;");
     1560  $Manager->Execute("INSERT INTO `FinanceInvoiceGroup` (`Id`, `Name`, `DocumentLine`, `ValueSign`, `Direction`) ".
     1561    "VALUES (NULL, 'Přijaté faktury - storno', '5', '1', '0'), (NULL, 'Vydané faktury - storno', '6', '-1', '1')");
     1562  $Manager->Execute("ALTER TABLE `FinanceInvoice` ADD `VisibleToUser` INT NOT NULL DEFAULT '1' AFTER `Generate`;".
     1563    "ALTER TABLE `FinanceInvoice` ADD `VisibleToUser` INT NOT NULL DEFAULT '1' AFTER `Generate`;");
    15601564
    15611565  $Manager->Execute("CREATE TABLE IF NOT EXISTS `FinanceInvoiceStorno` (
  • trunk/Modules/Finance/UserState.php

    r748 r756  
    1717      '`Time`, -`Value`, `File`, `BillCode`, `PeriodFrom`, `PeriodTo`, `DocumentLineCode`.`Name` AS `BillName` FROM `FinanceInvoice` '.
    1818      'LEFT JOIN `DocumentLineCode` ON `DocumentLineCode`.`Id`=`FinanceInvoice`.`BillCode` '.
    19       'WHERE (`Subject`='.$Subject['Id'].')))';
     19      'WHERE (`Subject`='.$Subject['Id'].') AND (`VisibleToUser` = 1)))';
    2020
    2121    $Output = '<div style="text-align:center">Výpis finančních operací</div>';
Note: See TracChangeset for help on using the changeset viewer.