Compare commits
	
		
			2 Commits
		
	
	
		
			25cf073fc7
			...
			d07a9a8372
		
	
	| Author | SHA1 | Date | 
|---|---|---|
|  | d07a9a8372 | |
|  | 64511479ef | 
|  | @ -1,5 +1,9 @@ | |||
| # 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 | ||||
|  |  | |||
|  | @ -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), | ||||
|             'data' => new MemberResource($member->load('bankAccount')), | ||||
|             'mode' => 'edit', | ||||
|             'conflict' => '1' === $request->query('conflict', '0'), | ||||
|             'meta' => MemberResource::meta(), | ||||
|  |  | |||
|  | @ -84,20 +84,24 @@ class MemberRequest extends FormRequest | |||
|             'salutation' => '', | ||||
|             'comment' => '', | ||||
|             'keepdata' => 'boolean', | ||||
|             'bank_account' => 'array|exclude', | ||||
|             'bank_account' => 'array', | ||||
|             '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->validated(), | ||||
|             ...$this->dataToInsert(), | ||||
|             'group_id' => Group::where('nami_id', $settings->default_group_id)->firstOrFail()->id, | ||||
|         ]); | ||||
|         $member->updatePhoneNumbers()->save(); | ||||
|         $member->bankAccount->update($this->input('bank_account')); | ||||
|         $member->bankAccount->update($this->validated('bank_account')); | ||||
| 
 | ||||
|         if ($this->input('has_nami')) { | ||||
|             $this->storeFreshMemberInNami($member); | ||||
|  | @ -116,12 +120,12 @@ class MemberRequest extends FormRequest | |||
| 
 | ||||
|     public function persistUpdate(Member $member): void | ||||
|     { | ||||
|         $member->fill($this->validated())->updatePhoneNumbers(); | ||||
|         $member->fill($this->dataToInsert())->updatePhoneNumbers(); | ||||
| 
 | ||||
|         $namiSync = $member->isDirty(Member::$namiFields); | ||||
| 
 | ||||
|         $member->save(); | ||||
|         $member->bankAccount->update($this->input('bank_account')); | ||||
|         $member->bankAccount->update($this->validated('bank_account')); | ||||
| 
 | ||||
|         if ($this->input('has_nami') && null === $member->nami_id) { | ||||
|             $this->storeFreshMemberInNami($member); | ||||
|  | @ -164,4 +168,9 @@ 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'); | ||||
|     } | ||||
| } | ||||
|  |  | |||
|  | @ -11,6 +11,7 @@ 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; | ||||
|  | @ -107,6 +108,7 @@ 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()]), | ||||
|  |  | |||
|  | @ -0,0 +1,31 @@ | |||
| <?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, | ||||
|         ]; | ||||
|     } | ||||
| } | ||||
|  | @ -18,11 +18,13 @@ | |||
|         <div v-else class="grow"> | ||||
|             <table class="custom-table custom-table-light custom-table-sm text-sm grow"> | ||||
|                 <thead> | ||||
|                     <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> | ||||
|                     </tr> | ||||
|                 </thead> | ||||
| 
 | ||||
|                 <tr v-for="(course, index) in data" :key="index"> | ||||
|  |  | |||
|  | @ -4,6 +4,7 @@ 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; | ||||
|  | @ -88,4 +89,30 @@ 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'); | ||||
|     } | ||||
| } | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue