Bugzilla – Attachment 173198 Details for
Bug 38136
Refactor database translations (alternative)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 38136: Return '404 Not Found' when trying to delete a non-existent translation
Bug-38136-Return-404-Not-Found-when-trying-to-dele.patch (text/plain), 1.37 KB, created by
Jonathan Druart
on 2024-10-23 10:04:32 UTC
(
hide
)
Description:
Bug 38136: Return '404 Not Found' when trying to delete a non-existent translation
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2024-10-23 10:04:32 UTC
Size:
1.37 KB
patch
obsolete
>From 75c5c6a3d305532441a283b30f7a6dfa68274b3a Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 23 Oct 2024 12:04:02 +0200 >Subject: [PATCH] Bug 38136: Return '404 Not Found' when trying to delete a > non-existent translation > >--- > svc/localization | 9 +++++++++ > 1 file changed, 9 insertions(+) > >diff --git a/svc/localization b/svc/localization >index 15e78030b06..825e9d51870 100755 >--- a/svc/localization >+++ b/svc/localization >@@ -3,10 +3,12 @@ > use Modern::Perl; > use Encode qw( encode ); > use Try::Tiny; >+use JSON qw( to_json ); > > use C4::Service; > use Koha::Caches; > use Koha::Database; >+use C4::Output qw( output_with_http_headers ); > > our ( $query, $response ) = C4::Service->init( parameters => 'manage_itemtypes' ); > >@@ -84,6 +86,13 @@ sub delete_translation { > my $row = $schema->resultset($source)->find($object_id); > if ($row && $row->can('localizations')) { > my $localization = $row->localizations->find($localization_id); >+ >+ unless ( $localization ) { >+ my $json = to_json ( { errors => 'Not found' } ); >+ output_with_http_headers $query, undef, $json, 'js', '404 Not Found'; >+ exit; >+ } >+ > if ($localization) { > $localization->delete(); > Koha::Caches->get_instance('localization')->clear_from_cache("$source:" . $localization->lang); >-- >2.34.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 38136
:
172585
|
172804
|
173195
|
173196
|
173197
|
173198
|
174578
|
174579
|
174580
|
174581
|
174598
|
174599
|
175077
|
175078
|
175082
|
175083
|
179978
|
180096
|
180136