Files
kupshop/admin/lists/Automatic_importList.php
2025-08-02 16:30:27 +02:00

43 lines
1.4 KiB
PHP

<?php
use KupShop\AdminBundle\AdminList\BaseList;
class Automatic_importList extends BaseList
{
protected $tableDef = [
'id' => 'id',
'fields' => [
'ID' => ['field' => 'i.id'],
'Jméno' => ['field' => 'i.name', 'size' => 1.5],
'Dodavatel' => ['field' => 'sup_name', 'size' => 1.5],
'Poslední synchronizace' => ['field' => 'last_sync'],
'Synchronizováno položek' => ['field' => 'i.last_count'],
'Interval (dnů)' => ['field' => 'i.interval'],
],
];
public function getQuery()
{
$qb = sqlQueryBuilder()
->select('i.id', 'i.id ID', 'i.name', 's.name AS sup_name', 'DATE_FORMAT(i.last_sync, \''.$GLOBALS['dbcfg']['date_format'].' '.$GLOBALS['dbcfg']['time_format'].'\') as last_sync', 'i.last_count', 'i.interval')
->from('import', 'i')
->leftJoin('i', 'suppliers', 's', 'i.id_supplier=s.id');
extract($_GET, EXTR_SKIP | EXTR_REFS);
if (!empty($IDi)) {
$qb->where(\Query\Operator::inIntArray($IDs, 's.id'));
}
// ###########
if (isset($supplier) && $supplier != '') {
$qb->where('s.name LIKE :supplier_name')
->orWhere('s.ico LIKE :supplier_name')
->setParameter('supplier_name', '%'.$supplier.'%');
unset($fields, $name);
}
return $qb;
}
}