PKPFileUploadWizardHandler::confirmRevision PHP Method

confirmRevision() public method

Confirm that the uploaded file is a revision of an earlier uploaded file.
public confirmRevision ( $args, $request ) : JSONMessage
$args array
$request Request
return JSONMessage JSON object
    function confirmRevision($args, $request)
    {
        // Instantiate the revision confirmation form.
        $submission = $this->getSubmission();
        import('lib.pkp.controllers.wizard.fileUpload.form.SubmissionFilesUploadConfirmationForm');
        // FIXME?: need assocType and assocId? Not sure if they would be used, so not adding now.
        $reviewRound = $this->getReviewRound();
        $confirmationForm = new SubmissionFilesUploadConfirmationForm($request, $submission->getId(), $this->getStageId(), $this->getFileStage(), $reviewRound);
        $confirmationForm->readInputData();
        // Validate the form and revise the file.
        if ($confirmationForm->validate($request)) {
            if (is_a($uploadedFile = $confirmationForm->execute($request), 'SubmissionFile')) {
                // Go to the meta-data editing step.
                return new JSONMessage(true, '', '0', $this->_getUploadedFileInfo($uploadedFile));
            } else {
                return new JSONMessage(false, __('common.uploadFailed'));
            }
        } else {
            return new JSONMessage(false, array_pop($confirmationForm->getErrorsArray()));
        }
    }