2 # status of a Hold transaction
4 package ILS::Transaction::Hold;
12 use C4::Reserves; # AddReserve
13 use C4::Members; # GetMember
14 use C4::Biblio; # GetBiblioFromItemNumber GetBiblioItemByBiblioNumber
16 use vars qw($VERSION @ISA);
20 @ISA = qw(ILS::Transaction);
25 pickup_location => undef,
26 constraint_type => undef,
31 my $self = $class->SUPER::new();
33 foreach $element (keys %fields) {
34 $self->{_permitted}->{$element} = $fields{$element};
36 @{$self}{keys %fields} = values %fields;
37 return bless $self, $class;
42 return $self->item->hold_queue_position($self->patron->id);
47 unless ($self->{patron}) {
48 $self->screen_msg('do_hold called with undefined patron');
52 my $borrower = GetMember( 'cardnumber'=>$self->{patron}->id);
54 $self->screen_msg('No borrower matches cardnumber "' . $self->{patron}->id . '".');
58 my $bib = GetBiblioFromItemNumber(undef, $self->{item}->id);
60 $self->screen_msg('No biblio record matches barcode "' . $self->{item}->id . '".');
64 my $branch = ($self->pickup_location || $self->{patron}->branchcode);
66 $self->screen_msg('No branch specified (or found w/ patron).');
70 my $bibno = $bib->{biblionumber};
71 AddReserve($branch, $borrower->{borrowernumber},
72 $bibno, 'a', GetBiblioItemByBiblioNumber($bibno)) ;
73 # unfortunately no meaningful return value
80 unless ($self->{patron}) {
81 $self->screen_msg('drop_hold called with undefined patron');
85 my $borrower = GetMember( 'cardnumber'=>$self->{patron}->id);
87 $self->screen_msg('No borrower matches cardnumber "' . $self->{patron}->id . '".');
91 my $bib = GetBiblioFromItemNumber(undef, $self->{item}->id);
92 # FIXME: figure out if it is a item or title hold. Till then, cancel both.
93 CancelReserve($bib->{biblionumber}, undef, $borrower->{borrowernumber});
94 CancelReserve(undef, $self->{item}->id, $borrower->{borrowernumber});
95 # unfortunately no meaningful return value here either
102 unless ($self->{patron}) {
103 $self->screen_msg('change_hold called with undefined patron');
107 my $borrower = GetMember( 'cardnumber'=>$self->{patron}->id);
109 $self->screen_msg('No borrower matches cardnumber "' . $self->{patron}->id . '".');
113 my $bib = GetBiblioFromItemNumber(undef, $self->{item}->id);
115 $self->screen_msg('No biblio record matches barcode "' . $self->{item}->id . '".');
119 my $branch = ($self->pickup_location || $self->{patron}->branchcode);
121 $self->screen_msg('No branch specified (or found w/ patron).');
125 my $bibno = $bib->{biblionumber};
126 ModReserve($bibno, $borrower->{borrowernumber}, $branch, GetBiblioItemByBiblioNumber($bibno));
127 # unfortunately no meaningful return value
128 # ModReserve needs to be fixed to maintain priority by iteself (Feb 2008)
135 # 11 friggin arguments
136 AddReserve($branch,$borrowernumber,$biblionumber,$constraint,$bibitems,$priority,$startdate,$notes,$title,$checkitem,$found)
138 ModReserve($rank, $biblio, $borrower, $branch , $itemnumber)