diff --git a/includes/form.inc b/includes/form.inc index 06878b5..0b71066 100644 --- a/includes/form.inc +++ b/includes/form.inc @@ -115,7 +115,7 @@ function upei_roblib_ill_form_redirect() { $standard_message = t("To contact the department about this request, you can send a message to ill@upei.ca or call 902-566-0445."); if (isset($_GET['error']) && $_GET['error'] === 'FALSE') { - $standard_message = t("A message including the Request ID has been sent to @email.", array( + $standard_message = t("A message including the Request ID has been sent to @email. ", array( '@email' => $_GET['email'], )) . $standard_message; } @@ -344,7 +344,7 @@ function upei_roblib_ill_request_form($form, &$form_state) { '#rows' => 2, '#title' => t('Source Title'), '#default_value' => upei_roblib_ill_get_request_variable('title'), - '#description' => 'Journal or Book Title', + '#description' => 'Journal or Book Title (Required)', '#size' => 50, '#required' => FALSE, ); diff --git a/includes/utilities.inc b/includes/utilities.inc index 922a985..105c7a4 100644 --- a/includes/utilities.inc +++ b/includes/utilities.inc @@ -21,11 +21,11 @@ function upei_roblib_ill_clean_array($values) { if (isset($arr['ISBN'])) { $arr['ISBN'] = array($arr['ISBN']); } - if(isset($arr['Genre']) && $arr['Genre'] == 'article' && isset($arr['Author'])) { + if (isset($arr['Genre']) && $arr['Genre'] == 'article' && isset($arr['Author'])) { // We want ArticleAuthor unset($arr['Author']); } - if(isset($arr['doi'])) { + if (isset($arr['doi'])) { $arr['AdditionalNumbers'] = $arr['doi']; } unset($arr['form_build_id']); @@ -55,6 +55,10 @@ function upei_roblib_ill_get_request_variable($variable) { $last_name = isset($_REQUEST['aulast']) ? $_REQUEST['aulast'] : NULL; return !empty($last_name) ? $last_name . ',' . $initial : ''; } + if ($variable == 'issn' && !empty($_REQUEST[$variable])) { + // ebsco sometimes sends garbage as issns verify this is a valid issn before displaying the value in the form. + return preg_match('/^\d{4}-?\d{3}[\dxX]$/', $_REQUEST[$variable]) ? $_REQUEST[$variable] : ''; + } return isset($_REQUEST[$variable]) ? $_REQUEST[$variable] : ''; } @@ -89,10 +93,10 @@ function upei_roblib_ill_request_info_array($values, $notes) { * @return string */ function upei_roblib_format_biblio_info($form_state) { - $data = upei_roblib_ill_clean_array($form_state['storage']['upei_roblib_ill_request_form']); + $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') { + foreach ($data as $key => $value) { + if ($key == 'ISSN' || $key == 'ISBN') { $value = reset($value); } array_push($rows, array($key, $value));