Simplificacion de retorno de ventas por unidades
This commit is contained in:
@ -108,11 +108,11 @@ class Venta extends Service
|
||||
public function getActiveByUnidadIds(array $unidad_ids): array
|
||||
{
|
||||
try {
|
||||
$ventas = $this->ventaRepository->fetchActiveByUnidadIds($unidad_ids);
|
||||
$ventas = $this->ventaRepository->fetchActiveArrayByUnidadIds($unidad_ids);
|
||||
return array_map(function($data) {
|
||||
return [
|
||||
'unidad_id' => $data['unidad_id'],
|
||||
'venta' => $this->process($data['venta'])
|
||||
'venta' => $this->processSimple($data['venta'])
|
||||
];
|
||||
}, $ventas);
|
||||
} catch (Implement\Exception\EmptyResult $exception) {
|
||||
@ -189,6 +189,18 @@ class Venta extends Service
|
||||
return $venta;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $venta
|
||||
* @return array
|
||||
* @throws Read
|
||||
*/
|
||||
protected function processSimple(array $venta): array
|
||||
{
|
||||
$output = $venta;
|
||||
$output['propiedad'] = $this->propiedadService->getArrayById($venta['propiedad']);
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Exception
|
||||
*/
|
||||
|
Reference in New Issue
Block a user