Changeset 748 for trunk/Common/Setup/Updates.php
- Timestamp:
- Sep 30, 2015, 11:55:11 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Common/Setup/Updates.php
r747 r748 1489 1489 } 1490 1490 1491 function UpdateTo74 8($Manager)1491 function UpdateTo747($Manager) 1492 1492 { 1493 1493 $Manager->Execute('ALTER TABLE `FinanceOperation` ADD `ValueUser` FLOAT NOT NULL AFTER `Value`;'); … … 1506 1506 $Manager->Execute('ALTER TABLE `FinanceInvoice` DROP `Direction`, DROP `ValueSign`;'); 1507 1507 // 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 1511 function 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 } 1509 1518 } 1510 1519 … … 1579 1588 740 => array('Revision' => 741, 'Function' => 'UpdateTo741'), 1580 1589 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'), 1582 1592 )); 1583 1593 }
Note:
See TracChangeset
for help on using the changeset viewer.