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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt (-1 / +1 lines)
Lines 362-368 Link Here
362
                                        [% IF ( loopro.module == 'CIRCULATION' ) %]
362
                                        [% IF ( loopro.module == 'CIRCULATION' ) %]
363
                                            <a href="/cgi-bin/koha/catalogue/moredetail.pl?itemnumber=[% loopro.info | uri %]&amp;biblionumber=[% loopro.biblionumber | uri %]&amp;bi=[% loopro.biblioitemnumber | uri %]#item[% loopro.info | uri %]" title="Display detail for this item">Item [% loopro.barcode | html %]</a>
363
                                            <a href="/cgi-bin/koha/catalogue/moredetail.pl?itemnumber=[% loopro.info | uri %]&amp;biblionumber=[% loopro.biblionumber | uri %]&amp;bi=[% loopro.biblioitemnumber | uri %]#item[% loopro.info | uri %]" title="Display detail for this item">Item [% loopro.barcode | html %]</a>
364
                                        [% ELSE %]
364
                                        [% ELSE %]
365
                                            [% IF loopro.module == "SYSTEMPREFERENCE" || loopro.module == "REPORTS" || loopro.module == "OPACNEWS" %]
365
                                            [% IF loopro.module == "SYSTEMPREFERENCE" || loopro.module == "REPORTS" || loopro.module == "NEWS" %]
366
                                                <div class="loginfo" id="loginfo[% loopro.action_id | html %]">[% loopro.info | trim | html %]</div>
366
                                                <div class="loginfo" id="loginfo[% loopro.action_id | html %]">[% loopro.info | trim | html %]</div>
367
                                                <div class="compare_info" id="compare_info[% loopro.action_id | html %]">
367
                                                <div class="compare_info" id="compare_info[% loopro.action_id | html %]">
368
                                                    <label><input type="checkbox" name="diff" id="action_id[% loopro.action_id | html %]" data-actionid="[% loopro.action_id | html %]" data-filter="[% FOREACH info IN loopro.info.split(' \| ') %][% IF loop.first %][% info | html %][% END %][% END %]" class="compare" /> Compare</label>
368
                                                    <label><input type="checkbox" name="diff" id="action_id[% loopro.action_id | html %]" data-actionid="[% loopro.action_id | html %]" data-filter="[% FOREACH info IN loopro.info.split(' \| ') %][% IF loop.first %][% info | html %][% END %][% END %]" class="compare" /> Compare</label>
(-)a/tools/additional-contents.pl (-4 / +29 lines)
Lines 27-32 use CGI qw ( -utf8 ); Link Here
27
use C4::Auth qw(get_template_and_user);
27
use C4::Auth qw(get_template_and_user);
28
use C4::Koha;
28
use C4::Koha;
29
use C4::Context;
29
use C4::Context;
30
use C4::Log qw( logaction );
30
use C4::Output qw(output_html_with_http_headers);
31
use C4::Output qw(output_html_with_http_headers);
31
use C4::Languages qw(getTranslatedLanguages);
32
use C4::Languages qw(getTranslatedLanguages);
32
use Koha::DateUtils;
33
use Koha::DateUtils;
Lines 119-128 elsif ( $op eq 'add_validate' ) { Link Here
119
        # Delete if title or content is empty
120
        # Delete if title or content is empty
120
        unless ( $title and $content ) {
121
        unless ( $title and $content ) {
121
            $additional_content->delete if $additional_content;
122
            $additional_content->delete if $additional_content;
123
            logaction('NEWS', 'DELETE' , undef, sprintf("%s|%s|%s|%s", $additional_content->code, $additional_content->title, $additional_content->lang, $additional_content->content));
122
            next;
124
            next;
123
        } elsif ( $additional_content ) {
125
        } elsif ( $additional_content ) {
126
            my $updated;
124
            eval {
127
            eval {
125
                $additional_content->update(
128
                $additional_content->set(
126
                    {
129
                    {
127
                        category       => $category,
130
                        category       => $category,
128
                        code           => $code,
131
                        code           => $code,
Lines 137-148 elsif ( $op eq 'add_validate' ) { Link Here
137
                        borrowernumber => $borrowernumber,
140
                        borrowernumber => $borrowernumber,
138
                    }
141
                    }
139
                );
142
                );
143
                $updated = $additional_content->_result->get_dirty_columns;
144
                $additional_content->store;
140
            };
145
            };
141
            if ($@) {
146
            if ($@) {
142
                $success = 0;
147
                $success = 0;
143
                push @messages, { type => 'error', code => 'error_on_update' };
148
                push @messages, { type => 'error', code => 'error_on_update' };
144
                last;
149
                last;
145
            }
150
            }
151
152
            logaction('NEWS', 'MODIFY' , undef, sprintf("%s|%s|%s|%s", $code, $title, $lang, $content))
153
                if C4::Context->preference("NewsLog") && $updated;
146
        }
154
        }
147
        else {
155
        else {
148
            my $additional_content = Koha::AdditionalContent->new(
156
            my $additional_content = Koha::AdditionalContent->new(
Lines 166-171 elsif ( $op eq 'add_validate' ) { Link Here
166
                push @messages, { type => 'error', code => 'error_on_insert' };
174
                push @messages, { type => 'error', code => 'error_on_insert' };
167
                last;
175
                last;
168
            }
176
            }
177
178
            logaction('NEWS', 'ADD' , undef, sprintf("%s|%s|%s|%s", $code, $title, $lang, $content))
179
                if C4::Context->preference("NewsLog");
169
        }
180
        }
170
181
171
    }
182
    }
Lines 173-180 elsif ( $op eq 'add_validate' ) { Link Here
173
}
184
}
174
elsif ( $op eq 'delete_confirmed' ) {
185
elsif ( $op eq 'delete_confirmed' ) {
175
    my @ids = $cgi->multi_param('ids');
186
    my @ids = $cgi->multi_param('ids');
176
    my $deleted =
187
    my $deleted = eval {
177
      eval { Koha::AdditionalContents->search( { idnew => @ids } )->delete; };
188
189
        my $schema = Koha::Database->new->schema;
190
        $schema->txn_do(
191
            sub {
192
                my $contents =
193
                  Koha::AdditionalContents->search( { idnew => @ids } );
194
195
                if ( C4::Context->preference("NewsLog") ) {
196
                    while ( my $c = $contents->next ) {
197
                        logaction('NEWS', 'DELETE' , undef, sprintf("%s|%s|%s|%s", $c->code, $c->title, $c->lang, $c->content));
198
                    }
199
                }
200
                $contents->delete;
201
            }
202
        );
203
    };
178
204
179
    if ( $@ or not $deleted ) {
205
    if ( $@ or not $deleted ) {
180
        push @messages, { type => 'error', code => 'error_on_delete' };
206
        push @messages, { type => 'error', code => 'error_on_delete' };
181
- 

Return to bug 28717