Skip to content

VGBC Fase 2 - Sessie Verslag

Datum: 2025-12-16 Status: Fase 2 basis voltooid, kritieke issues gevonden


βœ… Bereikt Vandaag

1. Conditional Fields - Beroep Velden

Probleem: field_beroep_anders en field_student_instelling stonden altijd zichtbaar en verplicht Oplossing: - field_beroep_anders: required=false in field config - Conditional Fields regels opnieuw ingesteld: - Target: field_beroep_anders, Controlled by: field_beroep, Value="anders" - Target: field_student_instelling, Controlled by: field_beroep, Value="student" - Reset target: AAN - Insert value: UIT Status: βœ… WERKT

2. Studentenkorting 40%

Probleem: Promotie werkte niet omdat: - StudentProfessionCondition zocht alleen in "customer" profile - Gebruikers hebben field_beroep in "openbaar" profile Oplossing: - Code aangepast om ALLE user profiles te checken (customer + openbaar) - Loop door alle profiles, return TRUE bij eerste match met "student" Code: /web/modules/custom/vg_commerce/src/Plugin/Commerce/Condition/StudentProfessionCondition.php Status: βœ… WERKT - 40% korting wordt toegepast

3. VGBC Tickets in Winkel

Bereikt: - VGBC 2026 editie (ECK entity vgbc, ID 33) - field_vgbc_editie op vgbc_ticket variations - Beide tickets gekoppeld aan editie 33 - Vignet geΓΌpload en zichtbaar - View winkel_tickets toont tickets met vignet - field_partner toegevoegd aan customer profile (Field Permissions: custom) Status: βœ… Tickets zichtbaar in winkel met vignet

4. VGBC Editie ↔ Ticket Referentie

Bereikt: - View "vgbc_editie_producten" aangemaakt - Contextual filter op vgbc editie ID - Block toegevoegd aan vgbc_editie display (Layout Builder) - Toont automatisch gekoppelde tickets per editie Status: βœ… Twee-weg referentie werkt

5. User Account Pagina

Bereikt: - View blocks aangemaakt: "Mijn bestellingen" en "Mijn facturen" - Contextual filter: Gebruiker-ID van route-context - Privacy: users zien alleen eigen bestellingen/facturen - Toegevoegd aan user profile via Layout Builder Status: βœ… Werkt, PDF links nog toe te voegen


πŸ”΄ KRITIEKE ISSUES

1. Mollie Checkout - Database Lock Timeouts

Probleem: - Lock wait timeout op commerce_number_pattern_sequence tabel - Webhook en return page racen om order te updaten - Orders blijven hangen in "validation" state - Users worden uitgelogd na checkout - Foutmeldingen: "SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded"

Impact: - 🚨 HOOG - Users krijgen errors bij checkout - Ongeruste users β†’ veel support telefoontjes - Orders worden niet automatisch voltooid - Facturen worden niet gegenereerd

Huidige situatie: - Patch voor duplicate invoices is geΓ―nstalleerd (commerce_mollie) - Lock timeout: 50 seconden (innodb_lock_wait_timeout) - Probleem blijft bestaan

Mogelijke oplossingen (TO DO): 1. Webhook vs Return race condition: - Mollie webhook en return page updaten order tegelijk - Oplossing: Debounce/queue mechanisme - Of: Skip webhook bij test payments

  1. Number pattern locking:
  2. commerce_number_pattern_sequence genereert order/invoice numbers met FOR UPDATE lock
  3. Oplossing: Pre-generate numbers
  4. Of: Gebruik UUID voor order numbers

  5. Session timeout:

  6. Lange wachttijd β†’ session expires β†’ user uitgelogd
  7. Oplossing: Verhoog session timeout voor checkout
  8. Of: Return page re-authenticates user

  9. UX verbetering:

  10. Betere loading state tijdens Mollie return
  11. "Uw betaling wordt verwerkt" scherm
  12. Automatische retry bij timeout
  13. Email bevestiging als fallback

Prioriteit: πŸ”₯ KRITIEK voor productie

Next steps: - Notities doorzoeken voor eerdere oplossingen - commerce-setup-overzicht.md: duplicate invoice fix - 20251121-checkout-ux-duplicate-invoices.md: UX improvements


πŸ“ Kleinere Issues

2. Invoice Detail Page - SDC Error

Probleem: /user/{uid}/invoices/{id} geeft component error Foutmelding: InvalidComponentDataException: Unable to render component "navigation:title" Oorzaak: Drupal 11 SDC (Single Directory Components) + Gin toolbar conflict Status: Bekend issue, eerder in notities behandeld Workaround: Link niet naar detail pagina, gebruik PDF download direct Prioriteit: Laag (PDF download is voldoende)

3. Facturennummering

Observatie: Facturen starten bij ID 30, geen oudere facturen in dev database Oorzaak: Dev database refresh of cleanup Impact: Geen - voor productie wordt fresh start gemaakt Actie: Geen, documenteren dat dit normaal is voor dev


🎯 Fase 2 Status

