From dpavlin at rot13.org Thu Sep 4 15:21:45 2014
From: dpavlin at rot13.org (Dobrica Pavlinusic)
Date: Thu, 4 Sep 2014 15:21:45 +0200
Subject: [Koha-patches] [PATCH] Bug 12729 - Overdue items won't show as
overdue in red in circulation
Message-ID: <1409836905-23104-1-git-send-email-dpavlin@rot13.org>
It seems that Firefox date parser doesn't like our dates which are
formatted in ISO format like "2014-08-06 00:00:00". This results in
missing red color in overdue dates.
So intead of munching different date formats and JavaScript (and having
to support different browers) this patch moves check for overdue dates
back to mysql and just transfers boolean value to JavaScript so it can
show correct class for date_due.
Test scenario:
1. find borrower with overdue checkouts
2. verify that all dates are black (and are in ISO format)
3. apply this patch
4. reload page and verify that overdue dates turned red
---
koha-tmpl/intranet-tmpl/prog/en/js/checkouts.js | 4 +---
svc/checkouts | 2 ++
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/checkouts.js b/koha-tmpl/intranet-tmpl/prog/en/js/checkouts.js
index 6efe9f9..4424d3a 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/js/checkouts.js
+++ b/koha-tmpl/intranet-tmpl/prog/en/js/checkouts.js
@@ -151,9 +151,7 @@ $(document).ready(function() {
{
"iDataSort": 1, // Sort on hidden unformatted date due column
"mDataProp": function( oObj ) {
- var today = new Date();
- var due = new Date( oObj.date_due );
- if ( today > due ) {
+ if ( oObj.date_due_overdue ) {
return "" + oObj.date_due_formatted + "";
} else {
return oObj.date_due_formatted;
diff --git a/svc/checkouts b/svc/checkouts
index abe2c0e..f56bdff 100755
--- a/svc/checkouts
+++ b/svc/checkouts
@@ -60,6 +60,7 @@ my $sql = '
SELECT
issuedate,
date_due,
+ date_due < now() as date_due_overdue,
biblionumber,
biblio.title,
@@ -148,6 +149,7 @@ while ( my $c = $sth->fetchrow_hashref() ) {
biblionumber => $c->{biblionumber},
issuedate => $c->{issuedate},
date_due => $c->{date_due},
+ date_due_overdue => $c->{date_due_overdue} ? JSON::true : JSON::false,
renewals_count => $renewals_count,
renewals_allowed => $renewals_allowed,
renewals_remaining => $renewals_remaining,
--
1.7.2.5
From srdjan at catalyst.net.nz Thu Sep 18 04:07:54 2014
From: srdjan at catalyst.net.nz (Srdjan)
Date: Thu, 18 Sep 2014 14:07:54 +1200
Subject: [Koha-patches] [PATCH] Log koha actions to syslog too
Message-ID: <1411006074-6842-1-git-send-email-srdjan@catalyst.net.nz>
* Added kohasite and syslog_facility to config
* syslog_facility is set to "user" and commented out for the fresh site
install
* If syslog_facility is enabled in config, log to syslog as
(value of kohasite config)
* /etc/rsyslog.d/99-.conf is created with filter instructions
to direct log entries to standard log dir
(/var/log/koha/) action.log; syslog daemons other than
rsyslog need to be configured (or not) to do the same, otherwise catch
all syslog log file is used
http://bugs.koha-community.org/show_bug.cgi?id=12952
---
C4/Log.pm | 8 ++++++++
debian/scripts/koha-create | 6 +++++-
debian/scripts/koha-dump | 1 +
debian/scripts/koha-remove | 2 ++
debian/templates/koha-conf-site.xml.in | 4 ++++
debian/templates/rsyslog-site.in | 2 ++
t/Log.t | 1 +
7 files changed, 23 insertions(+), 1 deletion(-)
create mode 100644 debian/templates/rsyslog-site.in
diff --git a/C4/Log.pm b/C4/Log.pm
index 80c3493..7e3bbe7 100644
--- a/C4/Log.pm
+++ b/C4/Log.pm
@@ -26,6 +26,7 @@ use warnings;
use C4::Context;
use C4::Dates qw(format_date);
+use Sys::Syslog qw(:standard :macros);
use vars qw($VERSION @ISA @EXPORT);
@@ -79,6 +80,13 @@ sub logaction {
my $sth=$dbh->prepare("Insert into action_logs (timestamp,user,module,action,object,info) values (now(),?,?,?,?,?)");
$sth->execute($usernumber,$modulename,$actionname,$objectnumber,$infos);
$sth->finish;
+
+ my $facility = C4::Context->config("syslog_facility") or return;
+ my $kohasite = C4::Context->config("kohasite");
+ openlog($kohasite, 'nofatal', $facility);
+ $objectnumber = '' unless defined $objectnumber;
+ syslog(LOG_NOTICE, "$modulename: $actionname ($objectnumber); [$usernumber] $infos");
+ closelog();
}
=item GetLogStatus
diff --git a/debian/scripts/koha-create b/debian/scripts/koha-create
index 6891ac1..5c4aa2a 100755
--- a/debian/scripts/koha-create
+++ b/debian/scripts/koha-create
@@ -546,8 +546,12 @@ eof
# Generate and install Apache site-available file and log dir.
generate_config_file apache-site.conf.in \
"/etc/apache2/sites-available/$name.conf"
+ # Generate and install rsyslog conf
+ generate_config_file rsyslog-site.conf.in \
+ "/etc/rsyslog.d/99-$name.conf"
mkdir "/var/log/koha/$name"
- chown "$username:$username" "/var/log/koha/$name"
+ chown "$username:adm" "/var/log/koha/$name"
+ chmod 0775 "/var/log/koha/$name"
# Generate and install main Koha config file.
diff --git a/debian/scripts/koha-dump b/debian/scripts/koha-dump
index bf4bd5f..23a4b38 100755
--- a/debian/scripts/koha-dump
+++ b/debian/scripts/koha-dump
@@ -63,6 +63,7 @@ tar -C / -czf "$metadump" \
"etc/koha/sites/$name" \
"etc/apache2/sites-available/$instancefile" \
"etc/apache2/sites-enabled/$instancefile" \
+ "etc/rsyslog.d/99-$name.conf" \
"var/lib/koha/$name" \
"var/log/koha/$name"
diff --git a/debian/scripts/koha-remove b/debian/scripts/koha-remove
index 528db75..39e3afd 100755
--- a/debian/scripts/koha-remove
+++ b/debian/scripts/koha-remove
@@ -81,6 +81,8 @@ eof
[ -f "$instancefile" ] && \
rm "$instancefile"
+ [ -f "/etc/rsyslog.d/99-$name.conf" ] && \
+ rm "/etc/rsyslog.d/99-$name.conf"
[ -f "/etc/koha/sites/$name/koha-conf.xml" ] && \
rm "/etc/koha/sites/$name/koha-conf.xml"
[ -f "/etc/koha/sites/$name/zebra-biblios.cfg" ] && \
diff --git a/debian/templates/koha-conf-site.xml.in b/debian/templates/koha-conf-site.xml.in
index 371b1d2..7506631 100644
--- a/debian/templates/koha-conf-site.xml.in
+++ b/debian/templates/koha-conf-site.xml.in
@@ -248,6 +248,7 @@
-->
+ __KOHASITE__
mysql
__DB_NAME__
__DB_HOST__
@@ -282,6 +283,9 @@
__AUTHORITIES_INDEXING_MODE__
/var/lock/koha/__KOHASITE__
/etc/koha/searchengine/queryparser.yaml
+
diff --git a/debian/templates/rsyslog-site.in b/debian/templates/rsyslog-site.in
new file mode 100644
index 0000000..bd566d3
--- /dev/null
+++ b/debian/templates/rsyslog-site.in
@@ -0,0 +1,2 @@
+if $programname == '__KOHASITE__' then /var/log/koha/__KOHASITE__/action.log
+if $programname == '__KOHASITE__' then ~
diff --git a/t/Log.t b/t/Log.t
index 601b909..d11cd9f 100755
--- a/t/Log.t
+++ b/t/Log.t
@@ -13,6 +13,7 @@ BEGIN {
use_ok('C4::Log');
}
+t::lib::Mocks::mock_config('syslog_facility', 'user');
t::lib::Mocks::mock_preference('BorrowersLog', 1);
t::lib::Mocks::mock_preference('CataloguingLog', 1);
t::lib::Mocks::mock_preference('IssueLog', 1);
--
1.9.1
From srdjan at catalyst.net.nz Fri Sep 26 04:58:29 2014
From: srdjan at catalyst.net.nz (Srdjan)
Date: Fri, 26 Sep 2014 14:58:29 +1200
Subject: [Koha-patches] [PATCH] Log koha actions to syslog too
Message-ID: <1411700309-11615-1-git-send-email-srdjan@catalyst.net.nz>
* Added kohasite and syslog_facility to config
* syslog_facility is set to "user" and commented out for the fresh site
install
* If syslog_facility is enabled in config, log to syslog as
(value of kohasite config)
* /etc/rsyslog.d/99-.conf is created with filter instructions
to direct log entries to standard log dir
(/var/log/koha/) action.log; syslog daemons other than
rsyslog need to be configured (or not) to do the same, otherwise catch
all syslog log file is used
http://bugs.koha-community.org/show_bug.cgi?id=12952
---
C4/Log.pm | 8 ++++++++
debian/scripts/koha-create | 6 +++++-
debian/scripts/koha-dump | 1 +
debian/scripts/koha-remove | 2 ++
debian/templates/koha-conf-site.xml.in | 4 ++++
debian/templates/rsyslog-site.conf.in | 2 ++
t/Log.t | 1 +
7 files changed, 23 insertions(+), 1 deletion(-)
create mode 100644 debian/templates/rsyslog-site.conf.in
diff --git a/C4/Log.pm b/C4/Log.pm
index 80c3493..7e3bbe7 100644
--- a/C4/Log.pm
+++ b/C4/Log.pm
@@ -26,6 +26,7 @@ use warnings;
use C4::Context;
use C4::Dates qw(format_date);
+use Sys::Syslog qw(:standard :macros);
use vars qw($VERSION @ISA @EXPORT);
@@ -79,6 +80,13 @@ sub logaction {
my $sth=$dbh->prepare("Insert into action_logs (timestamp,user,module,action,object,info) values (now(),?,?,?,?,?)");
$sth->execute($usernumber,$modulename,$actionname,$objectnumber,$infos);
$sth->finish;
+
+ my $facility = C4::Context->config("syslog_facility") or return;
+ my $kohasite = C4::Context->config("kohasite");
+ openlog($kohasite, 'nofatal', $facility);
+ $objectnumber = '' unless defined $objectnumber;
+ syslog(LOG_NOTICE, "$modulename: $actionname ($objectnumber); [$usernumber] $infos");
+ closelog();
}
=item GetLogStatus
diff --git a/debian/scripts/koha-create b/debian/scripts/koha-create
index 6891ac1..5c4aa2a 100755
--- a/debian/scripts/koha-create
+++ b/debian/scripts/koha-create
@@ -546,8 +546,12 @@ eof
# Generate and install Apache site-available file and log dir.
generate_config_file apache-site.conf.in \
"/etc/apache2/sites-available/$name.conf"
+ # Generate and install rsyslog conf
+ generate_config_file rsyslog-site.conf.in \
+ "/etc/rsyslog.d/99-$name.conf"
mkdir "/var/log/koha/$name"
- chown "$username:$username" "/var/log/koha/$name"
+ chown "$username:adm" "/var/log/koha/$name"
+ chmod 0775 "/var/log/koha/$name"
# Generate and install main Koha config file.
diff --git a/debian/scripts/koha-dump b/debian/scripts/koha-dump
index bf4bd5f..23a4b38 100755
--- a/debian/scripts/koha-dump
+++ b/debian/scripts/koha-dump
@@ -63,6 +63,7 @@ tar -C / -czf "$metadump" \
"etc/koha/sites/$name" \
"etc/apache2/sites-available/$instancefile" \
"etc/apache2/sites-enabled/$instancefile" \
+ "etc/rsyslog.d/99-$name.conf" \
"var/lib/koha/$name" \
"var/log/koha/$name"
diff --git a/debian/scripts/koha-remove b/debian/scripts/koha-remove
index 528db75..39e3afd 100755
--- a/debian/scripts/koha-remove
+++ b/debian/scripts/koha-remove
@@ -81,6 +81,8 @@ eof
[ -f "$instancefile" ] && \
rm "$instancefile"
+ [ -f "/etc/rsyslog.d/99-$name.conf" ] && \
+ rm "/etc/rsyslog.d/99-$name.conf"
[ -f "/etc/koha/sites/$name/koha-conf.xml" ] && \
rm "/etc/koha/sites/$name/koha-conf.xml"
[ -f "/etc/koha/sites/$name/zebra-biblios.cfg" ] && \
diff --git a/debian/templates/koha-conf-site.xml.in b/debian/templates/koha-conf-site.xml.in
index 371b1d2..7506631 100644
--- a/debian/templates/koha-conf-site.xml.in
+++ b/debian/templates/koha-conf-site.xml.in
@@ -248,6 +248,7 @@
-->
+ __KOHASITE__
mysql
__DB_NAME__
__DB_HOST__
@@ -282,6 +283,9 @@
__AUTHORITIES_INDEXING_MODE__
/var/lock/koha/__KOHASITE__
/etc/koha/searchengine/queryparser.yaml
+
diff --git a/debian/templates/rsyslog-site.conf.in b/debian/templates/rsyslog-site.conf.in
new file mode 100644
index 0000000..bd566d3
--- /dev/null
+++ b/debian/templates/rsyslog-site.conf.in
@@ -0,0 +1,2 @@
+if $programname == '__KOHASITE__' then /var/log/koha/__KOHASITE__/action.log
+if $programname == '__KOHASITE__' then ~
diff --git a/t/Log.t b/t/Log.t
index 601b909..d11cd9f 100755
--- a/t/Log.t
+++ b/t/Log.t
@@ -13,6 +13,7 @@ BEGIN {
use_ok('C4::Log');
}
+t::lib::Mocks::mock_config('syslog_facility', 'user');
t::lib::Mocks::mock_preference('BorrowersLog', 1);
t::lib::Mocks::mock_preference('CataloguingLog', 1);
t::lib::Mocks::mock_preference('IssueLog', 1);
--
1.9.1