Compare commits
	
		
			103 Commits
		
	
	
		
			febb90e40e
			...
			4644f3832b
		
	
	| Author | SHA1 | Date | 
|---|---|---|
|  | 4644f3832b | |
|  | d68b166e15 | |
|  | 5d103b1908 | |
|  | 195fcc97b2 | |
|  | ef4f4e68fb | |
|  | 7c73b489ce | |
|  | 74db2f7c6b | |
|  | 458d68c271 | |
|  | 471f766638 | |
|  | dc3eb68861 | |
|  | 003e30d423 | |
|  | 5d40c0b2bb | |
|  | e60105e5af | |
|  | 2fadba3193 | |
|  | 357a696a53 | |
|  | 79fed8c002 | |
|  | 9b02bddea9 | |
|  | 1b6057673a | |
|  | 5c9c59718c | |
|  | c1e0842457 | |
|  | a61fd55b29 | |
|  | 4156a8744a | |
|  | 84b17b312f | |
|  | 6906b7c097 | |
|  | 30c84f0cfd | |
|  | d765bad0ed | |
|  | 89ce931f9d | |
|  | 2fac4d5a73 | |
|  | 56090b0104 | |
|  | 131061a3ee | |
|  | 9733c260b2 | |
|  | e2e9ddb9fd | |
|  | 511a58ded3 | |
|  | b937a8f4fa | |
|  | cb01496028 | |
|  | 92284b053c | |
|  | 39f0d476fb | |
|  | e6aa5e2c61 | |
|  | d225be6137 | |
|  | 6094a16c36 | |
|  | 34355d9b32 | |
|  | 7a39798e8b | |
|  | b07ad8d739 | |
|  | 5cd164f0d8 | |
|  | 652b83a140 | |
|  | 4d0923a01f | |
|  | 1de148eecc | |
|  | 12f053428c | |
|  | 0ce797c874 | |
|  | 8e2487c719 | |
|  | 2b1fe6ddcd | |
|  | fe8a2d69e6 | |
|  | 76d6c4ef90 | |
|  | 8bd66010dd | |
|  | bb9c219d81 | |
|  | b52eedc254 | |
|  | a06fd01194 | |
|  | 4a731f1104 | |
|  | 278a598078 | |
|  | 3c72b890fb | |
|  | 7de12a92dd | |
|  | 643959ff04 | |
|  | 5d16d65f8a | |
|  | 985b7942c4 | |
|  | 6582f49321 | |
|  | 5998230569 | |
|  | 0dbac1da4a | |
|  | 4b507aa297 | |
|  | af45560fe1 | |
|  | cecc90f07b | |
|  | 5b116a54c4 | |
|  | 0070976e34 | |
|  | dd07f6dbd7 | |
|  | ab74abdfdf | |
|  | 8f5448bbbc | |
|  | 2fd6598ef3 | |
|  | 0c90f66a66 | |
|  | b541d246e0 | |
|  | 858ae7f8d1 | |
|  | abf4158256 | |
|  | f2d59e4535 | |
|  | a75b4a7808 | |
|  | ecf3cc998c | |
|  | 7202cd60f5 | |
|  | 9d5c71adcd | |
|  | eb00d928fc | |
|  | 6683990755 | |
|  | 2a5f4832e1 | |
|  | 719b1920c9 | |
|  | 3260202465 | |
|  | 9b995641b6 | |
|  | 2d5921fe1d | |
|  | efa9eeccbe | |
|  | b33072ad20 | |
|  | 2e77823c3a | |
|  | 9a5d9ae30e | |
|  | d607c8beac | |
|  | 1a86ea7ea5 | |
|  | a157f2b656 | |
|  | e3c7dad51e | |
|  | 749e3dcd7c | |
|  | 4417008d22 | |
|  | b38591b87c | 
|  | @ -1,5 +1,9 @@ | |||
| # Letzte Änderungen | ||||
| 
 | ||||
| ### 1.12.7 | ||||
| 
 | ||||
| -   Fix: Synchronisation von allen Mitgliedern bei Mail-Verteilern - nicht nur den ersten 20 | ||||
| 
 | ||||
| ### 1.12.6 | ||||
| 
 | ||||
| -   Fix: Beiträge von Familienmitgliedern splitten | ||||
|  |  | |||
|  | @ -1,4 +1,4 @@ | |||
| @servers(['docker' => ['stammsilva@zoomyboy.de', 'stammgallier@stamm-gallier.de', 'dpsg-lennep@zoomyboy.de', 'dpsgbergischland@zoomyboy.de', 'dpsg-koeln@dpsg-koeln.de']]) | ||||
| @servers(['docker' => ['stamm-silva@zoomyboy.de', 'stammgallier@stamm-gallier.de', 'dpsg-lennep@zoomyboy.de', 'dpsgbergischland@zoomyboy.de', 'dpsg-koeln@dpsg-koeln.de']]) | ||||
| 
 | ||||
| @task('deploy', ['on' => 'docker']) | ||||
| cd $ADREMA_PATH | ||||
|  |  | |||
|  | @ -22,7 +22,6 @@ class InsertMemberAction | |||
|     { | ||||
|         $region = Region::firstWhere('nami_id', $member->regionId ?: -1); | ||||
| 
 | ||||
| 
 | ||||
|         $payload = [ | ||||
|             'firstname' => $member->firstname, | ||||
|             'lastname' => $member->lastname, | ||||
|  | @ -61,7 +60,17 @@ class InsertMemberAction | |||
|             } | ||||
|         } | ||||
| 
 | ||||
|         return Member::updateOrCreate(['nami_id' => $member->id], $payload); | ||||
|         return tap(Member::updateOrCreate(['nami_id' => $member->id], $payload), function ($insertedMember) use ($member) { | ||||
|             $insertedMember->bankAccount->update([ | ||||
|                 'iban' => $member->bankAccount->iban, | ||||
|                 'bic' => $member->bankAccount->bic, | ||||
|                 'blz' => $member->bankAccount->blz, | ||||
|                 'account_number' => $member->bankAccount->accountNumber, | ||||
|                 'person' => $member->bankAccount->person, | ||||
|                 'bank_name' => $member->bankAccount->bankName, | ||||
|                 'nami_id' => $member->bankAccount->id, | ||||
|             ]); | ||||
|         }); | ||||
|     } | ||||
| 
 | ||||
