diff --git a/Koha/Import/Record.pm b/Koha/Import/Record.pm index 9b1e1c3f67..2f888bfd43 100644 --- a/Koha/Import/Record.pm +++ b/Koha/Import/Record.pm @@ -132,7 +132,7 @@ sub replace { if ($biblio) { my $record = $biblio->metadata->record; $xmlrecord = $record->as_xml; - my $context = { source => 'batchimport' }; + my $context = { source => 'add_to_basket' }; if ($logged_in_patron) { $context->{categorycode} = $logged_in_patron->categorycode; $context->{userid} = $logged_in_patron->userid; diff --git a/installer/data/mysql/atomicupdate/bug_41029.pl b/installer/data/mysql/atomicupdate/bug_41029.pl new file mode 100755 index 0000000000..b252c6d1df --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_41029.pl @@ -0,0 +1,40 @@ +use Modern::Perl; +use Koha::Installer::Output qw(say_warning say_success say_info); + +return { + bug_number => "41029", + description => "Add 'add_to_basket' source option for MARC overlay rules", + up => sub { + my ($args) = @_; + my ( $dbh, $out ) = @$args{qw(dbh out)}; + + my $existing_batchimport_rules_count = ( + $dbh->selectrow_array( + 'SELECT COUNT(*) FROM marc_overlay_rules WHERE module="source" and filter="batchimport"', undef + ) + )[0]; + my $existing_add_to_basket_rules_count = ( + $dbh->selectrow_array( + 'SELECT COUNT(*) FROM marc_overlay_rules WHERE module="source" and filter="add_to_basket"', undef + ) + )[0]; + if ( $existing_batchimport_rules_count > 0 && $existing_add_to_basket_rules_count == 0 ) { + say_info( $out, "Existing batchimport marc_overlay_rules found and no add_to_basket rules found" ); + $dbh->do( + q{ + INSERT INTO marc_overlay_rules (`tag`, `module`, `filter`, `add`, `append`, `remove`, `delete`) + SELECT `tag`, `module`, "add_to_basket", `add`, `append`, `remove`, `delete` + FROM marc_overlay_rules + WHERE module = 'source' AND filter = 'batchimport' + } + ); + say $out "Added existing batchimport overlay rules as add_to_basket rules"; + } else { + say_info( + $out, + "No existing batchimport marc_overlay_rules found or existing add_to_basket rules found, not updating" + ); + } + + }, +}; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc-overlay-rules.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc-overlay-rules.tt index 209e5042b6..47fe5a73b8 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc-overlay-rules.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc-overlay-rules.tt @@ -215,6 +215,8 @@ Staff interface MARC editor [% CASE 'batchimport' %] Staged MARC import + [% CASE 'add_to_basket' %] + Add to basket [% CASE 'z3950' %] Z39.50 [% CASE 'bulkmarcimport' %] @@ -326,11 +328,12 @@ [% FOREACH record_source IN record_sources %] [% SWITCH record_source %] [% CASE 'batchmod' %]'[% record_source | html %]': _("Batch record modification"), - [% CASE 'intranet' %]'[% record_source | html %]':_("Staff interface MARC editor"), + [% CASE 'intranet' %]'[% record_source | html %]': _("Staff interface MARC editor"), [% CASE 'batchimport' %]'[% record_source | html %]': _("Staged MARC import"), + [% CASE 'add_to_basket' %]'[% record_source | html %]': _("Add to basket"), [% CASE 'z3950' %]'[% record_source | html %]': _("Z39.50"), [% CASE 'bulkmarcimport' %]'[% record_source | html %]': _("bulkmarcimport.pl"), - [% CASE 'import_lexile' %]'[% record_source | html %]': _("import_lexile.pl"), + [% CASE 'import_lexile' %]'[% record_source | html %]': _("import_lexile.pl"), [% CASE %] '[% record_source | html %]' : '[% record_source | html %]', [% END %] [% END %]