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

(-)a/Koha/Hold.pm (+12 lines)
Lines 62-67 sub waiting_expires_on { Link Here
62
    return $dt;
62
    return $dt;
63
}
63
}
64
64
65
=head3 is_waiting
66
67
Returns true if hold is a waiting hold
68
69
=cut
70
71
sub is_waiting {
72
    my ($self) = @_;
73
74
    return $self->found() eq 'W';
75
}
76
65
=head3 biblio
77
=head3 biblio
66
78
67
Returns the related Koha::Biblio object for this hold
79
Returns the related Koha::Biblio object for this hold
(-)a/Koha/Item.pm (+27 lines)
Lines 23-28 use Carp; Link Here
23
23
24
use Koha::Database;
24
use Koha::Database;
25
25
26
use Koha::Branches;
27
26
use base qw(Koha::Object);
28
use base qw(Koha::Object);
27
29
28
=head1 NAME
30
=head1 NAME
Lines 47-52 sub effective_itemtype { Link Here
47
    return $self->_result()->effective_itemtype();
49
    return $self->_result()->effective_itemtype();
48
}
50
}
49
51
52
=head3 home_branch
53
54
=cut
55
56
sub home_branch {
57
    my ($self) = @_;
58
59
    $self->{_home_branch} ||= Koha::Branches->find( $self->homebranch() );
60
61
    return $self->{_home_branch};
62
}
63
64
=head3 holding_branch
65
66
=cut
67
68
sub holding_branch {
69
    my ($self) = @_;
70
71
    $self->{_holding_branch} ||= Koha::Branches->find( $self->holdingbranch() );
72
73
    return $self->{_holding_branch};
74
}
75
76
50
=head3 type
77
=head3 type
51
78
52
=cut
79
=cut
(-)a/svc/holds (-10 / +14 lines)
Lines 29-36 use C4::Charset; Link Here
29
use C4::Circulation qw(GetTransfers);
29
use C4::Circulation qw(GetTransfers);
30
use C4::Context;
30
use C4::Context;
31
31
32
use Koha::Database;
33
use Koha::DateUtils;
32
use Koha::DateUtils;
33
use Koha::Holds;
34
34
35
my $input = new CGI;
35
my $input = new CGI;
36
36
Lines 59-65 my $sorting_column = $sort_columns[ $input->param('iSortCol_0') ] Link Here
59
binmode STDOUT, ":encoding(UTF-8)";
59
binmode STDOUT, ":encoding(UTF-8)";
60
print $input->header( -type => 'text/plain', -charset => 'UTF-8' );
60
print $input->header( -type => 'text/plain', -charset => 'UTF-8' );
61
61
62
my $holds_rs = $schema->resultset('Reserve')->search(
62
my $holds_rs = Koha::Holds->search(
63
    { borrowernumber => $borrowernumber },
63
    { borrowernumber => $borrowernumber },
64
    {
64
    {
65
        order_by => { "-$sorting_direction" => $sorting_column }
65
        order_by => { "-$sorting_direction" => $sorting_column }
Lines 79-93 while ( my $h = $holds_rs->next() ) { Link Here
79
        title          => $h->biblio()->title(),
79
        title          => $h->biblio()->title(),
80
        author         => $h->biblio()->author(),
80
        author         => $h->biblio()->author(),
81
        reserve_id     => $h->reserve_id(),
81
        reserve_id     => $h->reserve_id(),
82
        branchcode     => $h->branchcode()->branchname(),
82
        branchcode     => $h->branch()->branchname(),
83
        reservedate    => $h->reservedate(),
83
        reservedate    => $h->reservedate(),
84
        expirationdate => $h->expirationdate(),
84
        expirationdate => $h->expirationdate(),
85
        suspend        => $h->suspend(),
85
        suspend        => $h->suspend(),
86
        suspend_until  => $h->suspend_until(),
86
        suspend_until  => $h->suspend_until(),
87
        found          => $h->found(),
87
        found          => $h->found(),
88
        waiting        => $h->found() eq 'W',
88
        waiting        => $h->is_waiting(),
89
        waiting_at     => $h->branchcode()->branchname(),
89
        waiting_at     => $h->branch()->branchname(),
90
        waiting_here   => $h->branchcode()->branchcode() eq $branch,
90
        waiting_here   => $h->branch()->branchcode() eq $branch,
91
        priority       => $h->priority(),
91
        priority       => $h->priority(),
92
        subtitle       => GetRecordValue(
92
        subtitle       => GetRecordValue(
93
            'subtitle', GetMarcBiblio($biblionumber),
93
            'subtitle', GetMarcBiblio($biblionumber),
Lines 107-112 while ( my $h = $holds_rs->next() ) { Link Here
107
        : q{},
107
        : q{},
108
    };
108
    };
109
109
110
    if ( my $e = $h->waiting_expires_on() ) {
111
        $hold->{expirationdate} = $e->ymd();
112
        $hold->{expirationdate_formatted} = output_pref( { dt => $e, dateonly => 1 });
113
    }
114
110
    $hold->{transfered}     = 0;
115
    $hold->{transfered}     = 0;
111
    $hold->{not_transfered} = 0;
116
    $hold->{not_transfered} = 0;
112
117
Lines 124-134 while ( my $h = $holds_rs->next() ) { Link Here
124
            $hold->{date_sent} = output_pref( dt_from_string($transferred_when) );
129
            $hold->{date_sent} = output_pref( dt_from_string($transferred_when) );
125
            $hold->{from_branch} = GetBranchName($transferred_from);
130
            $hold->{from_branch} = GetBranchName($transferred_from);
126
        }
131
        }
127
        elsif ( $item->holdingbranch()->branchcode() ne
132
        elsif ( $item->holding_branch()->branchcode() ne
128
            $h->branchcode()->branchcode() )
133
            $h->branch()->branchcode() )
129
        {
134
        {
130
            $hold->{not_transferred}    = 1;
135
            $hold->{not_transferred}    = 1;
131
            $hold->{not_transferred_by} = $h->item()->holdingbranch()->branchname();
136
            $hold->{not_transferred_by} = $h->item()->holding_branch()->branchname();
132
        }
137
        }
133
    }
138
    }
134
139
135
- 

Return to bug 13853