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

(-)a/C4/NewsChannels.pm (+22 lines)
Lines 21-26 package C4::NewsChannels; Link Here
21
use Modern::Perl;
21
use Modern::Perl;
22
use C4::Context;
22
use C4::Context;
23
use Koha::DateUtils;
23
use Koha::DateUtils;
24
use C4::Log qw(logaction);
25
use Koha::News;
24
26
25
use vars qw(@ISA @EXPORT);
27
use vars qw(@ISA @EXPORT);
26
28
Lines 68-73 sub add_opac_new { Link Here
68
        my $sth = $dbh->prepare("INSERT INTO opac_news ( $field_string ) VALUES ( $values_string )");
70
        my $sth = $dbh->prepare("INSERT INTO opac_news ( $field_string ) VALUES ( $values_string )");
69
        $sth->execute(@values);
71
        $sth->execute(@values);
70
        $retval = 1;
72
        $retval = 1;
73
74
        #log the NEW OPAC news entry
75
        if (C4::Context->preference("NewsLog")) {
76
                logaction('OPACNEWS', 'ADD' , undef, $href_entry->{lang} . ' | ' . $href_entry->{content});
77
        }
71
    }
78
    }
72
    return $retval;
79
    return $retval;
73
}
80
}
Lines 108-119 sub upd_opac_new { Link Here
108
        $sth->execute(@values);
115
        $sth->execute(@values);
109
        $retval = 1;
116
        $retval = 1;
110
    }
117
    }
118
119
    #log new OPAC news modification
120
    if (C4::Context->preference("NewsLog")) {
121
            logaction('OPACNEWS', 'MODIFY' , undef, $href_entry->{lang} . ' | ' . $href_entry->{content});
122
    }
111
    return $retval;
123
    return $retval;
