Ignore:
Timestamp:
Sep 30, 2015, 11:55:11 PM (9 years ago)
Author:
chronos
Message:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Common/Setup/Updates.php

    r747 r748  
    14891489}
    14901490
    1491 function UpdateTo748($Manager)
     1491function UpdateTo747($Manager)
    14921492{
    14931493  $Manager->Execute('ALTER TABLE `FinanceOperation` ADD `ValueUser` FLOAT NOT NULL AFTER `Value`;');
     
    15061506  $Manager->Execute('ALTER TABLE `FinanceInvoice` DROP `Direction`, DROP `ValueSign`;');
    15071507  // Check manual vs. calculated value from items
    1508   // SELECT * FROM (SELECT `FinanceInvoice`.`Id`, ((SELECT SUM(`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`
     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`
     1509}
     1510
     1511function UpdateTo748($Manager)
     1512{
     1513  $DbResult = $Manager->Database->query('SELECT * FROM (SELECT `FinanceInvoice`.`Id`, ((SELECT SUM(`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`');
     1514  while($DbRow = $DbResult->fetch_assoc())
     1515  {
     1516    $Manager->Database->query('UPDATE `FinanceInvoiceItem` SET `Price` = -`Price` WHERE `FinanceInvoice`='.$DbRow['Id']);
     1517  }
    15091518}
    15101519
     
    15791588      740 => array('Revision' => 741, 'Function' => 'UpdateTo741'),
    15801589      741 => array('Revision' => 742, 'Function' => 'UpdateTo742'),
    1581       742 => array('Revision' => 748, 'Function' => 'UpdateTo748'),
     1590      742 => array('Revision' => 747, 'Function' => 'UpdateTo747'),
     1591      747 => array('Revision' => 748, 'Function' => 'UpdateTo748'),
    15821592    ));
    15831593  }
Note: See TracChangeset for help on using the changeset viewer.