- Base create/update coupon in backoffice
This commit is contained in:
gmorel
2013-09-04 19:22:20 +02:00
parent f399b1de2e
commit 23a4ff26c8
8 changed files with 226 additions and 108 deletions

View File

@@ -44,6 +44,9 @@ use Thelia\Model\Map\CouponTableMap;
class Coupon extends BaseCoupon
{
use \Thelia\Model\Tools\ModelEventDispatcherTrait;
/**
* Constructor
*
@@ -60,9 +63,9 @@ class Coupon extends BaseCoupon
* @param boolean $isRemovingPostage Is removing Postage
* @param int $maxUsage Coupon quantity
* @param CouponRuleCollection $rules CouponRuleInterface to add
* @param string $lang Coupon Language code ISO (ex: fr_FR)
* @param string $locale Coupon Language code ISO (ex: fr_FR)
*/
function createOrUpdate($code, $title, $amount, $effect, $shortDescription, $description, $isEnabled, $expirationDate, $isAvailableOnSpecialOffers, $isCumulative, $maxUsage, $rules, $lang = null)
function createOrUpdate($code, $title, $amount, $effect, $shortDescription, $description, $isEnabled, $expirationDate, $isAvailableOnSpecialOffers, $isCumulative, $maxUsage, $rules, $locale = null)
{
$this->setCode($code)
->setTitle($title)
@@ -79,8 +82,8 @@ class Coupon extends BaseCoupon
->setRules($rules);
// Set object language (i18n)
if (!is_null($lang)) {
$this->setLang($lang);
if (!is_null($locale)) {
$this->setLocale($locale);
}
$con = Propel::getWriteConnection(CouponTableMap::DATABASE_NAME);