[OJS 3.2.1-1 wiht Postgres] Correction suggestion in the code in AuthorDAO.inc.php

Hi @asmecher,

When we see this error:

 [php7:error] [pid 29799] [client 54.36.148.91:62328] PHP Fatal error:  Uncaught Exception: DB Error: ERROR:  syntax error at or near "AND"\nLINHA 71:       AND (LOWER(asf0.setting_value) LIKE LOWER( $8) OR LOWE...\n                ^ Query: SELECT a.*, ug.show_title, p.locale,\n\t\t\t\tCOALESCE(agl.setting_value, agpl.setting_value) AS author_given,\n\t\t\t\tCASE WHEN agl.setting_value <> '' THEN afl.setting_value ELSE afpl.setting_value END AS author_family\n\t\t\tFROM\tauthors a\n\t\t\t\tJOIN user_groups ug ON (a.user_group_id = ug.user_group_id)\n\t\t\t\tJOIN publications p ON (p.publication_id = a.publication_id)\n\t\t\t\tJOIN submissions s ON (s.current_publication_id = p.publication_id)\n\t\t\t\tLEFT JOIN author_settings agl ON (a.author_id = agl.author_id AND agl.setting_name = ? AND agl.locale = ?)\n\t\t\t\tLEFT JOIN author_settings agpl ON (a.author_id = agpl.author_id AND agpl.setting_name = ? AND agpl.locale = p.locale)\n\t\t\t\tLEFT JOIN author_settings afl ON (a.author_id = afl.author_id AND afl.setting_name = ? AND afl.locale = ?)\n\t\t\t\tLEFT JOIN author_settings afpl ON (a.author_id = afpl.author_id AND afpl.setti in /var/www/ojs-3.2.0-3/lib/pkp/classes/db/DAO.inc.php on line 703

my colleague @diegojmacedo
saw that it was necessary to make the following correction:
ojs-3.2.0-3\classes\article\AuthorDAO.inc.php
change lines 123 to 124, from:

WHERE j.enabled = 1 AND
                                        ' . (isset($journalId) ? '  j.journal_id = ?' : '')

for:

WHERE j.enabled = 1 
                                        ' . (isset($journalId) ? '  AND  j.journal_id = ?' : '')

What do you think?
We use postgres 7 and this error comes from version 3.2.0-3 more or less.

Hi @Adriano_Jose,

Good spotting – I’ve filed and committed that here: SQL typo in "browse by authors" feature · Issue #6111 · pkp/pkp-lib · GitHub

The fix will be released in the next OJS and OPS releases (either 3.2.1-2 or 3.3.0-0).

Regards,
Alec Smecher
Public Knowledge Project Team