View | Details | Raw Unified | Return to bug 27182
Collapse All | Expand All

(-)a/C4/MarcModificationTemplates.pm (-4 / +6 lines)
Lines 170-180 sub DelModificationTemplate { Link Here
170
=cut
170
=cut
171
171
172
sub RenameModificationTemplate {
172
sub RenameModificationTemplate {
173
  my ( $template_name, $template_id ) = @_;
173
    my ($args)        = @_;
174
    my $template_name = $args->{'template_name'};
175
    my $template_id   = $args->{'template_id'};
174
176
175
  my $dbh = C4::Context->dbh;
177
    my $dbh = C4::Context->dbh;
176
  my $sth = $dbh->prepare("UPDATE marc_modification_templates SET name = ? WHERE template_id = ?");
178
    my $sth = $dbh->prepare("UPDATE marc_modification_templates SET name = ? WHERE template_id = ?");
177
  $sth->execute( $template_name, $template_id );
179
    $sth->execute( $template_name, $template_id );
178
}
180
}
179
181
180
=head2
182
=head2
(-)a/t/db_dependent/MarcModificationTemplates.t (-2 / +2 lines)
Lines 391-398 subtest 'RenameModificationTemplate' => sub { Link Here
391
    $dbh->do(q|DELETE FROM marc_modification_templates|);
391
    $dbh->do(q|DELETE FROM marc_modification_templates|);
392
    my $template_id = AddModificationTemplate("koah");
392
    my $template_id = AddModificationTemplate("koah");
393
    my $template_id2 = AddModificationTemplate("sma");
393
    my $template_id2 = AddModificationTemplate("sma");
394
    RenameModificationTemplate("koha", $template_id);
394
    RenameModificationTemplate({ 'template_name' => "koha", 'template_id' => $template_id});
395
    RenameModificationTemplate("sam", $template_id2);
395
    RenameModificationTemplate({ 'template_name' => "sam", 'template_id' => $template_id2});
396
    my @templates = GetModificationTemplates();
396
    my @templates = GetModificationTemplates();
397
    is_deeply( [map{$_->{name}} @templates], ['koha', 'sam'] );
397
    is_deeply( [map{$_->{name}} @templates], ['koha', 'sam'] );
398
};
398
};
(-)a/tools/marc_modification_templates.pl (-2 / +2 lines)
Lines 57-63 if ( $op eq "cud-create_template" ) { Link Here
57
  $template_id = '';
57
  $template_id = '';
58
58
59
} elsif ( $op eq "cud-rename_template" ) {
59
} elsif ( $op eq "cud-rename_template" ) {
60
    RenameModificationTemplate( scalar $cgi->param('template_name'), $template_id );
60
    RenameModificationTemplate(
61
        { 'template_name' => scalar $cgi->param('template_name'), 'template_id' => $template_id } );
61
62
62
} elsif ( $op eq "cud-add_action" ) {
63
} elsif ( $op eq "cud-add_action" ) {
63
64
64
- 

Return to bug 27182