แพ็คเกจ PHP เพื่อรองรับการใช้งาน SirsiDynix Symphony Web Services API (ILSWS) สำหรับฟังก์ชันผู้อุปถัมภ์
จอห์น เฮาเซอร์ [email protected]
ฟังก์ชันเหล่านี้สามารถใช้กับจุดเข้าใช้งาน ILSWS ที่ถูกต้องได้ พวกเขาจะโยนข้อยกเว้นเมื่อมีข้อผิดพลาด
ฟังก์ชันเหล่านี้สอดคล้องกับจุดเข้าใช้งาน ILSWS แต่จะตรวจสอบความถูกต้องของอินพุตทั้งหมด และจะส่งข้อยกเว้นหากมีอินพุตที่ไม่เหมาะสม
ฟังก์ชันเหล่านี้มีฟังก์ชันที่ ILSWS ไม่สนับสนุนโดยตรงโดยการสืบค้นหลายรายการ หรือโดยการรวม จัดการ หรือประเมินข้อมูลจากระบบ Symphony
เพื่อความสะดวกของนักพัฒนา ไลบรารีโค้ดยอมรับวันที่ในรูปแบบต่อไปนี้ โดยที่วันที่ได้รับการยอมรับเป็นพารามิเตอร์: YYYYMMDD, YYYY-MM-DD, YYYY/MM/DD, MM-DD-YYYY หรือ MM/DD/ ปปปป
กฎการตรวจสอบหมายเลขโทรศัพท์ในปัจจุบันได้รับการตั้งค่าให้เป็นสตริงตัวเลขโดยไม่มีเครื่องหมายวรรคตอน อย่างไรก็ตาม การปรับเปลี่ยนกฎการตรวจสอบที่ด้านบนของงานสาธารณะใดๆ จะเป็นเรื่องง่ายเพื่อยอมรับเครื่องหมายวรรคตอนในหมายเลขโทรศัพท์
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}}
ดูไฟล์ libilsws .yaml.sample สำหรับคำจำกัดความของฟิลด์และเอกสารประกอบของตัวเลือกการกำหนดค่า YAML
สำหรับชุดตัวอย่างโค้ดทั้งหมด โปรดดูสคริปต์ตัวอย่างในไดเร็กทอรี test
คำเตือน: สคริปต์ทดสอบอาจทำการเปลี่ยนแปลงจริงกับระบบ Symphony ที่กำหนดค่าไว้ ห้ามใช้กับระบบที่ใช้งานจริงโดยไม่ได้ทบทวนสิ่งที่พวกเขาทำอย่างละเอียด!