From 4ab451f3dad3f2135227123a7634a334e0c4f863 Mon Sep 17 00:00:00 2001 From: lizrea <51385152+lizrea@users.noreply.github.com> Date: Fri, 2 Aug 2024 16:27:33 -0500 Subject: [PATCH 01/82] Change order of permission changes for debian Logs directory was getting wrong ownership, moving the logs directory ownership command to after the permission changes for the parent should fix it to test: run updateSitePermissions.sh , observe that the permissions for var/log/aspen-discovery//logs are www-data:aspen_apache apply this patch run updateSitePermissions.sh , observer that the permissions for /var/log/aspen-dsicovery//logs are now aspen:aspen --- install/updateSitePermissions_debian.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install/updateSitePermissions_debian.sh b/install/updateSitePermissions_debian.sh index 8176e657fb..ab99f5c61b 100755 --- a/install/updateSitePermissions_debian.sh +++ b/install/updateSitePermissions_debian.sh @@ -55,8 +55,8 @@ chown -R www-data:aspen_apache /usr/local/aspen-discovery/tmp echo "Updating /var/log directory" chmod -R 755 /var/log/aspen-discovery/$1 chmod -R 755 /var/log/aspen-discovery/$1/logs -chown -R aspen:aspen /var/log/aspen-discovery/$1/logs chown www-data:aspen_apache /var/log/aspen-discovery/$1/* +chown -R aspen:aspen /var/log/aspen-discovery/$1/logs echo "Updating sideload permissions" -php /usr/local/aspen-discovery/install/updateAllSideloadPermissions.php $1 debian \ No newline at end of file +php /usr/local/aspen-discovery/install/updateAllSideloadPermissions.php $1 debian From 91f9e8de59cd4e44ba55d8276d6fffa815ec4c72 Mon Sep 17 00:00:00 2001 From: Kodi Date: Tue, 6 Aug 2024 13:11:51 -0700 Subject: [PATCH 02/82] Sierra Self Reg Functionality for custom self registration forms and ILS-based self registration via Sierra APIs for Sierra libraries Added TOS functionality for CarlX self registration via ILS Added release notes & DB updates --- code/web/Drivers/Sierra.php | 276 +++++++++++++++++- code/web/Drivers/SirsiDynixROA.php | 33 ++- code/web/release_notes/24.08.10.MD | 10 + .../services/ILS/SelfRegistrationForms.php | 7 + code/web/services/MyAccount/SelfReg.php | 2 +- code/web/sys/Account/User.php | 2 +- .../version_updates/24.08.10.php | 43 +++ .../CarlXSelfRegistrationForm.php | 17 +- .../SelfRegistrationForm.php | 2 +- .../SelfRegistrationFormValues.php | 120 +++++--- .../SelfRegistrationTerms.php | 4 +- .../SierraSelfRegistrationForm.php | 209 +++++++++++++ 12 files changed, 653 insertions(+), 72 deletions(-) create mode 100644 code/web/release_notes/24.08.10.MD create mode 100644 code/web/sys/DBMaintenance/version_updates/24.08.10.php create mode 100644 code/web/sys/SelfRegistrationForms/SierraSelfRegistrationForm.php diff --git a/code/web/Drivers/Sierra.php b/code/web/Drivers/Sierra.php index 2b783cd98a..fff5d05064 100644 --- a/code/web/Drivers/Sierra.php +++ b/code/web/Drivers/Sierra.php @@ -1519,14 +1519,282 @@ public function updatePatronInfo($patron, $canUpdateContactInfo, $fromMasquerade return $result; } + public function getSelfRegistrationTerms() { + global $library; + + if (!empty($library->selfRegistrationFormId)) { + require_once ROOT_DIR . '/sys/SelfRegistrationForms/SierraSelfRegistrationForm.php'; + $selfRegistrationForm = new SierraSelfRegistrationForm(); + $selfRegistrationForm->id = $library->selfRegistrationFormId; + if ($selfRegistrationForm->find(true)) { + $tosId = $selfRegistrationForm->termsOfServiceSetting; + require_once ROOT_DIR . '/sys/SelfRegistrationForms/SelfRegistrationTerms.php'; + $tos = new SelfRegistrationTerms(); + $tos->id = $tosId; + if ($tosId != -1){ + if ($tos->find(true)) { + return $tos; + } + } + } + return null; + } + return null; + } + public function getSelfRegistrationFields() { - return parent::getSelfRegistrationFields(); - // TODO: Use Sierra APIs to get Self Registration fields + global $library; + + $pickupLocations = []; + $location = new Location(); + //0 = no restrictions (ignore location setting) + if ($library->selfRegistrationLocationRestrictions == 1) { + //All Library Locations (ignore location setting) + $location->libraryId = $library->libraryId; + } elseif ($library->selfRegistrationLocationRestrictions == 2) { + //Valid pickup locations + $location->whereAdd('validSelfRegistrationBranch <> 2'); + $location->orderBy('isMainBranch DESC, displayName'); + } elseif ($library->selfRegistrationLocationRestrictions == 3) { + //Valid pickup locations + $location->libraryId = $library->libraryId; + $location->whereAdd('validSelfRegistrationBranch <> 2'); + $location->orderBy('isMainBranch DESC, displayName'); + } + if ($location->find()) { + while ($location->fetch()) { + $pickupLocations[$location->code] = $location->displayName; + } + if (count($pickupLocations) > 1) { + array_unshift($pickupLocations, translate([ + 'text' => 'Please select a location', + 'isPublicFacing' => true, + ])); + } + } + + global $library; + $hasCustomSelfRegistrationFrom = false; + + if (!empty($library->selfRegistrationFormId)) { + require_once ROOT_DIR . '/sys/SelfRegistrationForms/SierraSelfRegistrationForm.php'; + $selfRegistrationForm = new SierraSelfRegistrationForm(); + $selfRegistrationForm->id = $library->selfRegistrationFormId; + if ($selfRegistrationForm->find(true)) { + $customFields = $selfRegistrationForm->getFields(); + if ($customFields != null && count($customFields) > 0) { + $hasCustomSelfRegistrationFrom = true; + } + } + } + + $pickupLocationField = [ + 'property' => 'pickupLocation', + 'type' => 'enum', + 'label' => 'Home Library', + 'description' => 'Please choose the Library location you would prefer to use', + 'values' => $pickupLocations, + 'required' => true, + ]; + + $fields = []; + if ($hasCustomSelfRegistrationFrom) { + $hiddenDefault = false; + $fields['librarySection'] = [ + 'property' => 'librarySection', + 'type' => 'section', + 'label' => 'Library', + 'hideInLists' => true, + 'expandByDefault' => true, + 'properties' => [], + ]; + $fields['identitySection'] = [ + 'property' => 'identitySection', + 'type' => 'section', + 'label' => 'Identity', + 'hideInLists' => true, + 'expandByDefault' => true, + 'properties' => [], + ]; + $fields['mainAddressSection'] = [ + 'property' => 'mainAddressSection', + 'type' => 'section', + 'label' => 'Main Address', + 'hideInLists' => true, + 'expandByDefault' => true, + 'properties' => [], + ]; + $fields['contactInformationSection'] = [ + 'property' => 'contactInformationSection', + 'type' => 'section', + 'label' => 'Contact Information', + 'hideInLists' => true, + 'expandByDefault' => true, + 'properties' => [], + ]; + //Use self registration fields + /** @var SelfRegistrationFormValues $customField */ + foreach ($customFields as $customField) { + if ($customField->ilsName == 'library') { + if (count($pickupLocations) == 1) { + $fields['librarySection'] = [ + 'property' => 'librarySection', + 'type' => 'section', + 'label' => 'Library', + 'hideInLists' => true, + 'expandByDefault' => true, + 'properties' => [ + $customField->ilsName => $pickupLocationField, + ], + 'hiddenByDefault' => true, + ]; + } else { + $fields['librarySection'] = [ + 'property' => 'librarySection', + 'type' => 'section', + 'label' => 'Library', + 'hideInLists' => true, + 'expandByDefault' => true, + 'properties' => [ + $customField->ilsName => $pickupLocationField, + ], + ]; + } + } elseif ($customField->ilsName == 'zip' && !empty($library->validSelfRegistrationZipCodes)) { + $fields[$customField->section]['properties'][] = [ + 'property' => $customField->ilsName, + 'type' => $customField->fieldType, + 'label' => $customField->displayName, + 'required' => $customField->required, + 'note' => $customField->note, + 'validationPattern' => $library->validSelfRegistrationZipCodes, + 'validationMessage' => translate([ + 'text' => 'Please enter a valid zip code', + 'isPublicFacing' => true, + ]), + ]; + } elseif ($customField->ilsName == 'state') { + if (!empty($library->validSelfRegistrationStates)){ + $validStates = explode('|', $library->validSelfRegistrationStates); + $validStates = array_combine($validStates, $validStates); + $fields[$customField->section]['properties'][] = [ + 'property' => $customField->ilsName, + 'type' => 'enum', + 'values' => $validStates, + 'label' => $customField->displayName, + 'required' => $customField->required, + 'note' => $customField->note, + ]; + } else { + $fields[$customField->section]['properties'][] = [ + 'property' => $customField->ilsName, + 'type' => $customField->fieldType, + 'label' => $customField->displayName, + 'required' => $customField->required, + 'note' => $customField->note, + 'maxLength' => 2, + ]; + } + } else { + $fields[$customField->section]['properties'][] = [ + 'property' => $customField->ilsName, + 'type' => $customField->fieldType, + 'label' => $customField->displayName, + 'required' => $customField->required, + 'note' => $customField->note + ]; + } + } + foreach ($fields as $section) { + if ($section['type'] == 'section') { + if (empty($section['properties'])) { + unset ($fields[$section['property']]); + } + } + } + } + return $fields; } public function selfRegister(): array { - return parent::selfRegister(); - // TODO: Use Sierra APIs to self register + global $library; + $selfRegResult = [ + 'success' => false, + 'message' => 'Unknown Error while registering your account' + ]; + + $selfRegistrationForm = null; + $formFields = null; + if ($library->selfRegistrationFormId > 0){ + $selfRegistrationForm = new SierraSelfRegistrationForm(); + $selfRegistrationForm->id = $library->selfRegistrationFormId; + if ($selfRegistrationForm->find(true)) { + $formFields = $selfRegistrationForm->getFields(); + }else { + $selfRegistrationForm = null; + } + } + + $params = []; + + if ($formFields != null) { + foreach ($formFields as $fieldObj){ + $field = $fieldObj->ilsName; + if ($field == 'firstName') { + if (isset($_REQUEST['middleName'])) { + $fullName = $_REQUEST['firstName'] . ' ' . $_REQUEST['middleName'] . ' ' . $_REQUEST['lastName']; + } else { + $fullName = $_REQUEST['firstName'] . ' ' . $_REQUEST['lastName']; + } + $params['names'] = [$fullName]; + } + elseif ($field == 'birthDate') { + $params['birthDate'] = $_REQUEST['birthDate']; + } + elseif ($field == 'email') { + $params['emails'] = [$_REQUEST['email']]; + if ($selfRegistrationForm->selfRegEmailBarcode) { + $params['barcodes'] = [$_REQUEST['email']]; + } + } + elseif ($field == 'phone') { + $tmpPhone = new stdClass(); + $tmpPhone->type = 'p'; + $tmpPhone->number = $_REQUEST['phone']; + $params['phones'][] = $tmpPhone; + } + elseif ($field == 'street') { + $params['addresses'] = []; + $address = new stdClass(); + $address->lines = []; + $address->type = 'a'; + $address->lines[] = $_REQUEST['street']; + $cityStateZip = $_REQUEST['city'] . ', ' . $_REQUEST['state'] . ' ' . $_REQUEST['zip']; + $address->lines[] = $cityStateZip; + + $params['addresses'][] = $address; + } + elseif ($field == 'barcode') { + $params['barcodes'] = [$_REQUEST['barcode']]; + } + elseif ($field == 'pin') { + $params['pin'] = $_REQUEST['pin']; + } + } + } + + $sierraUrl = $this->accountProfile->vendorOpacUrl . "/iii/sierra-api/v{$this->accountProfile->apiVersion}/patrons/"; + $this->_postPage('sierra.createPatron', $sierraUrl, json_encode($params)); + + if ($this->lastResponseCode == 200) { + $selfRegResult = [ + 'success' => true, + 'barcode' => $params['barcodes'][0], + 'password' => $params['pin'] + ]; + } + + return $selfRegResult; } public function getFines($patron = null, $includeMessages = false): array { diff --git a/code/web/Drivers/SirsiDynixROA.php b/code/web/Drivers/SirsiDynixROA.php index ff962e04cf..347566e438 100644 --- a/code/web/Drivers/SirsiDynixROA.php +++ b/code/web/Drivers/SirsiDynixROA.php @@ -570,7 +570,7 @@ function selfRegister(): array { if ($formFields != null) { foreach ($formFields as $fieldObj){ - $field = $fieldObj->symphonyName; + $field = $fieldObj->ilsName; //General Info if ($field == 'firstName' && (!empty($_REQUEST['firstName'])) ) { $createPatronInfoParameters['fields']['firstName'] = $this->getPatronFieldValue(trim($_REQUEST['firstName']), $library->useAllCapsWhenSubmittingSelfRegistration); @@ -3108,6 +3108,7 @@ public function getSelfRegistrationTerms() { } return null; } + return null; } public function getSelfRegistrationFields() { global $library; @@ -3215,7 +3216,7 @@ public function getSelfRegistrationFields() { //Use self registration fields /** @var SelfRegistrationFormValues $customField */ foreach ($customFields as $customField) { - if ($customField->symphonyName == 'library') { + if ($customField->ilsName == 'library') { if (count($pickupLocations) == 1) { $fields['librarySection'] = [ 'property' => 'librarySection', @@ -3224,7 +3225,7 @@ public function getSelfRegistrationFields() { 'hideInLists' => true, 'expandByDefault' => true, 'properties' => [ - $customField->symphonyName => $pickupLocationField, + $customField->ilsName => $pickupLocationField, ], 'hiddenByDefault' => true, ]; @@ -3236,22 +3237,22 @@ public function getSelfRegistrationFields() { 'hideInLists' => true, 'expandByDefault' => true, 'properties' => [ - $customField->symphonyName => $pickupLocationField, + $customField->ilsName => $pickupLocationField, ], ]; } - } elseif (($customField->symphonyName == 'parentname' || $customField->symphonyName == 'guardian' || $customField->symphonyName == 'care_of' || $customField->symphonyName == 'careof')) { + } elseif (($customField->ilsName == 'parentname' || $customField->ilsName == 'guardian' || $customField->ilsName == 'care_of' || $customField->ilsName == 'careof')) { $fields[$customField->section]['properties'][] = [ - 'property' => $customField->symphonyName, + 'property' => $customField->ilsName, 'type' => $customField->fieldType, 'label' => $customField->displayName, 'required' => $customField->required, 'note' => $customField->note, 'hiddenByDefault' => $hiddenDefault, ]; - } elseif ($customField->symphonyName == 'cellPhone' && $selfRegistrationForm->promptForSMSNoticesInSelfReg) { + } elseif ($customField->ilsName == 'cellPhone' && $selfRegistrationForm->promptForSMSNoticesInSelfReg) { $fields[$customField->section]['properties'][] = [ - 'property' => $customField->symphonyName, + 'property' => $customField->ilsName, 'type' => $customField->fieldType, 'label' => $customField->displayName, 'required' => $customField->required, @@ -3264,9 +3265,9 @@ public function getSelfRegistrationFields() { 'label' => 'Receive notices via text', 'onchange' => 'AspenDiscovery.Account.updateSelfRegistrationFields()', ]; - } elseif ($customField->symphonyName == "email"){ + } elseif ($customField->ilsName == "email"){ $fields[$customField->section]['properties'][] = [ - 'property' => $customField->symphonyName, + 'property' => $customField->ilsName, 'type' => 'email', 'label' => $customField->displayName, 'maxLength' => 128, @@ -3282,9 +3283,9 @@ public function getSelfRegistrationFields() { 'required' => $customField->required, 'autocomplete' => false, ]; - } elseif ($customField->symphonyName == 'zip' && !empty($library->validSelfRegistrationZipCodes)) { + } elseif ($customField->ilsName == 'zip' && !empty($library->validSelfRegistrationZipCodes)) { $fields[$customField->section]['properties'][] = [ - 'property' => $customField->symphonyName, + 'property' => $customField->ilsName, 'type' => $customField->fieldType, 'label' => $customField->displayName, 'required' => $customField->required, @@ -3295,12 +3296,12 @@ public function getSelfRegistrationFields() { 'isPublicFacing' => true, ]), ]; - } elseif ($customField->symphonyName == 'state') { + } elseif ($customField->ilsName == 'state') { if (!empty($library->validSelfRegistrationStates)){ $validStates = explode('|', $library->validSelfRegistrationStates); $validStates = array_combine($validStates, $validStates); $fields[$customField->section]['properties'][] = [ - 'property' => $customField->symphonyName, + 'property' => $customField->ilsName, 'type' => 'enum', 'values' => $validStates, 'label' => $customField->displayName, @@ -3309,7 +3310,7 @@ public function getSelfRegistrationFields() { ]; } else { $fields[$customField->section]['properties'][] = [ - 'property' => $customField->symphonyName, + 'property' => $customField->ilsName, 'type' => $customField->fieldType, 'label' => $customField->displayName, 'required' => $customField->required, @@ -3319,7 +3320,7 @@ public function getSelfRegistrationFields() { } } else { $fields[$customField->section]['properties'][] = [ - 'property' => $customField->symphonyName, + 'property' => $customField->ilsName, 'type' => $customField->fieldType, 'label' => $customField->displayName, 'required' => $customField->required, diff --git a/code/web/release_notes/24.08.10.MD b/code/web/release_notes/24.08.10.MD new file mode 100644 index 0000000000..079cb7f06b --- /dev/null +++ b/code/web/release_notes/24.08.10.MD @@ -0,0 +1,10 @@ +## Aspen Discovery Updates +### Sierra Updates +- Added functionality for self registration via Sierra Patron API (*KL*) + +### CarlX Updates +- Added Terms of Service functionality to self registration forms for ILS self registration (*KL*) + +## This release includes code contributions from +- ByWater Solutions + - Kodi Lein (KL) \ No newline at end of file diff --git a/code/web/services/ILS/SelfRegistrationForms.php b/code/web/services/ILS/SelfRegistrationForms.php index 60be2bf4ca..6c471328ef 100644 --- a/code/web/services/ILS/SelfRegistrationForms.php +++ b/code/web/services/ILS/SelfRegistrationForms.php @@ -3,6 +3,7 @@ require_once ROOT_DIR . '/services/Admin/ObjectEditor.php'; require_once ROOT_DIR . '/sys/SelfRegistrationForms/SelfRegistrationForm.php'; require_once ROOT_DIR . '/sys/SelfRegistrationForms/CarlXSelfRegistrationForm.php'; +require_once ROOT_DIR . '/sys/SelfRegistrationForms/SierraSelfRegistrationForm.php'; class ILS_SelfRegistrationForms extends ObjectEditor { function getObjectType(): string { @@ -17,6 +18,8 @@ function getObjectType(): string { if ($ils == 'carlx') { return 'CarlXSelfRegistrationForm'; + } else if ($ils == 'sierra') { + return 'SierraSelfRegistrationForm'; } else { return 'SelfRegistrationForm'; } @@ -49,6 +52,8 @@ function getAllObjects($page, $recordsPerPage): array { $object = new CarlXSelfRegistrationForm(); } elseif ($ils == 'symphony') { $object = new SelfRegistrationForm(); + } else if ($ils == 'sierra') { + $object = new SierraSelfRegistrationForm(); } $list = []; @@ -80,6 +85,8 @@ function getObjectStructure($context = ''): array { if ($ils == 'carlx') { return CarlXSelfRegistrationForm::getObjectStructure($context); + } else if ($ils == 'sierra') { + return SierraSelfRegistrationForm::getObjectStructure($context); } else { return SelfRegistrationForm::getObjectStructure($context); } diff --git a/code/web/services/MyAccount/SelfReg.php b/code/web/services/MyAccount/SelfReg.php index a3eaddb830..19335a32ae 100644 --- a/code/web/services/MyAccount/SelfReg.php +++ b/code/web/services/MyAccount/SelfReg.php @@ -129,7 +129,7 @@ function launch($msg = null) { } $interface->assign('tos', false); - if ($catalog->accountProfile != null && $catalog->accountProfile->ils == "symphony"){ + if ($catalog->accountProfile != null && ($catalog->accountProfile->ils == "symphony" || $catalog->accountProfile->ils == "carlx" || $catalog->accountProfile->ils == "sierra")){ $selfRegTerms = $catalog->getSelfRegistrationTerms(); if ($selfRegTerms != null){ $interface->assign('tos', true); diff --git a/code/web/sys/Account/User.php b/code/web/sys/Account/User.php index 79fb9cd16d..c2fc3d9ee9 100644 --- a/code/web/sys/Account/User.php +++ b/code/web/sys/Account/User.php @@ -3570,7 +3570,7 @@ public function getAdminActions() { $hasCurbside = true; $allowILSMessaging = true; } - if ($accountProfile->ils == 'symphony' || $accountProfile->ils == 'carlx') { + if ($accountProfile->ils == 'symphony' || $accountProfile->ils == 'carlx' || $accountProfile->ils == 'sierra') { $customSelfRegForms = true; } if ($accountProfile->driver == 'Nashville') { diff --git a/code/web/sys/DBMaintenance/version_updates/24.08.10.php b/code/web/sys/DBMaintenance/version_updates/24.08.10.php new file mode 100644 index 0000000000..1981b32960 --- /dev/null +++ b/code/web/sys/DBMaintenance/version_updates/24.08.10.php @@ -0,0 +1,43 @@ + [ + 'title' => '', + 'description' => '', + 'continueOnError' => false, + 'sql' => [ + '' + ] + ], //name*/ + + //kodi - ByWater + 'self_registration_form_sierra' => [ + 'title' => 'Self Registration for Sierra', + 'description' => 'Creates self registration form table for Sierra', + 'sql' => [ + 'CREATE TABLE IF NOT EXISTS self_registration_form_sierra ( + id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, + name VARCHAR(100) NOT NULL UNIQUE, + selfRegistrationTemplate VARCHAR(25) default "default", + selfRegEmailBarcode TINYINT NOT NULL default 0, + termsOfServiceSetting int NOT NULL default -1 + ) ENGINE INNODB', + ], + ], // self_registration_form_sierra + 'self_reg_values_column_name' => [ + 'title' => 'ILS Self Reg Field Names', + 'description' => 'Rename column in self_reg_values to be ilsName instead of symphonyName as it applies to multiple ILSes', + 'sql' => [ + "ALTER TABLE self_reg_form_values RENAME COLUMN symphonyName TO ilsName", + ], + ], //self_reg_values_column_name + 'carlx_tos' => [ + 'title' => 'Terms of Service for CarlX Self Registration', + 'description' => 'Add terms of service functionality to CarlX self registration.', + 'sql' => [ + "ALTER TABLE self_registration_form_carlx ADD COLUMN termsOfServiceSetting int NOT NULL default -1" + ] + ], //carlx_tos + ]; +} \ No newline at end of file diff --git a/code/web/sys/SelfRegistrationForms/CarlXSelfRegistrationForm.php b/code/web/sys/SelfRegistrationForms/CarlXSelfRegistrationForm.php index d7e67c505a..28f973f1b5 100644 --- a/code/web/sys/SelfRegistrationForms/CarlXSelfRegistrationForm.php +++ b/code/web/sys/SelfRegistrationForms/CarlXSelfRegistrationForm.php @@ -1,5 +1,5 @@ find(); + $selfRegistrationTerms[-1] = 'None'; + while ($selfRegistrationTOS->fetch()) { + $selfRegistrationTerms[$selfRegistrationTOS->id] = (string)$selfRegistrationTOS->name; + } + return [ 'id' => [ 'property' => 'id', @@ -35,6 +44,12 @@ static function getObjectStructure($context = ''): array { 'size' => '40', 'maxLength' => 255, ], + 'termsOfServiceSetting' => [ + 'property' => 'termsOfServiceSetting', + 'type' => 'enum', + 'values' => $selfRegistrationTerms, + 'label' => 'Terms of Service Form', + ], 'selfRegEmailNotices' => [ 'property' => 'selfRegEmailNotices', 'type' => 'text', diff --git a/code/web/sys/SelfRegistrationForms/SelfRegistrationForm.php b/code/web/sys/SelfRegistrationForms/SelfRegistrationForm.php index da27c5642d..e4036d92be 100644 --- a/code/web/sys/SelfRegistrationForms/SelfRegistrationForm.php +++ b/code/web/sys/SelfRegistrationForms/SelfRegistrationForm.php @@ -4,7 +4,7 @@ class SelfRegistrationForm extends DataObject { public $__table = 'self_registration_form'; - public $__displayNameColumn = 'symphonyName'; + public $__displayNameColumn = 'ilsName'; public $id; public $name; public $selfRegistrationBarcodePrefix; diff --git a/code/web/sys/SelfRegistrationForms/SelfRegistrationFormValues.php b/code/web/sys/SelfRegistrationForms/SelfRegistrationFormValues.php index 1f0428a453..aeaf6d44b3 100644 --- a/code/web/sys/SelfRegistrationForms/SelfRegistrationFormValues.php +++ b/code/web/sys/SelfRegistrationForms/SelfRegistrationFormValues.php @@ -6,7 +6,7 @@ class SelfRegistrationFormValues extends DataObject { public $id; public $selfRegistrationFormId; public $weight; - public $symphonyName; + public $ilsName; public $displayName; public $fieldType; public $section; @@ -23,42 +23,53 @@ public function getNumericColumnNames(): array { } public static function getFieldValues() { - $fieldValues = [ - "firstName" => "firstName", - "middleName" => "middleName", - "lastName" => "lastName", - "preferredName" => 'preferredName', - "usePreferredName" => 'usePreferredName', - "library" => "Home Library", - "suffix" => "suffix", - "title" => "title", - "dob" => "birthDate", - "birthdate" => "BIRTHDATE", - "care_of" => "CARE/OF", - "careof" => "CARE_OF", - "guardian" => "GUARDIAN", - "po_box" => "PO_BOX", - "street" => "STREET", - "mailingaddr" => "MAILINGADDR", - "apt_suite" => "APT/SUITE", - "city" => "CITY", - "state" => "STATE", + //Determine ILS profile to return correct values + $ils = ''; + $fieldValues = []; + $accountProfiles = new AccountProfile(); + $accountProfiles->find(); + while ($accountProfiles->fetch()) { + if ($accountProfiles->ils != 'na') { + $ils = $accountProfiles->ils; + } + } + if ($ils == 'symphony') { + $fieldValues = [ + "firstName" => "firstName", + "middleName" => "middleName", + "lastName" => "lastName", + "preferredName" => 'preferredName', + "usePreferredName" => 'usePreferredName', + "library" => "Home Library", + "suffix" => "suffix", + "title" => "title", + "dob" => "birthDate", + "birthdate" => "BIRTHDATE", + "care_of" => "CARE/OF", + "careof" => "CARE_OF", + "guardian" => "GUARDIAN", + "po_box" => "PO_BOX", + "street" => "STREET", + "mailingaddr" => "MAILINGADDR", + "apt_suite" => "APT/SUITE", + "city" => "CITY", + "state" => "STATE", // "city_state" => "CITY/STATE", - "zip" => "ZIP", - "email" => "EMAIL", - "phone" => "PHONE", - "dayphone" => "DAYPHONE", - "cellPhone" => "CELLPHONE", - "workphone" => "WORKPHONE", - "homephone" => "HOMEPHONE", - "ext" => "EXT", - "fax" => "FAX", - "employer" => "EMPLOYER", - "parentname" => "PARENTNAME", - "location" => "LOCATION", - "type" => "TYPE", - "not_type" => "NOT TYPE", - "usefor" => "USEFOR", + "zip" => "ZIP", + "email" => "EMAIL", + "phone" => "PHONE", + "dayphone" => "DAYPHONE", + "cellPhone" => "CELLPHONE", + "workphone" => "WORKPHONE", + "homephone" => "HOMEPHONE", + "ext" => "EXT", + "fax" => "FAX", + "employer" => "EMPLOYER", + "parentname" => "PARENTNAME", + "location" => "LOCATION", + "type" => "TYPE", + "not_type" => "NOT TYPE", + "usefor" => "USEFOR", // "category01" => "category01", // "category02" => "category02", // "category03" => "category03", @@ -71,10 +82,27 @@ public static function getFieldValues() { // "category10" => "category10", // "category11" => "category11", // "category12" => "category12", - "customInformation" => "customInformation", - "primaryAddress" => "primaryAddress", - "primaryPhone" => "primaryPhone", - ]; + "customInformation" => "customInformation", + "primaryAddress" => "primaryAddress", + "primaryPhone" => "primaryPhone", + ]; + } else if ($ils == 'sierra') { + $fieldValues = [ + "firstName" => "names (First)", + "middleName" => "names (Middle)", + "lastName" => "names (Last)", + "library" => "homeLibraryCode", + "birthDate" => "birthDate", + "street" => "addresses (Street)", + "city" => "addresses (City)", + "state" => "addresses (State)", + "zip" => "addresses (ZIP)", + "email" => "emails", + "phone" => "phones", + "pin" => "pin", + "barcode" => "barcodes", + ]; + } return $fieldValues; } @@ -94,12 +122,12 @@ static function getObjectStructure($fieldValues = null) { 'description' => 'The sort order', 'default' => 0, ], - 'symphonyName' => [ - 'property' => 'symphonyName', + 'ilsName' => [ + 'property' => 'ilsName', 'type' => 'enum', - 'label' => 'Symphony Name', + 'label' => 'ILS Name', 'values' => self::getFieldValues(), - 'description' => 'The name of the field in Symphony', + 'description' => 'The name of the field in the ILS', ], 'displayName' => [ 'property' => 'displayName', @@ -130,7 +158,7 @@ static function getObjectStructure($fieldValues = null) { 'contactInformationSection' => 'Contact Information', ], 'description' => 'The field type for the field', - 'default' => '0', + 'default' => 'identitySection', ], 'required' => [ 'property' => 'required', @@ -168,7 +196,7 @@ public function getFormFieldsInOrder($selfRegFormId) { $fields->find(); $fieldNames = []; while ($fields->fetch()) { - $fieldNames[] = $fields->symphonyName; + $fieldNames[] = $fields->ilsName; } return $fieldNames; diff --git a/code/web/sys/SelfRegistrationForms/SelfRegistrationTerms.php b/code/web/sys/SelfRegistrationForms/SelfRegistrationTerms.php index 9695b48b91..ec09121d61 100644 --- a/code/web/sys/SelfRegistrationForms/SelfRegistrationTerms.php +++ b/code/web/sys/SelfRegistrationForms/SelfRegistrationTerms.php @@ -30,14 +30,14 @@ static function getObjectStructure($context = ''): array { 'allowableTags' => '