// Set $definition in ObjectModel classes for modules
This commit is contained in:
@@ -28,43 +28,40 @@
|
|||||||
if (!defined('_PS_VERSION_'))
|
if (!defined('_PS_VERSION_'))
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
class WishList extends ObjectModel
|
class WishList extends ObjectModel
|
||||||
{
|
{
|
||||||
/** @var integer Wishlist ID */
|
/** @var integer Wishlist ID */
|
||||||
public $id;
|
public $id;
|
||||||
|
|
||||||
/** @var integer Customer ID */
|
/** @var integer Customer ID */
|
||||||
public $id_customer;
|
public $id_customer;
|
||||||
|
|
||||||
/** @var integer Token */
|
/** @var integer Token */
|
||||||
public $token;
|
public $token;
|
||||||
|
|
||||||
/** @var integer Name */
|
/** @var integer Name */
|
||||||
public $name;
|
public $name;
|
||||||
|
|
||||||
/** @var string Object creation date */
|
/** @var string Object creation date */
|
||||||
public $date_add;
|
public $date_add;
|
||||||
|
|
||||||
/** @var string Object last modification date */
|
/** @var string Object last modification date */
|
||||||
public $date_upd;
|
public $date_upd;
|
||||||
|
|
||||||
protected $fieldsSize = array('name' => 64, 'token' => 64);
|
/**
|
||||||
protected $fieldsRequired = array('id_customer', 'name', 'token');
|
* @see ObjectModel::$definition
|
||||||
protected $fieldsValidate = array('id_customer' => 'isUnsignedId', 'name' => 'isMessage',
|
*/
|
||||||
'token' => 'isMessage');
|
public static $definition = array(
|
||||||
protected $table = 'wishlist';
|
'table' => 'wishlist',
|
||||||
protected $identifier = 'id_wishlist';
|
'primary' => 'id_wishlist',
|
||||||
|
'fields' => array(
|
||||||
public function getFields()
|
'id_customer' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
|
||||||
{
|
'token' => array('type' => self::TYPE_STRING, 'validate' => 'isMessage', 'required' => true),
|
||||||
$this->validateFields();
|
'name' => array('type' => self::TYPE_STRING, 'validate' => 'isMessage', 'required' => true),
|
||||||
$fields['id_customer'] = (int)($this->id_customer);
|
'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
|
||||||
$fields['token'] = pSQL($this->token);
|
'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
|
||||||
$fields['name'] = pSQL($this->name);
|
)
|
||||||
$fields['date_add'] = pSQL($this->date_add);
|
);
|
||||||
$fields['date_upd'] = pSQL($this->date_upd);
|
|
||||||
return ($fields);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function delete()
|
public function delete()
|
||||||
{
|
{
|
||||||
@@ -86,15 +83,18 @@ class WishList extends ObjectModel
|
|||||||
if (!Validate::isUnsignedId($id_wishlist))
|
if (!Validate::isUnsignedId($id_wishlist))
|
||||||
die (Tools::displayError());
|
die (Tools::displayError());
|
||||||
$result = Db::getInstance()->getRow('
|
$result = Db::getInstance()->getRow('
|
||||||
SELECT `counter`
|
SELECT `counter`
|
||||||
FROM `'._DB_PREFIX_.'wishlist`
|
FROM `'._DB_PREFIX_.'wishlist`
|
||||||
WHERE `id_wishlist` = '.(int)($id_wishlist));
|
WHERE `id_wishlist` = '.(int)$id_wishlist
|
||||||
if ($result == false OR !sizeof($result) OR empty($result) === true)
|
);
|
||||||
|
if ($result == false || !count($result) || empty($result) === true)
|
||||||
return (false);
|
return (false);
|
||||||
return (Db::getInstance()->execute('
|
|
||||||
UPDATE `'._DB_PREFIX_.'wishlist` SET
|
return Db::getInstance()->execute('
|
||||||
`counter` = '.(int)($result['counter'] + 1).'
|
UPDATE `'._DB_PREFIX_.'wishlist` SET
|
||||||
WHERE `id_wishlist` = '.(int)($id_wishlist)));
|
`counter` = '.(int)($result['counter'] + 1).'
|
||||||
|
WHERE `id_wishlist` = '.(int)$id_wishlist
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -102,10 +102,10 @@ class WishList extends ObjectModel
|
|||||||
{
|
{
|
||||||
$context = Context::getContext();
|
$context = Context::getContext();
|
||||||
return Db::getInstance()->getValue('
|
return Db::getInstance()->getValue('
|
||||||
SELECT COUNT(*) AS total
|
SELECT COUNT(*) AS total
|
||||||
FROM `'._DB_PREFIX_.'wishlist`
|
FROM `'._DB_PREFIX_.'wishlist`
|
||||||
WHERE `name` = \''.pSQL($name).'\'
|
WHERE `name` = \''.pSQL($name).'\'
|
||||||
AND `id_customer` = '.(int)$context->customer->id
|
AND `id_customer` = '.(int)$context->customer->id
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,68 +25,43 @@
|
|||||||
* International Registered Trademark & Property of PrestaShop SA
|
* International Registered Trademark & Property of PrestaShop SA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class EditorialClass extends ObjectModel
|
class EditorialClass extends ObjectModel
|
||||||
{
|
{
|
||||||
/** @var integer editorial id*/
|
/** @var integer editorial id*/
|
||||||
public $id = 1;
|
public $id = 1;
|
||||||
|
|
||||||
/** @var string body_title*/
|
/** @var string body_title*/
|
||||||
public $body_home_logo_link;
|
public $body_home_logo_link;
|
||||||
|
|
||||||
/** @var string body_title*/
|
/** @var string body_title*/
|
||||||
public $body_title;
|
public $body_title;
|
||||||
|
|
||||||
/** @var string body_title*/
|
/** @var string body_title*/
|
||||||
public $body_subheading;
|
public $body_subheading;
|
||||||
|
|
||||||
/** @var string body_title*/
|
/** @var string body_title*/
|
||||||
public $body_paragraph;
|
public $body_paragraph;
|
||||||
|
|
||||||
/** @var string body_title*/
|
/** @var string body_title*/
|
||||||
public $body_logo_subheading;
|
public $body_logo_subheading;
|
||||||
|
|
||||||
protected $table = 'editorial';
|
|
||||||
protected $identifier = 'id_editorial';
|
|
||||||
|
|
||||||
protected $fieldsValidate = array('body_home_logo_link' => 'isUrl');
|
|
||||||
protected $fieldsValidateLang = array(
|
|
||||||
'body_title' => 'isGenericName',
|
|
||||||
'body_subheading' => 'isGenericName',
|
|
||||||
'body_paragraph' => 'isCleanHtml',
|
|
||||||
'body_logo_subheading' => 'isGenericName');
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check then return multilingual fields for database interaction
|
* @see ObjectModel::$definition
|
||||||
*
|
*/
|
||||||
* @return array Multilingual fields
|
public static $definition = array(
|
||||||
*/
|
'table' => 'editorial',
|
||||||
public function getTranslationsFieldsChild()
|
'primary' => 'id_editorial',
|
||||||
{
|
'fields' => array(
|
||||||
$this->validateFieldsLang();
|
'body_home_logo_link' => array('type' => self::TYPE_STRING, 'validate' => 'isUrl'),
|
||||||
|
|
||||||
|
// Lang fields
|
||||||
|
'body_title' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName'),
|
||||||
|
'body_subheading' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName'),
|
||||||
|
'body_paragraph' => array('type' => self::TYPE_HTML, 'lang' => true, 'validate' => 'isCleanHtml'),
|
||||||
|
'body_logo_subheading' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName'),
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
$fieldsArray = array('body_title', 'body_subheading', 'body_paragraph', 'body_logo_subheading');
|
|
||||||
$fields = array();
|
|
||||||
$languages = Language::getLanguages(false);
|
|
||||||
$defaultLanguage = (int)(Configuration::get('PS_LANG_DEFAULT'));
|
|
||||||
foreach ($languages as $language)
|
|
||||||
{
|
|
||||||
$fields[$language['id_lang']]['id_lang'] = (int)($language['id_lang']);
|
|
||||||
$fields[$language['id_lang']][$this->identifier] = (int)($this->id);
|
|
||||||
foreach ($fieldsArray as $field)
|
|
||||||
{
|
|
||||||
if (!Validate::isTableOrIdentifier($field))
|
|
||||||
die(Tools::displayError());
|
|
||||||
if (isset($this->{$field}[$language['id_lang']]) AND !empty($this->{$field}[$language['id_lang']]))
|
|
||||||
$fields[$language['id_lang']][$field] = pSQL($this->{$field}[$language['id_lang']], true);
|
|
||||||
elseif (in_array($field, $this->fieldsRequiredLang))
|
|
||||||
$fields[$language['id_lang']][$field] = pSQL($this->{$field}[$defaultLanguage], true);
|
|
||||||
else
|
|
||||||
$fields[$language['id_lang']][$field] = '';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $fields;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function copyFromPost()
|
public function copyFromPost()
|
||||||
{
|
{
|
||||||
/* Classical fields */
|
/* Classical fields */
|
||||||
@@ -104,12 +79,4 @@ class EditorialClass extends ObjectModel
|
|||||||
$this->{$field}[(int)($language['id_lang'])] = $_POST[$field.'_'.(int)($language['id_lang'])];
|
$this->{$field}[(int)($language['id_lang'])] = $_POST[$field.'_'.(int)($language['id_lang'])];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getFields()
|
|
||||||
{
|
|
||||||
$this->validateFields();
|
|
||||||
$fields['id_editorial'] = (int)($this->id);
|
|
||||||
$fields['body_home_logo_link'] = pSQL($this->body_home_logo_link);
|
|
||||||
return $fields;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,54 +35,24 @@ class HomeSlide extends ObjectModel
|
|||||||
public $active;
|
public $active;
|
||||||
public $position;
|
public $position;
|
||||||
|
|
||||||
protected $fieldsValidate = array(
|
/**
|
||||||
'active' => 'isunsignedInt',
|
* @see ObjectModel::$definition
|
||||||
'position' => 'isunsignedInt'
|
*/
|
||||||
);
|
public static $definition = array(
|
||||||
protected $fieldsRequired = array(
|
'table' => 'homeslider_slides',
|
||||||
'active',
|
'primary' => 'id_homeslider_slides',
|
||||||
'position'
|
'fields' => array(
|
||||||
);
|
'active' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'required' => true),
|
||||||
protected $fieldsRequiredLang = array('title', 'url', 'legend');
|
'position' => array('type' => self::TYPE_INT, 'validate' => 'isunsignedInt', 'required' => true),
|
||||||
protected $fieldsSizeLang = array(
|
|
||||||
'description' => 4000,
|
|
||||||
'title' => 255,
|
|
||||||
'legend' => 255,
|
|
||||||
'url' => 255,
|
|
||||||
'image' => 255
|
|
||||||
);
|
|
||||||
protected $fieldsValidateLang = array(
|
|
||||||
'title' => 'isCleanHtml',
|
|
||||||
'description' => 'isCleanHtml',
|
|
||||||
'url' => 'isUrl',
|
|
||||||
'legend' => 'isCleanHtml',
|
|
||||||
'image' => 'isCleanHtml'
|
|
||||||
);
|
|
||||||
|
|
||||||
protected $tables = array('homeslider_slides, homeslider_slides_lang');
|
// Lang fields
|
||||||
protected $table = 'homeslider_slides';
|
'description' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isCleanHtml', 'size' => 4000),
|
||||||
protected $identifier = 'id_homeslider_slides';
|
'title' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isCleanHtml', 'required' => true, 'size' => 255),
|
||||||
|
'legend' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isCleanHtml', 'required' => true, 'size' => 255),
|
||||||
public function getFields()
|
'url' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isUrl', 'required' => true, 'size' => 255),
|
||||||
{
|
'image' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isCleanHtml', 'size' => 255),
|
||||||
$this->validateFields();
|
)
|
||||||
$fields['id_homeslider_slides'] = (int)$this->id;
|
);
|
||||||
$fields['active'] = (int)$this->active;
|
|
||||||
$fields['position'] = (int)$this->position;
|
|
||||||
return $fields;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getTranslationsFieldsChild()
|
|
||||||
{
|
|
||||||
$this->validateFieldsLang();
|
|
||||||
return $this->getTranslationsFields(array(
|
|
||||||
'title',
|
|
||||||
'description',
|
|
||||||
'url',
|
|
||||||
'legend',
|
|
||||||
'image'
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
public function __construct($id_slide = null, $id_lang = null, $id_shop = null, Context $context = null)
|
public function __construct($id_slide = null, $id_lang = null, $id_shop = null, Context $context = null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -38,24 +38,22 @@ class LoyaltyModule extends ObjectModel
|
|||||||
public $date_add;
|
public $date_add;
|
||||||
public $date_upd;
|
public $date_upd;
|
||||||
|
|
||||||
protected $fieldsRequired = array('id_customer', 'points');
|
/**
|
||||||
protected $fieldsValidate = array('id_loyalty_state' => 'isInt', 'id_customer' => 'isInt', 'id_cart_rule' => 'isInt', 'id_order' => 'isInt', 'points' => 'isInt');
|
* @see ObjectModel::$definition
|
||||||
|
*/
|
||||||
protected $table = 'loyalty';
|
public static $definition = array(
|
||||||
protected $identifier = 'id_loyalty';
|
'table' => 'loyalty',
|
||||||
|
'primary' => 'id_loyalty',
|
||||||
public function getFields()
|
'fields' => array(
|
||||||
{
|
'id_loyalty_state' => array('type' => self::TYPE_INT, 'validate' => 'isInt'),
|
||||||
$this->validateFields();
|
'id_customer' => array('type' => self::TYPE_INT, 'validate' => 'isInt', 'required' => true),
|
||||||
$fields['id_loyalty_state'] = (int)$this->id_loyalty_state;
|
'id_order' => array('type' => self::TYPE_INT, 'validate' => 'isInt'),
|
||||||
$fields['id_customer'] = (int)$this->id_customer;
|
'id_cart_rule' => array('type' => self::TYPE_INT, 'validate' => 'isInt'),
|
||||||
$fields['id_order'] = (int)$this->id_order;
|
'points' => array('type' => self::TYPE_INT, 'validate' => 'isInt', 'required' => true),
|
||||||
$fields['id_cart_rule'] = (int)$this->id_cart_rule;
|
'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
|
||||||
$fields['points'] = (int)$this->points;
|
'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
|
||||||
$fields['date_add'] = pSQL($this->date_add);
|
)
|
||||||
$fields['date_upd'] = pSQL($this->date_upd);
|
);
|
||||||
return $fields;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function save($nullValues = false, $autodate = true)
|
public function save($nullValues = false, $autodate = true)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -33,31 +33,19 @@ class LoyaltyStateModule extends ObjectModel
|
|||||||
public $name;
|
public $name;
|
||||||
public $id_order_state;
|
public $id_order_state;
|
||||||
|
|
||||||
protected $fieldsValidate = array('id_order_state' => 'isInt');
|
|
||||||
protected $fieldsRequiredLang = array('name');
|
|
||||||
protected $fieldsSizeLang = array('name' => 128);
|
|
||||||
protected $fieldsValidateLang = array('name' => 'isGenericName');
|
|
||||||
|
|
||||||
protected $table = 'loyalty_state';
|
|
||||||
protected $identifier = 'id_loyalty_state';
|
|
||||||
|
|
||||||
public function getFields()
|
|
||||||
{
|
|
||||||
$this->validateFields();
|
|
||||||
$fields['id_order_state'] = (int)($this->id_order_state);
|
|
||||||
return $fields;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check then return multilingual fields for database interaction
|
* @see ObjectModel::$definition
|
||||||
*
|
*/
|
||||||
* @return array Multilingual fields
|
public static $definition = array(
|
||||||
*/
|
'table' => 'loyalty_state',
|
||||||
public function getTranslationsFieldsChild()
|
'primary' => 'id_loyalty_state',
|
||||||
{
|
'fields' => array(
|
||||||
$this->validateFieldsLang();
|
'id_order_state' => array('type' => self::TYPE_INT, 'validate' => 'isInt'),
|
||||||
return $this->getTranslationsFields(array('name'));
|
|
||||||
}
|
// Lang fields
|
||||||
|
'name' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 128),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
public static function getDefaultId() { return 1; }
|
public static function getDefaultId() { return 1; }
|
||||||
public static function getValidationId() { return 2; }
|
public static function getValidationId() { return 2; }
|
||||||
|
|||||||
@@ -62,35 +62,26 @@ class ProductComment extends ObjectModel
|
|||||||
/** @var string Object creation date */
|
/** @var string Object creation date */
|
||||||
public $date_add;
|
public $date_add;
|
||||||
|
|
||||||
protected $fieldsRequired = array('id_product', 'id_customer', 'content');
|
/**
|
||||||
protected $fieldsSize = array('content' => 65535);
|
* @see ObjectModel::$definition
|
||||||
protected $fieldsValidate = array(
|
*/
|
||||||
'id_product' => 'isUnsignedId',
|
public static $definition = array(
|
||||||
'id_customer' => 'isUnsignedId',
|
'table' => 'product_comment',
|
||||||
'content' => 'isMessage',
|
'primary' => 'id_product_comment',
|
||||||
'grade' => 'isFloat',
|
'fields' => array(
|
||||||
'validate' => 'isBool'
|
'id_product' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
|
||||||
|
'id_customer' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
|
||||||
|
'id_guest' => array('type' => self::TYPE_INT),
|
||||||
|
'customer_name' => array('type' => self::TYPE_STRING),
|
||||||
|
'title' => array('type' => self::TYPE_STRING),
|
||||||
|
'content' => array('type' => self::TYPE_STRING, 'validate' => 'isMessage', 'size' => 65535, 'required' => true),
|
||||||
|
'grade' => array('type' => self::TYPE_FLOAT, 'validate' => 'isFloat'),
|
||||||
|
'validate' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
|
||||||
|
'deleted' => array('type' => self::TYPE_BOOL),
|
||||||
|
'date_add' => array('type' => self::TYPE_DATE),
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
protected $table = 'product_comment';
|
|
||||||
protected $identifier = 'id_product_comment';
|
|
||||||
|
|
||||||
public function getFields()
|
|
||||||
{
|
|
||||||
$this->validateFields(false);
|
|
||||||
$fields['id_product'] = (int)$this->id_product;
|
|
||||||
$fields['id_customer'] = (int)$this->id_customer;
|
|
||||||
$fields['id_guest'] = (int)$this->id_guest;
|
|
||||||
$fields['customer_name'] = pSQL($this->customer_name);
|
|
||||||
$fields['title'] = pSQL($this->title);
|
|
||||||
$fields['content'] = pSQL($this->content);
|
|
||||||
$fields['grade'] = (float)$this->grade;
|
|
||||||
$fields['validate'] = (int)$this->validate;
|
|
||||||
$fields['deleted'] = (int)$this->deleted;
|
|
||||||
$fields['date_add'] = pSQL($this->date_add);
|
|
||||||
return ($fields);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get comments by IdProduct
|
* Get comments by IdProduct
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -31,27 +31,23 @@ class ProductCommentCriterion extends ObjectModel
|
|||||||
public $id_product_comment_criterion_type;
|
public $id_product_comment_criterion_type;
|
||||||
|
|
||||||
public $name;
|
public $name;
|
||||||
public $active = 1;
|
public $active = true;
|
||||||
protected $fieldsRequiredLang = array('name');
|
|
||||||
protected $fieldsSizeLang = array('name' => 128);
|
/**
|
||||||
protected $fieldsValidateLang = array('name' => 'isGenericName');
|
* @see ObjectModel::$definition
|
||||||
|
*/
|
||||||
protected $table = 'product_comment_criterion';
|
public static $definition = array(
|
||||||
protected $identifier = 'id_product_comment_criterion';
|
'table' => 'product_comment_criterion',
|
||||||
|
'primary' => 'id_product_comment_criterion',
|
||||||
|
'fields' => array(
|
||||||
public function getFields()
|
'id_product_comment_criterion_type' => array('type' => self::TYPE_INT),
|
||||||
{
|
'active' => array('type' => self::TYPE_BOOL),
|
||||||
$this->validateFields();
|
|
||||||
return array('id_product_comment_criterion_type' => (int)$this->id_product_comment_criterion_type, 'active' => (int)$this->active);
|
// Lang fields
|
||||||
}
|
'name' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => true, 'size' => 128),
|
||||||
|
)
|
||||||
public function getTranslationsFieldsChild()
|
);
|
||||||
{
|
|
||||||
$this->validateFieldsLang();
|
|
||||||
return $this->getTranslationsFields(array('name'));
|
|
||||||
}
|
|
||||||
|
|
||||||
public function delete()
|
public function delete()
|
||||||
{
|
{
|
||||||
if (!parent::delete())
|
if (!parent::delete())
|
||||||
|
|||||||
@@ -40,26 +40,24 @@ class ReferralProgramModule extends ObjectModel
|
|||||||
public $date_add;
|
public $date_add;
|
||||||
public $date_upd;
|
public $date_upd;
|
||||||
|
|
||||||
protected $fieldsRequired = array('id_sponsor', 'email', 'lastname', 'firstname');
|
/**
|
||||||
protected $fieldsSize = array('id_sponsor' => 8, 'email' => 255, 'lastname' => 128, 'firstname' => 128, 'id_customer' => 8, 'id_discount' => 8, 'id_discount_sponsor' => 8);
|
* @see ObjectModel::$definition
|
||||||
protected $fieldsValidate = array( 'id_sponsor' => 'isUnsignedId', 'email' => 'isEmail', 'lastname' => 'isName', 'firstname' => 'isName', 'id_customer' => 'isUnsignedId', 'id_discount' => 'isUnsignedId', 'id_discount_sponsor' => 'isUnsignedId');
|
*/
|
||||||
protected $table = 'referralprogram';
|
public static $definition = array(
|
||||||
protected $identifier = 'id_referralprogram';
|
'table' => 'referralprogram',
|
||||||
|
'primary' => 'id_referralprogram',
|
||||||
public function getFields()
|
'fields' => array(
|
||||||
{
|
'id_sponsor' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
|
||||||
$this->validateFields();
|
'email' => array('type' => self::TYPE_STRING, 'validate' => 'isEmail', 'required' => true, 'size' => 255),
|
||||||
$fields['id_sponsor'] = (int)$this->id_sponsor;
|
'lastname' => array('type' => self::TYPE_STRING, 'validate' => 'isName', 'required' => true, 'size' => 128),
|
||||||
$fields['email'] = pSQL($this->email);
|
'firstname' => array('type' => self::TYPE_STRING, 'validate' => 'isName', 'required' => true, 'size' => 128),
|
||||||
$fields['lastname'] = pSQL($this->lastname);
|
'id_customer' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
|
||||||
$fields['firstname'] = pSQL($this->firstname);
|
'id_discount' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
|
||||||
$fields['id_customer'] = (int)$this->id_customer;
|
'id_discount_sponsor' =>array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
|
||||||
$fields['id_discount'] = (int)$this->id_discount;
|
'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
|
||||||
$fields['id_discount_sponsor'] = (int)$this->id_discount_sponsor;
|
'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
|
||||||
$fields['date_add'] = pSQL($this->date_add);
|
),
|
||||||
$fields['date_upd'] = pSQL($this->date_upd);
|
);
|
||||||
return $fields;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function getDiscountPrefix()
|
public static function getDiscountPrefix()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user