Working : coupon creation : add default rule (thelia.constraint.rule.available_for_everyone)

This commit is contained in:
gmorel
2013-09-23 23:04:00 +02:00
parent e4658d2fa2
commit d0f20cca1d
12 changed files with 154 additions and 156 deletions

View File

@@ -78,8 +78,8 @@ class CouponCreateOrUpdateEvent extends ActionEvent
/** @var Coupon Coupon model */
protected $coupon = null;
/** @var string Coupon effect */
protected $effect;
/** @var string Coupon type */
protected $type;
/** @var string Language code ISO (ex: fr_FR) */
protected $locale = null;
@@ -87,36 +87,22 @@ class CouponCreateOrUpdateEvent extends ActionEvent
/**
* Constructor
*
* @param string $code Coupon Code
* @param string $title Coupon title
* @param float $amount Amount removed from the Total Checkout
* @param string $type Coupon type
* @param string $shortDescription Coupon short description
* @param string $description Coupon description
* @param boolean $isEnabled Enable/Disable
* @param \DateTime $expirationDate Coupon expiration date
* @param boolean $isAvailableOnSpecialOffers Is available on special offers
* @param boolean $isCumulative Is cumulative
* @param boolean $isRemovingPostage Is removing Postage
* @param int $maxUsage Coupon quantity
* @param CouponRuleCollection $rules CouponRuleInterface to add
* @param string $locale Coupon Language code ISO (ex: fr_FR)
* @param string $code Coupon Code
* @param string $title Coupon title
* @param float $amount Amount removed from the Total Checkout
* @param string $type Coupon type
* @param string $shortDescription Coupon short description
* @param string $description Coupon description
* @param boolean $isEnabled Enable/Disable
* @param \DateTime $expirationDate Coupon expiration date
* @param boolean $isAvailableOnSpecialOffers Is available on special offers
* @param boolean $isCumulative Is cumulative
* @param boolean $isRemovingPostage Is removing Postage
* @param int $maxUsage Coupon quantity
* @param string $locale Coupon Language code ISO (ex: fr_FR)
*/
public function __construct(
$code,
$title,
$amount,
$type,
$shortDescription,
$description,
$isEnabled,
\DateTime $expirationDate,
$isAvailableOnSpecialOffers,
$isCumulative,
$isRemovingPostage,
$maxUsage,
$rules,
$locale
$code, $title, $amount, $type, $shortDescription, $description, $isEnabled, \DateTime $expirationDate, $isAvailableOnSpecialOffers, $isCumulative, $isRemovingPostage, $maxUsage, $locale
) {
$this->amount = $amount;
$this->code = $code;
@@ -127,7 +113,6 @@ class CouponCreateOrUpdateEvent extends ActionEvent
$this->isEnabled = $isEnabled;
$this->isRemovingPostage = $isRemovingPostage;
$this->maxUsage = $maxUsage;
$this->rules = $rules;
$this->shortDescription = $shortDescription;
$this->title = $title;
$this->type = $type;
@@ -206,22 +191,6 @@ class CouponCreateOrUpdateEvent extends ActionEvent
return $this->amount;
}
/**
* Return condition to validate the Coupon or not
*
* @return CouponRuleCollection
*/
public function getRules()
{
if ($this->rules === null || !is_object($this->rules)) {
$rules = $this->rules;
} else {
$rules = clone $this->rules;
}
return $rules;
}
/**
* Return Coupon expiration date
*