// Format definitions

This commit is contained in:
rMalie
2011-12-13 13:41:54 +00:00
parent a40f3c304c
commit c022f4e0e5
71 changed files with 710 additions and 1791 deletions
+13 -17
View File
@@ -37,9 +37,6 @@ class GroupShopCore extends ObjectModel
public $share_order;
public $deleted;
/**
* @see ObjectModel::$definition
*/
@@ -47,15 +44,15 @@ class GroupShopCore extends ObjectModel
'table' => 'group_shop',
'primary' => 'id_group_shop',
'fields' => array(
'active' => array('type' => 'FILL_ME', 'validate' => 'isBool'),
'share_customer' => array('type' => 'FILL_ME', 'validate' => 'isBool'),
'share_order' => array('type' => 'FILL_ME', 'validate' => 'isBool'),
'share_stock' => array('type' => 'FILL_ME', 'validate' => 'isBool'),
'name' => array('type' => 'FILL_ME', 'validate' => 'isGenericName', 'size' => 64),
'name' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'size' => 64),
'share_customer' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
'share_order' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
'share_stock' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
'active' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
'deleted' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
),
);
private static $assoTables = array(
'attribute_group' => array('type' => 'group_shop'),
'attribute' => array('type' => 'group_shop'),
@@ -67,17 +64,16 @@ class GroupShopCore extends ObjectModel
'tax_rules_group' => array('type' => 'group_shop'),
);
/**
* @see ObjectModel::getFields()
* @return array
*/
public function getFields()
{
$this->validateFields();
if (!$this->share_customer || !$this->share_stock)
$this->share_order = false;
$fields['name'] = pSQL($this->name);
$fields['share_customer'] = (int)$this->share_customer;
$fields['share_stock'] = (int)$this->share_stock;
$fields['share_order'] = ($fields['share_customer'] && $fields['share_stock']) ? (int)$this->share_order : false;
$fields['active'] = (int)$this->active;
$fields['deleted'] = (int)$this->deleted;
return $fields;
return parent::getFields();
}
public static function getGroupShops($active = true)
+6 -23
View File
@@ -48,10 +48,6 @@ class ShopCore extends ObjectModel
*/
protected $group;
/**
* @see ObjectModel::$definition
*/
@@ -59,15 +55,15 @@ class ShopCore extends ObjectModel
'table' => 'shop',
'primary' => 'id_shop',
'fields' => array(
'active' => array('type' => 'FILL_ME', 'validate' => 'isBool'),
'name' => array('type' => 'FILL_ME', 'validate' => 'isGenericName', 'required' => true, 'size' => 64),
'id_theme' => array('type' => 'FILL_ME', 'required' => true),
'id_category' => array('type' => 'FILL_ME', 'required' => true),
'id_group_shop' => array('type' => 'FILL_ME', 'required' => true),
'active' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
'deleted' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
'name' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => true, 'size' => 64),
'id_theme' => array('type' => self::TYPE_INT, 'required' => true),
'id_category' => array('type' => self::TYPE_INT, 'required' => true),
'id_group_shop' => array('type' => self::TYPE_INT, 'required' => true),
),
);
/** @var array List of shops cached */
protected static $shops;
@@ -120,19 +116,6 @@ class ShopCore extends ObjectModel
const SHARE_CUSTOMER = 'share_customer';
const SHARE_ORDER = 'share_order';
public function getFields()
{
$this->validateFields();
$fields['id_group_shop'] = (int)$this->id_group_shop;
$fields['id_category'] = (int)$this->id_category;
$fields['id_theme'] = (int)$this->id_theme;
$fields['name'] = pSQL($this->name);
$fields['active'] = (int)$this->active;
$fields['deleted'] = (int)$this->deleted;
return $fields;
}
public function __construct($id = null, $id_lang = null, $id_shop = null)
{
parent::__construct($id, $id_lang, $id_shop);
+12 -20
View File
@@ -38,10 +38,6 @@ class ShopUrlCore extends ObjectModel
private static $main_domain = null;
private static $main_domain_ssl = null;
/**
* @see ObjectModel::$definition
*/
@@ -49,19 +45,22 @@ class ShopUrlCore extends ObjectModel
'table' => 'shop_url',
'primary' => 'id_shop_url',
'fields' => array(
'active' => array('type' => 'FILL_ME', 'validate' => 'isBool'),
'domain' => array('type' => 'FILL_ME', 'required' => true, 'size' => 255),
'id_shop' => array('type' => 'FILL_ME', 'required' => true),
'physical_uri' => array('type' => 'FILL_ME', 'size' => 64),
'virtual_uri' => array('type' => 'FILL_ME', 'size' => 64),
'active' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
'main' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
'domain' => array('type' => self::TYPE_STRING, 'required' => true, 'size' => 255),
'domain_ssl' => array('type' => self::TYPE_STRING, 'size' => 255),
'id_shop' => array('type' => self::TYPE_INT, 'required' => true),
'physical_uri' => array('type' => self::TYPE_STRING, 'size' => 64),
'virtual_uri' => array('type' => self::TYPE_STRING, 'size' => 64),
),
);
/**
* @see ObjectModel::getFields()
* @return array
*/
public function getFields()
{
$this->validateFields();
$this->physical_uri = trim($this->physical_uri, '/');
if ($this->physical_uri)
$this->physical_uri = preg_replace('#/+#', '/', '/'.$this->physical_uri.'/');
@@ -72,14 +71,7 @@ class ShopUrlCore extends ObjectModel
if ($this->virtual_uri)
$this->virtual_uri = preg_replace('#/+#', '/', trim($this->virtual_uri, '/')).'/';
$fields['domain'] = pSQL($this->domain);
$fields['domain_ssl'] = pSQL($this->domain_ssl);
$fields['physical_uri'] = pSQL($this->physical_uri);
$fields['virtual_uri'] = pSQL($this->virtual_uri);
$fields['id_shop'] = (int)$this->id_shop;
$fields['main'] = (int)$this->main;
$fields['active'] = (int)$this->active;
return $fields;
return parent::getFields();
}
public function getURL($ssl = false)