Lines 22-30
use DateTime;
Link Here
|
22 |
use File::Basename qw( dirname ); |
22 |
use File::Basename qw( dirname ); |
23 |
use C4::Installer; |
23 |
use C4::Installer; |
24 |
|
24 |
|
|
|
25 |
use Koha::DateUtils qw/ dt_from_string /; |
25 |
use Koha::ILL::Requests; |
26 |
use Koha::ILL::Requests; |
26 |
use Koha::ILL::Request::Attribute; |
27 |
use Koha::ILL::Request::Attribute; |
27 |
use C4::Biblio qw( AddBiblio ); |
28 |
use C4::Biblio qw( AddBiblio ); |
28 |
use C4::Charset qw( MarcToUTF8Record ); |
29 |
use C4::Charset qw( MarcToUTF8Record ); |
29 |
|
30 |
|
30 |
=head1 NAME |
31 |
=head1 NAME |
Lines 225-231
sub create {
Link Here
|
225 |
}; |
226 |
}; |
226 |
} elsif ( $stage eq 'form' ) { |
227 |
} elsif ( $stage eq 'form' ) { |
227 |
|
228 |
|
228 |
# We may be recieving a submitted form due to an additional |
229 |
# We may be receiving a submitted form due to an additional |
229 |
# custom field being added or deleted, or the material type |
230 |
# custom field being added or deleted, or the material type |
230 |
# having been changed, so check for these things |
231 |
# having been changed, so check for these things |
231 |
if ( !_can_create_request($other) ) { |
232 |
if ( !_can_create_request($other) ) { |
Lines 383-389
sub edititem {
Link Here
|
383 |
}; |
384 |
}; |
384 |
} elsif ( $stage eq 'form' ) { |
385 |
} elsif ( $stage eq 'form' ) { |
385 |
|
386 |
|
386 |
# We may be recieving a submitted form due to an additional |
387 |
# We may be receiving a submitted form due to an additional |
387 |
# custom field being added or deleted, or the material type |
388 |
# custom field being added or deleted, or the material type |
388 |
# having been changed, so check for these things |
389 |
# having been changed, so check for these things |
389 |
if ( defined $other->{'add_new_custom'} |
390 |
if ( defined $other->{'add_new_custom'} |
Lines 452-458
sub edititem {
Link Here
|
452 |
|
453 |
|
453 |
# ...Update Illrequest |
454 |
# ...Update Illrequest |
454 |
my $request = $params->{request}; |
455 |
my $request = $params->{request}; |
455 |
$request->updated( DateTime->now ); |
456 |
$request->updated( dt_from_string() ); |
456 |
$request->store; |
457 |
$request->store; |
457 |
|
458 |
|
458 |
# ...Populate Illrequestattributes |
459 |
# ...Populate Illrequestattributes |
Lines 638-644
sub migrate {
Link Here
|
638 |
|
639 |
|
639 |
my $core_fields = _get_core_string(); |
640 |
my $core_fields = _get_core_string(); |
640 |
|
641 |
|
641 |
# We may be recieving a submitted form due to an additional |
642 |
# We may be receiving a submitted form due to an additional |
642 |
# custom field being added or deleted, or the material type |
643 |
# custom field being added or deleted, or the material type |
643 |
# having been changed, so check for these things |
644 |
# having been changed, so check for these things |
644 |
if ( defined $other->{'add_new_custom'} |
645 |
if ( defined $other->{'add_new_custom'} |
Lines 679-685
sub migrate {
Link Here
|
679 |
}; |
680 |
}; |
680 |
} |
681 |
} |
681 |
|
682 |
|
682 |
# Recieve a new request from another backend and suppliment it with |
683 |
# Receive a new request from another backend and supplement it with |
683 |
# anything we require specifically for this backend. |
684 |
# anything we require specifically for this backend. |
684 |
if ( !$stage || $stage eq 'immigrate' ) { |
685 |
if ( !$stage || $stage eq 'immigrate' ) { |
685 |
my $original_request = Koha::ILL::Requests->find( $other->{illrequest_id} ); |
686 |
my $original_request = Koha::ILL::Requests->find( $other->{illrequest_id} ); |
Lines 688-695
sub migrate {
Link Here
|
688 |
$new_request->branchcode( $original_request->branchcode ); |
689 |
$new_request->branchcode( $original_request->branchcode ); |
689 |
$new_request->status('NEW'); |
690 |
$new_request->status('NEW'); |
690 |
$new_request->backend( $self->name ); |
691 |
$new_request->backend( $self->name ); |
691 |
$new_request->placed( DateTime->now ); |
692 |
$new_request->placed( dt_from_string() ); |
692 |
$new_request->updated( DateTime->now ); |
693 |
$new_request->updated( dt_from_string() ); |
693 |
$new_request->store; |
694 |
$new_request->store; |
694 |
|
695 |
|
695 |
my @default_attributes = (qw/title type author year volume isbn issn article_title article_author pages/); |
696 |
my @default_attributes = (qw/title type author year volume isbn issn article_title article_author pages/); |
Lines 972-979
sub add_request {
Link Here
|
972 |
$request->branchcode( $params->{other}->{branchcode} ); |
973 |
$request->branchcode( $params->{other}->{branchcode} ); |
973 |
$request->status('NEW'); |
974 |
$request->status('NEW'); |
974 |
$request->backend( $params->{other}->{backend} ); |
975 |
$request->backend( $params->{other}->{backend} ); |
975 |
$request->placed( DateTime->now ); |
976 |
$request->placed( dt_from_string() ); |
976 |
$request->updated( DateTime->now ); |
977 |
$request->updated( dt_from_string() ); |
977 |
$request->batch_id( |
978 |
$request->batch_id( |
978 |
$params->{other}->{ill_batch_id} ? $params->{other}->{ill_batch_id} : $params->{other}->{batch_id} ) |
979 |
$params->{other}->{ill_batch_id} ? $params->{other}->{ill_batch_id} : $params->{other}->{batch_id} ) |
979 |
if column_exists( 'illrequests', 'batch_id' ); |
980 |
if column_exists( 'illrequests', 'batch_id' ); |
Lines 1151-1159
sub _standard_request2biblio {
Link Here
|
1151 |
return 0 unless $metadata->{type} eq 'book'; |
1152 |
return 0 unless $metadata->{type} eq 'book'; |
1152 |
|
1153 |
|
1153 |
# We're going to try and populate author, title & ISBN |
1154 |
# We're going to try and populate author, title & ISBN |
1154 |
my $author = $metadata->{author} if $metadata->{author}; |
1155 |
my $author = $metadata->{author} // ''; |
1155 |
my $title = $metadata->{title} if $metadata->{title}; |
1156 |
my $title = $metadata->{title} // ''; |
1156 |
my $isbn = $metadata->{isbn} if $metadata->{isbn}; |
1157 |
my $isbn = $metadata->{isbn} // ''; |
1157 |
|
1158 |
|
1158 |
# Create the MARC::Record object and populate |
1159 |
# Create the MARC::Record object and populate |
1159 |
my $record = MARC::Record->new(); |
1160 |
my $record = MARC::Record->new(); |