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 <paul.derscheid@lmscloud.de>
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
This commit is contained in:
Jan Kissig 2026-03-20 13:41:56 +00:00 committed by Pedro Amorim
parent 398c329c21
commit 35c7cd1ae7
No known key found for this signature in database
GPG Key ID: 06B75BA7F3894D55
3 changed files with 22 additions and 15 deletions

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}