mirror of
https://github.com/OpenXE-org/OpenXE.git
synced 2024-11-14 20:17:14 +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 DateTimeInterface;
|
||||||
use Exception;
|
use Exception;
|
||||||
use Xentral\Components\Database\Database;
|
use Xentral\Components\Database\Database;
|
||||||
|
use Xentral\Components\Logger\Logger;
|
||||||
use Xentral\Modules\SubscriptionCycle\Service\SubscriptionCycleJobService;
|
use Xentral\Modules\SubscriptionCycle\Service\SubscriptionCycleJobService;
|
||||||
use Xentral\Modules\SubscriptionCycle\SubscriptionCycleModuleInterface;
|
use Xentral\Modules\SubscriptionCycle\SubscriptionCycleModuleInterface;
|
||||||
use Xentral\Modules\SubscriptionCycle\SubscriptionModuleInterface;
|
use Xentral\Modules\SubscriptionCycle\SubscriptionModuleInterface;
|
||||||
@ -58,15 +59,23 @@ final class SubscriptionCycleManualJobTask
|
|||||||
$this->taskMutexService->setMutex('rechnungslauf_manual');
|
$this->taskMutexService->setMutex('rechnungslauf_manual');
|
||||||
$jobs = $this->cycleJobService->listAll(100);
|
$jobs = $this->cycleJobService->listAll(100);
|
||||||
foreach ($jobs as $job) {
|
foreach ($jobs as $job) {
|
||||||
switch ($job['document_type']) {
|
try {
|
||||||
case 'rechnung':
|
switch ($job['document_type']) {
|
||||||
$this->subscriptionModule->CreateInvoice((int)$job['address_id']);
|
case 'rechnung':
|
||||||
break;
|
$this->subscriptionModule->CreateInvoice((int)$job['address_id']);
|
||||||
case 'auftrag':
|
break;
|
||||||
$this->subscriptionModule->CreateOrder((int)$job['address_id']);
|
case 'auftrag':
|
||||||
break;
|
$this->subscriptionModule->CreateOrder((int)$job['address_id']);
|
||||||
}
|
break;
|
||||||
$this->cycleJobService->delete((int)$job['id']);
|
}
|
||||||
|
}
|
||||||
|
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
|
WHERE aa.dokument = :doctype
|
||||||
AND greatest(aa.startdatum, aa.abgerechnetbis) <= :calcdate
|
AND greatest(aa.startdatum, aa.abgerechnetbis) <= :calcdate
|
||||||
AND (aa.enddatum = '0000-00-00' OR aa.abgerechnetbis < aa.enddatum)
|
AND (aa.enddatum = '0000-00-00' OR aa.abgerechnetbis < aa.enddatum)
|
||||||
|
AND aa.preisart IN ('monat', 'jahr', '30tage')
|
||||||
AND aa.adresse = :address";
|
AND aa.adresse = :address";
|
||||||
|
|
||||||
return $this->db->fetchAll($sql, [
|
return $this->db->fetchAll($sql, [
|
||||||
|
@ -70,7 +70,7 @@ class Rechnungslauf {
|
|||||||
$calcdate = new \DateTimeImmutable('today');
|
$calcdate = new \DateTimeImmutable('today');
|
||||||
$scalcdate = $calcdate->format('Y-m-d');
|
$scalcdate = $calcdate->format('Y-m-d');
|
||||||
$where = " aa.id > 0
|
$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 greatest(aa.startdatum, aa.abgerechnetbis) < '$scalcdate'
|
||||||
AND (aa.enddatum = '0000-00-00' OR aa.abgerechnetbis < aa.enddatum)";
|
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>"
|
. "<img src=\"themes/{$app->Conf->WFconf['defaulttheme']}/images/forward.svg\" border=\"0\"></a>"
|
||||||
. " </td></tr></table>";
|
. " </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,
|
$sql = "SELECT SQL_CALC_FOUND_ROWS aa.id, ad.name, ad.kundennummer,
|
||||||
aa.bezeichnung, a.nummer, DATE_FORMAT(aa.abgerechnetbis, '%d.%m.%Y'),
|
aa.bezeichnung, a.nummer, DATE_FORMAT(aa.abgerechnetbis, '%d.%m.%Y'),
|
||||||
|
Loading…
Reference in New Issue
Block a user