21 use \PKP\Services\PKPPublicationService;
51 $publication = $args[1];
53 $dependencies = $args[3];
54 $request = $dependencies[
'request'];
55 $dispatcher = $request->getDispatcher();
58 $submission = !empty($args[
'submission'])
60 : $args[
'submission'] =
Services::get(
'submission')->get($publication->getData(
'submissionId'));
62 $submissionContext = !empty($dependencies[
'context'])
63 ? $dependencies[
'context']
64 : $dependencies[
'context'] =
Services::get(
'context')->get($submission->getData(
'contextId'));
66 foreach ($props as $prop) {
69 $values[$prop] = array_map(
70 function($galley) use ($dependencies) {
71 return Services::get(
'galley')->getSummaryProperties($galley, $dependencies);
73 $publication->getData(
'galleys')
77 $values[$prop] = $dispatcher->url(
80 $submissionContext->getData(
'urlPath'),
83 [$submission->getBestId(),
'version', $publication->getId()]
106 $allowedLocales = $args[3];
107 $primaryLocale = $args[4];
111 if (isset($props[
'sectionId'])) {
112 $section =
Application::get()->getSectionDAO()->getById($props[
'sectionId']);
114 $errors[
'sectionId'] = [__(
'publication.invalidSection')];
119 if (!$section && isset($props[
'id'])) {
120 $publication =
Services::get(
'publication')->get($props[
'id']);
122 $section = $sectionDao->getById($publication->getData(
'sectionId'));
128 if ($action === VALIDATE_ACTION_ADD && !$section->getData(
'abstractsNotRequired') && empty($props[
'abstract'])) {
129 $errors[
'abstract'][$primaryLocale] = [__(
'author.submit.form.abstractRequired')];
132 if (isset($props[
'abstract']) && empty($errors[
'abstract'])) {
135 if (!$section->getData(
'abstractsNotRequired')) {
136 if (empty($props[
'abstract'][$primaryLocale])) {
137 if (!isset($errors[
'abstract'])) {
138 $errors[
'abstract'] = [];
141 $errors[
'abstract'][$primaryLocale] = [__(
'author.submit.form.abstractRequired')];
146 foreach ($allowedLocales as $localeKey) {
147 if (empty($props[
'abstract'][$localeKey])) {
150 $wordCount = count(preg_split(
'/\s+/', trim(str_replace(
' ',
' ', strip_tags($props[
'abstract'][$localeKey])))));
151 $wordCountLimit = $section->getData(
'wordCount');
152 if ($wordCountLimit && $wordCount > $wordCountLimit) {
153 if (!isset($errors[
'abstract'])) {
154 $errors[
'abstract'] = [];
156 $errors[
'abstract'][$localeKey] = [__(
'publication.wordCountLong', [
'limit' => $wordCountLimit,
'count' => $wordCount])];
163 if (isset($props[
'issueId']) && empty($errors[
'issueId'])) {
166 $errors[
'issueId'] = [__(
'publication.invalidIssue')];
186 $publication = $args[1];
189 if (!$publication->getData(
'issueId') || !
Services::get(
'issue')->get($publication->getData(
'issueId'))) {
190 $errors[
'issueId'] = __(
'publication.required.issue');
205 $newPublication = $args[0];
206 $oldPublication = $args[1];
209 $galleys = $oldPublication->getData(
'galleys');
210 if (!empty($galleys)) {
211 foreach ($galleys as $galley) {
212 $newGalley = clone $galley;
213 $newGalley->setData(
'id',
null);
214 $newGalley->setData(
'publicationId', $newPublication->getId());
219 $newPublication->setData(
'galleys', $this->
get($newPublication->getId())->getData(
'galleys'));
232 $newPublication = $args[0];
233 $oldPublication = $args[1];
238 $issue =
Services::get(
'issue')->get($newPublication->getData(
'issueId'));
239 if ($issue && !$issue->getData(
'published')) {
240 $newPublication->setData(
'datePublished',
'');
241 $newPublication->setData(
'status', STATUS_SCHEDULED);
254 $publication = $args[0];
256 $galleysIterator =
Services::get(
'galley')->getMany([
'publicationIds' => $publication->getId()]);
257 foreach ($galleysIterator as $galley) {