mirror of
https://github.com/OpenXE-org/OpenXE.git
synced 2024-12-24 13:40:29 +01:00
Merge pull request #142 from exciler/subscriptioncycle_bugfix
Subscriptioncycle bugfix
This commit is contained in:
commit
5b21ee0332
@ -15,6 +15,7 @@ use DateTimeImmutable;
|
||||
use DateTimeInterface;
|
||||
use Exception;
|
||||
use Xentral\Components\Database\Database;
|
||||
use Xentral\Components\Logger\Logger;
|
||||
use Xentral\Modules\SubscriptionCycle\Service\SubscriptionCycleJobService;
|
||||
use Xentral\Modules\SubscriptionCycle\SubscriptionCycleModuleInterface;
|
||||
use Xentral\Modules\SubscriptionCycle\SubscriptionModuleInterface;
|
||||
@ -58,15 +59,23 @@ final class SubscriptionCycleManualJobTask
|
||||
$this->taskMutexService->setMutex('rechnungslauf_manual');
|
||||
$jobs = $this->cycleJobService->listAll(100);
|
||||
foreach ($jobs as $job) {
|
||||
switch ($job['document_type']) {
|
||||
case 'rechnung':
|
||||
$this->subscriptionModule->CreateInvoice((int)$job['address_id']);
|
||||
break;
|
||||
case 'auftrag':
|
||||
$this->subscriptionModule->CreateOrder((int)$job['address_id']);
|
||||
break;
|
||||
}
|
||||
$this->cycleJobService->delete((int)$job['id']);
|
||||
try {
|
||||
switch ($job['document_type']) {
|
||||
case 'rechnung':
|
||||
$this->subscriptionModule->CreateInvoice((int)$job['address_id']);
|
||||
break;
|
||||
case 'auftrag':
|
||||
$this->subscriptionModule->CreateOrder((int)$job['address_id']);
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception $e) {
|
||||
/** @var Logger $logger */
|
||||
$logger = $this->app->Container->get('Logger');
|
||||
$logger->error($e->getMessage(), $job);
|
||||
} finally {
|
||||
$this->cycleJobService->delete((int)$job['id']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -61,6 +61,7 @@ class SubscriptionModule implements SubscriptionModuleInterface
|
||||
WHERE aa.dokument = :doctype
|
||||
AND greatest(aa.startdatum, aa.abgerechnetbis) <= :calcdate
|
||||
AND (aa.enddatum = '0000-00-00' OR aa.abgerechnetbis < aa.enddatum)
|
||||
AND aa.preisart IN ('monat', 'jahr', '30tage')
|
||||
AND aa.adresse = :address";
|
||||
|
||||
return $this->db->fetchAll($sql, [
|
||||
|
@ -70,7 +70,7 @@ class Rechnungslauf {
|
||||
$calcdate = new \DateTimeImmutable('today');
|
||||
$scalcdate = $calcdate->format('Y-m-d');
|
||||
$where = " aa.id > 0
|
||||
AND aa.dokument = '$doctype'
|
||||
AND aa.dokument = '$doctype' AND aa.preisart IN ('monat', 'jahr', '30tage')
|
||||
AND greatest(aa.startdatum, aa.abgerechnetbis) < '$scalcdate'
|
||||
AND (aa.enddatum = '0000-00-00' OR aa.abgerechnetbis < aa.enddatum)";
|
||||
|
||||
@ -167,7 +167,8 @@ class Rechnungslauf {
|
||||
. "<img src=\"themes/{$app->Conf->WFconf['defaulttheme']}/images/forward.svg\" border=\"0\"></a>"
|
||||
. " </td></tr></table>";
|
||||
|
||||
$where = " aa.id > 0 AND (aa.enddatum = '0000-00-00' OR aa.abgerechnetbis < aa.enddatum) ";
|
||||
$where = " aa.id > 0 AND aa.preisart IN ('monat', 'jahr', '30tage')
|
||||
AND (aa.enddatum = '0000-00-00' OR aa.abgerechnetbis < aa.enddatum) ";
|
||||
|
||||
$sql = "SELECT SQL_CALC_FOUND_ROWS aa.id, ad.name, ad.kundennummer,
|
||||
aa.bezeichnung, a.nummer, DATE_FORMAT(aa.abgerechnetbis, '%d.%m.%Y'),
|
||||
|
Loading…
Reference in New Issue
Block a user