diff --git a/C4/Creators/Template.pm b/C4/Creators/Template.pm index 0bbeadfa6e..8a7564c491 100644 --- a/C4/Creators/Template.pm +++ b/C4/Creators/Template.pm @@ -154,7 +154,7 @@ sub delete { warn sprintf('%s : Cannot delete template as the creator type is invalid or non-existant.', $call_type) if !$query_params[1]; return -1; } - my $query = "DELETE FROM " . $opts{'table_name'} . " WHERE template_id = ? AND creator = ?"; + my $query = "DELETE FROM creator_templates WHERE template_id = ? AND creator = ?"; my $sth = C4::Context->dbh->prepare($query); $sth->execute(@query_params); $self->{'template_stat'} = 0; diff --git a/t/db_dependent/Labels/t_Template.t b/t/db_dependent/Labels/t_Template.t index bd57a239db..9c5d2766a5 100644 --- a/t/db_dependent/Labels/t_Template.t +++ b/t/db_dependent/Labels/t_Template.t @@ -20,7 +20,7 @@ use strict; use warnings; -use Test::More tests => 52; +use Test::More tests => 54; use C4::Context; use Data::Dumper; @@ -29,6 +29,7 @@ BEGIN { } my $expect_template = { + creator => 'Labels', profile_id => 0, template_code => 'DEFAULT TEMPLATE', template_desc => 'Default description', @@ -61,6 +62,7 @@ foreach my $key (keys %{$expect_template}) { diag "Testing Template->set_attr() method."; my $new_attr = { + creator => 'Labels', profile_id => 0, template_code => 'Avery 5160 | 1 x 2-5/8', template_desc => '3 columns, 10 rows of labels',