|
Lines 171-176
sub patron {
Link Here
|
| 171 |
); |
171 |
); |
| 172 |
} |
172 |
} |
| 173 |
|
173 |
|
|
|
174 |
=head3 status_alias |
| 175 |
|
| 176 |
$Illrequest->status_alias(143); |
| 177 |
|
| 178 |
Overloaded getter/setter for request status_alias, |
| 179 |
also records the fact that the status has changed |
| 180 |
|
| 181 |
=cut |
| 182 |
|
| 183 |
sub status_alias { |
| 184 |
my ($self, $new_status_alias) = @_; |
| 185 |
|
| 186 |
my $current_status_alias = $self->SUPER::status_alias; |
| 187 |
|
| 188 |
if ($new_status_alias) { |
| 189 |
# Keep a record of the previous status before we change it, |
| 190 |
# we might need it |
| 191 |
$self->{previous_status} = $current_status_alias ? |
| 192 |
$current_status_alias : |
| 193 |
scalar $self->status; |
| 194 |
my $ret = $self->SUPER::status_alias($new_status_alias)->store; |
| 195 |
if ($ret) { |
| 196 |
my $logger = Koha::Illrequest::Logger->new; |
| 197 |
$logger->log_status_change( |
| 198 |
$self, |
| 199 |
$new_status_alias |
| 200 |
); |
| 201 |
} else { |
| 202 |
delete $self->{previous_status}; |
| 203 |
} |
| 204 |
return $ret; |
| 205 |
} else { |
| 206 |
return $current_status_alias; |
| 207 |
} |
| 208 |
} |
| 209 |
|
| 174 |
=head3 status |
210 |
=head3 status |
| 175 |
|
211 |
|
| 176 |
$Illrequest->status('CANREQ'); |
212 |
$Illrequest->status('CANREQ'); |
|
Lines 184-197
sub status {
Link Here
|
| 184 |
my ( $self, $new_status) = @_; |
220 |
my ( $self, $new_status) = @_; |
| 185 |
|
221 |
|
| 186 |
my $current_status = $self->SUPER::status; |
222 |
my $current_status = $self->SUPER::status; |
|
|
223 |
my $current_status_alias = $self->SUPER::status_alias; |
| 187 |
|
224 |
|
| 188 |
if ($new_status) { |
225 |
if ($new_status) { |
| 189 |
# Keep a record of the previous status before we change it, |
226 |
# Keep a record of the previous status before we change it, |
| 190 |
# we might need it |
227 |
# we might need it |
| 191 |
$self->{previous_status} = $current_status; |
228 |
$self->{previous_status} = $current_status_alias ? |
|
|
229 |
$current_status_alias : |
| 230 |
$current_status; |
| 192 |
my $ret = $self->SUPER::status($new_status)->store; |
231 |
my $ret = $self->SUPER::status($new_status)->store; |
| 193 |
if ($ret) { |
232 |
if ($ret) { |
| 194 |
$self->status_alias(undef); |
233 |
$self->SUPER::status_alias(undef); |
| 195 |
my $logger = Koha::Illrequest::Logger->new; |
234 |
my $logger = Koha::Illrequest::Logger->new; |
| 196 |
$logger->log_status_change( |
235 |
$logger->log_status_change( |
| 197 |
$self, |
236 |
$self, |