후원자 기능을 위한 SirsiDynix Symphony Web Services API(ILSWS) 사용을 지원하는 PHP 패키지
존 하우저 [email protected]
이러한 기능은 유효한 ILSWS 액세스 포인트와 함께 사용할 수 있습니다. 오류가 발생하면 예외가 발생합니다.
이러한 함수는 ILSWS 액세스 포인트에 해당하지만 모든 입력의 유효성을 검사하고 부적절한 입력이 있는 경우 예외를 발생시킵니다.
이러한 기능은 여러 쿼리를 수행하거나 Symphony 시스템의 데이터를 결합, 조작 또는 평가하여 ILSWS에서 직접 지원하지 않는 기능을 제공합니다.
개발자의 편의를 위해 코드 라이브러리는 날짜가 매개변수로 허용되는 경우 YYYYMMDD, YYYY-MM-DD, YYYY/MM/DD, MM-DD-YYYY 또는 MM/DD/ 형식의 날짜를 허용합니다. YYYY.
전화번호에 대한 유효성 검사 규칙은 현재 구두점이 없는 일련의 숫자를 예상하도록 설정되어 있습니다. 그러나 전화번호에 구두점을 허용하도록 공개 기능 상단의 유효성 검사 규칙을 수정하는 것은 쉽습니다.
require_once 'vendor/autoload.php';
// Initialize and load configuration from YAML configuration file
$ilsws = new libilsws libilsws ('./ libilsws .yaml');
// Connect to ILSWS with configuration loaded from YAML file
$token = $ilsws->connect();
/**
* Valid incoming params are:
* ct = number of results to return,
* rw = row to start on (so you can page through results),
* j = boolean AND or OR to use with multiple search terms, and
* includeFields = fields to return in result.
*/
$index = 'EMAIL';
$search = '[email protected]';
// Prepare search parameters, including fields to return
$options = [
'rw' => 1,
'ct' => 10,
'j' => 'AND',
'includeFields' => 'key,barcode']
];
// Run search
$response = $ilsws->search_patron($token, $index, $search, $options);
$response = $ilsws->get_patron_attributes($token, $patron_key);
/**
* The order of the fields doesn't matter. Not all of these are actually required.
* See the YAML configuration file to determine which fields are required. If an
* email template name is included in the options array, an email will be sent to the
* patron. Actual template files must include a language extension (for example .en for
* English. The system will look for template that matches the patrons language
* preference. If one is found, it will use that, otherwise it will attempt to
* find and use an English template.
*/
$patron = [
'birthDate' => '1962-03-07',
'city_state' => 'Portland, OR',
'county' => '0_MULT',
'email' => '[email protected]',
'firstName' => 'Bogus',
'friends_notices' => 'YES',
'home_library' => 'CEN',
'language' => 'ENGLISH',
'lastName' => 'Bogart',
'library_news' => 'YES',
'middleName' => 'T',
'notice_type' => 'PHONE',
'patron_id' => '21168045918653',
'postal_code' => '97209',
'street' => '925 NW Hoyt St Apt 406',
'telephone' => '215-534-6821',
'sms_phone' => [
'number' => '215-534-6821',
'countryCode' => 'US',
'bills' => true,
'general' => true,
'holds' => true,
'manual' => true,
'overdues' => true,
],
];
$addr_num = 1;
$options = [];
$options['role'] = 'STAFF';
$options['client_id'] = 'StaffClient';
$options['template'] = 'template.html.twig';
$options['subject'] = 'Welcome to the library!';
$response = $ilsws->register_patron($patron, $token, $addr_num, $options);
// Define patron array
$patron = [
'firstName' => 'John',
'middleName' => 'Rad',
'lastName' => 'Houser',
'birthDate' => '1972-03-10',
'home_library' => 'CEN',
'county' => '0_MULT',
'notice_type' => 'PHONE',
'library_news' => 'YES',
'friends_notices' => 'YES',
'online_update' => 'YES',
'street' => '925 NW Hoyt St Apt 606',
'city_state' => 'Portland, OR',
'patron_id' => '21168045918653',
'postal_code' => '97208',
'email' => '[email protected]',
'telephone' => '215-544-6941',
'sms_phone' => [
'number' => '215-544-6941',
'countryCode => 'US',
'bills' => true,
'general' => true,
'holds' => true,
'manual' => true,
'overdues' => true,
],
];
$addr_num = 1;
$patron_key = '782339';
// Update the patron record
$response = $ilsws->update_patron($patron, $token, $patron_key, $addr_num);
/**
* Convert UTF-8 characters with accents to ASCII and strip unwanted characters and
* boolean operators from search terms
*/
$search = $ilsws->prepare_search($search);
// Prepare search parameters and choose fields to return
$params = [
'ct' => '50',
'rw' => '1',
'j' => 'AND',
'includeFields' => 'author,title,bib{650_a,856_u},callList{callNumber,itemList{barcode,currentLocation}}'
];
// Run search
$response = $ilsws->search_bib($token, $index, $search, $params);
includeFields 매개변수에 대한 참고 사항:
bib{650_a}
callList{callNumber}
추가하세요.callList{itemList{barcode}}
추가하세요. YAML 구성 옵션의 필드 정의 및 문서는 libilsws .yaml.sample 파일을 참조하세요.
전체 코드 예제 세트를 보려면 test
디렉터리의 예제 스크립트를 참조하세요.
경고: 테스트 스크립트는 구성된 Symphony 시스템을 실제로 변경할 수 있습니다. 수행하는 작업을 주의 깊게 검토하지 않고 프로덕션 시스템에서 사용하지 마십시오!