diff --git a/code/web/Drivers/Sierra.php b/code/web/Drivers/Sierra.php index 030141eef2..c69595703d 100644 --- a/code/web/Drivers/Sierra.php +++ b/code/web/Drivers/Sierra.php @@ -1467,6 +1467,18 @@ public function updatePatronInfo($patron, $canUpdateContactInfo, $fromMasquerade $params['phones'][] = $tmpPhone; } } + if ($library->allowPatronWorkPhoneNumberUpdates) { + if (!array_key_exists('phones', $params)) { + $params['phones'] = []; + } + if (isset($_REQUEST['workPhone'])) { + $patron->_workPhone = $_REQUEST['workPhone']; + $tmpPhone = new stdClass(); + $tmpPhone->type = 't'; + $tmpPhone->number = $_REQUEST['workPhone']; + $params['phones'][] = $tmpPhone; + } + } if ($library->allowPatronAddressUpdates) { $params['addresses'] = []; $address = new stdClass(); @@ -1676,9 +1688,12 @@ private function loadContactInformationFromApiResult(User $user, stdClass $patro } } if (!empty($patronInfo->phones)) { - $primaryPhone = reset($patronInfo->phones); - if (!empty($primaryPhone)) { - $user->phone = $primaryPhone->number; + foreach ($patronInfo->phones as $phoneInfo) { + if ($phoneInfo->type == 'p') { + $user->phone = $phoneInfo->number; + }elseif ($phoneInfo->type == 't') { + $user->_workPhone = $phoneInfo->number; + } } } if (!empty($patronInfo->emails)) { diff --git a/code/web/interface/themes/responsive/MyAccount/contactInformation.tpl b/code/web/interface/themes/responsive/MyAccount/contactInformation.tpl index c1580f8af0..4324caa48f 100644 --- a/code/web/interface/themes/responsive/MyAccount/contactInformation.tpl +++ b/code/web/interface/themes/responsive/MyAccount/contactInformation.tpl @@ -118,7 +118,7 @@ {if !empty($showWorkPhoneInProfile)}
-
{if !empty($edit) && $canUpdateContactInfo && $canUpdatePhoneNumber && !$isHorizon}{else}{$profile->workPhone|escape}{/if}
+
{if !empty($edit) && $canUpdateContactInfo && $canUpdateWorkPhoneNumber && !$isHorizon}{else}{$profile->_workPhone|escape}{/if}
{/if} {/if} diff --git a/code/web/release_notes/24.05.10.MD b/code/web/release_notes/24.05.10.MD index f0ba3da317..7ac53f6605 100644 --- a/code/web/release_notes/24.05.10.MD +++ b/code/web/release_notes/24.05.10.MD @@ -3,6 +3,21 @@ - Update extracting records from Evolve to extract individual MARC records rather than updating individual items. (Ticket 125328) (*MDN*) - When processing records to reload, force the record to be updated from Evolve during the indexing process. (Ticket 125328) (*MDN*) +### Sierra Updates +- When loading phone numbers, load the primary phone number from the phone number with a type of p. (Ticket 126596) (*MDN*) +- When loading phone numbers, load the "work" phone number from the phone number with a type of t. (Ticket 126596) (*MDN*) +- Update phone numbers appropriately based on primary and work phone numbers in Contact Information. (Ticket 126596) (*MDN*) +- When using the "Pickup at" setting within the Format Map, properly load available locations when the location code is not the entire location code of the item. (Tickets 128864, 130706) (*MDN*) + +### User Account Updates +- Allow work phone to be updated independently of the main phone number. + +
+ +#### New Settings +- Library Systems > ILS/Account Integration > User Profile > Allow Patrons to Update Their Work Phone Number +
+ ## This release includes code contributions from - ByWater Solutions - Mark Noble (MDN) diff --git a/code/web/services/MyAccount/ContactInformation.php b/code/web/services/MyAccount/ContactInformation.php index cdd1d06fac..7aeda3a1e5 100644 --- a/code/web/services/MyAccount/ContactInformation.php +++ b/code/web/services/MyAccount/ContactInformation.php @@ -25,6 +25,7 @@ function launch() { $canUpdateAddress = false; $canUpdatePhoneNumber = false; $showWorkPhoneInProfile = false; + $canUpdateWorkPhoneNumber = false; $showNoticeTypeInProfile = false; $allowPinReset = false; $showAlternateLibraryOptionsInProfile = false; @@ -35,6 +36,7 @@ function launch() { $canUpdateAddress = ($patronHomeLibrary->allowPatronAddressUpdates == 1); $canUpdatePhoneNumber = ($patronHomeLibrary->allowPatronPhoneNumberUpdates == 1); $showWorkPhoneInProfile = ($patronHomeLibrary->showWorkPhoneInProfile == 1); + $canUpdateWorkPhoneNumber = ($patronHomeLibrary->allowPatronWorkPhoneNumberUpdates == 1); $showNoticeTypeInProfile = ($patronHomeLibrary->showNoticeTypeInProfile == 1); $allowPinReset = ($patronHomeLibrary->allowPinReset == 1); $showAlternateLibraryOptionsInProfile = ($patronHomeLibrary->showAlternateLibraryOptionsInProfile == 1); @@ -49,6 +51,7 @@ function launch() { $interface->assign('canUpdateContactInfo', $canUpdateContactInfo); $interface->assign('canUpdateAddress', $canUpdateAddress); $interface->assign('canUpdatePhoneNumber', $canUpdatePhoneNumber); + $interface->assign('canUpdateWorkPhoneNumber', $canUpdateWorkPhoneNumber); $interface->assign('showWorkPhoneInProfile', $showWorkPhoneInProfile); $interface->assign('showNoticeTypeInProfile', $showNoticeTypeInProfile); $interface->assign('allowPinReset', $allowPinReset); diff --git a/code/web/sys/DBMaintenance/version_updates/24.05.10.php b/code/web/sys/DBMaintenance/version_updates/24.05.10.php new file mode 100644 index 0000000000..83c93794e1 --- /dev/null +++ b/code/web/sys/DBMaintenance/version_updates/24.05.10.php @@ -0,0 +1,24 @@ + [ + 'title' => '', + 'description' => '', + 'continueOnError' => false, + 'sql' => [ + '' + ] + ], //name*/ + + 'library_add_can_update_work_phone_number' => [ + 'title' => 'Library Add Can Update Work Phone Number', + 'description' => 'Allow control over if a library can update their work phone number', + 'continueOnError' => true, + 'sql' => [ + "ALTER TABLE library ADD allowPatronWorkPhoneNumberUpdates TINYINT(1) DEFAULT 1", + "UPDATE library set allowPatronWorkPhoneNumberUpdates = showWorkPhoneInProfile", + ], + ], + ]; +} \ No newline at end of file diff --git a/code/web/sys/LibraryLocation/Library.php b/code/web/sys/LibraryLocation/Library.php index 8588eb122c..c542c444e7 100644 --- a/code/web/sys/LibraryLocation/Library.php +++ b/code/web/sys/LibraryLocation/Library.php @@ -237,6 +237,7 @@ class Library extends DataObject { public $useAllCapsWhenUpdatingProfile; public $requireNumericPhoneNumbersWhenUpdatingProfile; public $bypassReviewQueueWhenUpdatingProfile; + public $allowPatronWorkPhoneNumberUpdates; public $showWorkPhoneInProfile; public $showNoticeTypeInProfile; public $allowPickupLocationUpdates; @@ -1838,11 +1839,23 @@ static function getObjectStructure($context = ''): array { 'property' => 'showWorkPhoneInProfile', 'type' => 'checkbox', 'label' => 'Show Work Phone in Profile', + 'note' => 'Applies to CARL.X, Sierra, and Symphony Only', 'description' => 'Whether or not patrons should be able to change a secondary or work phone number in their profile.', 'hideInLists' => true, 'default' => 0, 'permissions' => ['Library ILS Connection'], ], + 'allowPatronWorkPhoneNumberUpdates' => [ + 'property' => 'allowPatronWorkPhoneNumberUpdates', + 'type' => 'checkbox', + 'label' => 'Allow Patrons to Update Their Work Phone Number', + 'note' => 'Applies to CARL.X, Sierra, and Symphony Only', + 'description' => 'Whether or not patrons should be able to update their own work phone number in their profile.', + 'hideInLists' => true, + 'default' => 1, + 'readOnly' => false, + 'permissions' => ['Library ILS Connection'], + ], 'showNoticeTypeInProfile' => [ 'property' => 'showNoticeTypeInProfile', 'type' => 'checkbox', @@ -3724,11 +3737,11 @@ static function getObjectStructure($context = ''): array { ], ], ], - - - - + + + + 'casSection' => [ 'property' => 'casSection', 'type' => 'section',