Filter only files associated to customer
This commit is contained in:
parent
9960d45989
commit
c5ee4748c6
@ -22,6 +22,33 @@ class Files extends ObjectModel
|
||||
),
|
||||
);
|
||||
|
||||
public function getAdminCustomerFiles($id, $limit_start, $limit_end = false)
|
||||
{
|
||||
$limit = (int)$limit_start;
|
||||
if ($limit_end) {
|
||||
$limit = (int)$limit_start.','.(int)$limit_end;
|
||||
}
|
||||
|
||||
$files = Db::getInstance()->executeS('
|
||||
SELECT * FROM `'._DB_PREFIX_.'antadis_files`
|
||||
WHERE `id_customer` = '.(int)$id.
|
||||
' ORDER BY `added` DESC LIMIT '.$limit
|
||||
);
|
||||
|
||||
return $files;
|
||||
}
|
||||
|
||||
public function getAdminCustomerNbFiles($id)
|
||||
{
|
||||
$nb = Db::getInstance()->getValue('
|
||||
SELECT COUNT(`id_file`)
|
||||
FROM `'._DB_PREFIX_.'antadis_files`
|
||||
WHERE `id_customer` = '.(int)$id
|
||||
);
|
||||
|
||||
return $nb;
|
||||
}
|
||||
|
||||
public function getCustomerFiles($id, $limit_start, $limit_end = false)
|
||||
{
|
||||
$limit = (int)$limit_start;
|
||||
@ -45,6 +72,7 @@ class Files extends ObjectModel
|
||||
FROM `'._DB_PREFIX_.'antadis_files`
|
||||
WHERE `id_customer`=0 OR `id_customer` = '.(int)$id
|
||||
);
|
||||
|
||||
return $nb;
|
||||
}
|
||||
}
|
@ -19,8 +19,8 @@ class AntadisFilesDisplayAdminCustomersController
|
||||
if ($id_customer > 0) {
|
||||
// Get files list
|
||||
$filesM = new Files();
|
||||
$nbFiles = $filesM->getCustomerNbFiles($id_customer);
|
||||
$files = $filesM->getCustomerFiles($id_customer, 10);
|
||||
$nbFiles = $filesM->getAdminCustomerNbFiles($id_customer);
|
||||
$files = $filesM->getAdminCustomerFiles($id_customer, 10);
|
||||
}
|
||||
|
||||
$this->context->smarty->assign(array(
|
||||
|
Loading…
Reference in New Issue
Block a user