use DateTime;
use DateTime::Format::DateParse;
use Koha::DateUtils;
+use Text::Unaccent qw( unac_string );
our ($VERSION,@ISA,@EXPORT,@EXPORT_OK,$debug);
BEGIN {
- $VERSION = 3.02;
+ $VERSION = 3.07.00.049;
$debug = $ENV{DEBUG} || 0;
require Exporter;
@ISA = qw(Exporter);
$firstname =~ s/[[:digit:][:space:][:blank:][:punct:][:cntrl:]]//g;
$surname =~ s/[[:digit:][:space:][:blank:][:punct:][:cntrl:]]//g;
$newuid = lc(($firstname)? "$firstname.$surname" : $surname);
+ $newuid = unac_string('utf-8',$newuid);
$newuid .= $offset unless $offset == 0;
$offset++;
return "V$cardnumber$rem";
} else {
- # MODIFIED BY JF: mysql4.1 allows casting as an integer, which is probably
- # better. I'll leave the original in in case it needs to be changed for you
- # my $sth=$dbh->prepare("select max(borrowers.cardnumber) from borrowers");
my $sth = $dbh->prepare(
- "select max(cast(cardnumber as signed)) from borrowers"
+ 'SELECT MAX( CAST( cardnumber AS SIGNED ) ) FROM borrowers WHERE cardnumber REGEXP "^-?[0-9]+$"'
);
$sth->execute;
my ($result) = $sth->fetchrow;
sub GetAllIssues {
my ( $borrowernumber, $order, $limit ) = @_;
- #FIXME: sanity-check order and limit
- my $dbh = C4::Context->dbh;
+ my $dbh = C4::Context->dbh;
my $query =
- "SELECT *, issues.timestamp as issuestimestamp, issues.renewals AS renewals,items.renewals AS totalrenewals,items.timestamp AS itemstimestamp
+'SELECT *, issues.timestamp as issuestimestamp, issues.renewals AS renewals,items.renewals AS totalrenewals,items.timestamp AS itemstimestamp
FROM issues
LEFT JOIN items on items.itemnumber=issues.itemnumber
LEFT JOIN biblio ON items.biblionumber=biblio.biblionumber
LEFT JOIN biblio ON items.biblionumber=biblio.biblionumber
LEFT JOIN biblioitems ON items.biblioitemnumber=biblioitems.biblioitemnumber
WHERE borrowernumber=? AND old_issues.itemnumber IS NOT NULL
- order by $order";
- if ( $limit != 0 ) {
+ order by ' . $order;
+ if ($limit) {
$query .= " limit $limit";
}
my $sth = $dbh->prepare($query);
- $sth->execute($borrowernumber, $borrowernumber);
- my @result;
- my $i = 0;
- while ( my $data = $sth->fetchrow_hashref ) {
- push @result, $data;
- }
-
- return \@result;
+ $sth->execute( $borrowernumber, $borrowernumber );
+ return $sth->fetchall_arrayref( {} );
}
# return unless ( C4::Context->boolean_preference('printcirculationslips') );
- my $today = POSIX::strftime("%Y-%m-%d", localtime);
+ my $now = POSIX::strftime("%Y-%m-%d", localtime);
my $issueslist = GetPendingIssues($borrowernumber);
foreach my $it (@$issueslist){
- if ($it->{'issuedate'} eq $today) {
- $it->{'today'} = 1;
+ if ((substr $it->{'issuedate'}, 0, 10) eq $now) {
+ $it->{'now'} = 1;
}
- elsif ($it->{'date_due'} le $today) {
+ elsif ((substr $it->{'date_due'}, 0, 10) le $now) {
$it->{'overdue'} = 1;
}
'biblio' => $_,
'items' => $_,
'issues' => $_,
- }, grep { $_->{'today'} } @issues ],
+ }, grep { $_->{'now'} } @issues ],
);
}
else {