function find_article_from_metadata($values, &$item) { global $debug; global $error; $found = false; if ($debug) { echo '<div style="border: 1px solid #c7cfd5;background: rgb(255,255,153);padding:15px;">'; echo "<p><b>Find article from metadata</b></p>"; echo '<pre>'; print_r($values); echo '</pre>'; echo '</div>'; } // We need ISSN for cache lookup check_for_missing_issn($values); // echo __LINE__ , ' boo'; // Case 1: User is enough to locate article (i.e., has starting page if (array_key_exists('spage', $values)) { // echo __LINE__ , ' boo'; // Simple lookup if ($values['spage'] != '') { $found = find_article_have_spage($values, $item); if (!$found) { $error = ERROR_NOT_FOUND_FROM_METADATA; } } } // echo __LINE__ , ' boo'; // Case 2: User has a page in the range spage-epage (e.g., a nomenclator) if (array_key_exists('pages', $values)) { // Harder case, we have a page in the range if ($values['pages'] != '') { $found = find_article_from_page($values, $item); if (!found) { $error = ERROR_NOT_FOUND_FROM_METADATA; } } } return $found; }
function enough_for_jstor_lookup(&$metadata) { $issn = ''; $year = ''; check_for_missing_issn($metadata); if (array_key_exists('issn', $metadata)) { $issn = $metadata['issn']; } if (array_key_exists('date', $metadata)) { $date = $metadata['date']; } //print_r($metadata); return $issn != '' and $date != ''; }