Lines 29-36
use base qw(Koha::Object);
Link Here
|
29 |
|
29 |
|
30 |
our @allowed_accounts_types = qw( writeoff payment ); |
30 |
our @allowed_accounts_types = qw( writeoff payment ); |
31 |
our @allowed_circulation_types = qw( renew issue localuse return onsite_checkout recall item_found item_lost ); |
31 |
our @allowed_circulation_types = qw( renew issue localuse return onsite_checkout recall item_found item_lost ); |
|
|
32 |
our @allowed_ill_types = qw( ill_request ); |
32 |
our @mandatory_accounts_keys = qw( type branch borrowernumber value ); # note that amount is mapped to value |
33 |
our @mandatory_accounts_keys = qw( type branch borrowernumber value ); # note that amount is mapped to value |
33 |
our @mandatory_circulation_keys = qw( type branch borrowernumber itemnumber ccode itemtype ); |
34 |
our @mandatory_circulation_keys = qw( type branch borrowernumber itemnumber ccode itemtype ); |
|
|
35 |
our @mandatory_ill_keys = qw( type branch borrowernumber); |
34 |
|
36 |
|
35 |
=head1 NAME |
37 |
=head1 NAME |
36 |
|
38 |
|
Lines 82-93
sub new {
Link Here
|
82 |
$category = 'circulation'; |
84 |
$category = 'circulation'; |
83 |
} elsif ( grep { $_ eq $params->{type} } @allowed_accounts_types ) { |
85 |
} elsif ( grep { $_ eq $params->{type} } @allowed_accounts_types ) { |
84 |
$category = 'accounts'; |
86 |
$category = 'accounts'; |
|
|
87 |
} elsif ( grep { $_ eq $params->{type} } @allowed_ill_types ) { |
88 |
$category = 'ill'; |
85 |
} else { |
89 |
} else { |
86 |
Koha::Exceptions::WrongParameter->throw( name => 'type', value => $params->{type} ); |
90 |
Koha::Exceptions::WrongParameter->throw( name => 'type', value => $params->{type} ); |
87 |
} |
91 |
} |
88 |
|
92 |
|
89 |
my @mandatory_keys = $category eq 'circulation' ? @mandatory_circulation_keys : @mandatory_accounts_keys; |
93 |
my @mandatory_keys = |
90 |
my @missing = map { exists $params->{$_} ? () : $_ } @mandatory_keys; |
94 |
$category eq 'circulation' ? @mandatory_circulation_keys |
|
|
95 |
: $category eq 'accounts' ? @mandatory_accounts_keys |
96 |
: $category eq 'ill' ? @mandatory_ill_keys |
97 |
: (); |
98 |
my @missing = grep { !exists $params->{$_} } @mandatory_keys; |
91 |
Koha::Exceptions::MissingParameter->throw( parameter => join( ',', @missing ) ) if @missing; |
99 |
Koha::Exceptions::MissingParameter->throw( parameter => join( ',', @missing ) ) if @missing; |
92 |
|
100 |
|
93 |
my $datetime = $params->{datetime} ? $params->{datetime} : dt_from_string(); |
101 |
my $datetime = $params->{datetime} ? $params->{datetime} : dt_from_string(); |
Lines 98-104
sub new {
Link Here
|
98 |
categorycode => $params->{categorycode}, |
106 |
categorycode => $params->{categorycode}, |
99 |
ccode => exists $params->{ccode} ? $params->{ccode} : q{}, |
107 |
ccode => exists $params->{ccode} ? $params->{ccode} : q{}, |
100 |
datetime => $datetime, |
108 |
datetime => $datetime, |
101 |
interface => $params->{interface} // C4::Context->interface, |
109 |
illrequest_id => $params->{illrequest_id} // q{}, |
|
|
110 |
interface => $params->{interface} // C4::Context->interface, |
102 |
itemnumber => $params->{itemnumber}, |
111 |
itemnumber => $params->{itemnumber}, |
103 |
itemtype => exists $params->{itemtype} ? $params->{itemtype} : q{}, |
112 |
itemtype => exists $params->{itemtype} ? $params->{itemtype} : q{}, |
104 |
location => $params->{location}, |
113 |
location => $params->{location}, |
Lines 167-173
sub pseudonymize {
Link Here
|
167 |
|
176 |
|
168 |
=cut |
177 |
=cut |
169 |
|
178 |
|
170 |
our @pseudonymization_types = qw(renew issue return onsite_checkout); |
179 |
our @pseudonymization_types = qw(renew issue return onsite_checkout ill_request); |
171 |
|
180 |
|
172 |
=head2 Internal methods |
181 |
=head2 Internal methods |
173 |
|
182 |
|
174 |
- |
|
|