Compare commits

..

No commits in common. "d07a9a83729ccd68e018a3f789817a83a0331a12" and "25cf073fc720e62a75a26d506b81f5e6a9b6a2ef" have entirely different histories.

7 changed files with 11 additions and 86 deletions

View File

@ -1,9 +1,5 @@
# Letzte Änderungen
### 1.12.11
- Fix: Bank Account mit abrufen wenn Mitglied editiert wird
### 1.12.7
- Fix: Synchronisation von allen Mitgliedern bei Mail-Verteilern - nicht nur den ersten 20

View File

@ -51,7 +51,7 @@ class MemberController extends Controller
session()->put('title', "Mitglied {$member->firstname} {$member->lastname} bearbeiten");
return Inertia::render('member/VForm', [
'data' => new MemberResource($member->load('bankAccount')),
'data' => new MemberResource($member),
'mode' => 'edit',
'conflict' => '1' === $request->query('conflict', '0'),
'meta' => MemberResource::meta(),

View File

@ -84,24 +84,20 @@ class MemberRequest extends FormRequest
'salutation' => '',
'comment' => '',
'keepdata' => 'boolean',
'bank_account' => 'array',
'bank_account' => 'array|exclude',
'bank_account.iban' => 'nullable|string|max:255',
'bank_account.bic' => 'nullable|string|max:255',
'bank_account.blz' => 'nullable|string|max:255',
'bank_account.bank_name' => 'nullable|string|max:255',
'bank_account.person' => 'nullable|string|max:255',
'bank_account.account_number' => 'nullable|string|max:255',
];
}
public function persistCreate(NamiSettings $settings): void
{
$member = new Member([
...$this->dataToInsert(),
...$this->validated(),
'group_id' => Group::where('nami_id', $settings->default_group_id)->firstOrFail()->id,
]);
$member->updatePhoneNumbers()->save();
$member->bankAccount->update($this->validated('bank_account'));
$member->bankAccount->update($this->input('bank_account'));
if ($this->input('has_nami')) {
$this->storeFreshMemberInNami($member);
@ -120,12 +116,12 @@ class MemberRequest extends FormRequest
public function persistUpdate(Member $member): void
{
$member->fill($this->dataToInsert())->updatePhoneNumbers();
$member->fill($this->validated())->updatePhoneNumbers();
$namiSync = $member->isDirty(Member::$namiFields);
$member->save();
$member->bankAccount->update($this->validated('bank_account'));
$member->bankAccount->update($this->input('bank_account'));
if ($this->input('has_nami') && null === $member->nami_id) {
$this->storeFreshMemberInNami($member);
@ -168,9 +164,4 @@ class MemberRequest extends FormRequest
$when = fn () => true === $request->input('has_nami') && ($member === null || !$member->has_nami);
$validator->sometimes($attribute, $rules, $when);
}
protected function dataToInsert(): array
{
return $this->safe()->except('bank_account');
}
}

View File

@ -11,7 +11,6 @@ use App\Invoice\BillKind;
use App\Invoice\Resources\InvoicePositionResource;
use App\Lib\HasMeta;
use App\Member\Data\NestedGroup;
use App\Member\Resources\BankAccountResource;
use App\Member\Resources\NationalityResource;
use App\Member\Resources\RegionResource;
use App\Membership\MembershipResource;
@ -108,7 +107,6 @@ class MemberResource extends JsonResource
'lon' => $this->lon,
'group_name' => $this->group->name,
'keepdata' => $this->keepdata,
'bank_account' => new BankAccountResource($this->whenLoaded('bankAccount')),
'links' => [
'membership_index' => route('member.membership.index', ['member' => $this->getModel()]),
'invoiceposition_index' => route('member.invoice-position.index', ['member' => $this->getModel()]),

View File

@ -1,31 +0,0 @@
<?php
namespace App\Member\Resources;
use App\Member\BankAccount;
use Illuminate\Http\Resources\Json\JsonResource;
/**
* @mixin BankAccount
*/
class BankAccountResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request $request
*
* @return array<string, int|string>
*/
public function toArray($request)
{
return [
'iban' => $this->iban,
'bic' => $this->bic,
'blz' => $this->blz,
'bank_name' => $this->bank_name,
'person' => $this->person,
'account_number' => $this->account_number,
];
}
}

View File

@ -18,13 +18,11 @@
<div v-else class="grow">
<table class="custom-table custom-table-light custom-table-sm text-sm grow">
<thead>
<tr>
<th>Baustein</th>
<th>Veranstaltung</th>
<th>Veranstalter</th>
<th>Datum</th>
<th></th>
</tr>
<th>Baustein</th>
<th>Veranstaltung</th>
<th>Veranstalter</th>
<th>Datum</th>
<th></th>
</thead>
<tr v-for="(course, index) in data" :key="index">

View File

@ -4,7 +4,6 @@ namespace Tests\Feature\Member;
use App\Activity;
use App\Country;
use App\Member\BankAccount;
use App\Member\Member;
use App\Subactivity;
use Illuminate\Foundation\Testing\DatabaseTransactions;
@ -89,30 +88,4 @@ class EditTest extends TestCase
'bill_kind' => 'E-Mail',
], $response, 'data');
}
public function testItDisplaysBankAccount(): void
{
$this->withoutExceptionHandling()->login()->loginNami();
$member = Member::factory()
->defaults()
->emailBillKind()
->withBankAccount(BankAccount::factory()->inNami(30)->state([
'bank_name' => 'Stadt',
'bic' => 'SOLSDE33',
'iban' => 'DE50',
'blz' => 'ssss',
'person' => 'Pill',
'account_number' => 'ddf',
]))
->create();
$response = $this->get(route('member.edit', ['member' => $member]));
$this->assertInertiaHas('Stadt', $response, 'data.bank_account.bank_name');
$this->assertInertiaHas('SOLSDE33', $response, 'data.bank_account.bic');
$this->assertInertiaHas('DE50', $response, 'data.bank_account.iban');
$this->assertInertiaHas('ssss', $response, 'data.bank_account.blz');
$this->assertInertiaHas('Pill', $response, 'data.bank_account.person');
$this->assertInertiaHas('ddf', $response, 'data.bank_account.account_number');
}
}