Lines 19-24
package Koha::Illbatch;
Link Here
|
19 |
|
19 |
|
20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
21 |
use Koha::Database; |
21 |
use Koha::Database; |
|
|
22 |
use Koha::Illrequest::Logger; |
23 |
use JSON qw( to_json ); |
22 |
use base qw(Koha::Object); |
24 |
use base qw(Koha::Object); |
23 |
|
25 |
|
24 |
=head1 NAME |
26 |
=head1 NAME |
Lines 72-77
sub requests_count {
Link Here
|
72 |
})->count; |
74 |
})->count; |
73 |
} |
75 |
} |
74 |
|
76 |
|
|
|
77 |
=head3 create_and_log |
78 |
|
79 |
$batch->create_and_log; |
80 |
|
81 |
Log batch creation following storage |
82 |
|
83 |
=cut |
84 |
|
85 |
sub create_and_log { |
86 |
my ( $self ) = @_; |
87 |
|
88 |
$self->store; |
89 |
|
90 |
my $logger = Koha::Illrequest::Logger->new; |
91 |
|
92 |
$logger->log_something({ |
93 |
modulename => 'ILL', |
94 |
actionname => 'batch_create', |
95 |
objectnumber => $self->id, |
96 |
infos => to_json({}) |
97 |
}); |
98 |
} |
99 |
|
100 |
=head3 update_and_log |
101 |
|
102 |
$batch->update_and_log; |
103 |
|
104 |
Log batch update following storage |
105 |
|
106 |
=cut |
107 |
|
108 |
sub update_and_log { |
109 |
my ( $self, $params ) = @_; |
110 |
|
111 |
my $before = { |
112 |
name => $self->name, |
113 |
branchcode => $self->branchcode |
114 |
}; |
115 |
|
116 |
$self->set( $params ); |
117 |
my $update = $self->store; |
118 |
|
119 |
my $after = { |
120 |
name => $self->name, |
121 |
branchcode => $self->branchcode |
122 |
}; |
123 |
|
124 |
my $logger = Koha::Illrequest::Logger->new; |
125 |
|
126 |
$logger->log_something({ |
127 |
modulename => 'ILL', |
128 |
actionname => 'batch_update', |
129 |
objectnumber => $self->id, |
130 |
infos => to_json({ |
131 |
before => $before, |
132 |
after => $after |
133 |
}) |
134 |
}); |
135 |
} |
136 |
|
137 |
=head3 delete_and_log |
138 |
|
139 |
$batch->delete_and_log; |
140 |
|
141 |
Log batch delete |
142 |
|
143 |
=cut |
144 |
|
145 |
sub delete_and_log { |
146 |
my ( $self ) = @_; |
147 |
|
148 |
my $logger = Koha::Illrequest::Logger->new; |
149 |
|
150 |
$logger->log_something({ |
151 |
modulename => 'ILL', |
152 |
actionname => 'batch_delete', |
153 |
objectnumber => $self->id, |
154 |
infos => to_json({}) |
155 |
}); |
156 |
|
157 |
$self->delete; |
158 |
} |
159 |
|
75 |
=head2 Internal methods |
160 |
=head2 Internal methods |
76 |
|
161 |
|
77 |
=head3 _type |
162 |
=head3 _type |