Browse Source

reworked pagerequested

9.x-1.0
Paul Pound 8 years ago
parent
commit
eb4ed9b3c6
  1. 3
      includes/doi.inc
  2. 21
      includes/form.inc
  3. 2
      includes/relais.inc
  4. 6
      includes/utilities.inc

3
includes/doi.inc

@ -77,7 +77,8 @@ function upei_roblib_ill_populate_form_doi($crossref_xml, $form) {
$form['Date']['#value'] = upei_roblib_ill_get_xml_node($crossref_xml, 'year');
$form['ArticleTitle']['#value'] = upei_roblib_ill_get_xml_node($crossref_xml, 'title');
$form['ImageOrPageNumber']['#value'] = upei_roblib_ill_get_xml_node($crossref_xml, 'first_page');
$form['PagesRequested']['#value'] = upei_roblib_ill_get_xml_node($crossref_xml, 'last_page');
$form['PagesRequested']['#value'] = upei_roblib_ill_get_xml_node($crossref_xml, 'first_page') . '-' .
upei_roblib_ill_get_xml_node($crossref_xml, 'last_page');
$form['Volume']['#value'] = upei_roblib_ill_get_xml_node($crossref_xml, 'volume');
$form['Issue']['#value'] = upei_roblib_ill_get_xml_node($crossref_xml, 'issue');
foreach ($crossref_xml->getElementsbyTagName('person_name') as $person) {

21
includes/form.inc

@ -283,8 +283,8 @@ function upei_roblib_ill_request_form($form, &$form_state) {
'#description' => 'Article or Chapter Title',
'#size' => 50,
'#states' => array(
'visible' => array(
':input[name="Genre"]' => array('value' => 'article'),
'invisible' => array(
':input[name="Genre"]' => array('value' => 'book'),
),
),
'#required' => FALSE,
@ -378,22 +378,11 @@ function upei_roblib_ill_request_form($form, &$form_state) {
),
),
);
$form['ImageOrPageNumber'] = array(
'#type' => 'textfield',
'#title' => t('Start Page'),
'#default_value' => upei_roblib_ill_get_request_variable('spage'),
'#size' => 50,
'#required' => FALSE,
'#states' => array(
'invisible' => array(
':input[name="Genre"]' => array('value' => 'book'),
),
),
);
$form['PagesRequested'] = array(
'#type' => 'textfield',
'#title' => t('End Page'),
'#default_value' => upei_roblib_ill_get_request_variable('epage'),
'#title' => t('Pages'),
'#default_value' => upei_roblib_ill_get_request_variable('pages'),
'#description' => 'Pages requested (startpage-endpage)',
'#size' => 50,
'#required' => FALSE,
'#states' => array(

2
includes/relais.inc

@ -22,6 +22,8 @@ function upei_roblib_ill_add_request($form_state, $aid) {
$relais_arr['DeliveryAddress'] = upei_roblib_ill_clean_array($form_state['storage']['upei_roblib_ill_auth_form']);
$request_info = upei_roblib_ill_request_info_array($relais_arr['BibliographicInfo'], $form_state['values']['notes']);
$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_json = json_encode($relais_arr);
$options = array(
'method' => 'POST',

6
includes/utilities.inc

@ -21,12 +21,8 @@ function upei_roblib_ill_clean_array($values) {
if (isset($arr['ISBN'])) {
$arr['ISBN'] = array($arr['ISBN']);
}
//in some cases values need to moved to other fields or eliminated do that here
if(isset($arr['PagesRequested']) || isset($arr['ImageOrPageNumber'])) {
$arr['PagesRequested'] = $arr['ImageOrPageNumber'] . ' to ' . $arr['PagesRequested'];
unset($arr['ImageOrPageNumber']);
}
if(isset($arr['Genre']) && $arr['Genre'] == 'article' && isset($arr['Author'])) {
// We want ArticleAuthor
unset($arr['Author']);
}
unset($arr['form_build_id']);

Loading…
Cancel
Save