@@ -75,7 +76,7 @@ export default {
type: String,
required: true,
},
- /** One of the `PKPSubmission::STATUS_` constants. When set to `PKPSubmission::STATUS_QUEUED` or `PKPSubmission::STATUS_PUBLISHED` the issue selection will be hidden. */
+ /** One of the `PKPPublication::STATUS_` constants. When set to `PKPPublication::STATUS_QUEUED` or `PKPPublication::STATUS_PUBLISHED` the issue selection will be hidden. */
publicationStatus: {
type: Number,
required: true,
@@ -112,7 +113,7 @@ export default {
*/
button() {
let button = null;
- if (this.publicationStatus !== pkp.const.STATUS_PUBLISHED) {
+ if (this.publicationStatus !== pkp.const.PUBLICATION_STATUS_PUBLISHED) {
button = {
label: this.value ? this.changeIssueLabel : this.assignLabel,
};
@@ -128,9 +129,11 @@ export default {
*/
notice() {
let notice = '';
- if (this.publicationStatus === pkp.const.STATUS_PUBLISHED) {
+ if (this.publicationStatus === pkp.const.PUBLICATION_STATUS_PUBLISHED) {
notice = this.publishedNoticeBase;
- } else if (this.publicationStatus === pkp.const.STATUS_SCHEDULED) {
+ } else if (
+ this.publicationStatus === pkp.const.PUBLICATION_STATUS_SCHEDULED
+ ) {
notice = this.scheduledNoticeBase;
} else if (this.value) {
notice = this.assignedNoticeBase;
@@ -167,7 +170,7 @@ export default {
const workflowStore = useWorkflowStore();
workflowStore.workflowAssignToIssue({}, (finishedData) => {
- if (finishedData.data) {
+ if (finishedData?.data) {
this.currentValue = finishedData.data.issueId;
}
});
diff --git a/src/components/Form/mocks/field-select-issue.js b/src/components/Form/mocks/field-select-issue.js
deleted file mode 100644
index bac809934..000000000
--- a/src/components/Form/mocks/field-select-issue.js
+++ /dev/null
@@ -1,51 +0,0 @@
-export default {
- name: 'issueId',
- component: 'field-select-issue',
- label: 'Issue',
- publicationStatus: 1, // PKPSubmission::STATUS_QUEUED
- options: [
- {
- value: '',
- label: '',
- },
- {
- value: '',
- label: '--- Future Issues ---',
- },
- {
- value: 5,
- label: 'Vol 2 No 1 2019',
- },
- {
- value: 4,
- label: 'Vol 1 No 4 2018',
- },
- {
- value: '',
- label: '--- Back Issues ---',
- },
- {
- value: 3,
- label: 'Vol 1 No 3 2019',
- },
- {
- value: 2,
- label: 'Vol 1 No 2 2019',
- },
- {
- value: 1,
- label: 'Vol 1 No 1 2019',
- },
- ],
- value: '',
- assignLabel: 'Assign to Issue',
- assignedNoticeBase:
- 'This has been assigned to
{$issueName} but it has not been scheduled for publication.',
- changeIssueLabel: 'Change Issue',
- publishedNoticeBase:
- 'Published in
{$issueName}.',
- scheduledNoticeBase:
- 'Scheduled for publication in
{$issueName}.',
- unscheduledNotice: 'This has not been scheduled for publication in an issue.',
- unscheduleLabel: 'Unschedule',
-};
diff --git a/src/composables/useForm.js b/src/composables/useForm.js
index 50e9be85f..76e2d1312 100644
--- a/src/composables/useForm.js
+++ b/src/composables/useForm.js
@@ -601,6 +601,7 @@ export function useForm(_form = {}, {customSubmit} = {}) {
initEmptyForm,
addPage,
addGroup,
+ addField,
addFieldText,
addFieldSelect,
addFieldOptions,
diff --git a/src/composables/useLegacyGridUrl.test.js b/src/composables/useLegacyGridUrl.test.js
index 5b347c05e..858db9911 100644
--- a/src/composables/useLegacyGridUrl.test.js
+++ b/src/composables/useLegacyGridUrl.test.js
@@ -32,16 +32,4 @@ describe('useLegacyGridUrl', () => {
'http://mock/index.php/publicknowledge/$$$call$$$/grid/users/reviewer/reviewer-grid/read-review?submissionId=13&reviewAssignmentId=19&stageId=3',
);
});
-
- test('modals.publish.AssignToIssueHandler', () => {
- const {url} = useLegacyGridUrl({
- component: 'modals.publish.AssignToIssueHandler',
- op: 'assign',
- params: {submissionId: 13, publicationId: 14},
- });
-
- expect(url.value).toBe(
- 'http://mock/index.php/publicknowledge/$$$call$$$/modals/publish/assign-to-issue/assign?submissionId=13&publicationId=14',
- );
- });
});
diff --git a/src/managers/GalleyManager/useGalleyManagerConfig.js b/src/managers/GalleyManager/useGalleyManagerConfig.js
index c2f4d7af1..2fa36404d 100644
--- a/src/managers/GalleyManager/useGalleyManagerConfig.js
+++ b/src/managers/GalleyManager/useGalleyManagerConfig.js
@@ -85,7 +85,7 @@ export function useGalleyManagerConfig() {
const permittedActions = GalleyManagerConfiguration.actions
.filter((action) => {
if (
- publication.value.status === pkp.const.STATUS_PUBLISHED &&
+ publication.value.status === pkp.const.PUBLICATION_STATUS_PUBLISHED &&
GalleyManagerConfiguration.actionsRequiresUnpublishedState.includes(
action,
)
@@ -141,12 +141,14 @@ export function useGalleyManagerConfig() {
if (config.permittedActions.includes(Actions.GALLEY_EDIT)) {
const label =
- publication.status === pkp.const.STATUS_PUBLISHED
+ publication.status === pkp.const.PUBLICATION_STATUS_PUBLISHED
? t('common.view')
: t('common.edit');
const icon =
- publication.status === pkp.const.STATUS_PUBLISHED ? 'View' : 'Edit';
+ publication.status === pkp.const.PUBLICATION_STATUS_PUBLISHED
+ ? 'View'
+ : 'Edit';
actions.push({
label,
diff --git a/src/pages/workflow/components/publication/WorkflowPublicationVersionControl.vue b/src/pages/workflow/components/publication/WorkflowPublicationVersionControl.vue
index 4fbbf7eed..9012c19e1 100644
--- a/src/pages/workflow/components/publication/WorkflowPublicationVersionControl.vue
+++ b/src/pages/workflow/components/publication/WorkflowPublicationVersionControl.vue
@@ -31,19 +31,19 @@ const selectedPublication = computed(() =>
const statusProps = computed(() => {
const publication = selectedPublication.value;
if (
- publication.status === pkp.const.STATUS_QUEUED &&
+ publication.status === pkp.const.PUBLICATION_STATUS_QUEUED &&
publication.id === props.submission.currentPublicationId
) {
return {
label: t('publication.status.unscheduled'),
color: 'bg-stage-declined',
};
- } else if (publication.status === pkp.const.STATUS_SCHEDULED) {
+ } else if (publication.status === pkp.const.PUBLICATION_STATUS_SCHEDULED) {
return {
label: t('publication.status.scheduled'),
color: 'bg-stage-scheduled-for-publishing',
};
- } else if (publication.status === pkp.const.STATUS_PUBLISHED) {
+ } else if (publication.status === pkp.const.PUBLICATION_STATUS_PUBLISHED) {
return {
label: t('publication.status.published'),
color: 'bg-stage-published',
diff --git a/src/pages/workflow/components/publication/WorkflowVersionSideModal.vue b/src/pages/workflow/components/publication/WorkflowVersionSideModal.vue
index c68780c46..a3d51758c 100644
--- a/src/pages/workflow/components/publication/WorkflowVersionSideModal.vue
+++ b/src/pages/workflow/components/publication/WorkflowVersionSideModal.vue
@@ -1,11 +1,11 @@
- {{ t('publication.scheduledForPublication.versionStage.label') }}
+ {{ t('publication.scheduledForPublication.reviewDetails.label') }}
- {{ t('publication.scheduledForPublication.versionStage.description') }}
+ {{ t('publication.scheduledForPublication.reviewDetails.description') }}
@@ -29,11 +29,16 @@ const props = defineProps({
type: Function,
default: () => () => {},
},
+ issueCount: {
+ type: Number,
+ default: 0,
+ },
});
const {form, set} = useWorkflowVersionForm(
'publish',
props.onCloseFn,
props.onSubmitFn,
+ props.issueCount,
);
diff --git a/src/pages/workflow/composables/useWorkflowActions.js b/src/pages/workflow/composables/useWorkflowActions.js
index 839ebdda3..87c4a32aa 100644
--- a/src/pages/workflow/composables/useWorkflowActions.js
+++ b/src/pages/workflow/composables/useWorkflowActions.js
@@ -4,6 +4,7 @@ import {useLocalize} from '@/composables/useLocalize';
import {useUrl} from '@/composables/useUrl';
import {useFetch} from '@/composables/useFetch';
import {useLegacyGridUrl} from '@/composables/useLegacyGridUrl';
+import {useApp} from '@/composables/useApp';
import WorkflowModalChangeSubmissionLanguage from '@/pages/workflow/modals/WorkflowChangeSubmissionLanguageModal.vue';
import WorkflowVersionDialogBody from '@/pages/workflow/components/publication/WorkflowVersionDialogBody.vue';
@@ -37,28 +38,6 @@ export function useWorkflowActions() {
redirectToPage();
}
- function workflowAssignToIssue(
- {submission, selectedPublication},
- finishedCallback,
- ) {
- const {openLegacyModal} = useLegacyGridUrl({
- component: 'modals.publish.AssignToIssueHandler',
- op: 'assign',
- params: {
- submissionId: submission.id,
- publicationId: selectedPublication.id,
- },
- });
-
- openLegacyModal(
- {
- title: t('publication.selectIssue'),
- closeOnFormSuccessId: pkp.const.FORM_ASSIGN_TO_ISSUE,
- },
- finishedCallback,
- );
- }
-
function workflowViewActivityLog({submission}, finishedCallback) {
const {openLegacyModal} = useLegacyGridUrl({
component: 'informationCenter.SubmissionInformationCenterHandler',
@@ -84,8 +63,29 @@ export function useWorkflowActions() {
);
}
+ /**
+ * Open a modal to assign publication stage and optionally assign to an issue.
+ *
+ * This function combines version assignment with issue assignment in a single modal.
+ * The modal will show:
+ * - Version stage selection (required for unassigned versions)
+ * - Version significance selection (major/minor)
+ * - Issue assignment options (only if issues exist in the journal)
+ *
+ * Issue assignment options include:
+ * - No issue assignment (publish immediately)
+ * - Assign to future issue and publish immediately
+ * - Assign to future issue and schedule only
+ * - Assign to current/back issue (publish immediately)
+ *
+ * @param {Object} params - Parameters object
+ * @param {Object} params.selectedPublication - The selected publication
+ * @param {Object} params.submission - The submission object
+ * @param {Object} params.pageInitConfig - Page initialization config containing issue count
+ * @param {Function} finishedCallback - Callback function to execute when finished
+ */
function workflowAssignPublicationStage(
- {selectedPublication, submission},
+ {selectedPublication, submission, pageInitConfig},
finishedCallback,
) {
const {openSideModal, closeSideModal} = useModal();
@@ -94,9 +94,14 @@ export function useWorkflowActions() {
closeSideModal(WorkflowVersionSideModal);
}
+ // Get issue count from pageInitConfig if available
+ // This determines whether to show issue assignment options
+ const issueCount = pageInitConfig?.publicationSettings?.countIssues || 0;
+
openSideModal(WorkflowVersionSideModal, {
onCloseFn,
onSubmitFn: finishedCallback,
+ issueCount,
});
}
@@ -104,10 +109,23 @@ export function useWorkflowActions() {
{pageInitConfig, selectedPublication, submission},
finishedCallback,
) {
- // if version is unassigned, we need to assign it to a publication stage first
- if (!selectedPublication.versionStage) {
+ const {isOJS} = useApp();
+
+ // if version is unassigned
+ // or OJS specific the publication status not to
+ // STATUS_READY_TO_PUBLISH or STATUS_READY_TO_SCHEDULE,
+ // we need to assign the publication stage and status (for issue or issueless context)
+ const requirePublicationStage = isOJS()
+ ? !selectedPublication.versionStage ||
+ ![
+ pkp.const.PUBLICATION_STATUS_READY_TO_PUBLISH,
+ pkp.const.PUBLICATION_STATUS_READY_TO_SCHEDULE,
+ ].includes(selectedPublication.status)
+ : !selectedPublication.versionStage;
+
+ if (requirePublicationStage) {
return workflowAssignPublicationStage(
- {selectedPublication, submission},
+ {selectedPublication, submission, pageInitConfig},
(publicationData) =>
workflowAssignToIssueAndScheduleForPublication(
{pageInitConfig, selectedPublication: publicationData, submission},
@@ -116,72 +134,10 @@ export function useWorkflowActions() {
);
}
- // if there are no issues, we can schedule the publication immediately
- if (pageInitConfig.publicationSettings.countIssues === 0) {
- workflowScheduleForPublication(
- {submission, selectedPublication},
- finishedCallback,
- );
-
- return;
- }
-
- // If the publication is marked as published,
- // and not assigned to an issue, or assigned to an issue that is not published (e.g. future issue),
- // we can publish the publication immediately as issueless or continuous publication
- if (
- selectedPublication.published &&
- (selectedPublication.issueId === null ||
- !pageInitConfig.publicationSettings.issuePublishedStatus[
- selectedPublication.issueId
- ])
- ) {
- workflowScheduleForPublication(
- {submission, selectedPublication},
- finishedCallback,
- );
- return;
- }
-
- if (selectedPublication.issueId === null || selectedPublication.published) {
- const {url} = useLegacyGridUrl({
- component: 'modals.publish.AssignToIssueHandler',
- op: 'assign',
- params: {
- submissionId: submission.id,
- publicationId: selectedPublication.id,
- },
- });
- const {openSideModal} = useModal();
-
- openSideModal(
- 'LegacyAjax',
- {
- legacyOptions: {
- title: t('publication.selectIssue'),
- url,
- closeOnFormSuccessId: pkp.const.FORM_ASSIGN_TO_ISSUE,
- },
- },
- {
- onClose: async ({formId, data}) => {
- if (data?.issueId || data?.published) {
- workflowScheduleForPublication(
- {submission, selectedPublication},
- finishedCallback,
- );
- } else {
- finishedCallback();
- }
- },
- },
- );
- } else {
- workflowScheduleForPublication(
- {submission, selectedPublication},
- finishedCallback,
- );
- }
+ workflowScheduleForPublication(
+ {submission, selectedPublication},
+ finishedCallback,
+ );
}
function workflowScheduleForPublication(
@@ -346,7 +302,6 @@ export function useWorkflowActions() {
return {
workflowViewPublishedSubmission,
- workflowAssignToIssue,
workflowViewActivityLog,
workflowViewLibrary,
workflowAssignToIssueAndScheduleForPublication,
diff --git a/src/pages/workflow/composables/useWorkflowConfig/workflowConfigAuthorOJS.js b/src/pages/workflow/composables/useWorkflowConfig/workflowConfigAuthorOJS.js
index 203b78498..b059a3767 100644
--- a/src/pages/workflow/composables/useWorkflowConfig/workflowConfigAuthorOJS.js
+++ b/src/pages/workflow/composables/useWorkflowConfig/workflowConfigAuthorOJS.js
@@ -274,7 +274,9 @@ export const PublicationConfig = {
selectedPublication,
}) => {
const items = [];
- if (selectedPublication.status === pkp.const.STATUS_PUBLISHED) {
+ if (
+ selectedPublication.status === pkp.const.PUBLICATION_STATUS_PUBLISHED
+ ) {
items.push({
component: 'WorkflowPublicationEditDisabled',
props: {},
diff --git a/src/pages/workflow/composables/useWorkflowConfig/workflowConfigEditorialOJS.js b/src/pages/workflow/composables/useWorkflowConfig/workflowConfigEditorialOJS.js
index 7de5afac9..7328dbed6 100644
--- a/src/pages/workflow/composables/useWorkflowConfig/workflowConfigEditorialOJS.js
+++ b/src/pages/workflow/composables/useWorkflowConfig/workflowConfigEditorialOJS.js
@@ -716,7 +716,9 @@ export const PublicationConfig = {
selectedPublication,
}) => {
const items = [];
- if (selectedPublication.status === pkp.const.STATUS_PUBLISHED) {
+ if (
+ selectedPublication.status === pkp.const.PUBLICATION_STATUS_PUBLISHED
+ ) {
items.push({
component: 'WorkflowPublicationEditDisabled',
props: {},
@@ -768,7 +770,13 @@ export const PublicationConfig = {
if (!permissions.canPublish) {
return [];
}
- if (selectedPublication.status === pkp.const.STATUS_QUEUED) {
+ if (
+ selectedPublication.status === pkp.const.PUBLICATION_STATUS_QUEUED ||
+ selectedPublication.status ===
+ pkp.const.PUBLICATION_STATUS_READY_TO_PUBLISH ||
+ selectedPublication.status ===
+ pkp.const.PUBLICATION_STATUS_READY_TO_SCHEDULE
+ ) {
if (
hasSubmissionPassedStage(
submission,
@@ -799,7 +807,9 @@ export const PublicationConfig = {
WorkflowActions.WORKFLOW_ASSIGN_TO_ISSUE_AND_SCHEDULE_FOR_PUBLICATION,
},
});
- } else if (selectedPublication.status === pkp.const.STATUS_SCHEDULED) {
+ } else if (
+ selectedPublication.status === pkp.const.PUBLICATION_STATUS_SCHEDULED
+ ) {
items.push({
component: 'WorkflowActionButton',
props: {
@@ -817,7 +827,9 @@ export const PublicationConfig = {
action: WorkflowActions.WORKFLOW_UNSCHEDULE_PUBLICATION,
},
});
- } else if (selectedPublication.status === pkp.const.STATUS_PUBLISHED) {
+ } else if (
+ selectedPublication.status === pkp.const.PUBLICATION_STATUS_PUBLISHED
+ ) {
items.push({
component: 'WorkflowActionButton',
props: {
diff --git a/src/pages/workflow/composables/useWorkflowConfig/workflowConfigEditorialOMP.js b/src/pages/workflow/composables/useWorkflowConfig/workflowConfigEditorialOMP.js
index 7760173cf..cc8160d1c 100644
--- a/src/pages/workflow/composables/useWorkflowConfig/workflowConfigEditorialOMP.js
+++ b/src/pages/workflow/composables/useWorkflowConfig/workflowConfigEditorialOMP.js
@@ -479,7 +479,7 @@ export const PublicationConfig = {
if (!permissions.canPublish) {
return [];
}
- if (selectedPublication.status === pkp.const.STATUS_QUEUED) {
+ if (selectedPublication.status === pkp.const.PUBLICATION_STATUS_QUEUED) {
if (
hasSubmissionPassedStage(
submission,
@@ -506,7 +506,9 @@ export const PublicationConfig = {
action: WorkflowActions.WORKFLOW_SCHEDULE_FOR_PUBLICATION,
},
});
- } else if (selectedPublication.status === pkp.const.STATUS_SCHEDULED) {
+ } else if (
+ selectedPublication.status === pkp.const.PUBLICATION_STATUS_SCHEDULED
+ ) {
items.push({
component: 'WorkflowActionButton',
props: {
@@ -524,7 +526,9 @@ export const PublicationConfig = {
action: WorkflowActions.WORKFLOW_UNSCHEDULE_PUBLICATION,
},
});
- } else if (selectedPublication.status === pkp.const.STATUS_PUBLISHED) {
+ } else if (
+ selectedPublication.status === pkp.const.PUBLICATION_STATUS_PUBLISHED
+ ) {
items.push({
component: 'WorkflowActionButton',
props: {
diff --git a/src/pages/workflow/composables/useWorkflowConfig/workflowConfigEditorialOPS.js b/src/pages/workflow/composables/useWorkflowConfig/workflowConfigEditorialOPS.js
index 72c693249..7f502a80d 100644
--- a/src/pages/workflow/composables/useWorkflowConfig/workflowConfigEditorialOPS.js
+++ b/src/pages/workflow/composables/useWorkflowConfig/workflowConfigEditorialOPS.js
@@ -220,7 +220,7 @@ export const PublicationConfig = {
if (!permissions.canPublish) {
return [];
}
- if (selectedPublication.status === pkp.const.STATUS_QUEUED) {
+ if (selectedPublication.status === pkp.const.PUBLICATION_STATUS_QUEUED) {
if (
hasSubmissionPassedStage(
submission,
@@ -247,7 +247,9 @@ export const PublicationConfig = {
action: WorkflowActions.WORKFLOW_SCHEDULE_FOR_PUBLICATION,
},
});
- } else if (selectedPublication.status === pkp.const.STATUS_SCHEDULED) {
+ } else if (
+ selectedPublication.status === pkp.const.PUBLICATION_STATUS_SCHEDULED
+ ) {
items.push({
component: 'WorkflowActionButton',
props: {
@@ -265,7 +267,9 @@ export const PublicationConfig = {
action: WorkflowActions.WORKFLOW_UNSCHEDULE_PUBLICATION,
},
});
- } else if (selectedPublication.status === pkp.const.STATUS_PUBLISHED) {
+ } else if (
+ selectedPublication.status === pkp.const.PUBLICATION_STATUS_PUBLISHED
+ ) {
items.push({
component: 'WorkflowActionButton',
props: {
diff --git a/src/pages/workflow/composables/useWorkflowPermissions.js b/src/pages/workflow/composables/useWorkflowPermissions.js
index 221ebf2e3..04a5194c7 100644
--- a/src/pages/workflow/composables/useWorkflowPermissions.js
+++ b/src/pages/workflow/composables/useWorkflowPermissions.js
@@ -52,7 +52,8 @@ export function useWorkflowPermissions({submission, selectedPublication}) {
if (
selectedPublication.value &&
- selectedPublication.value?.status === pkp.const.STATUS_PUBLISHED
+ selectedPublication.value?.status ===
+ pkp.const.PUBLICATION_STATUS_PUBLISHED
) {
canEditPublication = false;
}
diff --git a/src/pages/workflow/composables/useWorkflowVersionForm.js b/src/pages/workflow/composables/useWorkflowVersionForm.js
index a017385df..0254cddbc 100644
--- a/src/pages/workflow/composables/useWorkflowVersionForm.js
+++ b/src/pages/workflow/composables/useWorkflowVersionForm.js
@@ -5,6 +5,7 @@ import {useFetch} from '@/composables/useFetch';
import {useLocalize} from '@/composables/useLocalize';
import {useSubmission} from '@/composables/useSubmission';
import {useWorkflowStore} from '@/pages/workflow/workflowStore';
+import {useApp} from '@/composables/useApp';
const VERSION_MODE = {
CREATE: 'createNewVersion', // the "Create New Version" action in the publication workflow menu
@@ -48,12 +49,14 @@ export function useWorkflowVersionForm(
versionMode = 'createNewVersion',
closeDialog = () => {},
onSubmitFn = null,
+ issueCount = 0,
) {
const store = useWorkflowStore();
const {t} = useLocalize();
const {getLatestPublication} = useSubmission();
let publications = [];
let latestPublication = null;
+ const {isOJS} = useApp();
// Determine the mode based on the versionMode parameter
// versionMode can be one of 'createNewVersion', 'sendToTextEditor', or 'publish'
@@ -92,9 +95,45 @@ export function useWorkflowVersionForm(
});
const {apiUrl: versionUrl} = useUrl(
- `submissions/${store.submission.id}/publications/${publicationId}/version`,
+ isOJS() && modeState.isPublishMode
+ ? `submissions/${store.submission.id}/publications/${publicationId}`
+ : `submissions/${store.submission.id}/publications/${publicationId}/version`,
);
+ // Prepare request body with version data
+ const requestBody = {
+ versionStage: formData.versionStage,
+ versionIsMinor: formData.versionIsMinor,
+ };
+
+ if (isOJS() && modeState.isPublishMode) {
+ // if the issue count is 0, e.g. issueless context,
+ // we can safely set the issueId to null and status to STATUS_READY_TO_PUBLISH
+ if (issueCount === 0) {
+ requestBody.issueId = null;
+ requestBody.status = pkp.const.PUBLICATION_STATUS_READY_TO_PUBLISH;
+ }
+ // Add issue assignment data if in publish mode and issue assignment is provided
+ else {
+ const issueData = formData.issueId;
+
+ // cehck if the issue selection is valid
+ if (!issueData || !issueData.isValid) {
+ return {
+ data: null,
+ validationError: {
+ issueId: [
+ t('publication.assignToIssue.validation.issueRequired'),
+ ],
+ },
+ };
+ }
+
+ requestBody.issueId = issueData.issueId;
+ requestBody.status = issueData.publicationStatus;
+ }
+ }
+
const {
fetch,
data: publicationData,
@@ -102,10 +141,7 @@ export function useWorkflowVersionForm(
isSuccess,
} = useFetch(versionUrl, {
method: shouldCreateNewVersion ? 'POST' : 'PUT',
- body: {
- versionStage: formData.versionStage,
- versionIsMinor: formData.versionIsMinor,
- },
+ body: requestBody,
expectValidationError: true,
});
@@ -138,6 +174,7 @@ export function useWorkflowVersionForm(
const {
form,
initEmptyForm,
+ addField,
addFieldSelect,
addPage,
addGroup,
@@ -162,6 +199,15 @@ export function useWorkflowVersionForm(
}
function getVersionIsMinorField({allowMinorVersion, currentValue}) {
+ const versionMinorValue =
+ modeState.isPublishMode && store.selectedPublication?.versionStage
+ ? store.selectedPublication.versionMinor
+ ? 'true'
+ : 'false'
+ : currentValue === 'true' && !allowMinorVersion
+ ? 'false'
+ : currentValue;
+
return {
label: t('publication.revisionSignificance.label'),
description: t('publication.revisionSignificance.description'),
@@ -175,8 +221,7 @@ export function useWorkflowVersionForm(
],
size: 'large',
isRequired: modeState.isPublishMode,
- value:
- currentValue === 'true' && !allowMinorVersion ? 'false' : currentValue,
+ value: versionMinorValue,
showWhen: modeState.isTextEditorMode
? ['sendToVersion', getUnassignedVersions()]
: undefined,
@@ -227,10 +272,12 @@ export function useWorkflowVersionForm(
showErrorFooter: false,
spacingVariant: 'fullWidth',
});
+
addPage('default', {
submitButton: {label: t('common.confirm')},
cancelButton: {label: t('common.cancel')},
});
+
addGroup('default');
onMounted(() => {
@@ -266,6 +313,7 @@ export function useWorkflowVersionForm(
description: t('publication.versionStage.description'),
options: store.versionStageOptions,
size: 'large',
+ value: store.selectedPublication?.versionStage || null,
isRequired: modeState.isPublishMode,
showWhen: modeState.isTextEditorMode
? ['sendToVersion', getUnassignedVersions()]
@@ -282,10 +330,33 @@ export function useWorkflowVersionForm(
}),
);
+ // Issue assignment fields only visible when
+ // for OJS
+ // it's in publish mode
+ // have issues
+ if (modeState.isPublishMode && issueCount > 0 && isOJS()) {
+ addField('issueId', {
+ component: 'FieldIssueSelection',
+ issueCount: issueCount,
+ publication: store.selectedPublication,
+ isRequired: true,
+ });
+ }
+
setValue(
'versionSource',
modeState.isCreateMode ? latestPublication?.id : null,
);
+
+ // at initial setup, will set the version information(major/minor) only when
+ // at the publish mode
+ // and already have a verison stage assigned
+ if (modeState.isPublishMode && store.selectedPublication?.versionStage) {
+ setValue(
+ 'versionIsMinor',
+ store.selectedPublication?.versionMinor ? 'true' : 'false',
+ );
+ }
});
watch(