From 35c7cd1ae7bdb8adb65fc1479acd6aaecc05cc67 Mon Sep 17 00:00:00 2001 From: Jan Kissig Date: Fri, 20 Mar 2026 13:41:56 +0000 Subject: [PATCH] Bug 42141: Fix Save and show/list/edit button on Vue SIP2 config This patch fixes the behavior of the Save (Save and list, Save and continue editing, Save and show) button which is controlled via useBaseResource.navigationOnFormSave on Accounts, Institutions and System preference overrides in Administration -> Self-service circulation (SIP2) To test: a) go to Administration -> Self-service circulation (SIP2) b) create one of the given resources (institution, account, system preference override) and fill out mandatory fields c) click either Save or Save and continue editing or Save and show d) check that you always end up on the list. e) apply patch and run 'yarn js:build' , reload your browser f) repeat b) and c) g) check that the desired view is now shown - show the edited/created resource - list all created resources - continue editing the resource Signed-off-by: Paul Derscheid Signed-off-by: Pedro Amorim --- .../vue/components/SIP2/SIP2AccountResource.vue | 11 +++++++---- .../components/SIP2/SIP2InstitutionResource.vue | 16 ++++++++++------ .../SIP2SystemPreferenceOverrideResource.vue | 10 +++++----- 3 files changed, 22 insertions(+), 15 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/SIP2/SIP2AccountResource.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/SIP2/SIP2AccountResource.vue index 302261f668..102d2b04e2 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/SIP2/SIP2AccountResource.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/SIP2/SIP2AccountResource.vue @@ -1044,14 +1044,17 @@ export default { try { if (sip_account_id) { - await client.update(account, sip_account_id); + let updatedAccount = await client.update( + account, + sip_account_id + ); baseResource.setMessage(__("Account updated")); + return updatedAccount; } else { - await client.create(account); + let createdAccount = await client.create(account); baseResource.setMessage(__("Account created")); + return createdAccount; } - - baseResource.router.push({ name: "SIP2AccountsList" }); } catch (error) { // Handle errors if needed } diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/SIP2/SIP2InstitutionResource.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/SIP2/SIP2InstitutionResource.vue index 3931113864..57d3d79f13 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/SIP2/SIP2InstitutionResource.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/SIP2/SIP2InstitutionResource.vue @@ -44,6 +44,7 @@ export default { resourceTableUrl: APIClient.sip2.httpClient._baseURL + "institutions", }, + navigationOnFormSave: "SIP2InstitutionsList", resourceAttrs: [ { name: "name", @@ -172,16 +173,19 @@ export default { try { if (sip_institution_id) { - await baseResource.apiClient.update( - institution, - sip_institution_id - ); + let updatedInstitution = + await baseResource.apiClient.update( + institution, + sip_institution_id + ); baseResource.setMessage(__("Institution updated")); + return updatedInstitution; } else { - await baseResource.apiClient.create(institution); + let createdInstitution = + await baseResource.apiClient.create(institution); baseResource.setMessage(__("Institution created")); + return createdInstitution; } - baseResource.router.push({ name: "SIP2InstitutionsList" }); } catch (error) { // Handle error here if needed } diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/SIP2/SIP2SystemPreferenceOverrideResource.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/SIP2/SIP2SystemPreferenceOverrideResource.vue index cfc92fc341..f137e17b0d 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/SIP2/SIP2SystemPreferenceOverrideResource.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/SIP2/SIP2SystemPreferenceOverrideResource.vue @@ -47,6 +47,7 @@ export default { ), newLabel: $__("New system preference override"), }, + navigationOnFormSave: "SIP2SystemPreferenceOverridesList", resourceAttrs: [ { name: "variable", @@ -77,24 +78,23 @@ export default { try { if (sip_system_preference_override_id) { - await baseResource.apiClient.update( + let updatedResource = await baseResource.apiClient.update( system_preference_override, sip_system_preference_override_id ); baseResource.setMessage( $__("System preference override updated") ); + return updatedResource; } else { - await baseResource.apiClient.create( + let createdResource = await baseResource.apiClient.create( system_preference_override ); baseResource.setMessage( $__("System preference override created") ); + return createdResource; } - baseResource.router.push({ - name: "SIP2SystemPreferenceOverridesList", - }); } catch (error) { // Handle error here if needed }