Quellcode durchsuchen

Merge tag 'hotfix_1401' into develop

hotfix_1401
feature/souke
Guillaume Bourgeois vor 1 Jahr
Ursprung
Commit
a534bde4ea
2 geänderte Dateien mit 17 neuen und 7 gelöschten Zeilen
  1. +10
    -5
      common/logic/Distribution/Distribution/Service/DistributionBuilder.php
  2. +7
    -2
      console/commands/ActiveDistributionsInAdvanceController.php

+ 10
- 5
common/logic/Distribution/Distribution/Service/DistributionBuilder.php Datei anzeigen

$this->activeDistribution($distribution, $active); $this->activeDistribution($distribution, $active);
} }


public function activeDistributionByDayWeek(string $date, string $dayWeek, bool $active = true)
public function activeDistributionByDateIfDelivery(\DateTime $date, bool $active = true): void
{
$activeDay = $this->pointSaleRepository->isDayOfWeekWithDelivery($date->format('l'));
if($activeDay || !$active) {
$this->activeDistributionByDate($date, $active);
}
}

public function activeDistributionByDayWeek(string $date, string $dayWeek, bool $active = true): void
{ {
$week = sprintf('%02d', date('W', strtotime($date))); $week = sprintf('%02d', date('W', strtotime($date)));
$start = strtotime(date('Y', strtotime($date)) . 'W' . $week); $start = strtotime(date('Y', strtotime($date)) . 'W' . $week);
$dateDay = new \DateTime(date('Y-m-d', strtotime($dayWeek, $start))); $dateDay = new \DateTime(date('Y-m-d', strtotime($dayWeek, $start)));
$activeDay = $this->pointSaleRepository->isDayOfWeekWithDelivery($dayWeek);
if ($activeDay || !$active) {
$this->activeDistributionByDate($dateDay, $active);
}
$this->activeDistributionByDateIfDelivery($dateDay, $active);
} }


public function activeDistributionsOfWeek(string $date, bool $active = true): void public function activeDistributionsOfWeek(string $date, bool $active = true): void

+ 7
- 2
console/commands/ActiveDistributionsInAdvanceController.php Datei anzeigen

$weeksDistributionsActivatedInAdvance = $producerModule->getSolver()->getConfig('option_weeks_distributions_activated_in_advance'); $weeksDistributionsActivatedInAdvance = $producerModule->getSolver()->getConfig('option_weeks_distributions_activated_in_advance');
if($weeksDistributionsActivatedInAdvance) { if($weeksDistributionsActivatedInAdvance) {
$date = new \DateTime('+'.$weeksDistributionsActivatedInAdvance.' weeks'); $date = new \DateTime('+'.$weeksDistributionsActivatedInAdvance.' weeks');
$distributionModule->getBuilder()->activeDistributionByDate($date);
echo $producer->name. ' : distribution du ' . $date->format('d/m/Y') .' activée' ."\n";
$distributionModule->getBuilder()->activeDistributionByDateIfDelivery($date);

$distribution = $distributionModule->getRepository()
->findOneDistribution($date->format('Y-m-d'), true);
if($distribution) {
echo $producer->name. ' : distribution du ' . $date->format('d/m/Y') .' activée' ."\n";
}
} }
} }
} }

Laden…
Abbrechen
Speichern