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

(-)a/svc/localization (-1 / +9 lines)
Lines 3-12 Link Here
3
use Modern::Perl;
3
use Modern::Perl;
4
use Encode qw( encode );
4
use Encode qw( encode );
5
use Try::Tiny;
5
use Try::Tiny;
6
use JSON qw( to_json );
6
7
7
use C4::Service;
8
use C4::Service;
8
use Koha::Caches;
9
use Koha::Caches;
9
use Koha::Database;
10
use Koha::Database;
11
use C4::Output qw( output_with_http_headers );
10
12
11
our ( $query, $response ) = C4::Service->init( parameters => 'manage_itemtypes' );
13
our ( $query, $response ) = C4::Service->init( parameters => 'manage_itemtypes' );
12
14
Lines 84-89 sub delete_translation { Link Here
84
    my $row = $schema->resultset($source)->find($object_id);
86
    my $row = $schema->resultset($source)->find($object_id);
85
    if ($row && $row->can('localizations')) {
87
    if ($row && $row->can('localizations')) {
86
        my $localization = $row->localizations->find($localization_id);
88
        my $localization = $row->localizations->find($localization_id);
89
90
        unless ( $localization ) {
91
            my $json = to_json ( { errors => 'Not found' } );
92
            output_with_http_headers $query, undef, $json, 'js', '404 Not Found';
93
            exit;
94
        }
95
87
        if ($localization) {
96
        if ($localization) {
88
            $localization->delete();
97
            $localization->delete();
89
            Koha::Caches->get_instance('localization')->clear_from_cache("$source:" . $localization->lang);
98
            Koha::Caches->get_instance('localization')->clear_from_cache("$source:" . $localization->lang);
90
- 

Return to bug 38136