From d3e509ef8ceeaeda8739951b8cbf0b7747ec387d Mon Sep 17 00:00:00 2001 From: Paul Pound Date: Thu, 27 Apr 2017 09:35:15 -0300 Subject: [PATCH] added function to get Relais PubType based on Genre --- includes/form.inc | 2 +- includes/relais.inc | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/includes/form.inc b/includes/form.inc index 8c89dc8..bb6b2c1 100644 --- a/includes/form.inc +++ b/includes/form.inc @@ -182,7 +182,7 @@ function upei_roblib_ill_auth_form($form, &$form_state) { ); $form['LibraryName'] = array( '#type' => 'textfield', - '#title' => t('Name of Institution'), + '#title' => t('Name of Library'), '#size' => 50, '#default_value' => 'Robertson Library', '#required' => TRUE, diff --git a/includes/relais.inc b/includes/relais.inc index f357bb1..6d53aef 100644 --- a/includes/relais.inc +++ b/includes/relais.inc @@ -4,6 +4,16 @@ * Contains the functions to send and receive data to/from Relais. */ +function upei_roblib_ill_get_pub_type($genre) { + switch ($genre) { + case 'book' : + return 'B'; + case 'chapter' : + return 'I'; + default : + return 'J'; + } +} /** * Submit an ILL AddRequest to relais. * @param array $form_state @@ -24,6 +34,7 @@ function upei_roblib_ill_add_request($form_state, $aid) { $relais_arr['RequestInfo'] = $request_info; $relais_arr['PublisherInfo']['PublicationDate'] = isset($form_state['storage']['upei_roblib_ill_request_form']['Date']) ? $form_state['storage']['upei_roblib_ill_request_form']['Date'] : ''; + $relais_arr['PublisherInfo']['PublicationType'] = upei_roblib_ill_get_pub_type($form_state['storage']['upei_roblib_ill_request_form']['Genre']); $relais_json = json_encode($relais_arr); $options = array( 'method' => 'POST',