54 lines
1.5 KiB
PHP
54 lines
1.5 KiB
PHP
<?php
|
|
/**
|
|
* Description of SaleAlertMailCat
|
|
*
|
|
* @company Antadis
|
|
*/
|
|
|
|
class SaleAlertMailCat extends ObjectModel{
|
|
|
|
public $id_privatesales_alertmail_category;
|
|
public $id_privatesales_category;
|
|
public $id_user;
|
|
public $email;
|
|
/**
|
|
*
|
|
* @var type
|
|
*/
|
|
public static $definition = array(
|
|
'table' => 'privatesales_alertmail_category',
|
|
'primary' => 'id_privatesales_alertmail_category',
|
|
'fields' => array(
|
|
'id_privatesales_category' => array(
|
|
'type' => ObjectModel :: TYPE_INT,
|
|
'required' => TRUE,
|
|
'validate' => 'isInt'
|
|
),
|
|
'id_user' => array(
|
|
'type' => ObjectModel :: TYPE_INT,
|
|
'validate' => 'isInt'
|
|
),
|
|
'email' => array(
|
|
'type' => ObjectModel :: TYPE_STRING,
|
|
'required' => TRUE,
|
|
'validate' => 'isEmail'
|
|
)
|
|
)
|
|
);
|
|
|
|
public static function isAlertedCategory($id_customer,$id_category){
|
|
if(!$id_customer || !$id_category)
|
|
return false;
|
|
|
|
if ($row = Db::getInstance()->getRow('
|
|
SELECT `id_privatesales_alertmail_category`
|
|
FROM `' . _DB_PREFIX_ . 'privatesales_alertmail_category`
|
|
WHERE `id_privatesales_category` = ' . (int)$id_category . '
|
|
AND `id_user` = ' . (int)$id_customer . '
|
|
')
|
|
) {
|
|
return (int)$row['id_privatesales_alertmail_category'];
|
|
}
|
|
return FALSE;
|
|
}
|
|
} |