Skip to content

Commit

Permalink
Set is_payable and is_default to TRUE for promotions items by default
Browse files Browse the repository at this point in the history
  • Loading branch information
hkdobrev committed Nov 18, 2013
1 parent 1fd7e18 commit f68f6c8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 10 additions & 1 deletion classes/Kohana/Model/Purchase/Item/Promotion.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,16 @@ public static function initialize(Jam_Meta $meta)
{
parent::initialize($meta);

$meta->table('purchase_items');
$meta
->table('purchase_items')
->fields(array(
'is_payable' => Jam::field('boolean', array(
'default' => TRUE
)),
'is_discount' => Jam::field('boolean', array(
'default' => TRUE
)),
));
}

public function get_price()
Expand Down
2 changes: 2 additions & 0 deletions tests/tests/Model/Purchase/Item/PromotionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ public function test_initialize()
{
$meta = Jam::meta('purchase_item_promotion');
$this->assertSame('purchase_items', $meta->table());
$this->assertTrue($meta->field('is_payable')->default);
$this->assertTrue($meta->field('is_discount')->default);
}

/**
Expand Down

0 comments on commit f68f6c8

Please sign in to comment.