Serveur preprod f0c0c48223 first push
2016-04-14 16:14:31 +02:00

54 lines
1.4 KiB
PHP

<?php
/**
* Description of SaleAlertMail
*
* @company Antadis
*/
class SaleAlertMail extends ObjectModel{
public $id_privatesales_alertmail;
public $id_privatesales;
public $id_user;
public $email;
/**
*
* @var type
*/
public static $definition = array(
'table' => 'privatesales_alertmail',
'primary' => 'id_privatesales_alertmail',
'fields' => array(
'id_privatesales' => 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 isAlerted($id_customer,$id_sale){
if(!$id_customer || !$id_sale)
return false;
if ($row = Db::getInstance()->getRow('
SELECT `id_privatesales_alertmail`
FROM `' . _DB_PREFIX_ . 'privatesales_alertmail`
WHERE `id_privatesales` = ' . (int)$id_sale . '
AND `id_user` = ' . (int)$id_customer . '
')
) {
return (int)$row['id_privatesales_alertmail'];
}
return FALSE;
}
}