VOLTOOID: - βœ… ECK entities (vgbc_partner_quota, vgbc_editie) - βœ… Custom plugins (StudentProfessionCondition, StandhouderQuotaValidator) - βœ… Product setup (2 tickets, variation type vgbc_ticket) - βœ… Promotie (40% studentenkorting) - βœ… field_partner op customer profile - βœ… Views (winkel_tickets, user orders, user invoices) - βœ… VGBC editie ↔ ticket referentie - βœ… Conditional fields (beroep, student, anders) - βœ… Config export

OPEN: - ❌ Mollie checkout stabiliteit (KRITIEK) - ⏳ PDF links in facturen view (simpel, via UI) - ⏳ Testing met echte users - ⏳ Standhouder quota testen


πŸ“‹ Voor Volgende Sessie

Prioriteit 1: Mollie Checkout Fix

  1. Notities doorzoeken voor eerdere oplossingen
  2. Test scenario's reproduceren
  3. Webhook/return race condition oplossen
  4. Session management tijdens checkout
  5. UX improvements (loading states, error handling)

Prioriteit 2: Fase 2 Afronden

  1. PDF download links toevoegen aan facturen view
  2. Standhouder quota flow testen
  3. Test checkout met verschillende scenarios
  4. Documentatie updaten

Prioriteit 3: Fase 3 Voorbereiden

  • Multi-ticket checkout (Jan koopt voor Marie)
  • TicketAssignmentPane checkout pane
  • Per-attendee kortingen
  • User/profile creatie voor "iemand anders"

πŸ”§ Technische Notities

Code Changes Today

  1. StudentProfessionCondition.php
  2. Van: check alleen customer profile
  3. Naar: loop door alle profiles (customer + openbaar)

  4. field_beroep_anders

  5. required: false (was: true)

  6. Views contextual filters

  7. commerce_user_orders: user ID from route context
  8. commerce_user_invoices: user ID from route context

Config Export

ddrush cex -y
GeΓ«xporteerd: - field.field.profile.customer.field_partner - field.storage.commerce_product_variation.field_vgbc_editie - views.view.commerce_user_orders (block display) - views.view.commerce_user_invoices (block display) - views.view.vgbc_editie_producten (new) - Conditional fields config (via UI)


πŸ’‘ Geleerde Lessen

  1. Profile types verwarrend: field_beroep zit in "openbaar" profile, niet "customer" β†’ code moet beide checken
  2. Conditional Fields alpha: Stabiel maar config kan verdwijnen β†’ altijd backup/export
  3. Commerce checkout fragiel: Lock timeouts en race conditions zijn reΓ«el probleem
  4. Views contextual filters: "User ID from route context" is essentieel voor privacy
  5. Field Permissions: Custom permissions nodig voor field_partner (alleen admin/redactie/winkel)

Sessie duur: ~4 uur Lines of code: ~50 (aangepast) Config changes: ~15 entities Coffee cups: β˜•β˜•β˜•


UPDATE: Patch Situatie (na middag sessie)

Geprobeerd: Beide Drupal.org patches toevoegen

Core patch: Issue #3505182 - Navigation:title component crasht met NULL label
Commerce Invoice patch: Issue #3532643 - Label fallback voor draft invoices

Probleem ontdekt

Beide patches zijn voor development branches (11.x-dev, 2.x-dev), niet stable releases: - https://git.drupalcode.org/project/drupal/-/merge_requests/10235.diff β†’ voor 11.x-dev - https://git.drupalcode.org/project/commerce_invoice/-/merge_requests/11.diff β†’ voor 2.x-dev

Onze installatie: - Drupal core: 11.2.10 (stable) - Commerce Invoice: 2.2.0 (stable)

Result: Patches passen niet, composer error: "No available patcher was able to apply patch"

Oplossing: Workaround zonder patches βœ…

Root cause van beide bugs: 1. Commerce Invoice heeft geen label voor draft/validation invoices (invoice_number is nog NULL) 2. Core Navigation component crasht als entity->label() NULL retourneert 3. Dit gebeurt alleen op de factuur detailpagina (/user/{uid}/invoices/{id})

Workaround: - Link niet naar detailpagina, maar direct naar PDF download - View commerce_user_invoices aangepast: - Row style: Fields (was: Rendered entity) - Velden: factuurnummer, bedrag, status, PDF download - PDF link: /print/pdf/commerce_invoice/{invoice_id} (Entity Print module) - Target: _blank (opent in nieuwe tab)

Voordelen: - βœ… Geen SDC/Navigation bug (detailpagina wordt niet bezocht) - βœ… Direct PDF download (betere UX) - βœ… Geen patches nodig - βœ… Werkt met stable releases

Voor productie: - Als Drupal 11.3.0 of 12.0.0 uitkomt met fix in core β†’ upgrade - Als Commerce Invoice 2.3.0 uitkomt met label fallback β†’ upgrade - Tot die tijd: workaround is solide en production-ready

Composer Patches Status

Actieve patches:

{
  "drupal/commerce_invoice": {
    "Fix file validator for Drupal 10+": "patches/commerce_invoice-file_validator_drupal10.patch"
  }
}

Alleen lokale patch voor file validator (werkt wel, is voor Drupal 10+ compatibility).

MR patches verwijderd uit composer.json (pasten niet op stable releases).

Conclusie

Patches zijn niet nodig voor productie. Workaround met PDF download is de beste oplossing tot de fixes in stable releases zitten.