Changeset 725


Ignore:
Timestamp:
Jan 4, 2015, 11:30:15 PM (10 years ago)
Author:
chronos
Message:
  • Modified: Old invoice items with validity period contained in Text was changed to move period to PeriodFrom and PeriodTo columns.
Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Application/Version.php

    r724 r725  
    11<?php
    22
    3 $Revision = 724; // Subversion revision
    4 $DatabaseRevision = 722; // SQL structure revision
    5 $ReleaseTime = strtotime('2015-01-03');
     3$Revision = 725; // Subversion revision
     4$DatabaseRevision = 725; // SQL structure revision
     5$ReleaseTime = strtotime('2015-01-04');
  • trunk/Common/Setup/Update.php

    r619 r725  
    5252      $RevUpdate($this);
    5353            $DbRevision = $TraceItem['Revision'];
    54             $this->Database->query('UPDATE `'.$this->VersionTable.'` SET `Revision`= '.$TraceItem['Revision'].' WHERE `Id`=1');
     54            $this->Database->query('UPDATE `'.$this->VersionTable.'` SET `Revision`= '.
     55                $TraceItem['Revision'].' WHERE `Id`=1');
    5556          }
    5657          return($Output);       
  • trunk/Common/Setup/Updates.php

    r722 r725  
    11271127{
    11281128        $Manager->Execute('ALTER TABLE `Service` DROP `CustomerCount`;');
     1129}
     1130
     1131function UpdateTo725($Manager)
     1132{
     1133        // Text column of invoices is not used. Text from invoice items is taken instead.
     1134        $DbResult = $Manager->Execute('ALTER TABLE `FinanceInvoice` DROP `Text`;');
     1135       
     1136        $SearchText = 'Připojení k síti';
     1137        $DbResult = $Manager->Execute('SELECT * FROM `FinanceInvoiceItem` WHERE `Description` LIKE "'.$SearchText.' za období%";');
     1138        while($DbRow = $DbResult->fetch_assoc())
     1139        {
     1140                $Text = trim(substr($DbRow['Description'], strlen($SearchText.' za období') + 1));
     1141                $Text = explode('-', $Text);           
     1142                $PeriodFrom = explode('.', trim($Text[0]));
     1143                $PeriodFrom = $PeriodFrom[2].'-'.$PeriodFrom[1].'-'.$PeriodFrom[0];
     1144                $PeriodTo = explode('.', trim($Text[1]));
     1145                $PeriodTo = $PeriodTo[2].'-'.$PeriodTo[1].'-'.$PeriodTo[0];
     1146                $Manager->Execute('UPDATE `FinanceInvoice` SET `PeriodFrom`="'.$PeriodFrom.'", `PeriodTo`="'.$PeriodTo.'" WHERE `Id`='.$DbRow['FinanceInvoice']);
     1147        }
     1148        $DbResult = $Manager->Execute('UPDATE `FinanceInvoiceItem` SET `Description` = "'.$SearchText.'" WHERE `Description` LIKE "'.$SearchText.' za období%";');
     1149       
     1150        $SearchText = 'Připojení k Internetu';
     1151        $DbResult = $Manager->Execute('SELECT * FROM `FinanceInvoiceItem` WHERE `Description` LIKE "'.$SearchText.' za období%";');
     1152        while($DbRow = $DbResult->fetch_assoc())
     1153        {
     1154                $Text = trim(substr($DbRow['Description'], strlen($SearchText.' za období') + 1));
     1155                $Text = explode('-', $Text);           
     1156                $PeriodFrom = explode('.', trim($Text[0]));
     1157                $PeriodFrom = $PeriodFrom[2].'-'.$PeriodFrom[1].'-'.$PeriodFrom[0];
     1158                $Text[1] = trim($Text[1]);
     1159                if(strpos($Text[1], ' ') !== false) $Text[1] = substr($Text[1], 0, strpos($Text[1], ' '));
     1160                $PeriodTo = explode('.', trim($Text[1]));
     1161                $PeriodTo = $PeriodTo[2].'-'.$PeriodTo[1].'-'.$PeriodTo[0];
     1162                $Manager->Execute('UPDATE `FinanceInvoice` SET `PeriodFrom`="'.$PeriodFrom.'", `PeriodTo`="'.$PeriodTo.'" WHERE `Id`='.$DbRow['FinanceInvoice']);
     1163        }
     1164        $DbResult = $Manager->Execute('UPDATE `FinanceInvoiceItem` SET `Description` = "'.$SearchText.'" WHERE `Description` LIKE "'.$SearchText.' za období%";');
    11291165}
    11301166
     
    11881224        719 => array('Revision' => 720, 'Function' => 'UpdateTo720'),
    11891225        720 => array('Revision' => 722, 'Function' => 'UpdateTo722'),
     1226        722 => array('Revision' => 725, 'Function' => 'UpdateTo725'),
    11901227    ));
    11911228  }
  • trunk/Modules/Finance/Finance.php

    r724 r725  
    9595
    9696    $DbResult = $this->Database->query('SELECT * FROM `DocumentLineSequence` WHERE '.
    97         '`DocumentLine`='.$Id.' AND `FinanceYear`='.$FinanceYear['Id']);
     97      '`DocumentLine`='.$Id.' AND `FinanceYear`='.$FinanceYear['Id']);
    9898    $Sequence = $DbResult->fetch_assoc();
    9999
     
    104104
    105105    $this->Database->query('UPDATE `DocumentLineSequence` SET `NextNumber` = `NextNumber` + 1 '.
    106         'WHERE (`DocumentLine`='.$Id.') AND (`FinanceYear`='.$FinanceYear['Id'].')');
     106      'WHERE (`DocumentLine`='.$Id.') AND (`FinanceYear`='.$FinanceYear['Id'].')');
    107107    return($Result);
    108108  }
Note: See TracChangeset for help on using the changeset viewer.