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

(-)a/C4/Acquisition.pm (-24 / +21 lines)
Lines 237-276 sub GetBasketAsCSV { Link Here
237
    my $csv = Text::CSV->new();
237
    my $csv = Text::CSV->new();
238
    my $output; 
238
    my $output; 
239
239
240
    my $fields = C4::Context->preference("BasketExportFields");
241
    my @fields = split(/,/, $fields);
242
240
    # TODO: Translate headers
243
    # TODO: Translate headers
241
    my @headers = qw(contractname ordernumber entrydate isbn author title publishercode collectiontitle notes quantity rrp);
244
    my @headers = 'contractname';
245
    push @headers, @fields;
242
246
243
    $csv->combine(@headers);                                                                                                        
247
    $csv->combine(@headers);
244
    $output = $csv->string() . "\n";	
248
    $output = $csv->string() . "\n";
245
249
246
    my @rows;
250
    my @rows;
247
    foreach my $order (@orders) {
251
    foreach my $order (@orders) {
248
	my @cols;
252
        my @cols;
249
	# newlines are not valid characters for Text::CSV combine()
253
        # newlines are not valid characters for Text::CSV combine()
250
        $order->{'notes'} =~ s/[\r\n]+//g;
254
        $order->{'notes'} =~ s/[\r\n]+//g;
251
	push(@cols,
255
        push(@cols, $contract->{'contractname'});
252
		$contract->{'contractname'},
256
        foreach my $fieldName (@fields) { #Add value from orders for each fields set in the sysprefs
253
		$order->{'ordernumber'},
257
            #Strip trailing and ending whitespaces
254
		$order->{'entrydate'}, 
258
            $fieldName =~ s/^\s+//;
255
		$order->{'isbn'},
259
            $fieldName =~ s/\s+$//;
256
		$order->{'author'},
260
            push @cols, $order->{$fieldName};
257
		$order->{'title'},
261
        }
258
		$order->{'publishercode'},
262
        push (@rows, \@cols);
259
		$order->{'collectiontitle'},
260
		$order->{'notes'},
261
		$order->{'quantity'},
262
		$order->{'rrp'},
263
	    );
264
	push (@rows, \@cols);
265
    }
263
    }
266
264
267
    foreach my $row (@rows) {
265
    foreach my $row (@rows) {
268
	$csv->combine(@$row);                                                                                                                    
266
        $csv->combine(@$row);
269
	$output .= $csv->string() . "\n";    
267
        $output .= $csv->string() . "\n";
270
271
    }
268
    }
272
                                                                                                                                                      
269
273
    return $output;             
270
    return $output;
274
271
275
}
272
}
276
273
(-)a/installer/data/mysql/sysprefs.sql (+1 lines)
Lines 365-367 INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES(' Link Here
365
INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('ReservesControlBranch','PatronLibrary','ItemHomeLibrary|PatronLibrary','Branch checked for members reservations rights','Choice');
365
INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('ReservesControlBranch','PatronLibrary','ItemHomeLibrary|PatronLibrary','Branch checked for members reservations rights','Choice');
366
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('SuspendHoldsIntranet', '1', NULL , 'Allow holds to be suspended from the intranet.', 'YesNo');
366
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('SuspendHoldsIntranet', '1', NULL , 'Allow holds to be suspended from the intranet.', 'YesNo');
367
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('SuspendHoldsOpac', '1', NULL , 'Allow holds to be suspended from the OPAC.', 'YesNo');
367
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('SuspendHoldsOpac', '1', NULL , 'Allow holds to be suspended from the OPAC.', 'YesNo');
368
INSERT INTO systempreferences (variable, value) VALUES ('BasketExportFields', 'ordernumber,entrydate,isbn,author,title,publishercode,collectiontitle,notes,quantity,rrp');
(-)a/installer/data/mysql/updatedatabase.pl (+7 lines)
Lines 5249-5254 if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { Link Here
5249
    SetVersion($DBversion);
5249
    SetVersion($DBversion);
5250
}
5250
}
5251
5251
5252
$DBversion = 'XXX';
5253
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
5254
   $dbh->do("INSERT INTO systempreferences (variable, value) VALUES ('BasketExportFields', 'ordernumber,entrydate,isbn,author,title,publishercode,collectiontitle,notes,quantity,rrp');");
5255
   print "Upgrade to $DBversion done (Add BasketExportFields syspref)\n";
5256
   SetVersion ($DBversion);
5257
}
5258
5252
=head1 FUNCTIONS
5259
=head1 FUNCTIONS
5253
5260
5254
=head2 TableExists($table)
5261
=head2 TableExists($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref (-1 / +4 lines)
Lines 19-24 Acquisitions: Link Here
19
                  1: always ask for confirmation.
19
                  1: always ask for confirmation.
20
                  2: do not ask for confirmation.
20
                  2: do not ask for confirmation.
21
        -
21
        -
22
            - Fields shown when exporting a basket. Fields from these tables are allowed : biblio, biblioitems, aqorders and aqbudgets
23
            - pref: BasketExportFields
24
              class: multi
25
        -
22
            - Show baskets
26
            - Show baskets
23
            - pref: AcqViewBaskets
27
            - pref: AcqViewBaskets
24
              choices:
28
              choices:
25
- 

Return to bug 8612