Bugzilla – Attachment 125278 Details for
Bug 29019
Unable to delete HTML customization
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29019: Unable to delete HTML customization
Bug-29019-Unable-to-delete-HTML-customization.patch (text/plain), 5.53 KB, created by
Caroline Cyr La Rose
on 2021-09-24 15:48:18 UTC
(
hide
)
Description:
Bug 29019: Unable to delete HTML customization
Filename:
MIME Type:
Creator:
Caroline Cyr La Rose
Created:
2021-09-24 15:48:18 UTC
Size:
5.53 KB
patch
obsolete
>From 9e09999b17938e827a5e4d42653c328ec60eec52 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Thu, 23 Sep 2021 21:14:52 +0000 >Subject: [PATCH] Bug 29019: Unable to delete HTML customization > >This patch makes some corrections to additional contents to allow >content to be deleted. The wrong parameter was being passed to the >script. The script was also not handling multiple deletions correctly. > >The patch also adds a "category" parameter to the delete operation so >that the page is redirected correctly. > >The patch also changes some strings which referred to "news" >referencing operations which might be performed on news or on HTML >customizations, e.g.: > >"Are you sure you want to delete the selected content?" instead of "Are >you sure you want to delete the selected news?" > >To test, apply the patch and go to Tools -> News. > >- Create multiple news items if necessary. >- Test the "Delete" button corresponding to a single news item: > - Clicking the button should ask you to confirm. > - Check that the wording of the message is correct. > - After confirming the news item should be deleted. > - Ideally, test on news items which are on the second page of the > DataTable of news items. >- Test the process of deleting multiple news items at once: > - Check the checkbox next to multiple items. > - Click the "Delete selected" button at the bottom of the page. > - Check that the wording of the confirmation message is correct. > - After you confirm, the items should be deleted. >- Repeat these tests under Tools -> HTML customizations to confirm that > redirects work correctly. After deleting an HTML customization you > should be redirected back to the list of HTML customizations. > >Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com> >--- > .../en/modules/tools/additional-contents.tt | 22 ++++++++++++++----- > tools/additional-contents.pl | 2 +- > 2 files changed, 17 insertions(+), 7 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt >index c693a68b2e..21dd0eeb04 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt >@@ -366,16 +366,22 @@ > </ul> > </div> > <div class="btn-group"> >- <a href="/cgi-bin/koha/tools/additional-contents.pl?op=del&ids=[% c.idnew | uri %]" class="delete_news btn btn-default btn-xs"><i class="fa fa-trash"></i> Delete</a> >+ <a href="#" class="delete_news btn btn-default btn-xs" data-idnew="[% c.idnew | html %]"><i class="fa fa-trash"></i> Delete</a> > </div> > </td> > </tr> > [% END %] > </tbody> > </table> >- <input type="hidden" name="op" value="del" /> >+ <input type="hidden" name="op" value="delete_confirmed" /> >+ <input type="hidden" name="category" value="[% category | html %]" /> > <fieldset class="action"><input type="submit" class="button" value="Delete selected" /></fieldset> > </form> >+ <form action="/cgi-bin/koha/tools/additional-contents.pl" method="post" id="delete_single"> >+ <input type="hidden" id="del_op" name="op" value="delete_confirmed" /> >+ <input type="hidden" id="del_category" name="category" value="[% category | html %]" /> >+ <input type="hidden" id="del_ids" name="ids" /> >+ </form> > [% ELSE %] > <div class="dialog message">There are no additional contents.</div> > [% END %] >@@ -482,15 +488,19 @@ > "sPaginationType": "full_numbers" > })); > >- $(".delete_news").on("click", function(){ >- return confirmDelete( _("Are you sure you want to delete this news item? This cannot be undone.") ); >+ $("#del_form").on("click", ".delete_news", function(e){ >+ e.preventDefault(); >+ if( confirmDelete( _("Are you sure you want to delete this content? This cannot be undone.") ) ){ >+ $("#del_ids").val( $(this).data("idnew") ); >+ $("#delete_single").submit(); >+ } > }); > > $("#del_form").on("submit",function(){ > if ( Checkbox() ) { >- return confirmDelete( _("Are you sure you want to delete the selected news?") ); >+ return confirmDelete( _("Are you sure you want to delete the selected content?") ); > } else { >- alert(_("Please select a news item to delete.")); >+ alert(_("Please select content to delete.")); > return false; > } > }); >diff --git a/tools/additional-contents.pl b/tools/additional-contents.pl >index e4a409cb68..288c6e1ab7 100755 >--- a/tools/additional-contents.pl >+++ b/tools/additional-contents.pl >@@ -174,7 +174,7 @@ elsif ( $op eq 'add_validate' ) { > elsif ( $op eq 'delete_confirmed' ) { > my @ids = $cgi->multi_param('ids'); > my $deleted = >- eval { Koha::AdditionalContents->search( { idnew => @ids } )->delete; }; >+ map { Koha::AdditionalContents->find($_)->delete() } @ids; > > if ( $@ or not $deleted ) { > push @messages, { type => 'error', code => 'error_on_delete' }; >-- >2.17.1
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 29019
:
125223
|
125278
|
125339
|
125394