3 Commits

Author SHA1 Message Date
th.guenther 3fdbaf0285 Release 2026-05-23 15:58:06 +02:00
th.guenther 8a049efe49 Release 2026-05-14 17:59:22 +02:00
th.guenther a62b2214c4 Merge pull request 'Comments for invoices' (#3) from dev-4.2.0 into main
Comments for invoices
Bugfix: Birthday can be stored
Bugfix: Cronjobs  run correctly
2026-05-14 17:00:56 +02:00
3 changed files with 26 additions and 6 deletions
+4 -2
View File
@@ -23,12 +23,14 @@ class CostUnitRepository {
public function getCurrentEvents() : array {
public function getCurrentEvents(bool $disableAccessCheck = false) : array {
return $this->getCostUnitsByCriteria([
'allow_new' => true,
'type' => CostUnitType::COST_UNIT_TYPE_EVENT,
'archived' => false
]);
],
true,
$disableAccessCheck);
}
public function getRunningJobs() : array {
+21 -3
View File
@@ -2,23 +2,41 @@
namespace App\Tasks;
use App\Domains\CostUnit\Actions\ChangeCostUnitDetails\ChangeCostUnitDetailsCommand;
use App\Domains\CostUnit\Actions\ChangeCostUnitDetails\ChangeCostUnitDetailsRequest;
use App\Domains\CostUnit\Actions\ChangeCostUnitState\ChangeCostUnitStateCommand;
use App\Domains\CostUnit\Actions\ChangeCostUnitState\ChangeCostUnitStateRequest;
use App\Models\CostUnit;
use App\Repositories\CostUnitRepository;
use App\ValueObjects\Amount;
class CloseCostUnit implements CronTask {
public function handle(): void
{
$now = now();
$costUnitRepository = new CostUnitRepository();
$now = now();
$billingResetEnd = clone $now;
$billingResetEnd->add(new \DateInterval('P6W'));
/** @var CostUnit $costUnit */
foreach ($costUnitRepository->getCurrentEvents() as $costUnit) {
$billingEndTime = \DateTime::createFromFormat('Y-m-d H:i:s', $costUnit['billing_deadline']);
foreach ($costUnitRepository->getCurrentEvents(true) as $costUnit) {
$billingEnd = $costUnit['billing_deadline'];
if ($billingEnd === null) {
$billingEnd = \DateTime::createFromFormat('Y-m-d H:i:s', $billingResetEnd)->format('Y-m-d H:i:s');
new ChangeCostUnitDetailsCommand(new ChangeCostUnitDetailsRequest(
CostUnit::where('id', $costUnit['id'])->first(),
Amount::fromString($costUnit['distance_allowance']),
$costUnit['mail_on_new'],
$billingResetEnd
))->execute();
}
$billingEndTime = \DateTime::createFromFormat('Y-m-d H:i:s', $billingEnd);
$billingEndTime->setTime(0,0,0);
$billingEndTime->add(new \DateInterval('P1D'));
$now = now();
if ($billingEndTime < $now) {
new ChangeCostUnitStateCommand(
+1 -1
View File
@@ -1 +1 @@
4.2.0
4.2.1