|
56 | 56 | use PKP\submission\PKPSubmission;
|
57 | 57 | use PKP\submission\reviewAssignment\ReviewAssignment;
|
58 | 58 | use PKP\userGroup\UserGroup;
|
| 59 | +use PKP\observers\events\MetadataChanged; |
| 60 | + |
59 | 61 |
|
60 | 62 | class PKPSubmissionController extends PKPBaseController
|
61 | 63 | {
|
@@ -1100,13 +1102,6 @@ public function editPublication(Request $illuminateRequest): JsonResponse
|
1100 | 1102 | ], Response::HTTP_FORBIDDEN);
|
1101 | 1103 | }
|
1102 | 1104 |
|
1103 |
| - // Publications can not be edited when they are published |
1104 |
| - if ($publication->getData('status') === PKPSubmission::STATUS_PUBLISHED) { |
1105 |
| - return response()->json([ |
1106 |
| - 'error' => __('api.publication.403.cantEditPublished'), |
1107 |
| - ], Response::HTTP_FORBIDDEN); |
1108 |
| - } |
1109 |
| - |
1110 | 1105 | // Prevent users from editing publications if they do not have permission. Except for admins.
|
1111 | 1106 | $userRoles = $this->getAuthorizedContextObject(Application::ASSOC_TYPE_USER_ROLES);
|
1112 | 1107 | if (!in_array(Role::ROLE_ID_SITE_ADMIN, $userRoles) && !Repo::submission()->canEditPublication($submission->getId(), $currentUser->getId())) {
|
@@ -1139,6 +1134,8 @@ public function editPublication(Request $illuminateRequest): JsonResponse
|
1139 | 1134 |
|
1140 | 1135 | Repo::publication()->edit($publication, $params);
|
1141 | 1136 | $publication = Repo::publication()->get($publication->getId());
|
| 1137 | + event(new MetadataChanged($submission)); |
| 1138 | + |
1142 | 1139 |
|
1143 | 1140 | $userGroups = Repo::userGroup()->getCollector()
|
1144 | 1141 | ->filterByContextIds([$submission->getData('contextId')])
|
@@ -1400,13 +1397,6 @@ public function addContributor(Request $illuminateRequest): JsonResponse
|
1400 | 1397 | ], Response::HTTP_FORBIDDEN);
|
1401 | 1398 | }
|
1402 | 1399 |
|
1403 |
| - // Publications can not be edited when they are published |
1404 |
| - if ($publication->getData('status') === PKPSubmission::STATUS_PUBLISHED) { |
1405 |
| - return response()->json([ |
1406 |
| - 'error' => __('api.publication.403.cantEditPublished'), |
1407 |
| - ], Response::HTTP_FORBIDDEN); |
1408 |
| - } |
1409 |
| - |
1410 | 1400 | $params = $this->convertStringsToSchema(PKPSchemaService::SCHEMA_AUTHOR, $illuminateRequest->input());
|
1411 | 1401 | $params['publicationId'] = $publication->getId();
|
1412 | 1402 |
|
@@ -1449,12 +1439,6 @@ public function deleteContributor(Request $illuminateRequest): JsonResponse
|
1449 | 1439 | ], Response::HTTP_NOT_FOUND);
|
1450 | 1440 | }
|
1451 | 1441 |
|
1452 |
| - // Publications can not be edited when they are published |
1453 |
| - if ($publication->getData('status') === PKPSubmission::STATUS_PUBLISHED) { |
1454 |
| - return response()->json([ |
1455 |
| - 'error' => __('api.publication.403.cantEditPublished'), |
1456 |
| - ], Response::HTTP_FORBIDDEN); |
1457 |
| - } |
1458 | 1442 |
|
1459 | 1443 | if ($submission->getId() !== $publication->getData('submissionId')) {
|
1460 | 1444 | return response()->json([
|
@@ -1511,13 +1495,6 @@ public function editContributor(Request $illuminateRequest): JsonResponse
|
1511 | 1495 | ], Response::HTTP_FORBIDDEN);
|
1512 | 1496 | }
|
1513 | 1497 |
|
1514 |
| - // Publications can not be edited when they are published |
1515 |
| - if ($publication->getData('status') === PKPSubmission::STATUS_PUBLISHED) { |
1516 |
| - return response()->json([ |
1517 |
| - 'error' => __('api.publication.403.cantEditPublished'), |
1518 |
| - ], Response::HTTP_FORBIDDEN); |
1519 |
| - } |
1520 |
| - |
1521 | 1498 | $params = $this->convertStringsToSchema(PKPSchemaService::SCHEMA_AUTHOR, $illuminateRequest->input());
|
1522 | 1499 | $params['id'] = $author->getId();
|
1523 | 1500 |
|
@@ -1580,13 +1557,6 @@ public function saveContributorsOrder(Request $illuminateRequest): JsonResponse
|
1580 | 1557 | ], Response::HTTP_FORBIDDEN);
|
1581 | 1558 | }
|
1582 | 1559 |
|
1583 |
| - // Publications can not be edited when they are published |
1584 |
| - if ($publication->getData('status') === PKPSubmission::STATUS_PUBLISHED) { |
1585 |
| - return response()->json([ |
1586 |
| - 'error' => __('api.publication.403.cantEditPublished'), |
1587 |
| - ], Response::HTTP_FORBIDDEN); |
1588 |
| - } |
1589 |
| - |
1590 | 1560 | if (!empty($params['sortedAuthors'])) {
|
1591 | 1561 | $authors = [];
|
1592 | 1562 | foreach ($params['sortedAuthors'] as $author) {
|
|
0 commit comments