Skip to content

Commit

Permalink
Fix paid flag
Browse files Browse the repository at this point in the history
  • Loading branch information
trasher committed Aug 25, 2024
1 parent 10e3ac1 commit 3caa9a8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/GaletteActivities/Entity/Subscription.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ public function check(array $values): bool
}

//financial information
if (isset($values['paid'])) {
if (isset($values['paid']) && $values['paid']) {
$this->paid = true;
} else {
$this->paid = false;
Expand Down
10 changes: 5 additions & 5 deletions tests/GaletteActivities/Entity/tests/units/Subscription.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,15 @@ public function testEmpty(): void
$this->assertNull($subscription->getActivity());
$this->assertNull($subscription->getMemberId());
$this->assertNull($subscription->getMember());
$this->assertFalse($subscription->isPaid());
$this->assertTrue($subscription->isPaid());
$this->assertNull($subscription->getAmount());
$this->assertSame(6, $subscription->getPaymentMethod());
$this->assertSame('Other', $subscription->getPaymentMethodName());
$this->assertNotSame('', $subscription->getCreationDate());
$this->assertSame('', $subscription->getSubscriptionDate());
$this->assertSame('', $subscription->getEndDate());
$this->assertSame('', $subscription->getComment());
$this->assertSame('subscription-notpaid', $subscription->getRowClass());
$this->assertSame('subscription-paid', $subscription->getRowClass());
}

/**
Expand Down Expand Up @@ -212,7 +212,7 @@ public function testCrud(): void
//reload
$subscription = new \GaletteActivities\Entity\Subscription($this->zdb, $subscription_id);
$data += [
'paid' => 1,
'paid' => 0,
'payment_amount' => 21.0,
'payment_method' => 1,
];
Expand All @@ -221,9 +221,9 @@ public function testCrud(): void
$this->assertSame(42.0, $subscription->getAmountFromActivity());
$this->assertTrue($subscription->store());

$this->assertTrue($subscription->isPaid());
$this->assertFalse($subscription->isPaid());
$this->assertSame(21.0, $subscription->getAmount());
$this->assertSame('subscription-paid', $subscription->getRowClass());
$this->assertSame('subscription-notpaid', $subscription->getRowClass());
$this->assertSame(1, $subscription->getPaymentMethod());
$this->assertSame('Cash', $subscription->getPaymentMethodName());

Expand Down

0 comments on commit 3caa9a8

Please sign in to comment.