Add check to resensitize sub.
[koha-equinox.git] / C4 / SIP / ILS / Transaction / Checkin.pm
1 #
2 # An object to handle checkin status
3 #
4
5 package ILS::Transaction::Checkin;
6
7 use warnings;
8 use strict;
9
10 use POSIX qw(strftime);
11
12 use ILS;
13 use ILS::Transaction;
14
15 use C4::Circulation;
16
17 our @ISA = qw(ILS::Transaction);
18
19 my %fields = (
20         magnetic => 0,
21         sort_bin => undef,
22 );
23
24 sub new {
25         my $class = shift;;
26         my $self = $class->SUPER::new();
27         my $element;
28
29         foreach $element (keys %fields) {
30                 $self->{_permitted}->{$element} = $fields{$element};
31         }
32
33         @{$self}{keys %fields} = values %fields;
34         return bless $self, $class;
35 }
36
37 sub do_checkin {
38         my $self = shift;
39         my $barcode = $self->{item}->{id};
40         my $branch='ALB'; # gotta set this
41                         # FIXME: hardcoded branch not good.
42         my $return = AddReturn($barcode,$branch);
43         $self->ok($return);
44         return 1;
45 }
46
47 sub resensitize {
48         my $self = shift;
49         unless ($self->{item}) {
50                 warn "no item found in object to resensitize";
51                 return undef;
52         }
53         return !$self->{item}->magnetic;
54 }
55
56 1;