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

(-)a/C4/Circulation.pm (-41 lines)
Lines 88-94 BEGIN { Link Here
88
		&GetRenewCount
88
		&GetRenewCount
89
        &GetSoonestRenewDate
89
        &GetSoonestRenewDate
90
        &GetLatestAutoRenewDate
90
        &GetLatestAutoRenewDate
91
		&GetItemIssue
92
		&GetIssuingCharges
91
		&GetIssuingCharges
93
        &GetBranchBorrowerCircRule
92
        &GetBranchBorrowerCircRule
94
        &GetBranchItemRule
93
        &GetBranchItemRule
Lines 2487-2531 sub _GetCircControlBranch { Link Here
2487
    return $branch;
2486
    return $branch;
2488
}
2487
}
2489
2488
2490
2491
2492
2493
2494
2495
=head2 GetItemIssue
2496
2497
  $issue = &GetItemIssue($itemnumber);
2498
2499
Returns patron currently having a book, or undef if not checked out.
2500
2501
C<$itemnumber> is the itemnumber.
2502
2503
C<$issue> is a hashref of the row from the issues table.
2504
2505
=cut
2506
2507
sub GetItemIssue {
2508
    my ($itemnumber) = @_;
2509
    return unless $itemnumber;
2510
    my $sth = C4::Context->dbh->prepare(
2511
        "SELECT items.*, issues.*
2512
        FROM issues
2513
        LEFT JOIN items ON issues.itemnumber=items.itemnumber
2514
        WHERE issues.itemnumber=?");
2515
    $sth->execute($itemnumber);
2516
    my $data = $sth->fetchrow_hashref;
2517
    return unless $data;
2518
    $data->{issuedate_sql} = $data->{issuedate};
2519
    $data->{date_due_sql} = $data->{date_due};
2520
    $data->{issuedate} = dt_from_string($data->{issuedate}, 'sql');
2521
    $data->{issuedate}->truncate(to => 'minute');
2522
    $data->{date_due} = dt_from_string($data->{date_due}, 'sql');
2523
    $data->{date_due}->truncate(to => 'minute');
2524
    my $dt = DateTime->now( time_zone => C4::Context->tz)->truncate( to => 'minute');
2525
    $data->{'overdue'} = DateTime->compare($data->{'date_due'}, $dt ) == -1 ? 1 : 0;
2526
    return $data;
2527
}
2528
2529
=head2 GetOpenIssue
2489
=head2 GetOpenIssue
2530
2490
2531
  $issue = GetOpenIssue( $itemnumber );
2491
  $issue = GetOpenIssue( $itemnumber );
2532
- 

Return to bug 17680