<?php
 namespace Modules\Orders\Cancel; class Model extends \App\Mvc\ModelAbstract { public function getServiceEntity($idEntity, $input) { $servObj=\Entity\Service::cancel($idEntity); $servObj->cancelReason=$input['serviceCancelReason']; $servObj->cancelReasonDetails=$input['serviceCancelDetails']; return $servObj; } public function getNotIssuedServiceInvoices($idService) { $invRowsList=\Entity\Service::select($idService)->invoiceRowsList; $return=[]; foreach($invRowsList as $row) { $inv=\Entity\Invoice::select($row['idInvoice']); if (!$inv->issueTime and !$return[$row['idInvoice']]) { $return[$row['idInvoice']]=['id'=>$row['idInvoice'], 'invoiceNumber'=>$inv->invoiceNumber, 'invoiceDate'=>$inv->invoiceDate]; } } return $return; } public function getNotIssuedOrderInvoices($idOrder) { $servList=\Entity\Order::select($idOrder)->servicesList; $return=[]; foreach($servList as $idServ=>$servDet) { if ($servDet['statusOp']!='XX') { $return += $this->getNotIssuedServiceInvoices($idServ); } } return $return; } } 