Compare commits
84 Commits
1bb7d9000f
...
febb90e40e
Author | SHA1 | Date |
---|---|---|
|
febb90e40e | |
|
e1271d25ea | |
|
fe3720436f | |
|
099079f119 | |
|
fea179fe7d | |
|
9be2a48db0 | |
|
2fa6d3fd42 | |
|
392f364e2f | |
|
312cd5b19e | |
|
2a330f911f | |
|
da82cf6700 | |
|
d5cee85928 | |
|
c5518d6051 | |
|
c7d8195e45 | |
|
dc3c3f0b05 | |
|
4a865ee679 | |
|
69d39e8934 | |
|
54c25e7090 | |
|
f651d0bf4d | |
|
e7f2573bb4 | |
|
0f97f7e6bd | |
|
d0afaba8e8 | |
|
9d5b44f050 | |
|
9367cdabf6 | |
|
d1e65b2f6c | |
|
f0c239055b | |
|
d4992b2cd6 | |
|
d282b865b5 | |
|
c95eae60a5 | |
|
db7c34751a | |
|
63120b1795 | |
|
a98c9b7d4b | |
|
ffed9f7ce3 | |
|
15b9847b72 | |
|
4aca886cd4 | |
|
2729ed40dc | |
|
cbe53369e7 | |
|
1c5a9681b2 | |
|
74c0e7f6b7 | |
|
d89a93ae9c | |
|
c931b9b61b | |
|
4a686ff20e | |
|
de5152ee95 | |
|
f2a8bcd381 | |
|
7b40e942bd | |
|
5bd4eb36e7 | |
|
5fd5dd2da8 | |
|
fc88910bd1 | |
|
cf63884bdb | |
|
7bb09d76fa | |
|
bfbad59df5 | |
|
591dc8ad55 | |
|
7a1d5d8769 | |
|
4abd16bb72 | |
|
f7720a004d | |
|
e7ec93e0d9 | |
|
143b1635de | |
|
90dc4fe9a9 | |
|
7b1e8cadb0 | |
|
beb8e37eef | |
|
68aac8feef | |
|
48d045489b | |
|
9eb1a9963c | |
|
f3318f4428 | |
|
063c3ad3ba | |
|
847aaf450a | |
|
a4438c7b35 | |
|
8afdd4f124 | |
|
ad2521ea5b | |
|
e3cb08dbf8 | |
|
618fbafdcd | |
|
62313aa1d4 | |
|
8d16ba251b | |
|
db32093621 | |
|
da528fb09b | |
|
e60ea9e92b | |
|
17e4fe5f82 | |
|
b2f3e4f1fd | |
|
376c1ceb9b | |
|
056b8f9ed6 | |
|
011e414848 | |
|
5e64797277 | |
|
2e8dc96665 | |
|
b1dcdeb579 |
16
CHANGELOG.md
16
CHANGELOG.md
|
@ -1,5 +1,21 @@
|
||||||
# Letzte Änderungen
|
# Letzte Änderungen
|
||||||
|
|
||||||
|
### 1.12.6
|
||||||
|
|
||||||
|
- Fix: Beiträge von Familienmitgliedern splitten
|
||||||
|
|
||||||
|
### 1.12.5
|
||||||
|
|
||||||
|
- Fix: Synchronisieren von bestehenden Beiträgen aus NaMi
|
||||||
|
|
||||||
|
### 1.12.4
|
||||||
|
|
||||||
|
- Filter Mitglieder nach Verhaltenskodex
|
||||||
|
|
||||||
|
### 1.12.3
|
||||||
|
|
||||||
|
- Volltextsuche für Rechnungen
|
||||||
|
|
||||||
### 1.12.2
|
### 1.12.2
|
||||||
|
|
||||||
- Zuschussliste Gallier
|
- Zuschussliste Gallier
|
||||||
|
|
|
@ -22,7 +22,8 @@ class InsertMemberAction
|
||||||
{
|
{
|
||||||
$region = Region::firstWhere('nami_id', $member->regionId ?: -1);
|
$region = Region::firstWhere('nami_id', $member->regionId ?: -1);
|
||||||
|
|
||||||
return Member::updateOrCreate(['nami_id' => $member->id], [
|
|
||||||
|
$payload = [
|
||||||
'firstname' => $member->firstname,
|
'firstname' => $member->firstname,
|
||||||
'lastname' => $member->lastname,
|
'lastname' => $member->lastname,
|
||||||
'joined_at' => $member->joinedAt,
|
'joined_at' => $member->joinedAt,
|
||||||
|
@ -51,7 +52,16 @@ class InsertMemberAction
|
||||||
'mitgliedsnr' => $member->memberId,
|
'mitgliedsnr' => $member->memberId,
|
||||||
'version' => $member->version,
|
'version' => $member->version,
|
||||||
'keepdata' => $member->keepdata,
|
'keepdata' => $member->keepdata,
|
||||||
]);
|
];
|
||||||
|
|
||||||
|
// Dont update subscription if fee id of existing member's subscription is already the same
|
||||||
|
if ($existing = Member::nami($member->id)) {
|
||||||
|
if ($existing->subscription && $existing->subscription->fee->nami_id === $member->feeId) {
|
||||||
|
$payload['subscription_id'] = $existing->subscription->id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return Member::updateOrCreate(['nami_id' => $member->id], $payload);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getSubscription(NamiMember $member): ?Subscription
|
public function getSubscription(NamiMember $member): ?Subscription
|
||||||
|
|
|
@ -49,7 +49,6 @@ class Invoice extends Model
|
||||||
*/
|
*/
|
||||||
public static function createForMember(Member $member, Collection $members, int $year, Subscription $subscription = null): self
|
public static function createForMember(Member $member, Collection $members, int $year, Subscription $subscription = null): self
|
||||||
{
|
{
|
||||||
$subscription = $subscription ?: $member->subscription;
|
|
||||||
$invoice = new self([
|
$invoice = new self([
|
||||||
'to' => [
|
'to' => [
|
||||||
'name' => 'Familie ' . $member->lastname,
|
'name' => 'Familie ' . $member->lastname,
|
||||||
|
@ -66,7 +65,8 @@ class Invoice extends Model
|
||||||
|
|
||||||
$positions = collect([]);
|
$positions = collect([]);
|
||||||
foreach ($members as $member) {
|
foreach ($members as $member) {
|
||||||
foreach ($subscription->children as $child) {
|
$memberSubscription = $subscription ?: $member->subscription;
|
||||||
|
foreach ($memberSubscription->children as $child) {
|
||||||
$positions->push([
|
$positions->push([
|
||||||
'description' => str($child->name)->replace('{name}', $member->firstname . ' ' . $member->lastname)->replace('{year}', (string) $year),
|
'description' => str($child->name)->replace('{name}', $member->firstname . ' ' . $member->lastname)->replace('{year}', (string) $year),
|
||||||
'price' => $child->amount,
|
'price' => $child->amount,
|
||||||
|
|
|
@ -46,6 +46,8 @@ class FilterScope extends ScoutFilter
|
||||||
public array $exclude = [],
|
public array $exclude = [],
|
||||||
public ?bool $hasFullAddress = null,
|
public ?bool $hasFullAddress = null,
|
||||||
public ?bool $hasBirthday = null,
|
public ?bool $hasBirthday = null,
|
||||||
|
public ?bool $hasSvk = null,
|
||||||
|
public ?bool $hasVk = null,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,6 +87,12 @@ class FilterScope extends ScoutFilter
|
||||||
if ($this->hasBirthday === true) {
|
if ($this->hasBirthday === true) {
|
||||||
$filter->push('birthday IS NOT NULL');
|
$filter->push('birthday IS NOT NULL');
|
||||||
}
|
}
|
||||||
|
if ($this->hasSvk !== null) {
|
||||||
|
$filter->push('has_svk = ' . ($this->hasSvk ? 'true' : 'false'));
|
||||||
|
}
|
||||||
|
if ($this->hasVk !== null) {
|
||||||
|
$filter->push('has_vk = ' . ($this->hasVk ? 'true' : 'false'));
|
||||||
|
}
|
||||||
if ($this->ausstand === true) {
|
if ($this->ausstand === true) {
|
||||||
$filter->push('ausstand > 0');
|
$filter->push('ausstand > 0');
|
||||||
}
|
}
|
||||||
|
|
|
@ -544,6 +544,8 @@ class Member extends Model implements Geolocatable
|
||||||
'bill_kind' => $this->bill_kind?->value,
|
'bill_kind' => $this->bill_kind?->value,
|
||||||
'group_id' => $this->group->id,
|
'group_id' => $this->group->id,
|
||||||
'group_name' => $this->group->inner_name ?: $this->group->name,
|
'group_name' => $this->group->inner_name ?: $this->group->name,
|
||||||
|
'has_vk' => $this->has_vk,
|
||||||
|
'has_svk' => $this->has_svk,
|
||||||
'links' => [
|
'links' => [
|
||||||
'show' => route('member.show', ['member' => $this], false),
|
'show' => route('member.show', ['member' => $this], false),
|
||||||
'edit' => route('member.edit', ['member' => $this], false),
|
'edit' => route('member.edit', ['member' => $this], false),
|
||||||
|
|
|
@ -163,6 +163,10 @@ class MemberResource extends JsonResource
|
||||||
'activity_ids' => [],
|
'activity_ids' => [],
|
||||||
'subactivity_ids' => []
|
'subactivity_ids' => []
|
||||||
],
|
],
|
||||||
|
'boolean_filter' => [
|
||||||
|
['id' => true, 'name' => 'Ja'],
|
||||||
|
['id' => false, 'name' => 'Nein'],
|
||||||
|
],
|
||||||
'default' => [
|
'default' => [
|
||||||
'gender_id' => null,
|
'gender_id' => null,
|
||||||
'salutation' => '',
|
'salutation' => '',
|
||||||
|
|
|
@ -138,7 +138,7 @@ return [
|
||||||
'key' => env('MEILI_MASTER_KEY', null),
|
'key' => env('MEILI_MASTER_KEY', null),
|
||||||
'index-settings' => [
|
'index-settings' => [
|
||||||
Member::class => [
|
Member::class => [
|
||||||
'filterableAttributes' => ['address', 'birthday', 'ausstand', 'bill_kind', 'group_id', 'memberships', 'id'],
|
'filterableAttributes' => ['address', 'birthday', 'ausstand', 'bill_kind', 'group_id', 'memberships', 'has_vk', 'has_svk', 'id'],
|
||||||
'searchableAttributes' => ['fullname', 'address'],
|
'searchableAttributes' => ['fullname', 'address'],
|
||||||
'sortableAttributes' => ['lastname', 'firstname'],
|
'sortableAttributes' => ['lastname', 'firstname'],
|
||||||
'displayedAttributes' => ['age_group_icon', 'group_name', 'links', 'is_leader', 'lastname', 'firstname', 'fullname', 'address', 'ausstand', 'birthday', 'id', 'memberships', 'bill_kind', 'group_id'],
|
'displayedAttributes' => ['age_group_icon', 'group_name', 'links', 'is_leader', 'lastname', 'firstname', 'fullname', 'address', 'ausstand', 'birthday', 'id', 'memberships', 'bill_kind', 'group_id'],
|
||||||
|
|
|
@ -37,6 +37,8 @@ class MemberFactory extends Factory
|
||||||
'email' => $this->faker->safeEmail(),
|
'email' => $this->faker->safeEmail(),
|
||||||
'recertified_at' => null,
|
'recertified_at' => null,
|
||||||
'keepdata' => false,
|
'keepdata' => false,
|
||||||
|
'has_svk' => $this->faker->boolean(),
|
||||||
|
'has_vk' => $this->faker->boolean(),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,6 +48,24 @@
|
||||||
size="sm"
|
size="sm"
|
||||||
@update:model-value="setFilter('ausstand', $event)"
|
@update:model-value="setFilter('ausstand', $event)"
|
||||||
></f-switch>
|
></f-switch>
|
||||||
|
<f-select
|
||||||
|
id="has_vk"
|
||||||
|
name="has_vk"
|
||||||
|
:model-value="getFilter('has_vk')"
|
||||||
|
label="Verhaltenskodex unterschrieben"
|
||||||
|
size="sm"
|
||||||
|
:options="meta.boolean_filter"
|
||||||
|
@update:model-value="setFilter('has_vk', $event)"
|
||||||
|
></f-select>
|
||||||
|
<f-select
|
||||||
|
id="has_svk"
|
||||||
|
name="has_svk"
|
||||||
|
:model-value="getFilter('has_svk')"
|
||||||
|
label="SVK unterschrieben"
|
||||||
|
size="sm"
|
||||||
|
:options="meta.boolean_filter"
|
||||||
|
@update:model-value="setFilter('has_svk', $event)"
|
||||||
|
></f-select>
|
||||||
<f-multipleselect
|
<f-multipleselect
|
||||||
id="group_ids"
|
id="group_ids"
|
||||||
:options="meta.groups"
|
:options="meta.groups"
|
||||||
|
|
|
@ -202,6 +202,30 @@ class MemberIndexTest extends EndToEndTestCase
|
||||||
]])->assertInertiaCount('data.data', 1);
|
]])->assertInertiaCount('data.data', 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testItFiltersForSvkPrevention(): void
|
||||||
|
{
|
||||||
|
Member::factory()->defaults()->create(['has_svk' => true]);
|
||||||
|
Member::factory()->defaults()->create(['has_svk' => false]);
|
||||||
|
Member::factory()->defaults()->create(['has_svk' => false]);
|
||||||
|
|
||||||
|
sleep(1);
|
||||||
|
$this->callFilter('member.index', ['has_svk' => true])->assertInertiaCount('data.data', 1);
|
||||||
|
$this->callFilter('member.index', ['has_svk' => false])->assertInertiaCount('data.data', 2);
|
||||||
|
$this->callFilter('member.index', ['has_svk' => null])->assertInertiaCount('data.data', 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testItFiltersForVkPrevention(): void
|
||||||
|
{
|
||||||
|
Member::factory()->defaults()->create(['has_vk' => true]);
|
||||||
|
Member::factory()->defaults()->create(['has_vk' => false]);
|
||||||
|
Member::factory()->defaults()->create(['has_vk' => false]);
|
||||||
|
|
||||||
|
sleep(1);
|
||||||
|
$this->callFilter('member.index', ['has_vk' => true])->assertInertiaCount('data.data', 1);
|
||||||
|
$this->callFilter('member.index', ['has_vk' => false])->assertInertiaCount('data.data', 2);
|
||||||
|
$this->callFilter('member.index', ['has_vk' => null])->assertInertiaCount('data.data', 3);
|
||||||
|
}
|
||||||
|
|
||||||
public function testGroupOfMembershipsFilterCanBeEmpty(): void
|
public function testGroupOfMembershipsFilterCanBeEmpty(): void
|
||||||
{
|
{
|
||||||
$mitglied = Activity::factory()->create();
|
$mitglied = Activity::factory()->create();
|
||||||
|
|
|
@ -90,8 +90,8 @@ class MassStoreActionTest extends TestCase
|
||||||
|
|
||||||
$this->assertDatabaseCount('invoices', 1);
|
$this->assertDatabaseCount('invoices', 1);
|
||||||
$this->assertDatabaseCount('invoice_positions', 2);
|
$this->assertDatabaseCount('invoice_positions', 2);
|
||||||
$this->assertDatabaseHas('invoice_positions', ['description' => 'beitrag Max Muster']);
|
$this->assertDatabaseHas('invoice_positions', ['description' => 'beitrag Max Muster', 'price' => 4466]);
|
||||||
$this->assertDatabaseHas('invoice_positions', ['description' => 'beitrag Jane Muster']);
|
$this->assertDatabaseHas('invoice_positions', ['description' => 'beitrag Jane Muster', 'price' => 4466]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testItSeparatesBillKinds(): void
|
public function testItSeparatesBillKinds(): void
|
||||||
|
@ -105,4 +105,21 @@ class MassStoreActionTest extends TestCase
|
||||||
$this->assertDatabaseCount('invoices', 2);
|
$this->assertDatabaseCount('invoices', 2);
|
||||||
$this->assertDatabaseCount('invoice_positions', 2);
|
$this->assertDatabaseCount('invoice_positions', 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testItSeparatesSubscriptions(): void
|
||||||
|
{
|
||||||
|
$member1 = Member::factory()->defaults()->emailBillKind()
|
||||||
|
->for(Subscription::factory()->forFee()->children([new Child('beitrag1 {name}', 4466)]))
|
||||||
|
->create(['firstname' => 'Member1', 'lastname' => 'ln']);
|
||||||
|
$member2 = Member::factory()->defaults()->sameFamilyAs($member1)->emailBillKind()
|
||||||
|
->for(Subscription::factory()->forFee()->children([new Child('beitrag2 {name}', 4467)]))
|
||||||
|
->create(['firstname' => 'Member2']);
|
||||||
|
|
||||||
|
$this->postJson(route('invoice.mass-store'), ['year' => now()->addYear()->year])->assertOk();
|
||||||
|
$invoice = Invoice::first();
|
||||||
|
|
||||||
|
$this->assertDatabaseCount('invoice_positions', 2);
|
||||||
|
$this->assertDatabaseHas('invoice_positions', ['invoice_id' => $invoice->id, 'member_id' => $member1->id, 'description' => 'beitrag1 Member1 ln', 'price' => 4466]);
|
||||||
|
$this->assertDatabaseHas('invoice_positions', ['invoice_id' => $invoice->id, 'member_id' => $member2->id, 'description' => 'beitrag2 Member2 ln', 'price' => 4467]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ use App\Country;
|
||||||
use App\Fee;
|
use App\Fee;
|
||||||
use App\Gender;
|
use App\Gender;
|
||||||
use App\Group;
|
use App\Group;
|
||||||
|
use App\Member\Member;
|
||||||
use App\Nationality;
|
use App\Nationality;
|
||||||
use App\Payment\Subscription;
|
use App\Payment\Subscription;
|
||||||
use App\Region;
|
use App\Region;
|
||||||
|
@ -142,3 +143,20 @@ it('testItPullsMemberWithNoSubscription', function () {
|
||||||
'subscription_id' => null,
|
'subscription_id' => null,
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('doesnt set first subscription if fee matches', function () {
|
||||||
|
$this->loginNami();
|
||||||
|
Subscription::factory()->forFee(55)->create();
|
||||||
|
$otherSubscription = Subscription::factory()->forFee(55)->create();
|
||||||
|
$member = Member::factory()->defaults()->inNami(1001)->create(['subscription_id' => $otherSubscription->id]);
|
||||||
|
app(MemberFake::class)->shows(1000, 1001, [
|
||||||
|
'beitragsartId' => 55,
|
||||||
|
]);
|
||||||
|
|
||||||
|
app(PullMemberAction::class)->handle(1000, 1001);
|
||||||
|
|
||||||
|
$this->assertDatabaseHas('members', [
|
||||||
|
'subscription_id' => $otherSubscription->id,
|
||||||
|
'id' => $member->id,
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
|
@ -149,7 +149,7 @@ class ShowTest extends TestCase
|
||||||
->for(Group::factory())
|
->for(Group::factory())
|
||||||
->for(Nationality::factory()->name('deutsch'))
|
->for(Nationality::factory()->name('deutsch'))
|
||||||
->for(Subscription::factory()->forFee())
|
->for(Subscription::factory()->forFee())
|
||||||
->create(['firstname' => 'Max', 'lastname' => 'Muster']);
|
->create(['firstname' => 'Max', 'lastname' => 'Muster', 'has_vk' => false, 'has_svk' => false]);
|
||||||
|
|
||||||
$response = $this->get("/member/{$member->id}");
|
$response = $this->get("/member/{$member->id}");
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue