use strict;
use warnings;
-use Sys::Syslog qw(syslog);
use Data::Dumper;
use C4::Context;
#=head2 C4::Labels::Lib::_SELECT()
#
-# This function returns a recordset upon success and 1 upon failure. Errors are logged to the syslog.
+# This function returns a recordset upon success and 1 upon failure. Errors are logged to the Apache log.
#
# examples:
#
# $sth->{'TraceLevel'} = 3;
$sth->execute();
if ($sth->err) {
- syslog("LOG_ERR", "C4::Labels::Lib::get_single_field_value : Database returned the following error: %s", $sth->errstr);
+ warn sprintf('Database returned the following error: %s', $sth->errstr);
return 1;
}
my $record_set = [];
=head2 C4::Labels::Lib::get_all_templates()
- This function returns a reference to a hash containing all templates upon success and 1 upon failure. Errors are logged to the syslog.
+ This function returns a reference to a hash containing all templates upon success and 1 upon failure. Errors are logged to the Apache log.
examples:
my $sth = C4::Context->dbh->prepare($query);
$sth->execute();
if ($sth->err) {
- syslog("LOG_ERR", "C4::Labels::Lib::get_all_templates : Database returned the following error: %s", $sth->errstr);
+ warn sprintf('Database returned the following error: %s', $sth->errstr);
return -1;
}
ADD_TEMPLATES:
=head2 C4::Labels::Lib::get_all_layouts()
- This function returns a reference to a hash containing all layouts upon success and 1 upon failure. Errors are logged to the syslog.
+ This function returns a reference to a hash containing all layouts upon success and 1 upon failure. Errors are logged to the Apache log.
examples:
my $sth = C4::Context->dbh->prepare($query);
$sth->execute();
if ($sth->err) {
- syslog("LOG_ERR", "C4::Labels::Lib::get_all_layouts : Database returned the following error: %s", $sth->errstr);
+ warn sprintf('Database returned the following error: %s', $sth->errstr);
return -1;
}
ADD_LAYOUTS:
=head2 C4::Labels::Lib::get_all_profiles()
This function returns an arrayref whose elements are hashes containing all profiles upon success and 1 upon failure. Errors are logged
- to the syslog. Two parameters are accepted. The first limits the field(s) returned. This parameter should be string of comma separted
+ to the Apache log. Two parameters are accepted. The first limits the field(s) returned. This parameter should be string of comma separted
fields. ie. "field_1, field_2, ...field_n" The second limits the records returned based on a string containing a valud SQL 'WHERE' filter.
NOTE: Do not pass in the keyword 'WHERE.'
# $sth->{'TraceLevel'} = 3 if $debug;
$sth->execute();
if ($sth->err) {
- syslog("LOG_ERR", "C4::Labels::Lib::get_all_profiles : Database returned the following error: %s", $sth->errstr);
+ warn sprintf('Database returned the following error: %s', $sth->errstr);
return -1;
}
ADD_PROFILES:
=head2 C4::Labels::Lib::get_batch_summary()
This function returns an arrayref whose elements are hashes containing the batch_ids of current batches along with the item count
- for each batch upon success and 1 upon failure. Item counts are stored under the key '_item_count' Errors are logged to the syslog.
+ for each batch upon success and 1 upon failure. Item counts are stored under the key '_item_count' Errors are logged to the Apache log.
One parameter is accepted which limits the records returned based on a string containing a valud SQL 'WHERE' filter.
NOTE: Do not pass in the keyword 'WHERE.'
# $sth->{'TraceLevel'} = 3;
$sth->execute();
if ($sth->err) {
- syslog("LOG_ERR", "C4::Labels::Lib::get_batch_summary : Database returned the following error on attempted SELECT: %s", $sth->errstr);
+ warn sprintf('Database returned the following error on attempted SELECT: %s', $sth->errstr);
return -1;
}
ADD_BATCHES:
my $sth1 = C4::Context->dbh->prepare($query);
$sth1->execute($batch->{'batch_id'});
if ($sth1->err) {
- syslog("LOG_ERR", "C4::Labels::Lib::get_batch_summary : Database returned the following error on attempted SELECT count: %s", $sth1->errstr);
+ warn sprintf('Database returned the following error on attempted SELECT count: %s', $sth1->errstr);
return -1;
}
my $count = $sth1->fetchrow_arrayref;
=head2 C4::Labels::Lib::get_label_summary()
This function returns an arrayref whose elements are hashes containing the label_ids of current labels along with the item count
- for each label upon success and 1 upon failure. Item counts are stored under the key '_item_count' Errors are logged to the syslog.
+ for each label upon success and 1 upon failure. Item counts are stored under the key '_item_count' Errors are logged to the Apache log.
One parameter is accepted which limits the records returned based on a string containing a valud SQL 'WHERE' filter.
NOTE: Do not pass in the keyword 'WHERE.'
$label_number++;
$sth->execute($item->{'item_number'}, $params{'batch_id'});
if ($sth->err) {
- syslog("LOG_ERR", "C4::Labels::Lib::get_label_summary : Database returned the following error on attempted SELECT: %s", $sth->errstr);
+ warn sprintf('Database returned the following error on attempted SELECT: %s', $sth->errstr);
return -1;
}
my $record = $sth->fetchrow_hashref;
my $label_summary->{'_label_number'} = $label_number;
$record->{'author'} =~ s/[^\.|\w]$// if $record->{'author'}; # strip off ugly trailing chars... but not periods or word chars
$record->{'title'} =~ s/\W*$//; # strip off ugly trailing chars
+ # FIXME contructing staff interface URLs should be done *much* higher up the stack - for the most part, C4 module code
+ # should not know that it's part of a web app
$record->{'title'} = '<a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=' . $record->{'biblionumber'} . '"> ' . $record->{'title'} . '</a>';
$label_summary->{'_summary'} = $record->{'title'} . " | " . ($record->{'author'} ? $record->{'author'} : 'N/A');
$label_summary->{'_item_type'} = $record->{'itemtype'};