|
|
@ -48,8 +48,10 @@ class RoblibIllLoanForm extends FormBase { |
|
|
|
|
|
|
|
|
|
|
|
$aid = upei_roblib_ill_authenticate($campus_id, $values['Surname']); |
|
|
|
$aid = upei_roblib_ill_authenticate($campus_id, $values['Surname']); |
|
|
|
if (is_array($aid) && isset($aid['Problem']['Message'])) { |
|
|
|
if (is_array($aid) && isset($aid['Problem']['Message'])) { |
|
|
|
|
|
|
|
if (!empty($aid['Problem']['HR_Message'])) { |
|
|
|
|
|
|
|
$form_state->setErrorByName('campus_id', $aid['Problem']['HR_Message']); |
|
|
|
|
|
|
|
} |
|
|
|
$form_state->setErrorByName('Surname', $aid['Problem']['Message']); |
|
|
|
$form_state->setErrorByName('Surname', $aid['Problem']['Message']); |
|
|
|
$form_state->setErrorByName('campus_id', ''); |
|
|
|
|
|
|
|
// Log invalid requests, we need to build the full array here to log it, even though we won't send it yet as auth has failed. |
|
|
|
// Log invalid requests, we need to build the full array here to log it, even though we won't send it yet as auth has failed. |
|
|
|
//$form_state->set('upei_roblib_ill_auth_form_storage') = $form_state->getValues(); |
|
|
|
//$form_state->set('upei_roblib_ill_auth_form_storage') = $form_state->getValues(); |
|
|
|
module_load_include('inc', 'upei_roblib_ill', 'includes/db'); |
|
|
|
module_load_include('inc', 'upei_roblib_ill', 'includes/db'); |
|
|
@ -61,8 +63,13 @@ class RoblibIllLoanForm extends FormBase { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
$trigger = $form_state->getTriggeringElement(); |
|
|
|
$trigger = $form_state->getTriggeringElement(); |
|
|
|
if (empty($form_state->get('step')) && $trigger['#value'] != 'Lookup DOI' && empty($form_state->getValue('Title'))) { |
|
|
|
if($trigger['#value'] != 'Lookup DOI' && empty($form_state->get('step'))) { |
|
|
|
$form_state->setErrorByName('Title', t('Journal/Book Title is required.')); |
|
|
|
if(empty($form_state->getValue('Title'))){ |
|
|
|
|
|
|
|
$form_state->setErrorByName('Title', t('Journal/Book Title is required.')); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if(empty($form_state->getValue('Genre'))) { |
|
|
|
|
|
|
|
$form_state->setErrorByName('Title', t('Item Type is required.')); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -148,7 +155,8 @@ class RoblibIllLoanForm extends FormBase { |
|
|
|
'chapter' => t('Book Chapter'), |
|
|
|
'chapter' => t('Book Chapter'), |
|
|
|
'article' => t('Journal Article'), |
|
|
|
'article' => t('Journal Article'), |
|
|
|
], |
|
|
|
], |
|
|
|
'#required' => TRUE, |
|
|
|
'#default_value' => 'article', |
|
|
|
|
|
|
|
'#required' => FALSE, |
|
|
|
]; |
|
|
|
]; |
|
|
|
if (!empty($type)) { |
|
|
|
if (!empty($type)) { |
|
|
|
$form['Genre']['#default_value'] = $type; |
|
|
|
$form['Genre']['#default_value'] = $type; |
|
|
|