+ else {
+ foreach my $order (@orders) {
+ my $biblio = Koha::Biblios->find( $order->{biblionumber} );
+ my $biblioitem = $biblio->biblioitem;
+ my $row = {
+ contractname => $contract->{'contractname'},
+ ordernumber => $order->{'ordernumber'},
+ entrydate => $order->{'entrydate'},
+ isbn => $order->{'isbn'},
+ author => $biblio->author,
+ title => $biblio->title,
+ publicationyear => $biblioitem->publicationyear,
+ publishercode => $biblioitem->publishercode,
+ collectiontitle => $biblioitem->collectiontitle,
+ notes => $order->{'order_vendornote'},
+ quantity => $order->{'quantity'},
+ rrp => $order->{'rrp'},
+ };
+ for my $place ( qw( deliveryplace billingplace ) ) {
+ if ( my $library = Koha::Libraries->find( $row->{deliveryplace} ) ) {
+ $row->{$place} = $library->branchname
+ }
+ }
+ foreach(qw(
+ contractname author title publishercode collectiontitle notes
+ deliveryplace billingplace
+ ) ) {
+ # Double the quotes to not be interpreted as a field end
+ $row->{$_} =~ s/"/""/g if $row->{$_};
+ }
+ push @rows, $row;
+ }