|     public function getSubscription(NamiMember $member): ?Subscription | ||||
|  |  | |||
|  | @ -34,7 +34,7 @@ class Activity extends Model | |||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * @return BelongsToMany<Subactivity> | ||||
|      * @return BelongsToMany<Subactivity, $this> | ||||
|      */ | ||||
|     public function subactivities(): BelongsToMany | ||||
|     { | ||||
|  |  | |||
|  | @ -17,7 +17,7 @@ class CourseMember extends Model | |||
|     public $guarded = []; | ||||
| 
 | ||||
|     /** | ||||
|      * @return BelongsTo<Course, self> | ||||
|      * @return BelongsTo<Course, $this> | ||||
|      */ | ||||
|     public function course(): BelongsTo | ||||
|     { | ||||
|  | @ -25,7 +25,7 @@ class CourseMember extends Model | |||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * @return BelongsTo<Member, self> | ||||
|      * @return BelongsTo<Member, $this> | ||||
|      */ | ||||
|     public function member(): BelongsTo | ||||
|     { | ||||
|  |  | |||
|  | @ -129,6 +129,7 @@ class Principal implements PrincipalBackendInterface | |||
|      */ | ||||
|     public function findByUri($uri, $principalPrefix) | ||||
|     { | ||||
|         return null; | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|  |  | |||
|  | @ -15,14 +15,13 @@ class Fee extends Model | |||
|     use HasFactory; | ||||
|     use HasNamiField; | ||||
| 
 | ||||
|     /** @var array<int, string> */ | ||||
|     public $fillable = ['name', 'nami_id']; | ||||
| 
 | ||||
|     /** @var bool */ | ||||
|     public $timestamps = false; | ||||
| 
 | ||||
|     /** | ||||
|      * @return HasMany<Subscription> | ||||
|      * @return HasMany<Subscription, $this> | ||||
|      */ | ||||
|     public function subscriptions(): HasMany | ||||
|     { | ||||
|  |  | |||
|  | @ -3,11 +3,11 @@ | |||
| namespace App\Form\Data; | ||||
| 
 | ||||
| use App\Fileshare\Data\FileshareResourceData; | ||||
| use App\Form\Fields\Field; | ||||
| use Spatie\LaravelData\Attributes\MapInputName; | ||||
| use Spatie\LaravelData\Attributes\MapOutputName; | ||||
| use Spatie\LaravelData\Data; | ||||
| use Spatie\LaravelData\Mappers\SnakeCaseMapper; | ||||
| use Spatie\LaravelData\Support\EloquentCasts\DataEloquentCast; | ||||
| 
 | ||||
| #[MapInputName(SnakeCaseMapper::class)]
 | ||||
| #[MapOutputName(SnakeCaseMapper::class)]
 | ||||
|  | @ -16,4 +16,13 @@ class ExportData extends Data | |||
|     public function __construct(public ?FileshareResourceData $root = null, public ?string $groupBy = null, public ?string $toGroupField = null) | ||||
|     { | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * @param array<int, mixed> $arguments | ||||
|      * @return DataEloquentCast<self> | ||||
|      */ | ||||
|     public static function castUsing(array $arguments): DataEloquentCast | ||||
|     { | ||||
|         return new DataEloquentCast(static::class, $arguments); | ||||
|     } | ||||
| } | ||||
|  |  | |||
|  | @ -8,6 +8,7 @@ use Illuminate\Support\Collection; | |||
| use Spatie\LaravelData\Data; | ||||
| use Spatie\LaravelData\Attributes\WithCast; | ||||
| use Spatie\LaravelData\Attributes\WithTransformer; | ||||
| use Spatie\LaravelData\Support\EloquentCasts\DataEloquentCast; | ||||
| 
 | ||||
| class FormConfigData extends Data | ||||
| { | ||||
|  | @ -29,4 +30,13 @@ class FormConfigData extends Data | |||
|             new FieldCollection([]) | ||||
|         ); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * @param array<int, mixed> $arguments | ||||
|      * @return DataEloquentCast<self> | ||||
|      */ | ||||
|     public static function castUsing(array $arguments): DataEloquentCast | ||||
|     { | ||||
|         return new DataEloquentCast(static::class, $arguments); | ||||
|     } | ||||
| } | ||||
|  |  | |||
|  | @ -62,7 +62,7 @@ class Form extends Model implements HasMedia | |||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * @return HasMany<Participant> | ||||
|      * @return HasMany<Participant, $this> | ||||
|      */ | ||||
|     public function participants(): HasMany | ||||
|     { | ||||
|  |  | |||
|  | @ -33,7 +33,7 @@ class Participant extends Model implements Preventable | |||
|     ]; | ||||
| 
 | ||||
|     /** | ||||
|      * @return BelongsTo<Form, self> | ||||
|      * @return BelongsTo<Form, $this> | ||||
|      */ | ||||
|     public function form(): BelongsTo | ||||
|     { | ||||
|  | @ -41,7 +41,7 @@ class Participant extends Model implements Preventable | |||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * @return HasMany<self> | ||||
|      * @return HasMany<Participant, $this> | ||||
|      */ | ||||
|     public function children(): HasMany | ||||
|     { | ||||
|  | @ -49,7 +49,7 @@ class Participant extends Model implements Preventable | |||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * @return BelongsTo<Member, self> | ||||
|      * @return BelongsTo<Member, $this> | ||||
|      */ | ||||
|     public function member(): BelongsTo | ||||
|     { | ||||
|  |  | |||
|  | @ -26,7 +26,7 @@ class Group extends Model | |||
|     ]; | ||||
| 
 | ||||
|     /** | ||||
|      * @return BelongsTo<self, self> | ||||
|      * @return BelongsTo<Group, $this> | ||||
|      */ | ||||
|     public function parent(): BelongsTo | ||||
|     { | ||||
|  | @ -34,7 +34,7 @@ class Group extends Model | |||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * @return HasMany<self> | ||||
|      * @return HasMany<Group, $this> | ||||
|      */ | ||||
|     public function children(): HasMany | ||||
|     { | ||||
|  |  | |||
|  | @ -18,5 +18,7 @@ class Authenticate extends Middleware | |||
|         if (!$request->expectsJson()) { | ||||
|             return route('login'); | ||||
|         } | ||||
| 
 | ||||
|         return null; | ||||
|     } | ||||
| } | ||||
|  |  | |||
|  | @ -39,7 +39,7 @@ class MassStoreAction | |||
|         foreach ($memberGroup as $members) { | ||||
|             $invoice = Invoice::createForMember($members->first(), $members, $year); | ||||
|             $invoice->save(); | ||||
|             $invoice->positions()->createMany($invoice->positions); | ||||
|             $invoice->positions()->createMany($invoice->positions->toArray()); | ||||
|             $invoices->push($invoice->fresh('positions')); | ||||
|         } | ||||
| 
 | ||||
|  |  | |||
|  | @ -37,7 +37,7 @@ class Invoice extends Model | |||
|     ]; | ||||
| 
 | ||||
|     /** | ||||
|      * @return HasMany<InvoicePosition> | ||||
|      * @return HasMany<InvoicePosition, $this> | ||||
|      */ | ||||
|     public function positions(): HasMany | ||||
|     { | ||||
|  |  | |||
|  | @ -16,7 +16,7 @@ class InvoicePosition extends Model | |||
|     public $guarded = []; | ||||
| 
 | ||||
|     /** | ||||
|      * @return BelongsTo<Member, self> | ||||
|      * @return BelongsTo<Member, $this> | ||||
|      */ | ||||
|     public function member(): BelongsTo | ||||
|     { | ||||
|  | @ -24,7 +24,7 @@ class InvoicePosition extends Model | |||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * @return BelongsTo<Invoice, self> | ||||
|      * @return BelongsTo<Invoice, $this> | ||||
|      */ | ||||
|     public function invoice(): BelongsTo | ||||
|     { | ||||
|  |  | |||
|  | @ -6,6 +6,7 @@ use Spatie\LaravelData\Data; | |||
| use Spatie\LaravelData\DataCollection; | ||||
| use Spatie\MediaLibrary\MediaCollections\Models\Media; | ||||
| use Spatie\LaravelData\Attributes\DataCollectionOf; | ||||
| use Spatie\LaravelData\Support\EloquentCasts\DataEloquentCast; | ||||
| 
 | ||||
| class Condition extends Data | ||||
| { | ||||
|  | @ -42,4 +43,13 @@ class Condition extends Data | |||
|     { | ||||
|         return $this->mode === ConditionMode::ALL; | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * @param array<int, mixed> $arguments | ||||
|      * @return DataEloquentCast<self> | ||||
|      */ | ||||
|     public static function castUsing(array $arguments): DataEloquentCast | ||||
|     { | ||||
|         return new DataEloquentCast(static::class, $arguments); | ||||
|     } | ||||
| } | ||||
|  |  | |||
|  | @ -5,6 +5,7 @@ namespace App\Lib\Editor; | |||
| use Livewire\Wireable; | ||||
| use Spatie\LaravelData\Concerns\WireableData; | ||||
| use Spatie\LaravelData\Data; | ||||
| use Spatie\LaravelData\Support\EloquentCasts\DataEloquentCast; | ||||
| 
 | ||||
| /** @todo replace blocks with actual block data classes */ | ||||
| class EditorData extends Data implements Editorable, Wireable | ||||
|  | @ -87,4 +88,13 @@ class EditorData extends Data implements Editorable, Wireable | |||
|     { | ||||
|         return $this; | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * @param array<int, mixed> $arguments | ||||
|      * @return DataEloquentCast<self> | ||||
|      */ | ||||
|     public static function castUsing(array $arguments): DataEloquentCast | ||||
|     { | ||||
|         return new DataEloquentCast(static::class, $arguments); | ||||
|     } | ||||
| } | ||||
|  |  | |||
|  | @ -8,7 +8,7 @@ use Spatie\LaravelData\Data; | |||
| 
 | ||||
| /** | ||||
|  * @template T of Model | ||||
|  * @property Builder $query | ||||
|  * @property Builder<T> $query | ||||
|  */ | ||||
| abstract class Filter extends Data | ||||
| { | ||||
|  | @ -40,7 +40,7 @@ abstract class Filter extends Data | |||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * @return static(self<T>) | ||||
|      * @return static | ||||
|      */ | ||||
|     public function toDefault(): self | ||||
|     { | ||||
|  |  | |||
|  | @ -8,7 +8,7 @@ use Spatie\LaravelData\Data; | |||
| 
 | ||||
| /** | ||||
|  * @template T of Model | ||||
|  * @property Builder $query | ||||
|  * @property Builder<T> $query | ||||
|  */ | ||||
| abstract class ScoutFilter extends Data | ||||
| { | ||||
|  |  | |||
|  | @ -25,7 +25,7 @@ class ResyncAction | |||
|      */ | ||||
|     public function getResults(Maildispatcher $dispatcher): Collection | ||||
|     { | ||||
|         return FilterScope::fromPost($dispatcher->filter)->getQuery()->get() | ||||
|         return FilterScope::fromPost($dispatcher->filter)->noPageLimit()->getQuery()->get() | ||||
|             ->filter(fn ($member) => $member->email || $member->email_parents) | ||||
|             ->map(fn ($member) => MailEntry::from(['email' => $member->email ?: $member->email_parents])) | ||||
|             ->unique(fn ($member) => $member->email); | ||||
|  |  | |||
|  | @ -23,7 +23,7 @@ class Maildispatcher extends Model | |||
|     ]; | ||||
| 
 | ||||
|     /** | ||||
|      * @return BelongsTo<Mailgateway, self> | ||||
|      * @return BelongsTo<Mailgateway, $this> | ||||
|      */ | ||||
|     public function gateway(): BelongsTo | ||||
|     { | ||||
|  |  | |||
|  | @ -10,6 +10,7 @@ use App\Member\Member; | |||
| use App\Setting\NamiSettings; | ||||
| use App\Subactivity; | ||||
| use Lorisleiva\Actions\Concerns\AsAction; | ||||
| use Zoomyboy\LaravelNami\Data\BankAccount; | ||||
| use Zoomyboy\LaravelNami\Data\Member as NamiMember; | ||||
| 
 | ||||
| class NamiPutMemberAction | ||||
|  | @ -47,6 +48,16 @@ class NamiPutMemberAction | |||
|             'id' => $member->nami_id, | ||||
|             'version' => $member->version, | ||||
|             'keepdata' => $member->keepdata, | ||||
|             'bankAccount' => BankAccount::from([ | ||||
|                 'bankName' => $member->bankAccount->bank_name, | ||||
|                 'id' => $member->bankAccount->nami_id, | ||||
|                 'memberId' => $member->mitgliedsnr, | ||||
|                 'iban' => $member->bankAccount->iban, | ||||
|                 'bic' => $member->bankAccount->bic, | ||||
|                 'blz' => $member->bankAccount->blz, | ||||
|                 'person' => $member->bankAccount->person, | ||||
|                 'accountNumber' => $member->bankAccount->account_number, | ||||
|             ]), | ||||
|         ]); | ||||
|         $response = $api->putMember($namiMember, $activity ? $activity->nami_id : null, $subactivity ? $subactivity->nami_id : null); | ||||
|         Member::withoutEvents(function () use ($response, $member) { | ||||
|  |  | |||
|  | @ -0,0 +1,17 @@ | |||
| <?php | ||||
| 
 | ||||
| namespace App\Member; | ||||
| 
 | ||||
| use Database\Factories\Member\BankAccountFactory; | ||||
| use Illuminate\Database\Eloquent\Factories\HasFactory; | ||||
| use Illuminate\Database\Eloquent\Model; | ||||
| 
 | ||||
| class BankAccount extends Model | ||||
| { | ||||
|     /** @use HasFactory<BankAccountFactory> */ | ||||
|     use HasFactory; | ||||
| 
 | ||||
|     public $guarded = []; | ||||
| 
 | ||||
|     public $primaryKey = 'member_id'; | ||||
| } | ||||
|  | @ -9,7 +9,8 @@ use Zoomyboy\LaravelNami\Data\Member as NamiMember; | |||
| use Zoomyboy\LaravelNami\Data\MembershipEntry as NamiMembershipEntry; | ||||
| use Spatie\LaravelData\Attributes\DataCollectionOf; | ||||
| 
 | ||||
| class FullMember extends Data { | ||||
| class FullMember extends Data | ||||
| { | ||||
|     /** | ||||
|      * @param DataCollection<int, NamiCourse> $courses | ||||
|      * @param DataCollection<int, NamiMembershipEntry> $memberships | ||||
|  | @ -20,6 +21,6 @@ class FullMember extends Data { | |||
|         public DataCollection $courses, | ||||
|         #[DataCollectionOf(NamiMembershipEntry::class)]
 | ||||
|         public DataCollection $memberships, | ||||
|     ) {} | ||||
|     ) { | ||||
|     } | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -34,6 +34,7 @@ use Zoomyboy\Osm\HasGeolocation; | |||
| use Zoomyboy\Phone\HasPhoneNumbers; | ||||
| use App\Prevention\Enums\Prevention; | ||||
| use Database\Factories\Member\MemberFactory; | ||||
| use Illuminate\Database\Eloquent\Relations\HasOne; | ||||
| 
 | ||||
| /** | ||||
|  * @property string $subscription_name | ||||
|  | @ -195,7 +196,7 @@ class Member extends Model implements Geolocatable | |||
| 
 | ||||
|     // ---------------------------------- Relations ----------------------------------
 | ||||
|     /** | ||||
|      * @return BelongsTo<Country, self> | ||||
|      * @return BelongsTo<Country, $this> | ||||
|      */ | ||||
|     public function country(): BelongsTo | ||||
|     { | ||||
|  | @ -203,7 +204,7 @@ class Member extends Model implements Geolocatable | |||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * @return BelongsTo<Gender, self> | ||||
|      * @return BelongsTo<Gender, $this> | ||||
|      */ | ||||
|     public function gender(): BelongsTo | ||||
|     { | ||||
|  | @ -211,7 +212,7 @@ class Member extends Model implements Geolocatable | |||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * @return BelongsTo<Region, self> | ||||
|      * @return BelongsTo<Region, $this> | ||||
|      */ | ||||
|     public function region(): BelongsTo | ||||
|     { | ||||
|  | @ -222,7 +223,7 @@ class Member extends Model implements Geolocatable | |||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * @return HasMany<InvoicePosition> | ||||
|      * @return HasMany<InvoicePosition, $this> | ||||
|      */ | ||||
|     public function invoicePositions(): HasMany | ||||
|     { | ||||
|  | @ -230,7 +231,7 @@ class Member extends Model implements Geolocatable | |||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * @return BelongsTo<Confession, self> | ||||
|      * @return BelongsTo<Confession, $this> | ||||
|      */ | ||||
|     public function confession(): BelongsTo | ||||
|     { | ||||
|  | @ -238,7 +239,7 @@ class Member extends Model implements Geolocatable | |||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * @return BelongsTo<Nationality, self> | ||||
|      * @return BelongsTo<Nationality, $this> | ||||
|      */ | ||||
|     public function nationality(): BelongsTo | ||||
|     { | ||||
|  | @ -246,7 +247,7 @@ class Member extends Model implements Geolocatable | |||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * @return BelongsTo<Subscription, self> | ||||
|      * @return BelongsTo<Subscription, $this> | ||||
|      */ | ||||
|     public function subscription(): BelongsTo | ||||
|     { | ||||
|  | @ -254,7 +255,7 @@ class Member extends Model implements Geolocatable | |||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * @return BelongsTo<Group, self> | ||||
|      * @return BelongsTo<Group, $this> | ||||
|      */ | ||||
|     public function group(): BelongsTo | ||||
|     { | ||||
|  | @ -262,7 +263,7 @@ class Member extends Model implements Geolocatable | |||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * @return HasMany<CourseMember> | ||||
|      * @return HasMany<CourseMember, $this> | ||||
|      */ | ||||
|     public function courses(): HasMany | ||||
|     { | ||||
|  | @ -270,7 +271,7 @@ class Member extends Model implements Geolocatable | |||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * @return HasMany<Membership> | ||||
|      * @return HasMany<Membership, $this> | ||||
|      */ | ||||
|     public function memberships(): HasMany | ||||
|     { | ||||
|  | @ -278,7 +279,7 @@ class Member extends Model implements Geolocatable | |||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * @return HasMany<Membership> | ||||
|      * @return HasMany<Membership, $this> | ||||
|      */ | ||||
|     public function leaderMemberships(): HasMany | ||||
|     { | ||||
|  | @ -286,21 +287,34 @@ class Member extends Model implements Geolocatable | |||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * @return HasMany<Membership> | ||||
|      * @return HasMany<Membership, $this> | ||||
|      */ | ||||
|     public function ageGroupMemberships(): HasMany | ||||
|     { | ||||
|         return $this->memberships()->isAgeGroup()->active(); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * @return HasOne<BankAccount, $this> | ||||
|      */ | ||||
|     public function bankAccount(): HasOne | ||||
|     { | ||||
|         return $this->hasOne(BankAccount::class); | ||||
|     } | ||||
| 
 | ||||
|     public static function booted() | ||||
|     { | ||||
|         static::created(function (self $model): void { | ||||
|             $model->bankAccount()->create([]); | ||||
|         }); | ||||
| 
 | ||||
|         static::deleting(function (self $model): void { | ||||
|             $model->memberships->each->delete(); | ||||
|             $model->courses->each->delete(); | ||||
|             $model->invoicePositions->each(function ($position) { | ||||
|                 $position->delete(); | ||||
|             }); | ||||
|             $model->bankAccount()->delete(); | ||||
|         }); | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
|  | @ -32,7 +32,7 @@ class Membership extends Model | |||
|     ]; | ||||
| 
 | ||||
|     /** | ||||
|      * @return BelongsTo<Activity, self> | ||||
|      * @return BelongsTo<Activity, $this> | ||||
|      */ | ||||
|     public function activity(): BelongsTo | ||||
|     { | ||||
|  | @ -40,7 +40,7 @@ class Membership extends Model | |||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * @return BelongsTo<Group, self> | ||||
|      * @return BelongsTo<Group, $this> | ||||
|      */ | ||||
|     public function group(): BelongsTo | ||||
|     { | ||||
|  | @ -48,7 +48,7 @@ class Membership extends Model | |||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * @return BelongsTo<Subactivity, self> | ||||
|      * @return BelongsTo<Subactivity, $this> | ||||
|      */ | ||||
|     public function subactivity(): BelongsTo | ||||
|     { | ||||
|  | @ -56,7 +56,7 @@ class Membership extends Model | |||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * @return BelongsTo<Member, self> | ||||
|      * @return BelongsTo<Member, $this> | ||||
|      */ | ||||
|     public function member(): BelongsTo | ||||
|     { | ||||
|  |  | |||
|  | @ -14,9 +14,6 @@ class Subscription extends Model | |||
|     /** @use HasFactory<SubscriptionFactory> */ | ||||
|     use HasFactory; | ||||
| 
 | ||||
|     /** | ||||
|      * @var array<int, string> | ||||
|      */ | ||||
|     public $fillable = ['name', 'fee_id']; | ||||
| 
 | ||||
|     public function getAmount(): int | ||||
|  | @ -25,7 +22,7 @@ class Subscription extends Model | |||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * @return BelongsTo<Fee, self> | ||||
|      * @return BelongsTo<Fee, $this> | ||||
|      */ | ||||
|     public function fee(): BelongsTo | ||||
|     { | ||||
|  | @ -33,7 +30,7 @@ class Subscription extends Model | |||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * @return HasMany<SubscriptionChild> | ||||
|      * @return HasMany<SubscriptionChild, $this> | ||||
|      */ | ||||
|     public function children(): HasMany | ||||
|     { | ||||
|  |  | |||
|  | @ -16,9 +16,6 @@ class Subactivity extends Model | |||
|     use HasNamiField; | ||||
|     use Sluggable; | ||||
| 
 | ||||
|     /** | ||||
|      * @var array<int, string> | ||||
|      */ | ||||
|     public $fillable = ['is_age_group', 'is_filterable', 'slug', 'name', 'nami_id']; | ||||
| 
 | ||||
|     /** | ||||
|  | @ -26,9 +23,6 @@ class Subactivity extends Model | |||
|      */ | ||||
|     public $timestamps = false; | ||||
| 
 | ||||
|     /** | ||||
|      * @var array<string, string> | ||||
|      */ | ||||
|     public $casts = [ | ||||
|         'is_age_group' => 'boolean', | ||||
|         'is_filterable' => 'boolean', | ||||
|  | @ -47,7 +41,7 @@ class Subactivity extends Model | |||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * @return BelongsToMany<Activity> | ||||
|      * @return BelongsToMany<Activity, $this> | ||||
|      */ | ||||
|     public function activities(): BelongsToMany | ||||
|     { | ||||
|  |  | |||
|  | @ -3,8 +3,8 @@ | |||
| echo "drop database scoutrobot;" | sudo mysql | ||||
| echo "create database scoutrobot;" | sudo mysql | ||||
| 
 | ||||
| ssh -l stammsilva zoomyboy.de "cd /usr/share/webapps/nami_silva && docker compose exec db mysqldump -udb -p$SCOUTROBOT_DB_PASSWORD db" > db.tmp | ||||
| sudo mysql scoutrobot < db.tmp | ||||
| ssh -l stamm-silva zoomyboy.de "cd /usr/share/webapps/adrema_silva && docker compose exec db mysqldump -udb -p$SCOUTROBOT_DB_PASSWORD db" > db.tmp | ||||
| sudo mysql adrema < db.tmp | ||||
| rm db.tmp | ||||
| 
 | ||||
| echo 'app(\App\Form\FormSettings::class)->fill(["registerUrl" => "http://stammsilva.test/anmeldung/{slug}/register", "clearCacheUrl" => "http://stammsilva.test/adrema/clear-cache"])->save();' | php artisan tinker | ||||
|  |  | |||
|  | @ -81,12 +81,12 @@ | |||
|     }, | ||||
|     "require-dev": { | ||||
|         "fakerphp/faker": "^1.9.1", | ||||
|         "larastan/larastan": "^2.0", | ||||
|         "larastan/larastan": "^3.0", | ||||
|         "laravel/envoy": "^2.8", | ||||
|         "mockery/mockery": "^1.4.4", | ||||
|         "orchestra/testbench": "^9.0", | ||||
|         "pestphp/pest": "^3.0", | ||||
|         "phpstan/phpstan-mockery": "^1.1", | ||||
|         "phpstan/phpstan-mockery": "^2.0", | ||||
|         "qossmic/deptrac": "^2.0" | ||||
|     }, | ||||
|     "config": { | ||||
|  |  | |||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							|  | @ -0,0 +1,6 @@ | |||
| <?php | ||||
| 
 | ||||
| return [ | ||||
|     'email' => env('USER_EMAIL', 'admin@example.com'), | ||||
|     'password' => env('USER_PASSWORD', 'admin'), | ||||
| ]; | ||||
|  | @ -0,0 +1,36 @@ | |||
| <?php | ||||
| 
 | ||||
| namespace Database\Factories\Member; | ||||
| 
 | ||||
| use App\Member\BankAccount; | ||||
| use Illuminate\Database\Eloquent\Factories\Factory; | ||||
| 
 | ||||
| /** | ||||
|  * @extends Factory<BankAccount> | ||||
|  */ | ||||
| class BankAccountFactory extends Factory | ||||
| { | ||||
|     protected $model = BankAccount::class; | ||||
| 
 | ||||
|     /** | ||||
|      * Define the model's default state. | ||||
|      * | ||||
|      * @return array<string, mixed> | ||||
|      */ | ||||
|     public function definition(): array | ||||
|     { | ||||
|         return [ | ||||
|             'bank_name' => $this->faker->name(), | ||||
|             'bic' => $this->faker->swiftBicNumber(), | ||||
|             'iban' => $this->faker->iban('DE'), | ||||
|             'blz' => $this->faker->name(), | ||||
|             'person' => $this->faker->name(), | ||||
|             'account_number' => $this->faker->name(), | ||||
|         ]; | ||||
|     } | ||||
| 
 | ||||
|     public function inNami(int $namiId): self | ||||
|     { | ||||
|         return $this->state(['nami_id' => $namiId]); | ||||
|     } | ||||
| } | ||||
|  | @ -93,6 +93,13 @@ class MemberFactory extends Factory | |||
|         return $this->state(['nami_id' => $namiId]); | ||||
|     } | ||||
| 
 | ||||
|     public function withBankAccount(BankAccountFactory $factory): self | ||||
|     { | ||||
|         return $this->afterCreating(function ($member) use ($factory) { | ||||
|             $member->bankAccount->update($factory->make()->toArray()); | ||||
|         }); | ||||
|     } | ||||
| 
 | ||||
|     public function sameFamilyAs(Member $member): self | ||||
|     { | ||||
|         return $this->state([ | ||||
|  |  | |||
|  | @ -0,0 +1,34 @@ | |||
| <?php | ||||
| 
 | ||||
| use Illuminate\Database\Migrations\Migration; | ||||
| use Illuminate\Database\Schema\Blueprint; | ||||
| use Illuminate\Support\Facades\Schema; | ||||
| 
 | ||||
| return new class extends Migration | ||||
| { | ||||
|     /** | ||||
|      * Run the migrations. | ||||
|      */ | ||||
|     public function up(): void | ||||
|     { | ||||
|         Schema::create('bank_accounts', function (Blueprint $table) { | ||||
|             $table->unsignedBigInteger('member_id')->primary(); | ||||
|             $table->unsignedBigInteger('nami_id')->nullable(); | ||||
|             $table->string('iban')->nullable(); | ||||
|             $table->string('bic')->nullable(); | ||||
|             $table->string('blz')->nullable(); | ||||
|             $table->string('bank_name')->nullable(); | ||||
|             $table->string('person')->nullable(); | ||||
|             $table->string('account_number')->nullable(); | ||||
|             $table->timestamps(); | ||||
|         }); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * Reverse the migrations. | ||||
|      */ | ||||
|     public function down(): void | ||||
|     { | ||||
|         Schema::dropIfExists('bank_accounts'); | ||||
|     } | ||||
| }; | ||||
|  | @ -16,9 +16,9 @@ class UserSeeder extends Seeder | |||
|     public function run() | ||||
|     { | ||||
|         User::create([ | ||||
|             'email' => env('USER_EMAIL', 'admin@example.com'), | ||||
|             'email' => config('init.email'), | ||||
|             'email_verified_at' => now(), | ||||
|             'password' => Hash::make(env('USER_PASSWORD', 'admin')), | ||||
|             'password' => Hash::make(config('init.password')), | ||||
|             'name' => 'Adrema Benutzer', | ||||
|         ]); | ||||
|     } | ||||
|  |  | |||
|  | @ -73,6 +73,17 @@ abstract class Type extends Data implements Wireable | |||
|         ])->toArray(); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * @return mixed | ||||
|      */ | ||||
|     public function toResource() | ||||
|     { | ||||
|         return [ | ||||
|             'cls' => get_class($this), | ||||
|             'params' => get_object_vars($this), | ||||
|         ]; | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * @param Collection<int, MailEntry> $results | ||||
|      */ | ||||
|  |  | |||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							|  | @ -1 +1 @@ | |||
| Subproject commit bc61530e510b3d41048984b7cf20b6d82c4f85fb | ||||
| Subproject commit f905c316ee7913cbf85c386021fbaa28b4b2a158 | ||||
|  | @ -1 +1 @@ | |||
| Subproject commit 74800de149bf2ca250a17263cfaf59e48b76186f | ||||
| Subproject commit ed283d97ca7680b3c27b2d75da9937f4f379e321 | ||||
							
								
								
									
										53
									
								
								phpstan.neon
								
								
								
								
							
							
						
						
									
										53
									
								
								phpstan.neon
								
								
								
								
							|  | @ -7,6 +7,9 @@ parameters: | |||
|     stubFiles: | ||||
|         - tests/stub/phpstan/TestResponse.stub | ||||
|         - tests/stub/phpstan/Settings.stub | ||||
|         - tests/stub/phpstan/DataEloquentCast.stub | ||||
|         - tests/stub/phpstan/File.stub | ||||
|         - tests/stub/phpstan/CastsAttributes.stub | ||||
| 
 | ||||
|     paths: | ||||
|         - app | ||||
|  | @ -30,9 +33,6 @@ parameters: | |||
|     ignoreErrors: | ||||
|         - | ||||
|             message: "#but does not specify its types: TData#" | ||||
| 
 | ||||
|         - | ||||
|             message: "#cast\\(\\) has parameter \\$properties#" | ||||
|         - | ||||
|             message: "#^Method App\\\\Activity\\:\\:sluggable\\(\\) return type has no value type specified in iterable type array\\.$#" | ||||
|             count: 1 | ||||
|  | @ -453,11 +453,6 @@ parameters: | |||
|             count: 1 | ||||
|             path: app/Form/Fields/NamiField.php | ||||
| 
 | ||||
|         - | ||||
|             message: "#^Method App\\\\Fileshare\\\\ConnectionTypes\\\\ConnectionType\\:\\:types\\(\\) should return Illuminate\\\\Support\\\\Collection\\<int, class\\-string\\<App\\\\Fileshare\\\\ConnectionTypes\\\\ConnectionType\\>\\> but returns Illuminate\\\\Support\\\\Collection\\<int, string\\>\\.$#" | ||||
|             count: 1 | ||||
|             path: app/Fileshare/ConnectionTypes/ConnectionType.php | ||||
| 
 | ||||
|         - | ||||
|             message: "#^Call to an undefined method Phake\\\\Proxies\\\\StubberProxy\\:\\:check\\(\\)\\.$#" | ||||
|             count: 1 | ||||
|  | @ -507,3 +502,45 @@ parameters: | |||
|             message: "#^Call to an undefined method Illuminate\\\\Database\\\\Eloquent\\\\Relations\\\\Relation\\<\\*, \\*, \\*\\>\\:\\:isTrying\\(\\)\\.$#" | ||||
|             count: 1 | ||||
|             path: app/Membership/TestersBlock.php | ||||
| 
 | ||||
|         - | ||||
|             message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Builder\<Illuminate\\Database\\Eloquent\\Model\>\:\:isLeader\(\)\.$#' | ||||
|             identifier: method.notFound | ||||
|             count: 1 | ||||
|             path: app/Efz/EfzPendingBlock.php | ||||
| 
 | ||||
|         - | ||||
|             message: '#^Method App\\Fileshare\\ConnectionTypes\\ConnectionType\:\:types\(\) should return Illuminate\\Support\\Collection\<int, class\-string\<App\\Fileshare\\ConnectionTypes\\ConnectionType\>\> but returns Illuminate\\Support\\Collection\<int, non\-falsy\-string\>\.$#' | ||||
|             identifier: return.type | ||||
|             count: 1 | ||||
|             path: app/Fileshare/ConnectionTypes/ConnectionType.php | ||||
| 
 | ||||
|         - | ||||
|             message: '#^Unable to resolve the template type TGroupKey in call to method Illuminate\\Support\\Collection\<int,App\\Form\\Models\\Participant\>\:\:groupBy\(\)$#' | ||||
|             identifier: argument.templateType | ||||
|             count: 1 | ||||
|             path: app/Form/Actions/ExportSyncAction.php | ||||
| 
 | ||||
|         - | ||||
|             message: '#^Parameter \#1 \$callback of method Illuminate\\Support\\Collection\<\(int\|string\),mixed\>\:\:map\(\) contains unresolvable type\.$#' | ||||
|             identifier: argument.unresolvableType | ||||
|             count: 1 | ||||
|             path: app/Mailgateway/Resources/MailgatewayResource.php | ||||
| 
 | ||||
|         - | ||||
|             message: '#^Parameter \#1 \$value of method Illuminate\\Support\\Collection\<\(int\|string\),array\<string, mixed\>\>\:\:prepend\(\) contains unresolvable type\.$#' | ||||
|             identifier: argument.unresolvableType | ||||
|             count: 1 | ||||
|             path: app/Mailgateway/Resources/MailgatewayResource.php | ||||
| 
 | ||||
|         - | ||||
|             message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Builder\<Illuminate\\Database\\Eloquent\\Model\>\:\:isLeader\(\)\.$#' | ||||
|             identifier: method.notFound | ||||
|             count: 1 | ||||
|             path: app/Member/PsPendingBlock.php | ||||
| 
 | ||||
|         - | ||||
|             message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Builder\<TRelatedModel of Illuminate\\Database\\Eloquent\\Model\>\:\:isTrying\(\)\.$#' | ||||
|             identifier: method.notFound | ||||
|             count: 1 | ||||
|             path: app/Membership/TestersBlock.php | ||||
|  |  | |||
|  | @ -29,6 +29,7 @@ | |||
|     <server name="QUEUE_CONNECTION" value="sync"/> | ||||
|     <server name="SESSION_DRIVER" value="array"/> | ||||
|     <server name="TELESCOPE_ENABLED" value="false"/> | ||||
|     <server name="SCOUT_DRIVER" value="database"/> | ||||
|   </php> | ||||
|   <source> | ||||
|     <include> | ||||
|  |  | |||
|  | @ -7,11 +7,11 @@ use App\Actions\PullMembershipsAction; | |||
| use App\Activity; | ||||
| use App\Confession; | ||||
| use App\Country; | ||||
| use App\Fee; | ||||
| use App\Gender; | ||||
| use App\Group; | ||||
| use App\Member\Actions\NamiPutMemberAction; | ||||
| use App\Member\BankAccount; | ||||
| use App\Member\Member; | ||||
| use App\Nationality; | ||||
| use App\Payment\Subscription; | ||||
| use App\Region; | ||||
| use App\Subactivity; | ||||
|  | @ -20,52 +20,130 @@ use Phake; | |||
| use Zoomyboy\LaravelNami\Fakes\MemberFake; | ||||
| 
 | ||||
| uses(DatabaseTransactions::class); | ||||
| covers(NamiPutMemberAction::class); | ||||
| 
 | ||||
| it('testItPutsAMember', function (array $memberAttributes, array $storedAttributes) { | ||||
|     Fee::factory()->create(); | ||||
| beforeEach(function () { | ||||
|     $this->stubIo(PullMemberAction::class, fn ($mock) => $mock); | ||||
|     $this->stubIo(PullMembershipsAction::class, fn ($mock) => $mock); | ||||
|     Group::factory()->inNami(55)->create(); | ||||
|     $this->withoutExceptionHandling()->login()->loginNami(); | ||||
|     $country = Country::factory()->create(); | ||||
|     $region = Region::factory()->create(); | ||||
|     $nationality = Nationality::factory()->inNami(565)->create(); | ||||
|     $subscription = Subscription::factory()->forFee()->create(); | ||||
|     $group = Group::factory()->inNami(55)->create(); | ||||
|     $confession = Confession::factory()->inNami(567)->create(['is_null' => true]); | ||||
|     app(MemberFake::class)->stores(55, 993); | ||||
|     $activity = Activity::factory()->hasAttached(Subactivity::factory()->name('Biber')->inNami(55))->name('Leiter')->inNami(6)->create(); | ||||
|     $subactivity = $activity->subactivities->first(); | ||||
|     Confession::factory()->inNami(567)->create(['is_null' => true]); | ||||
|     $activity = Activity::factory()->inNami(6)->create(); | ||||
|     Subactivity::factory()->hasAttached($activity)->inNami(55)->create(); | ||||
| }); | ||||
| 
 | ||||
|     $member = Member::factory() | ||||
|         ->for($country) | ||||
|         ->for($subscription) | ||||
|         ->for($region) | ||||
|         ->for($nationality) | ||||
|         ->for($group) | ||||
|         ->emailBillKind() | ||||
|         ->create($memberAttributes); | ||||
| it('pulls member and memberships befre pushing', function () { | ||||
|     $member = Member::factory()->defaults()->create(); | ||||
| 
 | ||||
|     NamiPutMemberAction::run($member, $activity, $subactivity); | ||||
|     NamiPutMemberAction::run($member, Activity::first(), Subactivity::first()); | ||||
| 
 | ||||
|     app(MemberFake::class)->assertStored(55, [ | ||||
|         'ersteTaetigkeitId' => 6, | ||||
|         'ersteUntergliederungId' => 55, | ||||
|         'konfessionId' => 567, | ||||
|         ...$storedAttributes, | ||||
|     ]); | ||||
|     $this->assertDatabaseHas('members', [ | ||||
|         'nami_id' => 993, | ||||
|     ]); | ||||
|     Phake::verify(app(PullMemberAction::class))->handle(55, 993); | ||||
|     Phake::verify(app(PullMembershipsAction::class))->handle($member); | ||||
| }); | ||||
| 
 | ||||
| it('sets nami id of member', function () { | ||||
|     $member = Member::factory()->defaults()->create(); | ||||
| 
 | ||||
|     NamiPutMemberAction::run($member, Activity::first(), Subactivity::first()); | ||||
| 
 | ||||
|     $this->assertDatabaseHas('members', ['nami_id' => 993]); | ||||
| }); | ||||
| 
 | ||||
| it('stores member attributes', function (array $memberAttributes, array $storedAttributes) { | ||||
|     $member = Member::factory()->defaults()->create($memberAttributes); | ||||
| 
 | ||||
|     NamiPutMemberAction::run($member, Activity::first(), Subactivity::first()); | ||||
| 
 | ||||
|     app(MemberFake::class)->assertStored(55, $storedAttributes); | ||||
| })->with([ | ||||
|     [ | ||||
|         ['email_parents' => 'a@b.de'], ['emailVertretungsberechtigter' => 'a@b.de'], | ||||
|     ], | ||||
|     [ | ||||
|         ['keepdata' => true], ['wiederverwendenFlag' => true], | ||||
|     ], | ||||
|     [ | ||||
|         ['keepdata' => false], ['wiederverwendenFlag' => false], | ||||
|     ], | ||||
|     [['firstname' => 'Phi'], ['vorname' => 'Phi']], | ||||
|     [['lastname' => 'Phi'], ['nachname' => 'Phi']], | ||||
|     [['nickname' => 'Nick'], ['spitzname' => 'Nick']], | ||||
|     [['email' => 'a@b.de'], ['email' => 'a@b.de']], | ||||
|     [['zip' => '5566'], ['plz' => '5566']], | ||||
|     [['location' => 'SG'], ['ort' => 'SG']], | ||||
|     [['further_address' => 'SG'], ['nameZusatz' => 'SG']], | ||||
|     [['other_country' => 'SG'], ['staatsangehoerigkeitText' => 'SG']], | ||||
|     [['address' => 'Add'], ['strasse' => 'Add']], | ||||
|     [['main_phone' => '+49 212 5566234'], ['telefon1' => '+49 212 5566234']], | ||||
|     [['mobile_phone' => '+49 212 5566234'], ['telefon2' => '+49 212 5566234']], | ||||
|     [['work_phone' => '+49 212 5566234'], ['telefon3' => '+49 212 5566234']], | ||||
|     [['email_parents' => 'a@b.de'], ['emailVertretungsberechtigter' => 'a@b.de']], | ||||
|     [['keepdata' => true], ['wiederverwendenFlag' => true]], | ||||
|     [['keepdata' => false], ['wiederverwendenFlag' => false]], | ||||
|     fn () => [['joined_at' => now()], ['eintrittsdatum' => now()->format('Y-m-d') . ' 00:00:00']], | ||||
|     [['fax' => '555'], ['telefax' => '555']], | ||||
|     [[], ['konfessionId' => 567]], | ||||
|     [[], ['ersteTaetigkeitId' => 6]], | ||||
|     [[], ['ersteUntergliederungId' => 55]], | ||||
| ]); | ||||
| 
 | ||||
| it('stores related models', function () { | ||||
|     Subscription::factory()->forFee(3)->create(); | ||||
|     $member = Member::factory()->defaults() | ||||
|         ->for(Country::factory()->inNami(1)->create()) | ||||
|         ->for(Region::factory()->inNami(2)->create()) | ||||
|         ->for(Gender::factory()->inNami(4)->create()) | ||||
|         ->create(); | ||||
| 
 | ||||
|     NamiPutMemberAction::run($member, Activity::first(), Subactivity::first()); | ||||
| 
 | ||||
|     app(MemberFake::class)->assertStored(55, ['regionId' => 2, 'landId' => 1, 'beitragsartId' => 3, 'geschlechtId' => 4]); | ||||
| }); | ||||
| 
 | ||||
| it('stores bank account with empty values', function () { | ||||
|     $member = Member::factory()->defaults()->create(['mitgliedsnr' => 56]); | ||||
| 
 | ||||
|     NamiPutMemberAction::run($member, Activity::first(), Subactivity::first()); | ||||
| 
 | ||||
|     app(MemberFake::class)->assertStored(55, ['kontoverbindung' => json_encode([ | ||||
|         'id' => '', | ||||
|         'zahlungsKonditionId' => null, | ||||
|         'mitgliedsNummer' => 56, | ||||
|         'institut' => '', | ||||
|         'kontoinhaber' => '', | ||||
|         'kontonummer' => '', | ||||
|         'bankleitzahl' => '', | ||||
|         'iban' => '', | ||||
|         'bic' => '' | ||||
|     ])]); | ||||
| }); | ||||
| 
 | ||||
| it('updates existing member', function () { | ||||
|     app(MemberFake::class)->updatesSuccessfully(55, 103)->shows(55, 103); | ||||
|     $member = Member::factory()->defaults()->inNami(103)->create(['version' => 50]); | ||||
| 
 | ||||
|     NamiPutMemberAction::run($member, Activity::first(), Subactivity::first()); | ||||
| 
 | ||||
|     app(MemberFake::class)->assertUpdated(55, 103, ['id' => 103, 'version' => 50]); | ||||
| }); | ||||
| 
 | ||||
| it('updates bank account with filled values', function () { | ||||
|     app(MemberFake::class)->updatesSuccessfully(55, 103)->shows(55, 103); | ||||
|     $member = Member::factory()->defaults() | ||||
|         ->withBankAccount(BankAccount::factory()->inNami(30)->state([ | ||||
|             'bank_name' => 'Stadt', | ||||
|             'bic' => 'SOLSDE33', | ||||
|             'iban' => 'DE50', | ||||
|             'blz' => 'ssss', | ||||
|             'person' => 'Pill', | ||||
|             'account_number' => 'ddf', | ||||
|         ])) | ||||
|         ->inNami(103) | ||||
|         ->create(['mitgliedsnr' => 56]); | ||||
| 
 | ||||
|     NamiPutMemberAction::run($member, Activity::first(), Subactivity::first()); | ||||
| 
 | ||||
|     app(MemberFake::class)->assertUpdated(55, 103, ['kontoverbindung' => json_encode([ | ||||
|         'id' => 30, | ||||
|         'zahlungsKonditionId' => null, | ||||
|         'mitgliedsNummer' => 56, | ||||
|         'institut' => 'Stadt', | ||||
|         'kontoinhaber' => 'Pill', | ||||
|         'kontonummer' => 'ddf', | ||||
|         'bankleitzahl' => 'ssss', | ||||
|         'iban' => 'DE50', | ||||
|         'bic' => 'SOLSDE33' | ||||
|     ])]); | ||||
| }); | ||||
|  |  | |||
|  | @ -88,6 +88,26 @@ it('testFetchWiederverwendenFlag', function (array $memberAttributes, array $sto | |||
|     [['regionId' => 999], ['region_id' => null]] | ||||
| ]); | ||||
| 
 | ||||
| it('testFetchesKontoverbindung', function (array $memberAttributes, array $storedAttributes) { | ||||
|     $this->loginNami(); | ||||
|     Region::factory()->inNami(999)->name('nicht-de')->create(['is_null' => true]); | ||||
|     app(MemberFake::class)->shows(1000, 1001, $memberAttributes); | ||||
| 
 | ||||
|     app(PullMemberAction::class)->handle(1000, 1001); | ||||
| 
 | ||||
|     $this->assertDatabaseHas('bank_accounts', [ | ||||
|         'member_id' => Member::first()->id, | ||||
|         ...$storedAttributes | ||||
|     ]); | ||||
| })->with([ | ||||
|     [['kontoverbindung' => ['iban' => '3300', 'bic' => 'SOLSDE']], ['iban' => '3300', 'bic' => 'SOLSDE']], | ||||
|     [['kontoverbindung' => ['id' => 33003]], ['nami_id' => 33003]], | ||||
|     [['kontoverbindung' => ['blz' => 111]], ['blz' => 111]], | ||||
|     [['kontoverbindung' => ['institut' => 'Sparkasse']], ['bank_name' => 'Sparkasse']], | ||||
|     [['kontoverbindung' => ['kontoinhaber' => 'Max']], ['person' => 'Max']], | ||||
|     [['kontoverbindung' => ['kontonummer' => '333']], ['account_number' => '333']], | ||||
| ]); | ||||
| 
 | ||||
| it('testItSetsFirstSubscriptionFromFee', function () { | ||||
|     $this->loginNami(); | ||||
|     Region::factory()->inNami(999)->name('nicht-de')->create(['is_null' => true]); | ||||
|  |  | |||
|  | @ -35,10 +35,10 @@ class InitializeGroupsTest extends TestCase | |||
|     public function testItSynchsAGroupWithASingleNodeAndNoChildren(): void | ||||
|     { | ||||
|         $parentGroup = Group::from(['id' => 150, 'name' => 'lorem', 'parentId' => null]); | ||||
|         $this->api->method('groups')->will($this->returnValueMap([ | ||||
|         $this->api->method('groups')->willReturnMap([ | ||||
|             [null, collect([$parentGroup])], | ||||
|             [$parentGroup, collect([])], | ||||
|         ])); | ||||
|         ]); | ||||
|         $this->api->method('groups')->willReturn(collect([])); | ||||
| 
 | ||||
|         (new InitializeGroups($this->api))->handle(); | ||||
|  | @ -55,10 +55,10 @@ class InitializeGroupsTest extends TestCase | |||
|     { | ||||
|         $existingGroup = GroupModel::factory()->create(['nami_id' => 150, 'inner_name' => 'Def']); | ||||
|         $parentGroup = Group::from(['id' => 150, 'name' => 'lorem', 'parentId' => null]); | ||||
|         $this->api->method('groups')->will($this->returnValueMap([ | ||||
|         $this->api->method('groups')->willReturnMap([ | ||||
|             [null, collect([$parentGroup])], | ||||
|             [$parentGroup, collect([])], | ||||
|         ])); | ||||
|         ]); | ||||
| 
 | ||||
|         (new InitializeGroups($this->api))->handle(); | ||||
| 
 | ||||
|  | @ -75,11 +75,11 @@ class InitializeGroupsTest extends TestCase | |||
|     { | ||||
|         $parentGroup = Group::from(['id' => 150, 'name' => 'lorem', 'parentId' => null]); | ||||
|         $subgroup = Group::from(['id' => 200, 'name' => 'subgroup', 'parentId' => 150]); | ||||
|         $this->api->method('groups')->will($this->returnValueMap([ | ||||
|         $this->api->method('groups')->willReturnMap([ | ||||
|             [null, collect([$parentGroup])], | ||||
|             [$parentGroup, collect([$subgroup])], | ||||
|             [$subgroup, collect([])], | ||||
|         ])); | ||||
|         ]); | ||||
| 
 | ||||
|         (new InitializeGroups($this->api))->handle(); | ||||
| 
 | ||||
|  | @ -94,12 +94,12 @@ class InitializeGroupsTest extends TestCase | |||
|         $parentGroup = Group::from(['id' => 150, 'name' => 'lorem', 'parentId' => null]); | ||||
|         $subgroup = Group::from(['id' => 200, 'name' => 'subgroup', 'parentId' => 150]); | ||||
|         $subsubgroup = Group::from(['id' => 250, 'name' => 'subsubgroup', 'parentId' => 200]); | ||||
|         $this->api->method('groups')->will($this->returnValueMap([ | ||||
|         $this->api->method('groups')->willReturnMap([ | ||||
|             [null, collect([$parentGroup])], | ||||
|             [$parentGroup, collect([$subgroup])], | ||||
|             [$subgroup, collect([$subsubgroup])], | ||||
|             [$subsubgroup, collect([])], | ||||
|         ])); | ||||
|         ]); | ||||
| 
 | ||||
|         (new InitializeGroups($this->api))->handle(); | ||||
| 
 | ||||
|  | @ -111,11 +111,11 @@ class InitializeGroupsTest extends TestCase | |||
|         $existingSubgroup = GroupModel::factory()->create(['name' => 'Abc', 'inner_name' => 'Def', 'nami_id' => 200]); | ||||
|         $parentGroup = Group::from(['id' => 150, 'name' => 'root', 'parentId' => null]); | ||||
|         $subgroup = Group::from(['id' => 200, 'name' => 'child', 'parentId' => 150]); | ||||
|         $this->api->method('groups')->will($this->returnValueMap([ | ||||
|         $this->api->method('groups')->willReturnMap([ | ||||
|             [null, collect([$parentGroup])], | ||||
|             [$parentGroup, collect([$subgroup])], | ||||
|             [$subgroup, collect([])], | ||||
|         ])); | ||||
|         ]); | ||||
| 
 | ||||
|         (new InitializeGroups($this->api))->handle(); | ||||
| 
 | ||||
|  |  | |||
|  | @ -0,0 +1,35 @@ | |||
| <?php | ||||
| 
 | ||||
| namespace Illuminate\Contracts\Database\Eloquent; | ||||
| 
 | ||||
| use Illuminate\Database\Eloquent\Model; | ||||
| 
 | ||||
| /** | ||||
|  * @template TGet | ||||
|  * @template TSet | ||||
|  * @copy | ||||
|  */ | ||||
| interface CastsAttributes | ||||
| { | ||||
|     /** | ||||
|      * Transform the attribute from the underlying model values. | ||||
|      * | ||||
|      * @param  \Illuminate\Database\Eloquent\Model  $model | ||||
|      * @param  string  $key | ||||
|      * @param  mixed  $value | ||||
|      * @param  array<string, mixed>  $attributes | ||||
|      * @return TGet|null | ||||
|      */ | ||||
|     public function get(Model $model, string $key, mixed $value, array $attributes); | ||||
| 
 | ||||
|     /** | ||||
|      * Transform the attribute to its underlying model values. | ||||
|      * | ||||
|      * @param  \Illuminate\Database\Eloquent\Model  $model | ||||
|      * @param  string  $key | ||||
|      * @param  TSet|null  $value | ||||
|      * @param  array<string, mixed>  $attributes | ||||
|      * @return mixed | ||||
|      */ | ||||
|     public function set(Model $model, string $key, mixed $value, array $attributes); | ||||
| } | ||||
|  | @ -0,0 +1,13 @@ | |||
| <?php | ||||
| 
 | ||||
| namespace Spatie\LaravelData\Support\EloquentCasts; | ||||
| 
 | ||||
| use Illuminate\Contracts\Database\Eloquent\CastsAttributes; | ||||
| 
 | ||||
| /** | ||||
|  * @template TDto | ||||
|  * @implements CastsAttributes<TDto, TDto> | ||||
|  */ | ||||
| class DataEloquentCast implements CastsAttributes | ||||
| { | ||||
| } | ||||
|  | @ -0,0 +1,11 @@ | |||
| <?php | ||||
| 
 | ||||
| namespace Symfony\Component\HttpFoundation\File; | ||||
| 
 | ||||
| /** | ||||
|  * @copy | ||||
|  */ | ||||
| class File | ||||
| { | ||||
| 
 | ||||
| } | ||||
		Loading…
	
		Reference in New Issue