<?php
 namespace Modules\Partners\Suppliers\ContactPersons; class Model extends \App\Mvc\Model_ListingAbstract { public function list_execute(\App\Mvc\View\Listing\Members\Params $listingParams) { $filters = $listingParams->getFilters(); $listObj = new \App\EntityList\ContactPersons(); $listObj->setColumns(['addTime', 'idCompany', 'title', 'firstName', 'lastName', 'email', 'telephone', 'telephoneMobile', 'fax', 'job' ]); $listObj->setFilter('type', 'LIKE', 'supplier'); if ($filters['supplier']['id']) { $listObj->setFilter('idCompany', 'LIKE', $filters['supplier']['id']); } if ($filters['name']) { $listObj->setFilter('CONCAT(lastName, firstName)', 'LIKE', "%{$filters['name']}%"); } if ($filters['text']) { $listObj->setCustomFilter('email LIKE ? OR telephone LIKE ? OR telephoneMobile LIKE ? OR comments LIKE ?', ["%{$filters['text']}%", "%{$filters['text']}%", "%{$filters['text']}%", "%{$filters['text']}%"]); } $listObj = $this->entityList_inheritListingParams($listingParams, $listObj); $this->recordsList = $listObj->exportRecords(); $this->totalRecordsCount = $listObj->getRecordsCount(); } } 