Skip to content

Error in calculation of maxSequence #114

@t-mayer

Description

@t-mayer

Hi,
after upgrading to from OJS 3.3 to OJS 3.4 we noticed that the maxSequence calculation in the for loop always uses the current publication instead of the publication of the submissions it is iterating over:

   if (count($otherSubmissionsInSection)) {
             $maxSequence = 0;
                foreach ($otherSubmissionsInSection as $submission) {
                    if ($publication->getData('seq')) {
                        $maxSequence = max($maxSequence, $publication->getData('seq'));
                    }
                }
                $publication->setData('seq', $maxSequence + 1);
            }

            Repo::publication()->publish($publication);
        }

Instead it should be (I guess):

if (count($otherSubmissionsInSection)) {
                $maxSequence = 0;
                foreach ($otherSubmissionsInSection as $submission) {
                    if ($submission->getCurrentPublication()->getData('seq')) {
                        $maxSequence = max($maxSequence, $submission->getCurrentPublication()->getData('seq'));
                    }
                }
                $publication->setData('seq', $maxSequence + 1);
            }

Compare to OJS 3.3:

if (count($otherSubmissionsInSection)) {
				$maxSequence = 0;
				foreach ($otherSubmissionsInSection as $submission) {
					if ($submission->getCurrentPublication()->getData('seq')) {
						$maxSequence = max($maxSequence, $submission->getCurrentPublication()->getData('seq'));
					}
				}
				$publication->setData('seq', $maxSequence + 1);
			}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions