Bugzilla – Attachment 168081 Details for
Bug 27182
Add ability to rename a MARC modification template
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27182: Add ability to rename a MARC modification template
Bug-27182-Add-ability-to-rename-a-MARC-modificatio.patch (text/plain), 5.92 KB, created by
Lucas Gass (lukeg)
on 2024-06-25 15:30:25 UTC
(
hide
)
Description:
Bug 27182: Add ability to rename a MARC modification template
Filename:
MIME Type:
Creator:
Lucas Gass (lukeg)
Created:
2024-06-25 15:30:25 UTC
Size:
5.92 KB
patch
obsolete
>From 51fd3e91728949d288c108c0fb2498fe20cd8131 Mon Sep 17 00:00:00 2001 >From: Sam Lau <samalau@gmail.com> >Date: Mon, 24 Jun 2024 19:55:59 +0000 >Subject: [PATCH] Bug 27182: Add ability to rename a MARC modification template > >This patch adds a new 'Rename template' button on the MARC modifications templates page. > >To test: >1) Go to Cataloging -> MARC modification templates >2) Click the button at the top 'New template'. Name your template and press submit. >3) You should now be on the actions page for that template. Notice there isn't any options to rename your template. >4) Apply patch and restart_all >5) Notice that there is now a "Rename template' button. >6) Click this and rename your template and press submit. >7) Notice that the template name changed correctly. >8) Go back to the general MARC modifications templates page. Note the name of your template is correctly displayed in the table. > >Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> >--- > C4/MarcModificationTemplates.pm | 15 +++++++++ > .../tools/marc_modification_templates.tt | 32 +++++++++++++++++++ > tools/marc_modification_templates.pl | 4 +++ > 3 files changed, 51 insertions(+) > >diff --git a/C4/MarcModificationTemplates.pm b/C4/MarcModificationTemplates.pm >index 13b81ca0b4..8129fba820 100644 >--- a/C4/MarcModificationTemplates.pm >+++ b/C4/MarcModificationTemplates.pm >@@ -43,6 +43,7 @@ BEGIN { > GetModificationTemplates > AddModificationTemplate > DelModificationTemplate >+ RenameModificationTemplate > > GetModificationTemplateAction > GetModificationTemplateActions >@@ -162,6 +163,20 @@ sub DelModificationTemplate { > $sth->execute( $template_id ); > } > >+=head2 >+ RenameModificationTemplate >+ >+ RenameModificatoinTemplate( $template_name, $template_id ); >+=cut >+ >+sub RenameModificationTemplate { >+ my ( $template_name, $template_id ) = @_; >+ >+ my $dbh = C4::Context->dbh; >+ my $sth = $dbh->prepare("UPDATE marc_modification_templates SET name = ? WHERE template_id = ?"); >+ $sth->execute( $template_name, $template_id ); >+} >+ > =head2 > GetModificationTemplateAction > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/marc_modification_templates.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/marc_modification_templates.tt >index f2eecda293..61086861d8 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/marc_modification_templates.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/marc_modification_templates.tt >@@ -70,6 +70,7 @@ > <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> > [% IF ( template_id != '' ) %] > <a href="#" class="btn btn-default new_action"><i class="fa fa-plus"></i> New action</a> >+ <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> > <form action="/cgi-bin/koha/tools/marc_modification_templates.pl" method="post"> > [% INCLUDE 'csrf-token.inc' %] > <input type="hidden" name="template_id" value="[% template_id | html %]" /> >@@ -373,6 +374,37 @@ > </div> > </div> > >+ <!-- Modal to rename a template --> >+ <div class="modal" id="renameTemplate" tabindex="-1" role="dialog" aria-labelledby="LabelrenameTemplate" aria-hidden="true"> >+ <div class="modal-dialog"> >+ <div class="modal-content"> >+ <div class="modal-header"> >+ <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">Ã</button> >+ <h2 id="LabelrenameTemplate">Rename template</h2> >+ </div> >+ <form method="post" action="/cgi-bin/koha/tools/marc_modification_templates.pl" id="rename_template" class="validated"> >+ [% INCLUDE 'csrf-token.inc' %] >+ <div class="modal-body"> >+ <fieldset> >+ <p> >+ <label for="template_name" class="required">Name: </label> >+ <input name="template_name" id="template_name" type="text" size="30" required="required" class="required" /> >+ <span class="required">Required</span> >+ </p> >+ >+ <input type="hidden" name="template_id" value="[% template_id | html %]" /> >+ <input type="hidden" name="op" value="cud-rename_template" /> >+ </fieldset> >+ </div> >+ <div class="modal-footer"> >+ <button type="submit" class="btn btn-default">Submit</button> >+ <button class="btn btn-link" data-dismiss="modal" aria-hidden="true">Cancel</button> >+ </div> >+ </form> >+ </div> >+ </div> >+ </div> >+ > </main> > </div> <!-- /.col-sm-10.col-sm-push-2 --> > >diff --git a/tools/marc_modification_templates.pl b/tools/marc_modification_templates.pl >index 6105d74c15..be5472a891 100755 >--- a/tools/marc_modification_templates.pl >+++ b/tools/marc_modification_templates.pl >@@ -31,6 +31,7 @@ use C4::MarcModificationTemplates qw( > GetModificationTemplates > ModModificationTemplateAction > MoveModificationTemplateAction >+ RenameModificationTemplate > ); > > my $cgi = CGI->new; >@@ -55,6 +56,9 @@ if ( $op eq "cud-create_template" ) { > DelModificationTemplate( $template_id ); > $template_id = ''; > >+} elsif ( $op eq "cud-rename_template" ) { >+ RenameModificationTemplate ( scalar $cgi->param('template_name'), $template_id ); >+ > } elsif ( $op eq "cud-add_action" ) { > > my $mmta_id = $cgi->param('mmta_id'); >-- >2.39.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 27182
:
168041
|
168042
|
168045
|
168077
|
168079
|
168080
| 168081 |
168082
|
168083
|
171294
|
171295