diff --git a/includes/form.inc b/includes/form.inc index b4fea65..71e70bd 100644 --- a/includes/form.inc +++ b/includes/form.inc @@ -93,7 +93,8 @@ function upei_roblib_ill_form_submit($form, &$form_state) { * An array representing the bibliographic form. */ function upei_roblib_ill_auth_form($form, &$form_state) { - $_REQUEST; + module_load_include('inc', 'upei_roblib_ill', 'includes/utilities'); + $form['#prefix'] = upei_roblib_format_biblio_info($form_state); $form['FirstName'] = array( '#type' => 'textfield', diff --git a/includes/relais.inc b/includes/relais.inc index ab6841c..b10036c 100644 --- a/includes/relais.inc +++ b/includes/relais.inc @@ -18,7 +18,6 @@ function upei_roblib_ill_add_request($form_state, $aid) { "SupplyingLibrarySymbol" => 'PCU', ); $relais_arr['BibliographicInfo'] = upei_roblib_ill_clean_array($form_state['storage']['upei_roblib_ill_request_form']); - //$relais_arr['BibliographicInfo'] $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; diff --git a/includes/utilities.inc b/includes/utilities.inc index 09c524a..4e3732b 100644 --- a/includes/utilities.inc +++ b/includes/utilities.inc @@ -21,6 +21,14 @@ 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'])) { + unset($arr['Author']); + } unset($arr['form_build_id']); unset($arr['form_token']); unset($arr['form_id']); @@ -29,12 +37,13 @@ function upei_roblib_ill_clean_array($values) { unset($arr['next']); unset($arr['certify']); unset($arr['doi']); + unset($arr['doi_button']); return $arr; } /** * Allows us to ask for _REQUEST variables that may or may not exist without generating a php warning. - * Also does some formating for certain variables. + * Also does some formatting for certain variables. * @param string $variable * The name of the $_REQUEST variable to check * @return string @@ -74,3 +83,27 @@ function upei_roblib_ill_request_info_array($values, $notes) { } return $requestInfo; } + +/** + * Creates a summary Table based on the biblio information in the form_state array for display + * @param $form_state + * @return string + */ +function upei_roblib_format_biblio_info($form_state) { + $data = upei_roblib_ill_clean_array($form_state['storage']['upei_roblib_ill_request_form']); + $rows = array(); + foreach($data as $key => $value) { + if($key == 'ISSN' || $key == 'ISBN') { + $value = reset($value); + } + array_push($rows, array($key, $value)); + } + $output = array( + '#theme' => 'table', + '#rows' => $rows, + '#prefix' => '
', + '#suffix' => '
', + ); + $html_output = drupal_render($output); + return $html_output; +}