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

(-)a/C4/MarcModificationTemplates.pm (+15 lines)
Lines 43-48 BEGIN { Link Here
43
      GetModificationTemplates
43
      GetModificationTemplates
44
      AddModificationTemplate
44
      AddModificationTemplate
45
      DelModificationTemplate
45
      DelModificationTemplate
46
      RenameModificationTemplate
46
47
47
      GetModificationTemplateAction
48
      GetModificationTemplateAction
48
      GetModificationTemplateActions
49
      GetModificationTemplateActions
Lines 162-167 sub DelModificationTemplate { Link Here
162
  $sth->execute( $template_id );
163
  $sth->execute( $template_id );
163
}
164
}
164
165
166
=head2
167
  RenameModificationTemplate
168
169
  RenameModificatoinTemplate( $template_name, $template_id );
170
=cut
171
172
sub RenameModificationTemplate {
173
  my ( $template_name, $template_id ) = @_;
174
175
  my $dbh = C4::Context->dbh;
176
  my $sth = $dbh->prepare("UPDATE marc_modification_templates SET name = ? WHERE template_id = ?");
177
  $sth->execute( $template_name, $template_id );
178
}
179
165
=head2
180
=head2
166
  GetModificationTemplateAction
181
  GetModificationTemplateAction
167
182
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/marc_modification_templates.tt (+32 lines)
Lines 70-75 Link Here
70
                <a href="#" data-toggle="modal" data-template_id="" data-target="#createTemplate" id="new_template" class="btn btn-default duplicate_template"><i class="fa fa-plus"></i> New template</a>
70
                <a href="#" data-toggle="modal" data-template_id="" data-target="#createTemplate" id="new_template" class="btn btn-default duplicate_template"><i class="fa fa-plus"></i> New template</a>
71
                [% IF ( template_id != '' ) %]
71
                [% IF ( template_id != '' ) %]
72
                    <a href="#" class="btn btn-default new_action"><i class="fa fa-plus"></i> New action</a>
72
                    <a href="#" class="btn btn-default new_action"><i class="fa fa-plus"></i> New action</a>
73
                    <a href="#" data-toggle="modal" data-template_id="" data-target="#renameTemplate" id="rename_template" class="btn btn-default rename_template"><i class="fa-solid fa-pen"></i> Rename template</a>
73
                    <form action="/cgi-bin/koha/tools/marc_modification_templates.pl" method="post">
74
                    <form action="/cgi-bin/koha/tools/marc_modification_templates.pl" method="post">
74
                        [% INCLUDE 'csrf-token.inc' %]
75
                        [% INCLUDE 'csrf-token.inc' %]
75
                        <input type="hidden" name="template_id" value="[% template_id | html %]" />
76
                        <input type="hidden" name="template_id" value="[% template_id | html %]" />
Lines 373-378 Link Here
373
                </div>
374
                </div>
374
            </div>
375
            </div>
375
376
377
            <!-- Modal to rename a template -->
378
            <div class="modal" id="renameTemplate" tabindex="-1" role="dialog" aria-labelledby="LabelrenameTemplate" aria-hidden="true">
379
                <div class="modal-dialog">
380
                <div class="modal-content">
381
                <div class="modal-header">
382
                    <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
383
                    <h2 id="LabelrenameTemplate">Rename template</h2>
384
                </div>
385
                <form method="post" action="/cgi-bin/koha/tools/marc_modification_templates.pl" id="rename_template" class="validated">
386
                    [% INCLUDE 'csrf-token.inc' %]
387
                    <div class="modal-body">
388
                        <fieldset>
389
                            <p>
390
                                <label for="template_name" class="required">Name: </label>
391
                                <input name="template_name" id="template_name" type="text" size="30" required="required" class="required" />
392
                                <span class="required">Required</span>
393
                            </p>
394
395
                            <input type="hidden" name="template_id" value="[% template_id | html %]" />
396
                            <input type="hidden" name="op" value="cud-rename_template" />
397
                        </fieldset>
398
                    </div>
399
                    <div class="modal-footer">
400
                        <button type="submit" class="btn btn-default">Submit</button>
401
                        <button class="btn btn-link" data-dismiss="modal" aria-hidden="true">Cancel</button>
402
                    </div>
403
                </form>
404
                </div>
405
                </div>
406
            </div>
407
376
            </main>
408
            </main>
377
        </div> <!-- /.col-sm-10.col-sm-push-2 -->
409
        </div> <!-- /.col-sm-10.col-sm-push-2 -->
378
410
(-)a/tools/marc_modification_templates.pl (-1 / +4 lines)
Lines 31-36 use C4::MarcModificationTemplates qw( Link Here
31
    GetModificationTemplates
31
    GetModificationTemplates
32
    ModModificationTemplateAction
32
    ModModificationTemplateAction
33
    MoveModificationTemplateAction
33
    MoveModificationTemplateAction
34
    RenameModificationTemplate
34
);
35
);
35
36
36
my $cgi = CGI->new;
37
my $cgi = CGI->new;
Lines 55-60 if ( $op eq "cud-create_template" ) { Link Here
55
  DelModificationTemplate( $template_id );
56
  DelModificationTemplate( $template_id );
56
  $template_id = '';
57
  $template_id = '';
57
58
59
} elsif ( $op eq "cud-rename_template" ) {
60
  RenameModificationTemplate ( scalar $cgi->param('template_name'), $template_id  );
61
58
} elsif ( $op eq "cud-add_action" ) {
62
} elsif ( $op eq "cud-add_action" ) {
59
63
60
  my $mmta_id = $cgi->param('mmta_id');
64
  my $mmta_id = $cgi->param('mmta_id');
61
- 

Return to bug 27182