Mostrar alertas en inicio
This commit is contained in:
@ -69,15 +69,12 @@ class Pago
|
||||
public function getById(int $pago_id): Model\Venta\Pago
|
||||
{
|
||||
$pago = $this->pagoRepository->fetchById($pago_id);
|
||||
$pago->estados = $this->estadoPagoRepository->fetchByPago($pago_id);
|
||||
$pago->currentEstado = $this->estadoPagoRepository->fetchCurrentByPago($pago_id);
|
||||
if (($pago->uf === null or $pago->uf === 0.0) and $pago->fecha < new DateTimeImmutable()) {
|
||||
$pago->uf = $this->moneyService->getUF($pago->fecha);
|
||||
if ($pago->uf !== 0.0) {
|
||||
$this->pagoRepository->edit($pago, ['uf' => $pago->uf]);
|
||||
}
|
||||
}
|
||||
return $pago;
|
||||
return $this->process($pago);
|
||||
}
|
||||
|
||||
public function getByVenta(int $venta_id): array
|
||||
{
|
||||
return array_map([$this, 'process'], $this->pagoRepository->fetchByVenta($venta_id));
|
||||
}
|
||||
|
||||
public function getPendientes(): array
|
||||
@ -121,4 +118,17 @@ class Pago
|
||||
$pago->currentEstado = $estado;
|
||||
return $pago;
|
||||
}
|
||||
|
||||
protected function process($pago): Model\Venta\Pago
|
||||
{
|
||||
$pago->estados = $this->estadoPagoRepository->fetchByPago($pago->id);
|
||||
$pago->currentEstado = $this->estadoPagoRepository->fetchCurrentByPago($pago->id);
|
||||
if (($pago->uf === null or $pago->uf === 0.0) and $pago->fecha < new DateTimeImmutable()) {
|
||||
$pago->uf = $this->moneyService->getUF($pago->fecha);
|
||||
if ($pago->uf !== 0.0) {
|
||||
$this->pagoRepository->edit($pago, ['uf' => $pago->uf]);
|
||||
}
|
||||
}
|
||||
return $pago;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user