Bug 41029: (QA follow-up) Seed add_to_basket record source and tidy atomicupdate
Without a matching entry in the record_sources table, the new "Add to basket" option never appears in the Source filter dropdown of the marc-overlay-rules admin page for module=source, since that dropdown is populated from Koha::RecordSources, not the template's label switch. Seed it in both the mandatory install-time data and the upgrade atomicupdate, matching how batchimport/z3950/etc. were introduced. Also drop the unused say_warning import, route success messages through say_success instead of a bare say, and simplify the selectrow_array calls. Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
This commit is contained in:
parent
f473c7d451
commit
575e90f88f
|
|
@ -1,5 +1,5 @@
|
|||
use Modern::Perl;
|
||||
use Koha::Installer::Output qw(say_warning say_success say_info);
|
||||
use Koha::Installer::Output qw(say_success say_info);
|
||||
|
||||
return {
|
||||
bug_number => "41029",
|
||||
|
|
@ -8,16 +8,18 @@ return {
|
|||
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];
|
||||
$dbh->do(
|
||||
q{
|
||||
INSERT IGNORE INTO record_sources (`name`, `can_be_edited`, `is_system`)
|
||||
VALUES ('add_to_basket', 1, 1)
|
||||
}
|
||||
);
|
||||
say_success( $out, "Added 'add_to_basket' record source" );
|
||||
|
||||
my $existing_batchimport_rules_count = scalar $dbh->selectrow_array(
|
||||
'SELECT COUNT(*) FROM marc_overlay_rules WHERE module="source" AND filter="batchimport"');
|
||||
my $existing_add_to_basket_rules_count = scalar $dbh->selectrow_array(
|
||||
'SELECT COUNT(*) FROM marc_overlay_rules WHERE module="source" AND filter="add_to_basket"');
|
||||
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(
|
||||
|
|
@ -28,7 +30,7 @@ return {
|
|||
WHERE module = 'source' AND filter = 'batchimport'
|
||||
}
|
||||
);
|
||||
say $out "Added existing batchimport overlay rules as add_to_basket rules";
|
||||
say_success( $out, "Added existing batchimport overlay rules as add_to_basket rules" );
|
||||
} else {
|
||||
say_info(
|
||||
$out,
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ INSERT IGNORE INTO record_sources ( name, can_be_edited, is_system ) VALUES
|
|||
('batchmod', 1, 1 ),
|
||||
('intranet', 1, 1 ),
|
||||
('batchimport', 1, 1 ),
|
||||
('add_to_basket', 1, 1 ),
|
||||
('z3950', 1, 1 ),
|
||||
('bulkmarcimport', 1, 1 ),
|
||||
('import_lexile', 1, 1 );
|
||||
Loading…
Reference in New Issue