Bug 27842: Update serial.biblionumber when a subscription is linked with another record

It seems that a librarian can edit the biblionumber for a given subscription, however, when receiving serials the biblionumber is pulled from the existing serials, so all new received issues are received on the old biblionumber.

This is problematic in light of bug 21901 - you can change the biblionumber, the serials still point to the old biblionumber - and deleting the biblio deletes the serials. Additionally, the update will delete serials where this was the case

Test plan:
1 - Create a new subscription
2 - Receive an issue
3 - Edit the subscription and change the biblionumber
4 - Receive another issue
5 - SELECT biblionumber FROM serial
=> the biblionumber link must have been updated

Signed-off-by: Petro Vashchuk <stalkernoid@gmail.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 7e6f30e60e)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 9f16f42953)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
This commit is contained in:
Jonathan Druart 2021-03-03 12:21:33 +01:00 committed by Andrew Fuerste-Henry
parent 598e4c5d7a
commit 8d3fc1a6fa
1 changed files with 3 additions and 0 deletions

View File

@ -1355,6 +1355,9 @@ sub ModSubscription {
mana_id => $mana_id,
}
)->store;
# FIXME Must be $subscription->serials
# FIXME We shouldn't need serial.subscription (instead use serial->subscription->biblionumber)
Koha::Serials->search({ subscriptionid => $subscriptionid })->update({ biblionumber => $biblionumber });
logaction( "SERIAL", "MODIFY", $subscriptionid, "" ) if C4::Context->preference("SubscriptionLog");