Difference is I am not doing a second import, this is an initial import. The user also suggested to comment out the following from PKPSubmissionFileService.inc.php: Which I did but still the same error.
The insert statement is made to the custom_issue_orders table; however we are inserting the very same issueIds that are retrieved from the previous query (see getPublishedIssues). The inner join is checking for existing and matching issueIds on both the issue and custom_issue_orders tables. Thus inserting the very same issueId as we iterate over the previous call would immediately error.
Am I missing something here in the logic or is this a flaw?
/* IssueDAO.inc.php */
function setDefaultCustomIssueOrders($journalId) {
$publishedIssues = $this->getPublishedIssues($journalId);
for ($i=1; $issue = $publishedIssues->next(); $i++) {
/* error below */
$this->insertCustomIssueOrder($journalId, $issue->getId(), $i);
}
}
function insertCustomIssueOrder($journalId, $issueId, $seq) {
$this->update(
'INSERT INTO custom_issue_orders (issue_id, journal_id, seq) VALUES (?, ?, ?)',
[(int) $issueId, (int) $journalId, $seq]
);
}
function getPublishedIssues($journalId, $rangeInfo = null) {
$result = $this->retrieveRange(
'SELECT i.* FROM issues i LEFT JOIN custom_issue_orders o ON (o.issue_id = i.issue_id) WHERE i.journal_id = ? AND i.published = 1 ORDER BY o.seq ASC, i.current DESC, i.date_published DESC',
[(int) $journalId], $rangeInfo
);
return new DAOResultFactory($result, $this, '_returnIssueFromRow');
}
I also noticed that the custom_issue_orders table does not auto_incr the issueIds.
My issue was with the inserts to log files. That is with an issue keys. Do you try to import to an existing issue? I newer tried that but did full import of an issue in one import run.