diff --git a/classes/Kohana/Model/Purchase/Item/Promotion.php b/classes/Kohana/Model/Purchase/Item/Promotion.php index 3de1142..0cf992a 100644 --- a/classes/Kohana/Model/Purchase/Item/Promotion.php +++ b/classes/Kohana/Model/Purchase/Item/Promotion.php @@ -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() diff --git a/tests/tests/Model/Purchase/Item/PromotionTest.php b/tests/tests/Model/Purchase/Item/PromotionTest.php index 96ae54b..aac1bbf 100644 --- a/tests/tests/Model/Purchase/Item/PromotionTest.php +++ b/tests/tests/Model/Purchase/Item/PromotionTest.php @@ -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); } /**