[+] Project : Added the ability for groups to show or hide prices for their members

This commit is contained in:
jBreux
2011-12-21 16:42:17 +00:00
parent 018f959f9e
commit 4e661c0e4d
7 changed files with 464 additions and 339 deletions
+21
View File
@@ -38,6 +38,9 @@ class GroupCore extends ObjectModel
/** @var int Price display method (tax inc/tax exc) */
public $price_display_method;
/** @var boolean Show prices */
public $show_prices = 1;
/** @var string Object creation date */
public $date_add;
@@ -54,6 +57,7 @@ class GroupCore extends ObjectModel
'fields' => array(
'reduction' => array('type' => self::TYPE_FLOAT, 'validate' => 'isFloat'),
'price_display_method' => array('type' => self::TYPE_INT, 'validate' => 'isPriceDisplayMethod', 'required' => true),
'show_prices' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
@@ -279,6 +283,23 @@ class GroupCore extends ObjectModel
$sql = substr($sql, 0, strlen($sql) - 1);
Db::getInstance()->execute($sql);
}
/**
* Return current group object
* Use context
* @static
* @return Group Group object
*/
public static function getCurrent()
{
$customer = Context::getContext()->customer;
$id_group = (int)Configuration::get('PS_UNIDENTIFIED_GROUP');
if (Validate::isLoadedObject($customer))
$id_group = (int)$customer->id_default_group;
return new self($id_group);
}
}