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

(-)a/C4/Members.pm (-7 / +6 lines)
Lines 23-29 package C4::Members; Link Here
23
use strict;
23
use strict;
24
#use warnings; FIXME - Bug 2505
24
#use warnings; FIXME - Bug 2505
25
use C4::Context;
25
use C4::Context;
26
use C4::Dates qw(format_date_in_iso format_date);
27
use String::Random qw( random_string );
26
use String::Random qw( random_string );
28
use Date::Calc qw/Today Add_Delta_YM check_date Date_to_Days/;
27
use Date::Calc qw/Today Add_Delta_YM check_date Date_to_Days/;
29
use C4::Log; # logaction
28
use C4::Log; # logaction
Lines 741-752 sub AddMember { Link Here
741
740
742
    # add expiration date if it isn't already there
741
    # add expiration date if it isn't already there
743
    unless ( $data{'dateexpiry'} ) {
742
    unless ( $data{'dateexpiry'} ) {
744
        $data{'dateexpiry'} = GetExpiryDate( $data{'categorycode'}, C4::Dates->new()->output("iso") );
743
        $data{'dateexpiry'} = GetExpiryDate( $data{'categorycode'}, output_pref( { dt => dt_from_string, dateonly => 1, dateformat => 'iso' } ) );
745
    }
744
    }
746
745
747
    # add enrollment date if it isn't already there
746
    # add enrollment date if it isn't already there
748
    unless ( $data{'dateenrolled'} ) {
747
    unless ( $data{'dateenrolled'} ) {
749
        $data{'dateenrolled'} = C4::Dates->new()->output("iso");
748
        $data{'dateenrolled'} = output_pref( { dt => dt_from_string, dateonly => 1, dateformat => 'iso' } );
750
    }
749
    }
751
750
752
    my $patron_category = $schema->resultset('Category')->find( $data{'categorycode'} );
751
    my $patron_category = $schema->resultset('Category')->find( $data{'categorycode'} );
Lines 1831-1838 sub ExtendMemberSubscriptionTo { Link Here
1831
    my $borrower = GetMember('borrowernumber'=>$borrowerid);
1830
    my $borrower = GetMember('borrowernumber'=>$borrowerid);
1832
    unless ($date){
1831
    unless ($date){
1833
      $date = (C4::Context->preference('BorrowerRenewalPeriodBase') eq 'dateexpiry') ?
1832
      $date = (C4::Context->preference('BorrowerRenewalPeriodBase') eq 'dateexpiry') ?
1834
                                        C4::Dates->new($borrower->{'dateexpiry'}, 'iso')->output("iso") :
1833
                                        eval { output_pref( { dt => dt_from_string( $borrower->{'dateexpiry'}  ), dateonly => 1, dateformat => 'iso' } ); }
1835
                                        C4::Dates->new()->output("iso");
1834
                                        :
1835
                                        output_pref( { dt => dt_from_string, dateonly => 1, dateformat => 'iso' } );
1836
      $date = GetExpiryDate( $borrower->{'categorycode'}, $date );
1836
      $date = GetExpiryDate( $borrower->{'categorycode'}, $date );
1837
    }
1837
    }
1838
    my $sth = $dbh->do(<<EOF);
1838
    my $sth = $dbh->do(<<EOF);
Lines 2230-2237 sub GetMessages { Link Here
2230
    my @results;
2230
    my @results;
2231
2231
2232
    while ( my $data = $sth->fetchrow_hashref ) {
2232
    while ( my $data = $sth->fetchrow_hashref ) {
2233
        my $d = C4::Dates->new( $data->{message_date}, 'iso' );
2233
        $data->{message_date_formatted} = eval { output_pref( { dt => dt_from_string( $data->{message_date} ), dateonly => 1, dateformat => 'iso' } ); };
2234
        $data->{message_date_formatted} = $d->output;
2235
        push @results, $data;
2234
        push @results, $data;
2236
    }
2235
    }
2237
    return \@results;
2236
    return \@results;
(-)a/C4/Reserves.pm (-7 / +9 lines)
Lines 35-41 use C4::Members::Messaging; Link Here
35
use C4::Members qw();
35
use C4::Members qw();
36
use C4::Letters;
36
use C4::Letters;
37
use C4::Branch qw( GetBranchDetail );
37
use C4::Branch qw( GetBranchDetail );
38
use C4::Dates qw( format_date_in_iso );
39
38
40
use Koha::DateUtils;
39
use Koha::DateUtils;
41
use Koha::Calendar;
40
use Koha::Calendar;
Lines 166-176 sub AddReserve { Link Here
166
165
167
    my $dbh     = C4::Context->dbh;
166
    my $dbh     = C4::Context->dbh;
168
167
169
    $resdate = format_date_in_iso( $resdate ) if ( $resdate );
168
    $resdate = eval { output_pref( { dt => dt_from_string( $resdate ), dateonly => 1 }); }
170
    $resdate = C4::Dates->today( 'iso' ) unless ( $resdate );
169
               if ( $resdate );
170
    $resdate = eval { output_pref( { dt => dt_from_string, dateonly => 1 }); }
171
               unless ( $resdate );
171
172
172
    if ($expdate) {
173
    if ($expdate) {
173
        $expdate = format_date_in_iso( $expdate );
174
        $expdate = eval { output_pref( { dt => dt_from_string( $expdate), dateonly => 1, dateformat => 'iso' } ); };
174
    } else {
175
    } else {
175
        undef $expdate; # make reserves.expirationdate default to null rather than '0000-00-00'
176
        undef $expdate; # make reserves.expirationdate default to null rather than '0000-00-00'
176
    }
177
    }
Lines 1162-1168 sub ModReserve { Link Here
1162
1163
1163
        if ( defined( $suspend_until ) ) {
1164
        if ( defined( $suspend_until ) ) {
1164
            if ( $suspend_until ) {
1165
            if ( $suspend_until ) {
1165
                $suspend_until = C4::Dates->new( $suspend_until )->output("iso");
1166
                $suspend_until = eval { output_pref( { dt => dt_from_string( $suspend_until ), dateonly => 1 }); };
1166
                $dbh->do("UPDATE reserves SET suspend = 1, suspend_until = ? WHERE reserve_id = ?", undef, ( $suspend_until, $reserve_id ) );
1167
                $dbh->do("UPDATE reserves SET suspend = 1, suspend_until = ? WHERE reserve_id = ?", undef, ( $suspend_until, $reserve_id ) );
1167
            } else {
1168
            } else {
1168
                $dbh->do("UPDATE reserves SET suspend_until = NULL WHERE reserve_id = ?", undef, ( $reserve_id ) );
1169
                $dbh->do("UPDATE reserves SET suspend_until = NULL WHERE reserve_id = ?", undef, ( $reserve_id ) );
Lines 1655-1661 sub SuspendAll { Link Here
1655
    my $suspend_until  = $params{'suspend_until'}  || undef;
1656
    my $suspend_until  = $params{'suspend_until'}  || undef;
1656
    my $suspend        = defined( $params{'suspend'} ) ? $params{'suspend'} :  1;
1657
    my $suspend        = defined( $params{'suspend'} ) ? $params{'suspend'} :  1;
1657
1658
1658
    $suspend_until = C4::Dates->new( $suspend_until )->output("iso") if ( defined( $suspend_until ) );
1659
    $suspend_until = eval { output_pref( { dt => dt_from_string( $suspend_until), dateonly => 1, dateformat => 'iso' } ); }
1660
                     if ( defined( $suspend_until ) );
1659
1661
1660
    return unless ( $borrowernumber || $biblionumber );
1662
    return unless ( $borrowernumber || $biblionumber );
1661
1663
Lines 1976-1982 sub _koha_notify_reserve { Link Here
1976
            'reserves'  => $reserve,
1978
            'reserves'  => $reserve,
1977
            'items', $reserve->{'itemnumber'},
1979
            'items', $reserve->{'itemnumber'},
1978
        },
1980
        },
1979
        substitute => { today => C4::Dates->new()->output() },
1981
        substitute => { today => eval { output_pref( { dt => dt_from_string, dateonly => 1 } ); } },
1980
    );
1982
    );
1981
1983
1982
    my $notification_sent = 0; #Keeping track if a Hold_filled message is sent. If no message can be sent, then default to a print message.
1984
    my $notification_sent = 0; #Keeping track if a Hold_filled message is sent. If no message can be sent, then default to a print message.
(-)a/C4/Search.pm (-2 / +2 lines)
Lines 21-30 require Exporter; Link Here
21
use C4::Context;
21
use C4::Context;
22
use C4::Biblio;    # GetMarcFromKohaField, GetBiblioData
22
use C4::Biblio;    # GetMarcFromKohaField, GetBiblioData
23
use C4::Koha;      # getFacets
23
use C4::Koha;      # getFacets
24
use Koha::DateUtils;
24
use Lingua::Stem;
25
use Lingua::Stem;
25
use C4::Search::PazPar2;
26
use C4::Search::PazPar2;
26
use XML::Simple;
27
use XML::Simple;
27
use C4::Dates qw(format_date);
28
use C4::Members qw(GetHideLostItemsPreference);
28
use C4::Members qw(GetHideLostItemsPreference);
29
use C4::XSLT;
29
use C4::XSLT;
30
use C4::Branch;
30
use C4::Branch;
Lines 2094-2100 sub searchResults { Link Here
2094
            {
2094
            {
2095
                $onloan_count++;
2095
                $onloan_count++;
2096
                my $key = $prefix . $item->{onloan} . $item->{barcode};
2096
                my $key = $prefix . $item->{onloan} . $item->{barcode};
2097
                $onloan_items->{$key}->{due_date} = format_date( $item->{onloan} );
2097
                $onloan_items->{$key}->{due_date} = eval { output_pref( { dt => dt_from_string( $item->{onloan} ), dateonly => 1 } ); };
2098
                $onloan_items->{$key}->{count}++ if $item->{$hbranch};
2098
                $onloan_items->{$key}->{count}++ if $item->{$hbranch};
2099
                $onloan_items->{$key}->{branchname}     = $item->{branchname};
2099
                $onloan_items->{$key}->{branchname}     = $item->{branchname};
2100
                $onloan_items->{$key}->{location}       = $shelflocations->{ $item->{location} };
2100
                $onloan_items->{$key}->{location}       = $shelflocations->{ $item->{location} };
(-)a/C4/Utils/DataTables.pm (-2 / +2 lines)
Lines 249-259 sub dt_build_query_dates { Link Here
249
    my @params;
249
    my @params;
250
    if ( $datefrom ) {
250
    if ( $datefrom ) {
251
        $query .= " AND $field >= ? ";
251
        $query .= " AND $field >= ? ";
252
        push @params, C4::Dates->new($datefrom)->output('iso');
252
        push @params, eval { output_pref( { dt => dt_from_string( $datefrom ), dateonly => 1, dateformat => 'iso' } ); };
253
    }
253
    }
254
    if ( $dateto ) {
254
    if ( $dateto ) {
255
        $query .= " AND $field <= ? ";
255
        $query .= " AND $field <= ? ";
256
        push @params, C4::Dates->new($dateto)->output('iso');
256
        push @params, eval { output_pref( { dt => dt_from_string( $dateto ), dateonly => 1, dateformat => 'iso' } ); };
257
    }
257
    }
258
    return ( $query, \@params );
258
    return ( $query, \@params );
259
}
259
}
(-)a/C4/Utils/DataTables/Members.pm (-1 / +1 lines)
Lines 142-148 sub search { Link Here
142
        ($patron->{overdues}, $patron->{issues}, $patron->{fines}) =
142
        ($patron->{overdues}, $patron->{issues}, $patron->{fines}) =
143
            GetMemberIssuesAndFines($patron->{borrowernumber});
143
            GetMemberIssuesAndFines($patron->{borrowernumber});
144
        if($patron->{dateexpiry} and $patron->{dateexpiry} ne '0000-00-00') {
144
        if($patron->{dateexpiry} and $patron->{dateexpiry} ne '0000-00-00') {
145
            $patron->{dateexpiry} = C4::Dates->new($patron->{dateexpiry}, "iso")->output();
145
            $patron->{dateexpiry} = eval { output_pref( { dt => dt_from_string( $patron->{dateexpiry}), dateonly => 1, dateformat => 'iso' } ); };
146
        } else {
146
        } else {
147
            $patron->{dateexpiry} = '';
147
            $patron->{dateexpiry} = '';
148
        }
148
        }
(-)a/C4/VirtualShelves/Page.pm (-3 / +2 lines)
Lines 35-44 use C4::Koha; Link Here
35
use C4::Auth qw/get_session/;
35
use C4::Auth qw/get_session/;
36
use C4::Members;
36
use C4::Members;
37
use C4::Output;
37
use C4::Output;
38
use C4::Dates qw/format_date/;
39
use C4::Tags qw(get_tags);
38
use C4::Tags qw(get_tags);
40
use C4::Csv;
39
use C4::Csv;
41
use C4::XSLT;
40
use C4::XSLT;
41
use Koha::DateUtils;
42
42
43
use constant VIRTUALSHELVES_COUNT => 20;
43
use constant VIRTUALSHELVES_COUNT => 20;
44
44
Lines 276-282 sub shelfpage { Link Here
276
                    # and itemtypes tables, so I'm commenting them out for now to quiet the log -crn
276
                    # and itemtypes tables, so I'm commenting them out for now to quiet the log -crn
277
                    #$this_item->{imageurl} = $imgdir."/".$itemtypes->{ $this_item->{itemtype}  }->{'imageurl'};
277
                    #$this_item->{imageurl} = $imgdir."/".$itemtypes->{ $this_item->{itemtype}  }->{'imageurl'};
278
                    #$this_item->{'description'} = $itemtypes->{ $this_item->{itemtype} }->{'description'};
278
                    #$this_item->{'description'} = $itemtypes->{ $this_item->{itemtype} }->{'description'};
279
                    $this_item->{'dateadded'} = format_date( $this_item->{'dateadded'} );
279
                    $this_item->{'dateadded'} = eval { output_pref( { dt => dt_from_string( $this_item->{'dateadded'} ), dateonly => 1, dateformat => 'iso' } ); };
280
                    $this_item->{'imageurl'}  = getitemtypeinfo( $this_item->{'itemtype'}, $type )->{'imageurl'};
280
                    $this_item->{'imageurl'}  = getitemtypeinfo( $this_item->{'itemtype'}, $type )->{'imageurl'};
281
                    $this_item->{'coins'}     = GetCOinSBiblio( $record );
281
                    $this_item->{'coins'}     = GetCOinSBiblio( $record );
282
                    $this_item->{'subtitle'} = GetRecordValue('subtitle', $record, GetFrameworkCode($this_item->{'biblionumber'}));
282
                    $this_item->{'subtitle'} = GetRecordValue('subtitle', $record, GetFrameworkCode($this_item->{'biblionumber'}));
283
- 

Return to bug 14985