first commit
This commit is contained in:
42
admin/lists/Automatic_importList.php
Normal file
42
admin/lists/Automatic_importList.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user