// Adding compare options
This commit is contained in:
+19
-17
@@ -54,6 +54,7 @@ class EmployeeCore extends ObjectModel
|
||||
|
||||
public $stats_compare_from;
|
||||
public $stats_compare_to;
|
||||
public $stats_compare_option = 1;
|
||||
|
||||
/** @var string Display back office background in the specified color */
|
||||
public $bo_color;
|
||||
@@ -84,23 +85,24 @@ class EmployeeCore extends ObjectModel
|
||||
'table' => 'employee',
|
||||
'primary' => 'id_employee',
|
||||
'fields' => array(
|
||||
'lastname' => array('type' => self::TYPE_STRING, 'validate' => 'isName', 'required' => true, 'size' => 32),
|
||||
'firstname' => array('type' => self::TYPE_STRING, 'validate' => 'isName', 'required' => true, 'size' => 32),
|
||||
'email' => array('type' => self::TYPE_STRING, 'validate' => 'isEmail', 'required' => true, 'size' => 128),
|
||||
'id_lang' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'required' => true),
|
||||
'passwd' => array('type' => self::TYPE_STRING, 'validate' => 'isPasswdAdmin', 'required' => true, 'size' => 32),
|
||||
'last_passwd_gen' => array('type' => self::TYPE_STRING),
|
||||
'active' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
|
||||
'id_profile' => array('type' => self::TYPE_INT, 'validate' => 'isInt', 'required' => true),
|
||||
'bo_color' => array('type' => self::TYPE_STRING, 'validate' => 'isColor', 'size' => 32),
|
||||
'default_tab' => array('type' => self::TYPE_INT, 'validate' => 'isInt'),
|
||||
'bo_theme' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'size' => 32),
|
||||
'bo_width' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'),
|
||||
'bo_menu' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
|
||||
'stats_date_from' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
|
||||
'stats_date_to' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
|
||||
'stats_compare_from' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
|
||||
'stats_compare_to' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
|
||||
'lastname' => array('type' => self::TYPE_STRING, 'validate' => 'isName', 'required' => true, 'size' => 32),
|
||||
'firstname' => array('type' => self::TYPE_STRING, 'validate' => 'isName', 'required' => true, 'size' => 32),
|
||||
'email' => array('type' => self::TYPE_STRING, 'validate' => 'isEmail', 'required' => true, 'size' => 128),
|
||||
'id_lang' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'required' => true),
|
||||
'passwd' => array('type' => self::TYPE_STRING, 'validate' => 'isPasswdAdmin', 'required' => true, 'size' => 32),
|
||||
'last_passwd_gen' => array('type' => self::TYPE_STRING),
|
||||
'active' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
|
||||
'id_profile' => array('type' => self::TYPE_INT, 'validate' => 'isInt', 'required' => true),
|
||||
'bo_color' => array('type' => self::TYPE_STRING, 'validate' => 'isColor', 'size' => 32),
|
||||
'default_tab' => array('type' => self::TYPE_INT, 'validate' => 'isInt'),
|
||||
'bo_theme' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'size' => 32),
|
||||
'bo_width' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'),
|
||||
'bo_menu' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
|
||||
'stats_date_from' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
|
||||
'stats_date_to' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
|
||||
'stats_compare_from' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
|
||||
'stats_compare_to' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
|
||||
'stats_compare_option' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'),
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ class HelperCalendarCore extends Helper
|
||||
private $_compare_actions;
|
||||
private $_compare_date_from;
|
||||
private $_compare_date_to;
|
||||
private $_compare_date_option;
|
||||
private $_date_format;
|
||||
private $_date_from;
|
||||
private $_date_to;
|
||||
@@ -84,7 +85,7 @@ class HelperCalendarCore extends Helper
|
||||
$value = date('Y-m-d', strtotime("-31 days"));
|
||||
|
||||
if (!is_string($value))
|
||||
throw new PrestaShopException('Date must be string');
|
||||
throw new PrestaShopException('Date must be a string');
|
||||
|
||||
$this->_compare_date_from = $value;
|
||||
return $this;
|
||||
@@ -104,7 +105,7 @@ class HelperCalendarCore extends Helper
|
||||
$value = date('Y-m-d');
|
||||
|
||||
if (!is_string($value))
|
||||
throw new PrestaShopException('Date must be string');
|
||||
throw new PrestaShopException('Date must be a string');
|
||||
|
||||
$this->_compare_date_to = $value;
|
||||
return $this;
|
||||
@@ -118,10 +119,24 @@ class HelperCalendarCore extends Helper
|
||||
return $this->_compare_date_to;
|
||||
}
|
||||
|
||||
public function setCompareOption($value)
|
||||
{
|
||||
$this->_compare_date_option = (int)$value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCompareOption()
|
||||
{
|
||||
if (!isset($this->_compare_date_option))
|
||||
$this->_compare_date_option = self::DEFAULT_COMPARE_OPTION;
|
||||
|
||||
return $this->_compare_date_option;
|
||||
}
|
||||
|
||||
public function setDateFormat($value)
|
||||
{
|
||||
if (!is_string($value))
|
||||
throw new PrestaShopException('Date format must be string');
|
||||
throw new PrestaShopException('Date format must be a string');
|
||||
|
||||
$this->_date_format = $value;
|
||||
return $this;
|
||||
@@ -141,7 +156,7 @@ class HelperCalendarCore extends Helper
|
||||
$value = date('Y-m-d', strtotime("-31 days"));
|
||||
|
||||
if (!is_string($value))
|
||||
throw new PrestaShopException('Date must be string');
|
||||
throw new PrestaShopException('Date must be a string');
|
||||
|
||||
$this->_date_from = $value;
|
||||
return $this;
|
||||
@@ -161,7 +176,7 @@ class HelperCalendarCore extends Helper
|
||||
$value = date('Y-m-d');
|
||||
|
||||
if (!is_string($value))
|
||||
throw new PrestaShopException('Date must be string');
|
||||
throw new PrestaShopException('Date must be a string');
|
||||
|
||||
$this->_date_to = $value;
|
||||
return $this;
|
||||
@@ -232,6 +247,7 @@ class HelperCalendarCore extends Helper
|
||||
'compare_date_to' => $this->getCompareDateTo(),
|
||||
'actions' => $this->getActions(),
|
||||
'compare_actions' => $this->getCompareActions(),
|
||||
'compare_option' => $this->getCompareOption(),
|
||||
'is_rtl' => $this->isRTL()
|
||||
));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user