Lines 698-716
sub migrate {
Link Here
|
698 |
my $original_attributes = |
698 |
my $original_attributes = |
699 |
$original_request->extended_attributes->search( { type => { '-in' => \@default_attributes } } ); |
699 |
$original_request->extended_attributes->search( { type => { '-in' => \@default_attributes } } ); |
700 |
|
700 |
|
701 |
my $request_details = |
701 |
my @request_details_array = map { |
702 |
{ map { $_->type => $_->value } ( $original_attributes->as_list ) }; |
702 |
{ |
703 |
$request_details->{migrated_from} = $original_request->illrequest_id; |
703 |
'type' => $_->type, |
704 |
while ( my ( $type, $value ) = each %{$request_details} ) { |
704 |
'value' => $_->value, |
705 |
Koha::ILL::Request::Attribute->new( |
705 |
} |
706 |
{ |
706 |
} $original_attributes->as_list; |
707 |
illrequest_id => $new_request->illrequest_id, |
707 |
|
708 |
column_exists( 'illrequestattributes', 'backend' ) ? ( backend => "Standard" ) : (), |
708 |
push @request_details_array, { |
709 |
type => $type, |
709 |
'type' => 'migrated_from', |
710 |
value => $value, |
710 |
'value' => $original_request->illrequest_id, |
711 |
} |
711 |
}; |
712 |
)->store; |
712 |
|
713 |
} |
713 |
$new_request->extended_attributes( \@request_details_array ); |
714 |
|
714 |
|
715 |
return { |
715 |
return { |
716 |
error => 0, |
716 |
error => 0, |
Lines 993-1000
sub add_request {
Link Here
|
993 |
|
993 |
|
994 |
my @request_details_array = map { |
994 |
my @request_details_array = map { |
995 |
{ |
995 |
{ |
996 |
'type' => $_, |
996 |
'type' => $_, |
997 |
'value' => $request_details->{$_}, |
997 |
'value' => $request_details->{$_}, |
998 |
} |
998 |
} |
999 |
} keys %{$request_details}; |
999 |
} keys %{$request_details}; |
1000 |
$request->extended_attributes( \@request_details_array ); |
1000 |
$request->extended_attributes( \@request_details_array ); |
1001 |
- |
|
|