Changeset 688 for trunk/Common


Ignore:
Timestamp:
Sep 7, 2014, 2:48:21 PM (10 years ago)
Author:
chronos
Message:
  • Upraveno: Spotřeba se dále bude zákazníkům evidovat jako samostatná přiřazená služba namísto pevného vkládání položky a dopočtu z tabulky "Placení zákazníků".
File:
1 edited

Legend:

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

    r679 r688  
    885885}
    886886
     887function UpdateTo688($Manager)
     888{
     889        // Convert monthly plus payment for consumption to regular service
     890  $DbResult = $Manager->Execute('SELECT `MonthlyPlus`, `Member` FROM `MemberPayment` WHERE `MonthlyPlus` > 0');
     891  while($DbResult->num_rows > 0)
     892  {
     893        $DbRow = $DbResult->fetch_assoc();
     894    $Manager->Execute("INSERT INTO `Service` (`Id` ,`Name` ,`Category` ,`Price` ,`VAT`) ".
     895      "VALUES (NULL , 'Spotřeba energie', 3, -".$DbRow['MonthlyPlus'].", 2);");
     896    $ServiceId = $Manager->Database->insert_id;
     897    $Manager->Execute("INSERT INTO `ServiceCustomerRel` (`Id` ,`Service` ,`Customer`) ".
     898      "VALUES (NULL , ".$ServiceId.', '.$DbRow['Member'].");");
     899  }
     900}
     901
    887902class Updates
    888903{
     
    933948      676 => array('Revision' => 678, 'Function' => 'UpdateTo678'),
    934949      678 => array('Revision' => 679, 'Function' => 'UpdateTo679'),
     950      679 => array('Revision' => 688, 'Function' => 'UpdateTo688'),
    935951    ));
    936952  }
Note: See TracChangeset for help on using the changeset viewer.