Changeset 939


Ignore:
Timestamp:
Aug 2, 2022, 9:26:10 AM (21 months ago)
Author:
chronos
Message:
  • Fixed: Incorrectly used member date BillingPeriodLastDate for determining new payments log for payment notification email.
Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Application/UpdateTrace.php

    r934 r939  
    22172217  $Manager->Execute('UPDATE `PermissionGroup` SET `SysName`="other-users" WHERE `Description`="Ostatní"');
    22182218  $Manager->Execute('UPDATE `PermissionGroup` SET `SysName`="customers" WHERE `Description`="Zákazníci"');
     2219}
     2220
     2221function UpdateTo939(UpdateManager $Manager): void
     2222
     2223  $Manager->Execute('ALTER TABLE `Member` ADD `PaymentEmailTime` DATETIME NULL DEFAULT NULL AFTER `Contract`;');
     2224  $Manager->Execute('UPDATE `Member` SET `PaymentEmailTime`=DATE_SUB(`BillingPeriodLastDate`, INTERVAL 1 MONTH) WHERE BillingPeriod=2 AND BillingPeriodLastDate<>"0000-00-00"');
     2225  $Manager->Execute('UPDATE `Member` SET `PaymentEmailTime`=DATE_SUB(`BillingPeriodLastDate`, INTERVAL 3 MONTH) WHERE BillingPeriod=3 AND BillingPeriodLastDate<>"0000-00-00"');
     2226  $Manager->Execute('UPDATE `Member` SET `PaymentEmailTime`=DATE_SUB(`BillingPeriodLastDate`, INTERVAL 6 MONTH) WHERE BillingPeriod=4 AND BillingPeriodLastDate<>"0000-00-00"');
     2227  $Manager->Execute('UPDATE `Member` SET `PaymentEmailTime`=DATE_SUB(`BillingPeriodLastDate`, INTERVAL 12 MONTH) WHERE BillingPeriod=5 AND BillingPeriodLastDate<>"0000-00-00"');
     2228  $Manager->Execute('ALTER TABLE `UserOnline` ENGINE = InnoDB;');
    22192229}
    22202230
     
    23282338      911 => array('Revision' => 921, 'Function' => 'UpdateTo921'),
    23292339      921 => array('Revision' => 933, 'Function' => 'UpdateTo933'),
     2340      933 => array('Revision' => 939, 'Function' => 'UpdateTo939'),
    23302341    );
    23312342  }
  • trunk/Application/Version.php

    r934 r939  
    11<?php
    22
    3 $Revision = 933; // Subversion revision
    4 $DatabaseRevision = 933; // SQL structure revision
    5 $ReleaseTime = strtotime('2022-05-11');
     3$Revision = 939; // Subversion revision
     4$DatabaseRevision = 939; // SQL structure revision
     5$ReleaseTime = strtotime('2022-08-01');
  • trunk/Modules/Customer/Customer.php

    r914 r939  
    3939        'Consumption' => array('Type' => 'TCustomerStockSerialNumber', 'Caption' => 'Spotřeba zařízení', 'Default' => ''),
    4040        'Contract' => array('Type' => 'TContract', 'Caption' => 'Smlouva', 'Default' => '', 'Null' => true),
     41        'PaymentEmailTime' => array('Type' => 'DateTime', 'Caption' => 'Čas platebního emailu', 'Default' => 'NOW()', 'Null' => true, 'NotInList' => true),
    4142        'ChangeAction' => array('Type' => 'TActionEnum', 'Caption' => 'Změna - akce', 'Default' => '', 'Null' => true),
    4243        'ChangeTime' => array('Type' => 'DateTime', 'Caption' => 'Změna - čas', 'Default' => '', 'Null' => true, 'NotInList' => true),
     
    9293        'ChangeReplaceId' => array('Type' => 'TService', 'Caption' => 'Změna - položka', 'Default' => '', 'Null' => true),
    9394        'CustomerRel' => array('Type' => 'TServiceCustomerRelListService', 'Caption' => 'Placení zákazníky', 'Default' => ''),
     95        'TvRel' => array('Type' => 'TServiceTvRelListService', 'Caption' => 'TV kanály', 'Default' => ''),
    9496      ),
    9597    ));
     
    194196      'Type' => 'ManyToOne',
    195197      'Table' => 'ServiceCustomerRel',
     198      'Id' => 'Id',
     199      'Ref' => 'Service',
     200      'Filter' => '1',
     201    ));
     202    $this->System->FormManager->RegisterFormType('TServiceTvRelListService', array(
     203      'Type' => 'ManyToOne',
     204      'Table' => 'ServiceTvRel',
    196205      'Id' => 'Id',
    197206      'Ref' => 'Service',
     
    338347    $Desc->AddBoolean('Blocked');
    339348    $Desc->AddInteger('PayDay');
     349    $Desc->AddDateTime('PaymentEmailTime');
    340350    $Desc->AddChangeAction();
    341351    return $Desc;
  • trunk/Modules/Finance/Manage.php

    r916 r939  
    393393        '<th style="border-style: solid; border-width: 1px; padding: 1px 5px 1px 5px; text-align: center; font-weight: bold;">Popis</th>'.
    394394        '<th style="border-style: solid; border-width: 1px; padding: 1px 5px 1px 5px; text-align: center; font-weight: bold;">Částka [Kč]</th></tr>'."\n";
     395      if ($Member['PaymentEmailTime'] <> 'NULL')
     396      {
     397        $Where = ' WHERE (`T1`.`Time` > "'.$Member['PaymentEmailTime'].'")';
     398      } else
     399      {
     400        $Where = '';
     401      }
    395402      $DbResult = $this->Database->query('SELECT T1.* FROM ((SELECT `Text`, `Time`, `Value`, `File` FROM `FinanceOperation` WHERE (`Subject`='.$Member['Subject'].')) UNION ALL '.
    396403        '(SELECT (SELECT GROUP_CONCAT(`Description` SEPARATOR ", ") FROM `FinanceInvoiceItem` '.
    397404        'WHERE `FinanceInvoiceItem`.`FinanceInvoice` = `FinanceInvoice`.`Id`) AS `Text`, '.
    398         '`Time`, -`Value`, `File` FROM `FinanceInvoice` WHERE (`Subject`='.
    399         $Member['Subject'].')) ORDER BY `Time` DESC) AS `T1` WHERE (`T1`.`Time` > "'.$Member['BillingPeriodLastDate'].'")');
     405        '`Time`, -`Value`, `File` FROM `FinanceInvoice` WHERE (`Subject`='.$Member['Subject'].')) ORDER BY `Time` DESC) AS `T1`'.$Where);
    400406      while ($DbRow = $DbResult->fetch_assoc())
    401407      {
     
    413419      ModuleEmailQueue::Cast($this->System->GetModule('EmailQueue'))->AddItem($User['Name'].' <'.$User['Email'].'>', $Title, $Content,
    414420         $Config['Web']['Admin'].' <'.$Config['Web']['AdminEmail'].'>');
    415       $Output = '';
     421      $this->Database->update('Member', 'Id='.$Member['Id'], array('PaymentEmailTime' => 'NOW()'));
     422      $Output = '';     
    416423    } else $Output = 'Uživatel '.$User['Name'].' nemá email.';
    417424    return $Output;
Note: See TracChangeset for help on using the changeset viewer.