From 9e0ee8be7a000a2e511240af7642e3a126234faa Mon Sep 17 00:00:00 2001 From: Touhidur Rahman Date: Mon, 4 Aug 2025 18:09:05 +0600 Subject: [PATCH 1/6] pkp/pkp-lib#9295 refactor to remove publish column and depend on new status as STATUS_READY_TO_PUBLISH --- public/globals.js | 1 + src/components/Form/fields/FieldSelectIssue.vue | 2 +- .../workflow/composables/useWorkflowActions.js | 14 ++++++++++---- .../workflowConfigEditorialOJS.js | 5 ++++- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/public/globals.js b/public/globals.js index ff87fcc1f..1d310a651 100644 --- a/public/globals.js +++ b/public/globals.js @@ -100,6 +100,7 @@ window.pkp = { STATUS_PUBLISHED: 3, STATUS_DECLINED: 4, STATUS_SCHEDULED: 5, + STATUS_READY_TO_PUBLISH: 6, WORKFLOW_STAGE_ID_SUBMISSION: 1, WORKFLOW_STAGE_ID_INTERNAL_REVIEW: 2, WORKFLOW_STAGE_ID_EXTERNAL_REVIEW: 3, diff --git a/src/components/Form/fields/FieldSelectIssue.vue b/src/components/Form/fields/FieldSelectIssue.vue index 9dffd4d5f..e87f0d0e5 100644 --- a/src/components/Form/fields/FieldSelectIssue.vue +++ b/src/components/Form/fields/FieldSelectIssue.vue @@ -167,7 +167,7 @@ export default { const workflowStore = useWorkflowStore(); workflowStore.workflowAssignToIssue({}, (finishedData) => { - if (finishedData.data) { + if (finishedData?.data) { this.currentValue = finishedData.data.issueId; } }); diff --git a/src/pages/workflow/composables/useWorkflowActions.js b/src/pages/workflow/composables/useWorkflowActions.js index 839ebdda3..26b5fc0b4 100644 --- a/src/pages/workflow/composables/useWorkflowActions.js +++ b/src/pages/workflow/composables/useWorkflowActions.js @@ -126,11 +126,11 @@ export function useWorkflowActions() { return; } - // If the publication is marked as published, + // If the publication is marked as ready to publish, // 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.status === pkp.const.STATUS_READY_TO_PUBLISH && (selectedPublication.issueId === null || !pageInitConfig.publicationSettings.issuePublishedStatus[ selectedPublication.issueId @@ -143,7 +143,10 @@ export function useWorkflowActions() { return; } - if (selectedPublication.issueId === null || selectedPublication.published) { + if ( + selectedPublication.issueId === null || + selectedPublication.status === pkp.const.STATUS_READY_TO_PUBLISH + ) { const {url} = useLegacyGridUrl({ component: 'modals.publish.AssignToIssueHandler', op: 'assign', @@ -165,7 +168,10 @@ export function useWorkflowActions() { }, { onClose: async ({formId, data}) => { - if (data?.issueId || data?.published) { + if ( + data?.issueId || + data?.status === pkp.const.STATUS_READY_TO_PUBLISH + ) { workflowScheduleForPublication( {submission, selectedPublication}, finishedCallback, diff --git a/src/pages/workflow/composables/useWorkflowConfig/workflowConfigEditorialOJS.js b/src/pages/workflow/composables/useWorkflowConfig/workflowConfigEditorialOJS.js index 7de5afac9..ab5be612b 100644 --- a/src/pages/workflow/composables/useWorkflowConfig/workflowConfigEditorialOJS.js +++ b/src/pages/workflow/composables/useWorkflowConfig/workflowConfigEditorialOJS.js @@ -768,7 +768,10 @@ export const PublicationConfig = { if (!permissions.canPublish) { return []; } - if (selectedPublication.status === pkp.const.STATUS_QUEUED) { + if ( + selectedPublication.status === pkp.const.STATUS_QUEUED || + selectedPublication.status === pkp.const.STATUS_READY_TO_PUBLISH + ) { if ( hasSubmissionPassedStage( submission, From 2c6bfe478c6f1ea569c7ce924339856bb5e6b785 Mon Sep 17 00:00:00 2001 From: Touhidur Rahman Date: Wed, 6 Aug 2025 23:04:48 +0600 Subject: [PATCH 2/6] pkp/pkp-lib#9295 separate component for issue selection --- public/globals.js | 1 - src/components/Form/FormGroup.vue | 6 +- .../Form/fields/FieldIssueSelection.vue | 396 ++++++++++++++++++ .../Form/fields/FieldSelectIssue.vue | 1 + src/composables/useForm.js | 1 + src/composables/useLegacyGridUrl.test.js | 20 +- .../publication/WorkflowVersionSideModal.vue | 9 +- .../composables/useWorkflowActions.js | 245 +++++++---- .../workflowConfigEditorialOJS.js | 3 +- .../composables/useWorkflowVersionForm.js | 59 ++- 10 files changed, 628 insertions(+), 113 deletions(-) create mode 100644 src/components/Form/fields/FieldIssueSelection.vue diff --git a/public/globals.js b/public/globals.js index 1d310a651..ff87fcc1f 100644 --- a/public/globals.js +++ b/public/globals.js @@ -100,7 +100,6 @@ window.pkp = { STATUS_PUBLISHED: 3, STATUS_DECLINED: 4, STATUS_SCHEDULED: 5, - STATUS_READY_TO_PUBLISH: 6, WORKFLOW_STAGE_ID_SUBMISSION: 1, WORKFLOW_STAGE_ID_INTERNAL_REVIEW: 2, WORKFLOW_STAGE_ID_EXTERNAL_REVIEW: 3, diff --git a/src/components/Form/FormGroup.vue b/src/components/Form/FormGroup.vue index afe9b2a1e..335c6ec10 100644 --- a/src/components/Form/FormGroup.vue +++ b/src/components/Form/FormGroup.vue @@ -88,8 +88,9 @@ import FieldRadioInput from './fields/FieldRadioInput.vue'; import FieldRichTextarea from './fields/FieldRichTextarea.vue'; import FieldRichText from './fields/FieldRichText.vue'; import FieldSelect from './fields/FieldSelect.vue'; -import FieldSelectIssue from './fields/FieldSelectIssue.vue'; +// import FieldSelectIssue from './fields/FieldSelectIssue.vue'; import FieldSelectIssues from './fields/FieldSelectIssues.vue'; +import FieldIssueSelection from './fields/FieldIssueSelection.vue'; import FieldSelectSubmissions from './fields/FieldSelectSubmissions.vue'; import FieldSelectUsers from './fields/FieldSelectUsers.vue'; import FieldShowEnsuringLink from './fields/FieldShowEnsuringLink.vue'; @@ -125,8 +126,9 @@ export default { FieldRichTextarea, FieldRichText, FieldSelect, - FieldSelectIssue, + // FieldSelectIssue, FieldSelectIssues, + FieldIssueSelection, FieldSelectSubmissions, FieldSelectUsers, FieldShowEnsuringLink, diff --git a/src/components/Form/fields/FieldIssueSelection.vue b/src/components/Form/fields/FieldIssueSelection.vue new file mode 100644 index 000000000..1d982d4e9 --- /dev/null +++ b/src/components/Form/fields/FieldIssueSelection.vue @@ -0,0 +1,396 @@ + + + + + diff --git a/src/components/Form/fields/FieldSelectIssue.vue b/src/components/Form/fields/FieldSelectIssue.vue index e87f0d0e5..9f5b975ac 100644 --- a/src/components/Form/fields/FieldSelectIssue.vue +++ b/src/components/Form/fields/FieldSelectIssue.vue @@ -1,3 +1,4 @@ + @@ -242,6 +244,13 @@ export default { } this.$emit('set-errors', {...newErrors}); }, + + /** + * Forward field required events to the form page + */ + setFieldRequired: function (fieldName, isRequired) { + this.$emit('set-field-required', fieldName, isRequired); + }, }, }; diff --git a/src/components/Form/FormPage.vue b/src/components/Form/FormPage.vue index 836b181e8..4930a3c5e 100644 --- a/src/components/Form/FormPage.vue +++ b/src/components/Form/FormPage.vue @@ -13,6 +13,7 @@ :form-id="formId" @change="fieldChanged" @set-errors="setErrors" + @set-field-required="setFieldRequired" /> diff --git a/src/components/Form/fields/FieldIssueSelection.vue b/src/components/Form/fields/FieldIssueSelection.vue index 1d982d4e9..541ed82de 100644 --- a/src/components/Form/fields/FieldIssueSelection.vue +++ b/src/components/Form/fields/FieldIssueSelection.vue @@ -32,7 +32,7 @@ :name="props.name" :label="t('issue.issue')" :description="t('publication.assignToIssue.issueDescription')" - :is-required="isRequired" + :is-required="isIssueSelectionRequired" :value="selectedIssueId" :options="availableIssues" :all-errors="{}" @@ -88,7 +88,7 @@ const props = defineProps({ }, isRequired: { type: Boolean, - default: false, + default: true, }, isPhpForm: { type: Boolean, @@ -149,7 +149,7 @@ const fetchAssignmentOptions = async () => { }; const fetchAssignmentType = async () => { - // we will not fetch if the assignment type is give for the publication + // will not fetch if the assignment type is give for the publication // for example, it's can be given from the PHP form if (props.assignmentType !== null) { return; @@ -184,6 +184,19 @@ const showIssueDropdown = computed(() => { return option?.isPublished !== null; }); +// TODO : need it ? +// dynamic isRequired based on selection and props.isRequired +const isIssueSelectionRequired = computed(() => { + // Only require issue selection if: + // 1. The field is marked as required (from PHP or JS) + // 2. AND the selected assignment type actually requires an issue (isPublished !== null) + const selectedOption = assignmentOptions.value.find( + (opt) => opt.value === selectedAssignmentType.value, + ); + + return props.isRequired && selectedOption?.isPublished !== null; +}); + const shouldFetchPublishedIssues = computed(() => { const option = assignmentOptions.value.find( (opt) => opt.value === selectedAssignmentType.value, @@ -191,11 +204,25 @@ const shouldFetchPublishedIssues = computed(() => { return option?.isPublished; }); +// TODO : need this ? +// better validation logic const isValid = computed(() => { + // If no assignment type selected, not valid + if (!selectedAssignmentType.value) { + return false; + } + const option = assignmentOptions.value.find( (opt) => opt.value === selectedAssignmentType.value, ); - return option?.isPublished === null || selectedIssueId.value; + + // If assignment type doesn't require issue selection, always valid + if (option?.isPublished === null) { + return true; + } + + // If assignment type requires issue selection, check if issue is selected + return selectedIssueId.value !== null; }); const publicationStatus = computed(() => { @@ -205,23 +232,38 @@ const publicationStatus = computed(() => { return option?.status || null; }); +// TODO : need this ? +// validation error messages const validationErrors = computed(() => { if (!isValid.value) { - return [t('publication.assignToIssue.validation.issueRequired')]; + // If assignment type requires issue but none selected + if (isIssueSelectionRequired.value && !selectedIssueId.value) { + return [t('publication.assignToIssue.validation.issueRequired')]; + } + // If no assignment type selected + if (!selectedAssignmentType.value) { + return [t('publication.assignToIssue.validation.assignmentRequired')]; + } } return []; }); -// Emit validation errors to the form system -// FIXME : NOT propagating to top level from component watch( validationErrors, (errors) => { - if (errors.length > 0) { - emit('set-errors', props.name, errors); - } else { - emit('set-errors', props.name, []); - } + errors.length > 0 + ? emit('set-errors', props.name, errors) // emit errors + : emit('set-errors', props.name, []); // clear errors + }, + {immediate: true}, +); + +// Watch for assignment type changes to update validation +watch( + selectedAssignmentType, + () => { + // Trigger validation update when assignment type changes + // This ensures validationErrors computed property updates }, {immediate: true}, ); @@ -262,9 +304,10 @@ const emitValue = () => { } } else { const value = { - assignmentType: selectedAssignmentType.value, // User's assignment type selection - issueId: selectedIssueId.value, // User's issue selection - publicationStatus: publicationStatus.value, // Calculated status from user's selection + assignmentType: selectedAssignmentType.value, + issueId: selectedIssueId.value, + publicationStatus: publicationStatus.value, + isValid: isValid.value, }; // TODO: Remove this after testing @@ -339,6 +382,52 @@ watch(selectedIssueId, () => { emitValue(); }); +// Watch for changes and emit required state +watch( + [selectedAssignmentType, selectedIssueId], + () => { + // Determine if field is currently required + let isCurrentlyRequired = true; // Default to required + + if (selectedAssignmentType.value) { + const selectedOption = assignmentOptions.value.find( + (opt) => opt.value === selectedAssignmentType.value, + ); + + // If assignment type doesn't require issue selection, not required + if (selectedOption?.isPublished === null) { + isCurrentlyRequired = false; + } + } + + // Emit the current required state + emit('set-field-required', props.name, isCurrentlyRequired); + + emitValue(); // emit the value change + }, + {immediate: false}, // not run immediately since we handle it in onMounted +); + +// ✅ NEW: Function to emit initial required state +const emitInitialRequiredState = () => { + // Determine if field is currently required based on initial values + let isCurrentlyRequired = true; // Default to required + + if (selectedAssignmentType.value) { + const selectedOption = assignmentOptions.value.find( + (opt) => opt.value === selectedAssignmentType.value, + ); + + // If assignment type doesn't require issue selection, not required + if (selectedOption?.isPublished === null) { + isCurrentlyRequired = false; + } + } + + // Emit the initial required state + emit('set-field-required', props.name, isCurrentlyRequired); +}; + onMounted(async () => { selectedAssignmentType.value = props.assignmentType || null; @@ -354,12 +443,9 @@ onMounted(async () => { await fetchIssues(); } - // FIXME : remove this once the emit issue for hidden field is fixed - if (props.isPhpForm) { - $('input[name="prePublishStatus"]').hide(); - } - emitValue(); + + emitInitialRequiredState(); }); diff --git a/src/pages/workflow/components/publication/WorkflowPublicationForm.vue b/src/pages/workflow/components/publication/WorkflowPublicationForm.vue index 9ab6c3fc6..aed025998 100644 --- a/src/pages/workflow/components/publication/WorkflowPublicationForm.vue +++ b/src/pages/workflow/components/publication/WorkflowPublicationForm.vue @@ -57,6 +57,7 @@ const displayNoFieldsEnabled = computed(() => { const customFns = { metadata: metadataDataChange, + issue: issueDataChange, }; const {triggerDataChange} = useDataChanged(customFns[props.formName]); @@ -67,4 +68,8 @@ async function metadataDataChange() { // Some metadata fields need extra data from db not in publication object await fetchForm(); } + +async function issueDataChange() { + await fetchForm(); +} diff --git a/src/pages/workflow/composables/useWorkflowVersionForm.js b/src/pages/workflow/composables/useWorkflowVersionForm.js index ec4f3e540..7a0e6d928 100644 --- a/src/pages/workflow/composables/useWorkflowVersionForm.js +++ b/src/pages/workflow/composables/useWorkflowVersionForm.js @@ -104,7 +104,7 @@ export function useWorkflowVersionForm( versionIsMinor: formData.versionIsMinor, }; - if (isOJS()) { + 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) { @@ -112,9 +112,19 @@ export function useWorkflowVersionForm( requestBody.prePublishStatus = pkp.const.STATUS_READY_TO_PUBLISH; } // Add issue assignment data if in publish mode and issue assignment is provided - else if (modeState.isPublishMode && formData.issueId) { + 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.incomplete')], + }, + }; + } + requestBody.issueId = issueData.issueId; requestBody.prePublishStatus = issueData.publicationStatus; } @@ -328,6 +338,7 @@ export function useWorkflowVersionForm( component: 'FieldIssueSelection', issueCount: issueCount, publication: store.selectedPublication, + isRequired: true, }); } From c055c7c837e9dc9de51117de70bb59e2310b9a28 Mon Sep 17 00:00:00 2001 From: Touhidur Rahman Date: Sat, 16 Aug 2025 02:34:22 +0600 Subject: [PATCH 4/6] pkp/pkp-lib#9295 OJS review stage API and version logic update --- .../composables/useWorkflowVersionForm.js | 26 ++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/src/pages/workflow/composables/useWorkflowVersionForm.js b/src/pages/workflow/composables/useWorkflowVersionForm.js index 7a0e6d928..860d1781b 100644 --- a/src/pages/workflow/composables/useWorkflowVersionForm.js +++ b/src/pages/workflow/composables/useWorkflowVersionForm.js @@ -95,7 +95,9 @@ export function useWorkflowVersionForm( }); const {apiUrl: versionUrl} = useUrl( - `submissions/${store.submission.id}/publications/${publicationId}/version`, + isOJS() && modeState.isPublishMode + ? `submissions/${store.submission.id}/publications/${publicationId}/reviewEdit` + : `submissions/${store.submission.id}/publications/${publicationId}/version`, ); // Prepare request body with version data @@ -195,6 +197,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'), @@ -208,8 +219,7 @@ export function useWorkflowVersionForm( ], size: 'large', isRequired: modeState.isPublishMode, - value: - currentValue === 'true' && !allowMinorVersion ? 'false' : currentValue, + value: versionMinorValue, showWhen: modeState.isTextEditorMode ? ['sendToVersion', getUnassignedVersions()] : undefined, @@ -346,6 +356,16 @@ export function useWorkflowVersionForm( 'versionSource', modeState.isCreateMode ? latestPublication?.id : null, ); + + if (modeState.isPublishMode) { + setValue( + 'versionIsMinor', + store.selectedPublication?.versionStage && + store.selectedPublication?.versionMinor + ? 'true' + : 'false', + ); + } }); watch( From 0f61ced52ad355a34292ce2d3eface157be389f0 Mon Sep 17 00:00:00 2001 From: Touhidur Rahman Date: Sun, 17 Aug 2025 13:32:55 +0600 Subject: [PATCH 5/6] pkp/pkp-lib#9295 use publication edit and fixed issue from refetch race condition --- src/components/Form/FormGroup.vue | 2 - .../Form/fields/FieldIssueSelection.vue | 54 +++------ .../Form/fields/FieldSelectIssue.mdx | 23 ---- .../Form/fields/FieldSelectIssue.stories.js | 45 ------- .../Form/mocks/field-select-issue.js | 51 -------- src/composables/useLegacyGridUrl.test.js | 12 -- .../publication/WorkflowPublicationForm.vue | 5 - .../composables/useWorkflowActions.js | 112 ------------------ .../composables/useWorkflowVersionForm.js | 33 ++---- 9 files changed, 28 insertions(+), 309 deletions(-) delete mode 100644 src/components/Form/fields/FieldSelectIssue.mdx delete mode 100644 src/components/Form/fields/FieldSelectIssue.stories.js delete mode 100644 src/components/Form/mocks/field-select-issue.js diff --git a/src/components/Form/FormGroup.vue b/src/components/Form/FormGroup.vue index ef66004af..4f46c1d39 100644 --- a/src/components/Form/FormGroup.vue +++ b/src/components/Form/FormGroup.vue @@ -90,7 +90,6 @@ import FieldRadioInput from './fields/FieldRadioInput.vue'; import FieldRichTextarea from './fields/FieldRichTextarea.vue'; import FieldRichText from './fields/FieldRichText.vue'; import FieldSelect from './fields/FieldSelect.vue'; -// import FieldSelectIssue from './fields/FieldSelectIssue.vue'; import FieldSelectIssues from './fields/FieldSelectIssues.vue'; import FieldIssueSelection from './fields/FieldIssueSelection.vue'; import FieldSelectSubmissions from './fields/FieldSelectSubmissions.vue'; @@ -128,7 +127,6 @@ export default { FieldRichTextarea, FieldRichText, FieldSelect, - // FieldSelectIssue, FieldSelectIssues, FieldIssueSelection, FieldSelectSubmissions, diff --git a/src/components/Form/fields/FieldIssueSelection.vue b/src/components/Form/fields/FieldIssueSelection.vue index 541ed82de..08c640ec9 100644 --- a/src/components/Form/fields/FieldIssueSelection.vue +++ b/src/components/Form/fields/FieldIssueSelection.vue @@ -96,7 +96,7 @@ const props = defineProps({ }, }); -const emit = defineEmits(['change', 'set-errors', 'set']); +const emit = defineEmits(['change', 'set-errors', 'set', 'set-field-required']); const {t} = useLocalize(); const availableIssues = ref([]); @@ -184,12 +184,11 @@ const showIssueDropdown = computed(() => { return option?.isPublished !== null; }); -// TODO : need it ? -// dynamic isRequired based on selection and props.isRequired +// dynamic isRequired based on selection and `props.isRequired` const isIssueSelectionRequired = computed(() => { - // Only require issue selection if: - // 1. The field is marked as required (from PHP or JS) - // 2. AND the selected assignment type actually requires an issue (isPublished !== null) + // we are only going to require issue selection if: + // 1. The field is marked as required (from PHP or JS) + // 2. AND the selected assignment type actually requires an issue (isPublished !== null) const selectedOption = assignmentOptions.value.find( (opt) => opt.value === selectedAssignmentType.value, ); @@ -204,8 +203,6 @@ const shouldFetchPublishedIssues = computed(() => { return option?.isPublished; }); -// TODO : need this ? -// better validation logic const isValid = computed(() => { // If no assignment type selected, not valid if (!selectedAssignmentType.value) { @@ -232,7 +229,6 @@ const publicationStatus = computed(() => { return option?.status || null; }); -// TODO : need this ? // validation error messages const validationErrors = computed(() => { if (!isValid.value) { @@ -240,10 +236,6 @@ const validationErrors = computed(() => { if (isIssueSelectionRequired.value && !selectedIssueId.value) { return [t('publication.assignToIssue.validation.issueRequired')]; } - // If no assignment type selected - if (!selectedAssignmentType.value) { - return [t('publication.assignToIssue.validation.assignmentRequired')]; - } } return []; }); @@ -263,7 +255,7 @@ watch( selectedAssignmentType, () => { // Trigger validation update when assignment type changes - // This ensures validationErrors computed property updates + // which ensures validationErrors computed property updates }, {immediate: true}, ); @@ -292,15 +284,8 @@ const onIssueChange = (fieldName, propName, newValue) => { const emitValue = () => { if (props.isPhpForm) { if (assignmentOptions.value.length > 0) { - // TODO: Remove this after testing - // console.log('PHP Form - Emitting issueId, updating hiddenFields:', { - // issueId: selectedIssueId.value, // User's issue selection - // assignmentType: selectedAssignmentType.value, // User's assignment type selection - // publicationStatus: publicationStatus.value, // Calculated status from user's selection - // }); - - emit('change', 'issueId', 'value', selectedIssueId.value); - emit('change', 'prePublishStatus', 'value', publicationStatus.value); + emit('change', props.name, 'value', selectedIssueId.value); + emit('change', 'status', 'value', publicationStatus.value); } } else { const value = { @@ -310,16 +295,6 @@ const emitValue = () => { isValid: isValid.value, }; - // TODO: Remove this after testing - // console.log('Vue Form - FieldIssueSelection emitting:', { - // name: props.name, - // formId: props.formId, - // value: value, - // assignmentType: selectedAssignmentType.value, // User's selection - // selectedIssueId: selectedIssueId.value, // User's selection - // publicationStatus: publicationStatus.value, // Calculated status - // }); - emit('change', props.name, 'value', value); } }; @@ -405,10 +380,10 @@ watch( emitValue(); // emit the value change }, - {immediate: false}, // not run immediately since we handle it in onMounted + {immediate: false}, // not run immediately since it's been handled in onMounted ); -// ✅ NEW: Function to emit initial required state +// emit initial required state const emitInitialRequiredState = () => { // Determine if field is currently required based on initial values let isCurrentlyRequired = true; // Default to required @@ -453,12 +428,13 @@ onMounted(async () => { .pkpFormGroup--issueSelection { border: 1px solid #ddd; border-radius: 2px; + padding-left: 0rem; + padding-right: 0rem; .pkpFormGroup__heading { - border-bottom: 1px solid #ddd; + border-bottom: 0.1rem solid #ddd; margin: -2rem 0rem 2rem 0rem; - padding: 1.5rem 0rem 2rem 0rem; - border-radius: 4px 4px 0 0; + padding: 1.5rem 2rem 2rem 2rem; float: none; width: 100%; padding-inline-end: 2rem; @@ -468,6 +444,8 @@ onMounted(async () => { float: none; width: 100%; padding-inline-start: 0; + padding-left: 2rem !important; + padding-right: 2rem !important; > * + * { margin-top: 1.5rem; diff --git a/src/components/Form/fields/FieldSelectIssue.mdx b/src/components/Form/fields/FieldSelectIssue.mdx deleted file mode 100644 index 435a37151..000000000 --- a/src/components/Form/fields/FieldSelectIssue.mdx +++ /dev/null @@ -1,23 +0,0 @@ -import { - Primary, - Controls, - Stories, - Meta, - ArgTypes, -} from '@storybook/addon-docs/blocks'; - -import * as FieldSelectIssueStories from './FieldSelectIssue.stories.js'; - - - -# FieldSelectIssue - -## Usage - -A special component for selecting an issue. When a publication is scheduled or published, this field will no longer show the selection options and will instead show a message indicating the issue it was scheduled or published in. - -In the example above, the "Assign to Issue" button will not work. This depends on the old JavaScript framework within the application. - - - - diff --git a/src/components/Form/fields/FieldSelectIssue.stories.js b/src/components/Form/fields/FieldSelectIssue.stories.js deleted file mode 100644 index e8c4c7f51..000000000 --- a/src/components/Form/fields/FieldSelectIssue.stories.js +++ /dev/null @@ -1,45 +0,0 @@ -import FieldSelectIssue from './FieldSelectIssue.vue'; -import FieldBaseMock from '../mocks/field-base'; -import FieldSelectIssueMock from '../mocks/field-select-issue'; - -export default { - title: 'Forms/FieldSelectIssue', - component: FieldSelectIssue, - render: (args) => ({ - components: {FieldSelectIssue}, - setup() { - function change(name, prop, newValue, localeKey) { - if (localeKey) { - args[prop][localeKey] = newValue; - } else { - args[prop] = newValue; - } - } - - return {args, change}; - }, - template: ` - - `, - }), -}; - -export const Base = { - args: {...FieldBaseMock, ...FieldSelectIssueMock}, -}; - -export const Published = { - args: { - ...Base.args, - publicationStatus: 3, // PKPSubmission::STATUS_PUBLISHED - value: 3, - }, -}; - -export const Scheduled = { - args: { - ...Base.args, - publicationStatus: 5, // PKPSubmission::STATUS_SCHEDULED - value: 4, - }, -}; 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/useLegacyGridUrl.test.js b/src/composables/useLegacyGridUrl.test.js index 651e239d3..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/pages/workflow/components/publication/WorkflowPublicationForm.vue b/src/pages/workflow/components/publication/WorkflowPublicationForm.vue index aed025998..9ab6c3fc6 100644 --- a/src/pages/workflow/components/publication/WorkflowPublicationForm.vue +++ b/src/pages/workflow/components/publication/WorkflowPublicationForm.vue @@ -57,7 +57,6 @@ const displayNoFieldsEnabled = computed(() => { const customFns = { metadata: metadataDataChange, - issue: issueDataChange, }; const {triggerDataChange} = useDataChanged(customFns[props.formName]); @@ -68,8 +67,4 @@ async function metadataDataChange() { // Some metadata fields need extra data from db not in publication object await fetchForm(); } - -async function issueDataChange() { - await fetchForm(); -} diff --git a/src/pages/workflow/composables/useWorkflowActions.js b/src/pages/workflow/composables/useWorkflowActions.js index ec87e490b..5d31899f8 100644 --- a/src/pages/workflow/composables/useWorkflowActions.js +++ b/src/pages/workflow/composables/useWorkflowActions.js @@ -38,42 +38,6 @@ export function useWorkflowActions() { redirectToPage(); } - /** - * TODO: need this anymore ? - * Legacy function to assign a publication to an issue. - * - * NOTE: This function is kept for backward compatibility. - * For new implementations, consider using the combined version assignment - * and issue assignment functionality in workflowAssignPublicationStage. - * - * @param {Object} params - Parameters object - * @param {Object} params.submission - The submission object - * @param {Object} params.selectedPublication - The selected publication - * @param {Function} finishedCallback - Callback function to execute when finished - */ - // function workflowAssignToIssue( - // {submission, selectedPublication}, - // finishedCallback, - // ) { - // console.log('Legacy workflowAssignToIssue called'); - // 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', @@ -174,81 +138,6 @@ export function useWorkflowActions() { {submission, selectedPublication}, finishedCallback, ); - - // TODO : Rest of the codes are dead code, need cleanup - - // 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 ready to publish, - // 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.status === pkp.const.STATUS_READY_TO_PUBLISH && - // (selectedPublication.issueId === null || - // !pageInitConfig.publicationSettings.issuePublishedStatus[ - // selectedPublication.issueId - // ]) - // ) { - // workflowScheduleForPublication( - // {submission, selectedPublication}, - // finishedCallback, - // ); - // return; - // } - - // if ( - // selectedPublication.issueId === null || - // selectedPublication.status === pkp.const.STATUS_READY_TO_PUBLISH - // ) { - // 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?.status === pkp.const.STATUS_READY_TO_PUBLISH - // ) { - // workflowScheduleForPublication( - // {submission, selectedPublication}, - // finishedCallback, - // ); - // } else { - // finishedCallback(); - // } - // }, - // }, - // ); - // } else { - // workflowScheduleForPublication( - // {submission, selectedPublication}, - // finishedCallback, - // ); - // } } function workflowScheduleForPublication( @@ -413,7 +302,6 @@ export function useWorkflowActions() { return { workflowViewPublishedSubmission, - // workflowAssignToIssue, workflowViewActivityLog, workflowViewLibrary, workflowAssignToIssueAndScheduleForPublication, diff --git a/src/pages/workflow/composables/useWorkflowVersionForm.js b/src/pages/workflow/composables/useWorkflowVersionForm.js index 860d1781b..369066096 100644 --- a/src/pages/workflow/composables/useWorkflowVersionForm.js +++ b/src/pages/workflow/composables/useWorkflowVersionForm.js @@ -96,7 +96,7 @@ export function useWorkflowVersionForm( const {apiUrl: versionUrl} = useUrl( isOJS() && modeState.isPublishMode - ? `submissions/${store.submission.id}/publications/${publicationId}/reviewEdit` + ? `submissions/${store.submission.id}/publications/${publicationId}` : `submissions/${store.submission.id}/publications/${publicationId}/version`, ); @@ -111,7 +111,7 @@ export function useWorkflowVersionForm( // we can safely set the issueId to null and status to STATUS_READY_TO_PUBLISH if (issueCount === 0) { requestBody.issueId = null; - requestBody.prePublishStatus = pkp.const.STATUS_READY_TO_PUBLISH; + requestBody.status = pkp.const.STATUS_READY_TO_PUBLISH; } // Add issue assignment data if in publish mode and issue assignment is provided else { @@ -122,13 +122,15 @@ export function useWorkflowVersionForm( return { data: null, validationError: { - issueId: [t('publication.assignToIssue.validation.incomplete')], + issueId: [ + t('publication.assignToIssue.validation.issueRequired'), + ], }, }; } requestBody.issueId = issueData.issueId; - requestBody.prePublishStatus = issueData.publicationStatus; + requestBody.status = issueData.publicationStatus; } } @@ -276,15 +278,7 @@ export function useWorkflowVersionForm( cancelButton: {label: t('common.cancel')}, }); - addGroup( - 'default', - // FIXME: adding group breaking the page layout - // { - // pageId: 'default', - // label: t('publication.scheduledForPublication.versionStage.label'), - // description: t('publication.scheduledForPublication.versionStage.description'), - // } - ); + addGroup('default'); onMounted(() => { latestPublication = getLatestPublication(store.submission); @@ -296,7 +290,6 @@ export function useWorkflowVersionForm( label: t('publication.sendToTextEditor.label'), options: buildPublicationOptions({withCreateOption: true}), size: 'large', - // groupId: 'default', // FIXME: adding group breaking the page layout isRequired: modeState.isTextEditorMode, showWhen: !modeState.isTextEditorMode ? [] : undefined, }); @@ -308,7 +301,6 @@ export function useWorkflowVersionForm( description: t('publication.versionSource.create.description'), options: buildPublicationOptions(), size: 'large', - // groupId: 'default', // FIXME: adding group breaking the page layout showWhen: !modeState.isCreateMode ? ['sendToVersion', 'create'] : undefined, @@ -322,7 +314,6 @@ export function useWorkflowVersionForm( options: store.versionStageOptions, size: 'large', value: store.selectedPublication?.versionStage || null, - // groupId: 'default', // FIXME: adding group breaking the page layout isRequired: modeState.isPublishMode, showWhen: modeState.isTextEditorMode ? ['sendToVersion', getUnassignedVersions()] @@ -357,13 +348,13 @@ export function useWorkflowVersionForm( modeState.isCreateMode ? latestPublication?.id : null, ); - if (modeState.isPublishMode) { + // 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?.versionStage && - store.selectedPublication?.versionMinor - ? 'true' - : 'false', + store.selectedPublication?.versionMinor ? 'true' : 'false', ); } }); From 1eb22c538c2c92d0dc21b8025a582f932ef8aebd Mon Sep 17 00:00:00 2001 From: Touhidur Rahman Date: Wed, 20 Aug 2025 20:06:28 +0600 Subject: [PATCH 6/6] pkp/pkp-lib#9295 introduced publication status consts similar to submission --- public/globals.js | 4 ++++ .../Form/fields/FieldSelectIssue.vue | 10 ++++++---- .../GalleyManager/useGalleyManagerConfig.js | 8 +++++--- .../WorkflowPublicationVersionControl.vue | 6 +++--- .../composables/useWorkflowActions.js | 4 ++-- .../workflowConfigAuthorOJS.js | 4 +++- .../workflowConfigEditorialOJS.js | 20 +++++++++++++------ .../workflowConfigEditorialOMP.js | 10 +++++++--- .../workflowConfigEditorialOPS.js | 10 +++++++--- .../composables/useWorkflowPermissions.js | 3 ++- .../composables/useWorkflowVersionForm.js | 2 +- 11 files changed, 54 insertions(+), 27 deletions(-) diff --git a/public/globals.js b/public/globals.js index ff87fcc1f..6c06be909 100644 --- a/public/globals.js +++ b/public/globals.js @@ -100,6 +100,10 @@ window.pkp = { STATUS_PUBLISHED: 3, STATUS_DECLINED: 4, STATUS_SCHEDULED: 5, + PUBLICATION_STATUS_QUEUED: 1, + PUBLICATION_STATUS_PUBLISHED: 3, + PUBLICATION_STATUS_DECLINED: 4, + PUBLICATION_STATUS_SCHEDULED: 5, WORKFLOW_STAGE_ID_SUBMISSION: 1, WORKFLOW_STAGE_ID_INTERNAL_REVIEW: 2, WORKFLOW_STAGE_ID_EXTERNAL_REVIEW: 3, diff --git a/src/components/Form/fields/FieldSelectIssue.vue b/src/components/Form/fields/FieldSelectIssue.vue index 9f5b975ac..c206fb835 100644 --- a/src/components/Form/fields/FieldSelectIssue.vue +++ b/src/components/Form/fields/FieldSelectIssue.vue @@ -76,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, @@ -113,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, }; @@ -129,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; 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/composables/useWorkflowActions.js b/src/pages/workflow/composables/useWorkflowActions.js index 5d31899f8..87c4a32aa 100644 --- a/src/pages/workflow/composables/useWorkflowActions.js +++ b/src/pages/workflow/composables/useWorkflowActions.js @@ -118,8 +118,8 @@ export function useWorkflowActions() { const requirePublicationStage = isOJS() ? !selectedPublication.versionStage || ![ - pkp.const.STATUS_READY_TO_PUBLISH, - pkp.const.STATUS_READY_TO_SCHEDULE, + pkp.const.PUBLICATION_STATUS_READY_TO_PUBLISH, + pkp.const.PUBLICATION_STATUS_READY_TO_SCHEDULE, ].includes(selectedPublication.status) : !selectedPublication.versionStage; 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 34df34487..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: {}, @@ -769,9 +771,11 @@ export const PublicationConfig = { return []; } if ( - selectedPublication.status === pkp.const.STATUS_QUEUED || - selectedPublication.status === pkp.const.STATUS_READY_TO_PUBLISH || - selectedPublication.status === pkp.const.STATUS_READY_TO_SCHEDULE + 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( @@ -803,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: { @@ -821,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 369066096..0254cddbc 100644 --- a/src/pages/workflow/composables/useWorkflowVersionForm.js +++ b/src/pages/workflow/composables/useWorkflowVersionForm.js @@ -111,7 +111,7 @@ export function useWorkflowVersionForm( // 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.STATUS_READY_TO_PUBLISH; + requestBody.status = pkp.const.PUBLICATION_STATUS_READY_TO_PUBLISH; } // Add issue assignment data if in publish mode and issue assignment is provided else {