use strict;
#use warnings; FIXME - Bug 2505
use C4::Context;
-use C4::Dates qw(format_date_in_iso format_date);
use String::Random qw( random_string );
use Date::Calc qw/Today Add_Delta_YM check_date Date_to_Days/;
use C4::Log; # logaction
use Text::Unaccent qw( unac_string );
use Koha::AuthUtils qw(hash_password);
use Koha::Database;
-require Koha::NorwegianPatronDB;
+
+use Module::Load::Conditional qw( can_load );
+if ( ! can_load( modules => { 'Koha::NorwegianPatronDB' => undef } ) ) {
+ warn "Unable to load Koha::NorwegianPatronDB";
+}
our ($VERSION,@ISA,@EXPORT,@EXPORT_OK,$debug);
$borrower->{'flags'} = $flags;
$borrower->{'authflags'} = $accessflagshash;
- # For the purposes of making templates easier, we'll define a
- # 'showname' which is the alternate form the user's first name if
- # 'other name' is defined.
- if ($borrower->{category_type} eq 'I') {
- $borrower->{'showname'} = $borrower->{'othernames'};
- $borrower->{'showname'} .= " $borrower->{'firstname'}" if $borrower->{'firstname'};
- } else {
- $borrower->{'showname'} = $borrower->{'firstname'};
- }
-
# Handle setting the true behavior for BlockExpiredPatronOpacActions
$borrower->{'BlockExpiredPatronOpacActions'} =
C4::Context->preference('BlockExpiredPatronOpacActions')
# add expiration date if it isn't already there
unless ( $data{'dateexpiry'} ) {
- $data{'dateexpiry'} = GetExpiryDate( $data{'categorycode'}, C4::Dates->new()->output("iso") );
+ $data{'dateexpiry'} = GetExpiryDate( $data{'categorycode'}, output_pref( { dt => dt_from_string, dateonly => 1, dateformat => 'iso' } ) );
}
# add enrollment date if it isn't already there
unless ( $data{'dateenrolled'} ) {
- $data{'dateenrolled'} = C4::Dates->new()->output("iso");
+ $data{'dateenrolled'} = output_pref( { dt => dt_from_string, dateonly => 1, dateformat => 'iso' } );
}
my $patron_category = $schema->resultset('Category')->find( $data{'categorycode'} );
SELECT *
FROM accountlines
WHERE borrowernumber=?);
- $strsth.=" ORDER BY date desc,timestamp DESC";
+ $strsth.=" ORDER BY accountlines_id desc";
my $sth= $dbh->prepare( $strsth );
$sth->execute( $borrowernumber );
my $borrower = GetMember('borrowernumber'=>$borrowerid);
unless ($date){
$date = (C4::Context->preference('BorrowerRenewalPeriodBase') eq 'dateexpiry') ?
- C4::Dates->new($borrower->{'dateexpiry'}, 'iso')->output("iso") :
- C4::Dates->new()->output("iso");
+ eval { output_pref( { dt => dt_from_string( $borrower->{'dateexpiry'} ), dateonly => 1, dateformat => 'iso' } ); }
+ :
+ output_pref( { dt => dt_from_string, dateonly => 1, dateformat => 'iso' } );
$date = GetExpiryDate( $borrower->{'categorycode'}, $date );
}
my $sth = $dbh->do(<<EOF);
my @results;
while ( my $data = $sth->fetchrow_hashref ) {
- my $d = C4::Dates->new( $data->{message_date}, 'iso' );
- $data->{message_date_formatted} = $d->output;
+ $data->{message_date_formatted} = output_pref( { dt => dt_from_string( $data->{message_date} ), dateonly => 1, dateformat => 'iso' } );
push @results, $data;
}
return \@results;