Skip to content

Fix register_patron subject length validation and postal_code mapping in updatePatron - #181

Merged
john-c-houser merged 2 commits into
devfrom
fix/register-patron-postal-code
Jul 23, 2026
Merged

Fix register_patron subject length validation and postal_code mapping in updatePatron#181
john-c-houser merged 2 commits into
devfrom
fix/register-patron-postal-code

Conversation

@john-c-houser

Copy link
Copy Markdown
Collaborator

Description

Fixes two main issues identified in patron registration and update flows:

  1. Subject Length Validation Bug: Increased the email subject validation rule in Libilsws::registerPatron from s:20 to s:128 to allow standard registration email subjects like 'Welcome to our library!'.
  2. Zip Code Validation & Preservation:
    • Fixed typo 97032r97034 -> 97032|97034 in libilsws.yaml.sample.
    • Updated Libilsws::checkAliases to fallback-map zip -> ZIP and city/state -> CITY/STATE. This prevents updatePatron() from omitting address fields and erasing the Zip Code when updating a record retrieved via getPatronAttributes().
    • Added ONLINE profile to overlay_fields.profile.validation in libilsws.yaml.sample.

Verification

  • Unit tests updated and all 57 tests passing (./vendor/bin/phpunit).
  • End-to-end integration test executed against SirsiDynix API: registered 'Bogus Bogart', updated category02 to TEXT via updatePatron(), and verified all fields including zip remain preserved.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes issues in patron registration/update flows by loosening email subject validation and ensuring ZIP + city/state fields are preserved/mapped correctly when updating patrons using data sourced from getPatronAttributes().

Changes:

  • Increased registerPatron() email subject length validation from s:20 to s:128.
  • Enhanced checkAliases() to fallback-map zip/postal_codeZIP and city+state/city_stateCITY/STATE.
  • Updated sample YAML to fix a ZIP validation typo and to allow the ONLINE profile; updated unit test to assert ZIP mapping.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/Libilsws.php Adjusts subject validation limit and adds ZIP/CITY/STATE fallback alias mapping to prevent address data loss during updates.
tests/Unit/LibilswsTest.php Extends getPatronAttributes() unit test coverage to assert ZIP is extracted into zip.
libilsws.yaml.sample Fixes ZIP validation typo (97032r97034 → `97032
legacy_tests/register_patron.php Expands legacy script to fetch and print patron attributes after registration.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/Libilsws.php
Comment on lines +1960 to +1974
if (empty($patron['ZIP'])) {
if (isset($patron['zip'])) {
$patron['ZIP'] = $patron['zip'];
} elseif (isset($patron['postal_code'])) {
$patron['ZIP'] = $patron['postal_code'];
}
}

if (empty($patron['CITY/STATE'])) {
if (isset($patron['city_state'])) {
$patron['CITY/STATE'] = $patron['city_state'];
} elseif (isset($patron['city']) && isset($patron['state'])) {
$patron['CITY/STATE'] = $patron['city'] . ', ' . $patron['state'];
}
}
@john-c-houser
john-c-houser merged commit 26d1da8 into dev Jul 23, 2026
4 checks passed
@john-c-houser
john-c-houser deleted the fix/register-patron-postal-code branch July 23, 2026 23:56
john-c-houser added a commit that referenced this pull request Jul 23, 2026
… in updatePatron (#181) (#182)

* Fix register_patron subject length validation and postal_code mapping in updatePatron

* Add unit test for updatePatron address mapping and fix sample config rules
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants