Bug 34943: (QA follow-up) Use before_biblio_action
and an action
param
This patch harmonizes the hook name and parameters with the rest of the
codebase.
To test:
1. Apply this patch
2. Run:
$ ktd --shell
k$ qa
=> SUCCESS: All looks green, and tests still pass (i.e. they were
correctly adjusted to the new schema).
3. Sign off :-D
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 353f510c14
)
Signed-off-by: Frédéric Demians <f.demians@tamil.fr>
This commit is contained in:
parent
fdc58abc8c
commit
82f1e3906c
3 changed files with 12 additions and 4 deletions
|
@ -2846,7 +2846,10 @@ sub ModBiblioMarc {
|
|||
Koha::Util::MARC::set_marc_field($record, C4::Context->preference('MarcFieldForModifierName'), $borrowername);
|
||||
}
|
||||
|
||||
Koha::Plugins->call( 'before_biblio_metadata_store', $record );
|
||||
Koha::Plugins->call(
|
||||
'before_biblio_action',
|
||||
{ action => 'save', payload => { biblio_id => $biblionumber, record => $record } }
|
||||
);
|
||||
|
||||
$m_rs->metadata( $record->as_xml_record($encoding) );
|
||||
$m_rs->store;
|
||||
|
|
|
@ -88,7 +88,7 @@ subtest 'after_biblio_action() and after_item_action() hooks tests' => sub {
|
|||
Koha::Plugins::Methods->delete;
|
||||
};
|
||||
|
||||
subtest 'before_biblio_metadata_store() hooks tests' => sub {
|
||||
subtest 'before_biblio_action() hooks tests' => sub {
|
||||
|
||||
plan tests => 5;
|
||||
|
||||
|
|
|
@ -149,8 +149,13 @@ sub after_hold_create {
|
|||
Koha::Exception->throw("after_hold_create called with parameter " . ref($param) );
|
||||
}
|
||||
|
||||
sub before_biblio_metadata_store {
|
||||
my ( $self, $record ) = @_;
|
||||
sub before_biblio_action {
|
||||
my ( $self, $params ) = @_;
|
||||
|
||||
my $action = $params->{action} // '';
|
||||
my $payload = $params->{payload};
|
||||
my $bibli_id = $payload->{biblio_id};
|
||||
my $record = $payload->{record};
|
||||
|
||||
$record->insert_fields_ordered(
|
||||
MARC::Field->new(
|
||||
|
|
Loading…
Reference in a new issue