/** * Upload a copyediting file * @param $args array * @param $request PKPRequest */ function uploadFile($args, &$request) { // Get the copyediting signoff $signoffDao =& DAORegistry::getDAO('SignoffDAO'); /* @var $signoffDao SignoffDAO */ $signoff =& $signoffDao->getById($this->getSignoffId()); assert(is_a($signoff, 'Signoff')); // Get the file that is being copyedited $submissionFileDao =& DAORegistry::getDAO('SubmissionFileDAO'); /* @var $submissionFileDao SubmissionFileDAO */ $copyeditingFile =& $submissionFileDao->getLatestRevision($signoff->getAssocId()); // Get the copyedited file if it exists if ($signoff->getFileId()) { $copyeditedFile =& $submissionFileDao->getLatestRevision($signoff->getFileId()); } // If we're updating a file, get its ID for the file manager $copyeditedFileId = isset($copyeditedFile) ? $copyeditedFile->getFileId() : null; $monograph =& $this->getMonograph(); import('classes.file.MonographFileManager'); if (MonographFileManager::uploadedFileExists('copyeditingFile')) { $copyeditedFileId = MonographFileManager::uploadCopyeditResponseFile($monograph->getId(), 'copyeditingFile', $copyeditedFileId); if (isset($copyeditedFileId)) { // Amend the copyediting signoff with the new file $signoff->setFileId($copyeditedFileId); $signoff->setDateCompleted(Core::getCurrentDate()); $signoffDao->updateObject($signoff); $copyeditedFile =& $submissionFileDao->getLatestRevision($copyeditedFileId); // Transfer some of the original file's metadata over to the new file $copyeditedFile->setName($copyeditingFile->getLocalizedName(), Locale::getLocale()); $copyeditedFile->setGenreId($copyeditingFile->getGenreId()); $submissionFileDao->updateObject($copyeditedFile); } } return $copyeditedFileId; }