112
}
124
}
113
125
114
sub del_opac_new {
126
sub del_opac_new {
115
    my ($ids) = @_;
127
    my ($ids) = @_;
116
    if ($ids) {
128
    if ($ids) {
129
130
        #log new OPAC news deletion
131
        if (C4::Context->preference("NewsLog")) {
132
            foreach my $newsid ( split(/,/, $ids )) {
133
                my $n = Koha::News->find( $newsid );
134
                logaction('OPACNEWS', 'DELETE', undef, $n->unblessed->{lang} . ' | ' . $n->unblessed->{content} );
135
            }
136
        }
137
117
        my $dbh = C4::Context->dbh;
138
        my $dbh = C4::Context->dbh;
118
        my $sth = $dbh->prepare("DELETE FROM opac_news WHERE idnew IN ($ids)");
139
        my $sth = $dbh->prepare("DELETE FROM opac_news WHERE idnew IN ($ids)");
119
        $sth->execute();
140
        $sth->execute();
Lines 121-126 sub del_opac_new { Link Here
121
    } else {
142
    } else {
122
        return 0;
143
        return 0;
123
    }
144
    }
145
124
}
146
}
125
147
126
sub get_opac_new {
148
sub get_opac_new {
(-)a/installer/data/mysql/atomicupdate/bug_26205_add_newslog_system_pref.perl (+7 lines)
Line 0 Link Here
1
$DBversion = 'XXX'; # will be replaced by the RM
2
if( CheckVersion( $DBversion ) ) {
3
    $dbh->do( q| INSERT IGNORE INTO systempreferences (variable, value, explanation, options, type) VALUES ('NewsLog', '0', 'If enabled, log OPAC News changes', '', 'YesNo'); | );
4
5
    # Always end with this (adjust the bug info)
6
    NewVersion( $DBversion, 26205, "Log OPAC News changes");
7
}
(-)a/installer/data/mysql/mandatory/sysprefs.sql (+1 lines)
Lines 348-353 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
348
('minPasswordLength','8',NULL,'Specify the minimum length of a patron/staff password','free'),
348
('minPasswordLength','8',NULL,'Specify the minimum length of a patron/staff password','free'),
349
('NewItemsDefaultLocation','','','If set, all new items will have a location of the given Location Code ( Authorized Value type LOC )',''),
349
('NewItemsDefaultLocation','','','If set, all new items will have a location of the given Location Code ( Authorized Value type LOC )',''),
350
('NewsAuthorDisplay','none','none|opac|staff|both','Display the author name for news items.','Choice'),
350
('NewsAuthorDisplay','none','none|opac|staff|both','Display the author name for news items.','Choice'),
351
('NewsLog','0',NULL,'If ON, log OPAC news changes','YesNo'),
351
('NewsToolEditor','tinymce','tinymce|codemirror','Choose tool for editing News.', 'Choice'),
352
('NewsToolEditor','tinymce','tinymce|codemirror','Choose tool for editing News.', 'Choice'),
352
('noissuescharge','5','','Define maximum amount withstanding before checkouts are blocked','Integer'),
353
('noissuescharge','5','','Define maximum amount withstanding before checkouts are blocked','Integer'),
353
('NoIssuesChargeGuarantees','','','Define maximum amount withstanding before checkouts are blocked','Integer'),
354
('NoIssuesChargeGuarantees','','','Define maximum amount withstanding before checkouts are blocked','Integer'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/logs.pref (-1 / +6 lines)
Lines 102-108 Logging: Link Here
102
                  on: Log
102
                  on: Log
103
                  off: "Don't log"
103
                  off: "Don't log"
104
            - " changes to notice templates."
104
            - " changes to notice templates."
105
105
        -
106
            - pref: NewsLog
107
              choices:
108
                  on: Log
109
                  off: "Don't log"
110
            - " changes to OPAC news"
106
    Debugging:
111
    Debugging:
107
        -
112
        -
108
            - pref: DumpTemplateVarsIntranet
113
            - pref: DumpTemplateVarsIntranet
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt (-3 / +3 lines)
Lines 95-100 Link Here
95
[%        CASE 'SEARCHENGINE' %]Search engine
95
[%        CASE 'SEARCHENGINE' %]Search engine
96
96
97
[%        CASE 'NOTICES'      %]Notices[% UNLESS Koha.Preference('NoticesLog') %] <i class="fa fa-warning" title="Log not enabled"></i>[% END %]
97
[%        CASE 'NOTICES'      %]Notices[% UNLESS Koha.Preference('NoticesLog') %] <i class="fa fa-warning" title="Log not enabled"></i>[% END %]
98
[%        CASE 'OPACNEWS'      %]OPAC News[% UNLESS Koha.Preference('NewsLog') %] <i class="fa fa-warning" title="Log not enabled"></i>[% END %]
98
[%        CASE %][% module | html %]
99
[%        CASE %][% module | html %]
99
[%    END %]
100
[%    END %]
100
[% END %]
101
[% END %]
Lines 200-206 Link Here
200
                                        [% ELSE %]
201
                                        [% ELSE %]
201
                                            <label for="moduleALL" class="viewlog"><input type="checkbox" id="moduleALL" name="modules" value=""> All</label>
202
                                            <label for="moduleALL" class="viewlog"><input type="checkbox" id="moduleALL" name="modules" value=""> All</label>
202
                                        [% END %]
203
                                        [% END %]
203
                                        [% FOREACH modx IN [ 'AUTH' 'CATALOGUING' 'AUTHORITIES' 'MEMBERS' 'ACQUISITIONS' 'SERIAL' 'HOLDS' 'ILL' 'CIRCULATION' 'CLAIMS' 'FINES' 'SYSTEMPREFERENCE' 'CRONJOBS', 'REPORTS', 'SEARCHENGINE', 'NOTICES' ] %]
204
                                        [% FOREACH modx IN [ 'AUTH' 'CATALOGUING' 'AUTHORITIES' 'MEMBERS' 'ACQUISITIONS' 'SERIAL' 'HOLDS' 'ILL' 'CIRCULATION' 'CLAIMS' 'FINES' 'SYSTEMPREFERENCE' 'CRONJOBS', 'REPORTS', 'SEARCHENGINE', 'NOTICES', 'OPACNEWS' ] %]
204
                                            [% IF modules.grep(modx).size %]
205
                                            [% IF modules.grep(modx).size %]
205
                                                <label for="module[% modx | html %]" class="viewlog"><input type="checkbox" id="module[% modx | html %]" name="modules" value="[% modx | html %]" checked="checked"> [% PROCESS translate_log_module module=modx %]</label>
206
                                                <label for="module[% modx | html %]" class="viewlog"><input type="checkbox" id="module[% modx | html %]" name="modules" value="[% modx | html %]" checked="checked"> [% PROCESS translate_log_module module=modx %]</label>
206
                                            [% ELSE %]
207
                                            [% ELSE %]
Lines 361-367 Link Here
361
                                        [% IF ( loopro.module == 'CIRCULATION' ) %]
362
                                        [% IF ( loopro.module == 'CIRCULATION' ) %]
362
                                            <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>
363
                                        [% ELSE %]
364
                                        [% ELSE %]
364
                                            [% IF loopro.module == "SYSTEMPREFERENCE" || loopro.module == "REPORTS" %]
365
                                            [% IF loopro.module == "SYSTEMPREFERENCE" || loopro.module == "REPORTS" || loopro.module == "OPACNEWS" %]
365
                                                <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>
366
                                                <div class="compare_info" id="compare_info[% loopro.action_id | html %]">
367
                                                <div class="compare_info" id="compare_info[% loopro.action_id | html %]">
367
                                                    <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>
368
- 

Return to bug 26205