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

(-)a/Koha/Patron.pm (-1 / +29 lines)
Lines 30-36 use C4::Log; Link Here
30
use Koha::AuthUtils;
30
use Koha::AuthUtils;
31
use Koha::Checkouts;
31
use Koha::Checkouts;
32
use Koha::Database;
32
use Koha::Database;
33
use Koha::DateUtils;
33
use Koha::DateUtils qw( dt_from_string );
34
use Koha::Exceptions::Password;
34
use Koha::Exceptions::Password;
35
use Koha::Holds;
35
use Koha::Holds;
36
use Koha::Old::Checkouts;
36
use Koha::Old::Checkouts;
Lines 875-880 sub checkouts { Link Here
875
    return Koha::Checkouts->_new_from_dbic( $checkouts );
875
    return Koha::Checkouts->_new_from_dbic( $checkouts );
876
}
876
}
877
877
878
sub todays_checkouts { # FIXME Must be moved to Koha::Old::Checkouts->filter_by_returned_today?
879
    my ( $self ) = @_;
880
    my $dt_today = dt_from_string;
881
    my $dtf = Koha::Database->new->schema->storage->datetime_parser;
882
    return $self->old_checkouts->search(
883
        {
884
            returndate => {
885
                -between => [
886
                    $dtf->format_datetime(
887
                        $dt_today->set( hour => 0, minute => 0, second => 0 )
888
                    ),
889
                    $dtf->format_datetime(
890
                        $dt_today->set(
891
                            hour   => 23,
892
                            minute => 59,
893
                            second => 59
894
                        )
895
                    )
896
                ]
897
            }
898
        },
899
        {
900
            order_by => { -desc => 'date_due' },
901
            prefetch => 'item'
902
        }
903
    );
904
}
905
878
=head3 pending_checkouts
906
=head3 pending_checkouts
879
907
880
my $pending_checkouts = $patron->pending_checkouts
908
my $pending_checkouts = $patron->pending_checkouts
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc (-1 / +3 lines)
Lines 85-92 Link Here
85
                [% IF Koha.Preference('intranetreadinghistory') %]
85
                [% IF Koha.Preference('intranetreadinghistory') %]
86
                    [%IF ( privacy == 2 ) %]
86
                    [%IF ( privacy == 2 ) %]
87
                        <li class="disabled"><a data-toggle="tooltip" data-placement="left" title="Not allowed by patron's privacy settings" id="exportbarcodes" href="#">Export today's checked in barcodes</a></li>
87
                        <li class="disabled"><a data-toggle="tooltip" data-placement="left" title="Not allowed by patron's privacy settings" id="exportbarcodes" href="#">Export today's checked in barcodes</a></li>
88
                    [% ELSE %]
88
                    [% ELSIF patron.todays_checkouts.size > 0 %]
89
                        <li><a id="exportcheckins" href="#">Export today's checked in barcodes</a></li>
89
                        <li><a id="exportcheckins" href="#">Export today's checked in barcodes</a></li>
90
                    [% ELSE %]
91
                        <li class="disabled"><a data-toggle="tooltip" data-placement="left" title="No checkins today" id="exportbarcodes" href="#">Export today's checked in barcodes</a></li>
90
                    [% END %]
92
                    [% END %]
91
                [% END %]
93
                [% END %]
92
            </ul>
94
            </ul>
(-)a/members/readingrec.pl (-7 / +9 lines)
Lines 58-64 my $logged_in_user = Koha::Patrons->find( $loggedinuser ) or die "Not logged in" Link Here
58
output_and_exit_if_error( $input, $cookie, $template, { module => 'members', logged_in_user => $logged_in_user, current_patron => $patron } );
58
output_and_exit_if_error( $input, $cookie, $template, { module => 'members', logged_in_user => $logged_in_user, current_patron => $patron } );
59
59
60
my $order = 'date_due desc';
60
my $order = 'date_due desc';
61
my $limit = 0;
61
my $limit = 0; # FIXME This variable is useless
62
my $issues = ();
62
my $issues = ();
63
# Do not request the old issues of anonymous patron
63
# Do not request the old issues of anonymous patron
64
if ( $patron->borrowernumber eq C4::Context->preference('AnonymousPatron') ){
64
if ( $patron->borrowernumber eq C4::Context->preference('AnonymousPatron') ){
Lines 73-88 if ( $patron->borrowernumber eq C4::Context->preference('AnonymousPatron') ){ Link Here
73
if ( $op eq 'export_barcodes' ) {
73
if ( $op eq 'export_barcodes' ) {
74
    # FIXME This should be moved out of this script
74
    # FIXME This should be moved out of this script
75
    if ( $patron->privacy < 2) {
75
    if ( $patron->privacy < 2) {
76
        my $today = output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 });
76
        my $dt_today = dt_from_string;
77
        my @barcodes =
77
        my $todays_checkouts = $patron->todays_checkouts;
78
          map { $_->{barcode} } grep { $_->{returndate} =~ m/^$today/o } @{$issues};
78
        my @barcodes = $todays_checkouts->get_column('item.barcode');
79
        my $borrowercardnumber = $patron->cardnumber;
80
        my $delimiter = "\n";
79
        my $delimiter = "\n";
81
        binmode( STDOUT, ":encoding(UTF-8)" );
80
        binmode( STDOUT, ":encoding(UTF-8)" );
82
        print $input->header(
81
        print $input->header(
83
            -type       => 'application/octet-stream',
82
            -type       => 'application/octet-stream',
84
            -charset    => 'utf-8',
83
            -charset    => 'utf-8',
85
            -attachment => "$today-$borrowercardnumber-checkinexport.txt"
84
            -attachment => sprintf(
85
                "%s-%s-checkinexport.txt",
86
                output_pref({ dt => $dt_today, dateformat => 'iso', dateonly => 1 }),
87
                $patron->cardnumber
88
            ),
86
        );
89
        );
87
90
88
        my $content = join $delimiter, uniq(@barcodes);
91
        my $content = join $delimiter, uniq(@barcodes);
89
- 

Return to bug 9099