View | Details | Raw Unified | Return to bug 40850
Collapse All | Expand All

(-)a/Koha/ILL/Backend/Standard.pm (-33 / +7 lines)
Lines 716-734 sub migrate { Link Here
716
        my $original_attributes =
716
        my $original_attributes =
717
            $original_request->extended_attributes->search( { type => { '-in' => \@default_attributes } } );
717
            $original_request->extended_attributes->search( { type => { '-in' => \@default_attributes } } );
718
718
719
        my @request_details_array = map {
719
        # Build attributes hash directly
720
            {
720
        my %attributes = map { $_->type => $_->value } $original_attributes->as_list;
721
                'type'  => $_->type,
721
        $attributes{migrated_from} = $original_request->illrequest_id;
722
                'value' => $_->value,
723
            }
724
        } $original_attributes->as_list;
725
726
        push @request_details_array, {
727
            'type'  => 'migrated_from',
728
            'value' => $original_request->illrequest_id,
729
        };
730
722
731
        $new_request->extended_attributes( \@request_details_array );
723
        $new_request->add_or_update_attributes( \%attributes );
732
724
733
        return {
725
        return {
734
            error   => 0,
726
            error   => 0,
Lines 809-827 sub _set_requested_partners { Link Here
809
    # the time we get to this stage, any previous request
801
    # the time we get to this stage, any previous request
810
    # from partners would have had to be cancelled
802
    # from partners would have had to be cancelled
811
    my ($args) = @_;
803
    my ($args) = @_;
812
    my $where = {
804
813
        illrequest_id => $args->{request}->id,
805
    $args->{request}->add_or_update_attributes( { requested_partners => $args->{to} } );
814
        type          => 'requested_partners'
815
    };
816
    Koha::ILL::Request::Attributes->search($where)->delete();
817
    Koha::ILL::Request::Attribute->new(
818
        {
819
            illrequest_id => $args->{request}->id,
820
            column_exists( 'illrequestattributes', 'backend' ) ? ( backend => "Standard" ) : (),
821
            type  => 'requested_partners',
822
            value => $args->{to}
823
        }
824
    )->store;
825
}
806
}
826
807
827
=head3 _validate_borrower
808
=head3 _validate_borrower
Lines 1008-1020 sub add_request { Link Here
1008
        if column_exists( 'illrequests', 'batch_id' );
989
        if column_exists( 'illrequests', 'batch_id' );
1009
    $request->store;
990
    $request->store;
1010
991
1011
    my @request_details_array = map {
992
    $request->add_or_update_attributes($request_details);
1012
        {
1013
            'type'  => $_,
1014
            'value' => $request_details->{$_},
1015
        }
1016
    } keys %{$request_details};
1017
    $request->extended_attributes( \@request_details_array );
1018
    $request->add_unauthenticated_data( $params->{other} ) if $unauthenticated_request;
993
    $request->add_unauthenticated_data( $params->{other} ) if $unauthenticated_request;
1019
994
1020
    $request->after_created;
995
    $request->after_created;
1021
- 

Return to bug 40850