<?php
namespace ModulesAbstract\PluginReports\Report\Model\Gatherer; class SupplierInvoices extends GathererAbstract { protected $invoicesIterator = NULL; public function getRequiredFilters() { return [ 'invoiceDate', ]; } public function getAcceptedFilters() { return [ 'invoiceDate', 'invoiceIssued', ]; } protected function objectInitialize() { $listObj = new \App\EntityList\SupplierInvoices(); $listObj->setFilter('invoiceDate', '>=', $this->filters['invoiceDate']['start']); $listObj->setFilter('invoiceDate', '<=', $this->filters['invoiceDate']['end']); $listObj->applyUserRestriction(false); if ($this->filters['invoiceIssued']) { $listObj->setFilter('blockTime', '>', 0); } $this->invoicesIterator = $listObj->getExecution(); } protected function objectDestroy() { if ($this->invoicesIterator) { $this->invoicesIterator->Close(); $this->invoicesIterator = NULL; } } protected function objectNext() { if ($this->invoicesIterator && !$this->invoicesIterator->EOF) { $result = $this->invoicesIterator->FetchRow(); return \Entity\SupplierInvoice::select($result['id']); } return NULL; } }