Skip to content

Commit

Permalink
Merge pull request #1412 from tripal/tv334-issue1411-php8-errors-in-p…
Browse files Browse the repository at this point in the history
…ublication-api

tv3g4 Issue #1411 fix some php8 errors
  • Loading branch information
spficklin committed Feb 6, 2023
2 parents fbaf853 + 6c82293 commit dc5588e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions tripal_chado/includes/loaders/tripal_chado.pub_importers.inc
Original file line number Diff line number Diff line change
Expand Up @@ -1545,12 +1545,14 @@ function tripal_pub_get_publication_array($pub_id, $skip_existing = TRUE) {
$citation = chado_generate_var('pubprop', $values);
if ($citation) {
$citation = chado_expand_var($citation, 'field', 'pubprop.value', $options);
if (count($citation) > 1) {
// If multiple citations, it will be an array of objects.
if (is_array($citation) and (count($citation) > 1)) {
tripal_report_error('tripal_pub', TRIPAL_ERROR, "Publication has multiple citations already: %pub_id",
['%pub_id' => $pubid]);
return FALSE;
}
elseif (count($citation) == 1 and $skip_existing == TRUE) {
// If only one citation, it will be an object and not an array of objects.
elseif ($skip_existing == TRUE) {
// skip this publication, it already has a citation
return FALSE;
}
Expand Down Expand Up @@ -1584,7 +1586,8 @@ function tripal_pub_get_publication_array($pub_id, $skip_existing = TRUE) {
];
$authors = chado_generate_var('pubprop', $values);
$authors = chado_expand_var($authors, 'field', 'pubprop.value', $options);
if (count($authors) > 1) {
// If multiple author lists, $authors will be an array of objects instead of a single object.
if (is_array($authors) and (count($authors) > 1)) {
tripal_report_error('tripal_pub', TRIPAL_ERROR, "Publication has multiple author lists. It should have only one list: %pub_id",
['%pub_id' => $pubid]);
return FALSE;
Expand Down

0 comments on commit dc5588e

Please sign in to comment.