https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43518

--- Comment #3 from Martin Renvoize (ashimema) 
<[email protected]> ---
Created attachment 205591
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=205591&action=edit
Bug 43518: (follow-up) Close PatronAutoComplete parity gaps in PatronSelect

Add vue/utils/patron-options.js: pure, framework-free helpers that give
PatronSelect the same display fidelity as the legacy
$patron_to_html()/patron_autocomplete() pair it's meant to eventually
replace, without depending on either:

- formatPatronName() replicates $patron_to_html()'s name-assembly
  rules (preferred_name/firstname, title-free by parity with the
  actual legacy behaviour, middle_name, other_name, showDiffFirstname,
  invertName, hidePatronName, displayCardnumber, and the no-name
  fallback for restricted-view patrons), returning plain text instead
  of an HTML string.
- patronToOption() builds a full PatronSelect option from a raw patron
  API record: label, age, library name, expired/restricted flags, a
  current-library flag, and a plain city/country summary.
- resolvePatronOption() resolves either a bare patron id (fetching and
  mapping it) or an already-embedded patron record (mapping only, no
  fetch) to the same option shape - closing an asymmetry found in the
  booking store's openForEdit(), which skips the mapper entirely when
  a patron object is already supplied.

Extend PatronSelect.vue's option row with Expired/Restricted badges
and a current-library indicator (parity with patron_autocomplete's
_renderItem()) and a city/country line (deliberately simplified from
the legacy address formatter, which is template-generated and
locale/authorised-value-aware).

Out of scope, tracked as follow-up ideas rather than done here:
bridging $patron_to_html() to reuse formatPatronName() (blocked by
patron-format.js being a plain, unbundled script outside the rspack
pipeline), and full locale-aware address formatting.

Test plan:
1. Run: yarn cypress run --component --browser electron --spec
  
't/cypress/component/patronOptions_spec.ts,t/cypress/component/PatronSelect_spec.ts'
2. Verify all specs pass.

Assisted-by: Sonnet 5 (Anthropic)

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to