Browse Source

added function to get Relais PubType based on Genre

9.x-1.0
Paul Pound 8 years ago
parent
commit
d3e509ef8c
  1. 2
      includes/form.inc
  2. 11
      includes/relais.inc

2
includes/form.inc

@ -182,7 +182,7 @@ function upei_roblib_ill_auth_form($form, &$form_state) {
); );
$form['LibraryName'] = array( $form['LibraryName'] = array(
'#type' => 'textfield', '#type' => 'textfield',
'#title' => t('Name of Institution'), '#title' => t('Name of Library'),
'#size' => 50, '#size' => 50,
'#default_value' => 'Robertson Library', '#default_value' => 'Robertson Library',
'#required' => TRUE, '#required' => TRUE,

11
includes/relais.inc

@ -4,6 +4,16 @@
* Contains the functions to send and receive data to/from Relais. * 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. * Submit an ILL AddRequest to relais.
* @param array $form_state * @param array $form_state
@ -24,6 +34,7 @@ function upei_roblib_ill_add_request($form_state, $aid) {
$relais_arr['RequestInfo'] = $request_info; $relais_arr['RequestInfo'] = $request_info;
$relais_arr['PublisherInfo']['PublicationDate'] = isset($form_state['storage']['upei_roblib_ill_request_form']['Date']) ? $relais_arr['PublisherInfo']['PublicationDate'] = isset($form_state['storage']['upei_roblib_ill_request_form']['Date']) ?
$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); $relais_json = json_encode($relais_arr);
$options = array( $options = array(
'method' => 'POST', 'method' => 'POST',

Loading…
Cancel
Save