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

(-)a/C4/Budgets.pm (+24 lines)
Lines 35-40 BEGIN { Link Here
35
35
36
        &GetBudget
36
        &GetBudget
37
        &GetBudgetByOrderNumber
37
        &GetBudgetByOrderNumber
38
        &GetBudgetByCode
38
        &GetBudgets
39
        &GetBudgets
39
        &GetBudgetHierarchy
40
        &GetBudgetHierarchy
40
	    &AddBudget
41
	    &AddBudget
Lines 695-700 sub GetBudgetByOrderNumber { Link Here
695
    return $result;
696
    return $result;
696
}
697
}
697
698
699
=head2 GetBudgetByCode
700
701
    my $budget = &GetBudgetByCode($budget_code);
702
703
Retrieve all aqbudgets fields as a hashref for the budget that has
704
given budget_code
705
706
=cut
707
708
sub GetBudgetByCode {
709
    my ( $budget_code ) = @_;
710
711
    my $dbh = C4::Context->dbh;
712
    my $query = qq{
713
        SELECT *
714
        FROM aqbudgets
715
        WHERE budget_code = ?
716
    };
717
    my $sth = $dbh->prepare( $query );
718
    $sth->execute( $budget_code );
719
    return $sth->fetchrow_hashref;
720
}
721
698
=head2 GetChildBudgetsSpent
722
=head2 GetChildBudgetsSpent
699
723
700
  &GetChildBudgetsSpent($budget-id);
724
  &GetChildBudgetsSpent($budget-id);
(-)a/acqui/addorderiso2709.pl (-50 / +117 lines)
Lines 21-31 Link Here
21
# with Koha; if not, write to the Free Software Foundation, Inc.,
21
# with Koha; if not, write to the Free Software Foundation, Inc.,
22
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23
23
24
use strict;
24
use Modern::Perl;
25
use warnings;
26
use CGI;
25
use CGI;
27
use Carp;
26
use Carp;
28
use Number::Format qw(:all);
27
use Number::Format qw(:all);
28
use YAML qw/Load/;
29
29
30
use C4::Context;
30
use C4::Context;
31
use C4::Auth;
31
use C4::Auth;
Lines 56-62 my ($template, $loggedinuser, $cookie, $userflags) = get_template_and_user({ Link Here
56
});
56
});
57
57
58
my $cgiparams = $input->Vars;
58
my $cgiparams = $input->Vars;
59
my $op = $cgiparams->{'op'};
59
my $op = $cgiparams->{'op'} || '';
60
my $booksellerid  = $input->param('booksellerid');
60
my $booksellerid  = $input->param('booksellerid');
61
my $bookseller = GetBookSellerFromId($booksellerid);
61
my $bookseller = GetBookSellerFromId($booksellerid);
62
my $data;
62
my $data;
Lines 65-71 $template->param(scriptname => "/cgi-bin/koha/acqui/addorderiso2709.pl", Link Here
65
                booksellerid => $booksellerid,
65
                booksellerid => $booksellerid,
66
                booksellername => $bookseller->{name},
66
                booksellername => $bookseller->{name},
67
                );
67
                );
68
my $ordernumber;
69
68
70
if ($cgiparams->{'import_batch_id'} && $op eq ""){
69
if ($cgiparams->{'import_batch_id'} && $op eq ""){
71
    $op = "batch_details";
70
    $op = "batch_details";
Lines 124-130 if ($op eq ""){ Link Here
124
                     loop_currencies  => \@loop_currency,
123
                     loop_currencies  => \@loop_currency,
125
                     );
124
                     );
126
    import_biblios_list($template, $cgiparams->{'import_batch_id'});
125
    import_biblios_list($template, $cgiparams->{'import_batch_id'});
127
    if ( C4::Context->preference('AcqCreateItem') eq 'ordering' && !$ordernumber ) {
126
    if ( C4::Context->preference('AcqCreateItem') eq 'ordering' ) {
128
        # prepare empty item form
127
        # prepare empty item form
129
        my $cell = PrepareItemrecordDisplay( '', '', '', 'ACQ' );
128
        my $cell = PrepareItemrecordDisplay( '', '', '', 'ACQ' );
130
129
Lines 157-175 if ($op eq ""){ Link Here
157
    # retrieve the file you want to import
156
    # retrieve the file you want to import
158
    my $import_batch_id = $cgiparams->{'import_batch_id'};
157
    my $import_batch_id = $cgiparams->{'import_batch_id'};
159
    my $biblios = GetImportRecordsRange($import_batch_id);
158
    my $biblios = GetImportRecordsRange($import_batch_id);
159
    my @import_record_id_selected = $input->param("import_record_id");
160
    my @quantities = $input->param('quantity');
161
    my @prices = $input->param('price');
162
    my @budgets_id = $input->param('budget_id');
163
    my @rrp = $input->param('rrp');
164
    my @discount = $input->param('discount');
165
    my @sort1 = $input->param('sort1');
166
    my @sort2 = $input->param('sort2');
167
    my $cur = GetCurrency();
160
    for my $biblio (@$biblios){
168
    for my $biblio (@$biblios){
161
        # 1st insert the biblio, or find it through matcher
169
        # Check if this import_record_id was selected
170
        next if not grep { $_ eq $$biblio{import_record_id} } @import_record_id_selected;
162
        my ( $marcblob, $encoding ) = GetImportRecordMarc( $biblio->{'import_record_id'} );
171
        my ( $marcblob, $encoding ) = GetImportRecordMarc( $biblio->{'import_record_id'} );
163
        my $marcrecord = MARC::Record->new_from_usmarc($marcblob) || die "couldn't translate marc information";
172
        my $marcrecord = MARC::Record->new_from_usmarc($marcblob) || die "couldn't translate marc information";
164
        my $match = GetImportRecordMatches( $biblio->{'import_record_id'}, 1 );
173
        my $match = GetImportRecordMatches( $biblio->{'import_record_id'}, 1 );
165
        my $biblionumber=$#$match > -1?$match->[0]->{'biblionumber'}:0;
174
        my $biblionumber=$#$match > -1?$match->[0]->{'biblionumber'}:0;
175
        my $c_quantity = shift( @quantities ) || GetMarcQuantity($marcrecord, C4::Context->preference('marcflavour') ) || 1;
176
        my $c_budget_id = shift( @budgets_id ) || $input->param('all_budget_id') || $budget_id;
177
        my $c_rrp = shift( @rrp ); # rrp include tax
178
        my $c_discount = shift ( @discount);
179
        $c_discount = $c_discount / 100 if $c_discount > 100;
180
        my $c_sort1 = shift( @sort1 ) || $input->param('all_sort1') || '';
181
        my $c_sort2 = shift( @sort2 ) || $input->param('all_sort2') || '';
166
182
183
        # 1st insert the biblio, or find it through matcher
167
        unless ( $biblionumber ) {
184
        unless ( $biblionumber ) {
168
            # add the biblio
185
            # add the biblio
169
            my $bibitemnum;
186
            my $bibitemnum;
170
187
171
            # remove ISBN -
188
            # remove ISBN -
172
            my ( $isbnfield, $isbnsubfield ) = GetMarcFromKohaField( 'biblioitems.isbn', '' );                
189
            my ( $isbnfield, $isbnsubfield ) = GetMarcFromKohaField( 'biblioitems.isbn', '' );
173
            if ( $marcrecord->field($isbnfield) ) {
190
            if ( $marcrecord->field($isbnfield) ) {
174
                foreach my $field ( $marcrecord->field($isbnfield) ) {
191
                foreach my $field ( $marcrecord->field($isbnfield) ) {
175
                    foreach my $subfield ( $field->subfield($isbnsubfield) ) {
192
                    foreach my $subfield ( $field->subfield($isbnsubfield) ) {
Lines 180-186 if ($op eq ""){ Link Here
180
                }
197
                }
181
            }
198
            }
182
            ( $biblionumber, $bibitemnum ) = AddBiblio( $marcrecord, $cgiparams->{'frameworkcode'} || '' );
199
            ( $biblionumber, $bibitemnum ) = AddBiblio( $marcrecord, $cgiparams->{'frameworkcode'} || '' );
183
            SetImportRecordStatus( $biblio->{'import_record_id'}, 'imported' );
184
            # 2nd add authorities if applicable
200
            # 2nd add authorities if applicable
185
            if (C4::Context->preference("BiblioAddsAuthorities")){
201
            if (C4::Context->preference("BiblioAddsAuthorities")){
186
                my $headings_linked =BiblioAutoLink($marcrecord, $cgiparams->{'frameworkcode'});
202
                my $headings_linked =BiblioAutoLink($marcrecord, $cgiparams->{'frameworkcode'});
Lines 194-241 if ($op eq ""){ Link Here
194
        # get quantity in the MARC record (1 if none)
210
        # get quantity in the MARC record (1 if none)
195
        my $quantity = GetMarcQuantity($marcrecord, C4::Context->preference('marcflavour')) || 1;
211
        my $quantity = GetMarcQuantity($marcrecord, C4::Context->preference('marcflavour')) || 1;
196
        my %orderinfo = (
212
        my %orderinfo = (
197
            "biblionumber", $biblionumber, "basketno", $cgiparams->{'basketno'},
213
            biblionumber       => $biblionumber,
198
            "quantity", $quantity, "branchcode", $branch, 
214
            basketno           => $cgiparams->{'basketno'},
199
            "budget_id", $budget_id, "uncertainprice", 1,
215
            quantity           => $c_quantity,
200
            "sort1", $cgiparams->{'sort1'},"sort2", $cgiparams->{'sort2'},
216
            branchcode         => $patron->{branchcode},
201
            "order_internalnote", $cgiparams->{'order_internalnote'}, "budget_id", $cgiparams->{'budget_id'},
217
            budget_id          => $c_budget_id,
202
            "currency",$cgiparams->{'currency'},
218
            uncertainprice     => 1,
203
            "order_vendornote" => $cgiparams->{'order_vendornote'},
219
            sort1              => $c_sort1,
220
            sort2              => $c_sort2,
221
            order_internalnote => $cgiparams->{'all_order_internalnote'},
222
            order_vendornote   => $cgiparams->{'all_order_vendornote'},
223
            currency           => $cgiparams->{'all_currency'},
204
        );
224
        );
205
225
        # get the price if there is one.
206
        my $price = GetMarcPrice($marcrecord, C4::Context->preference('marcflavour'));
226
        my $price= shift( @prices ) || GetMarcPrice($marcrecord, C4::Context->preference('marcflavour'));
207
208
        if ($price){
227
        if ($price){
209
            eval {
228
            # in France, the cents separator is the , but sometimes, ppl use a .
210
		require C4::Acquisition;
229
            # in this case, the price will be x100 when unformatted ! Replace the . by a , to get a proper price calculation
211
		import C4::Acquisition qw/GetBasket/;
230
            $price =~ s/\./,/ if C4::Context->preference("CurrencyFormat") eq "FR";
212
	    };
231
            $price = $num->unformat_number($price);
213
	    if ($@){
214
		croak $@;
215
	    }
216
            eval {
217
		require C4::Bookseller;
218
	        import C4::Bookseller qw/GetBookSellerFromId/;
219
	    };
220
	    if ($@){
221
		croak $@;
222
	    }
223
            my $basket     = GetBasket( $orderinfo{basketno} );
224
            my $bookseller = GetBookSellerFromId( $basket->{booksellerid} );
225
            $orderinfo{gstrate} = $bookseller->{gstrate};
232
            $orderinfo{gstrate} = $bookseller->{gstrate};
226
            $orderinfo{rrp}   = $price;
233
            my $c = $c_discount ? $c_discount / 100 : $bookseller->{discount} / 100;
227
            $orderinfo{ecost} = $orderinfo{rrp} * ( 1 - $bookseller->{discount} / 100 );
234
            if ( $bookseller->{listincgst} ) {
228
            $orderinfo{listprice} = $orderinfo{rrp};
235
                if ( $c_discount ) {
236
                    $orderinfo{ecost} = $price;
237
                    $orderinfo{rrp}   = $orderinfo{ecost} / ( 1 - $c );
238
                } else {
239
                    $orderinfo{ecost} = $price * ( 1 - $c );
240
                    $orderinfo{rrp}   = $price;
241
                }
242
            } else {
243
                if ( $c_discount ) {
244
                    $orderinfo{ecost} = $price / ( 1 + $orderinfo{gstrate} );
245
                    $orderinfo{rrp}   = $orderinfo{ecost} / ( 1 - $c );
246
                } else {
247
                    $orderinfo{rrp}   = $price / ( 1 + $orderinfo{gstrate} );
248
                    $orderinfo{ecost} = $orderinfo{rrp} * ( 1 - $c );
249
                }
250
            }
251
            $orderinfo{listprice} = $orderinfo{rrp} / $cur->{rate};
229
            $orderinfo{unitprice} = $orderinfo{ecost};
252
            $orderinfo{unitprice} = $orderinfo{ecost};
230
            $orderinfo{total} = $orderinfo{ecost};
253
            $orderinfo{total} = $orderinfo{ecost} * $c_quantity;
231
        } else {
254
        } else {
232
            $orderinfo{'listprice'} = 0;
255
            $orderinfo{listprice} = 0;
233
        }
256
        }
234
257
235
        # remove uncertainprice flag if we have found a price in the MARC record
258
        # remove uncertainprice flag if we have found a price in the MARC record
236
        $orderinfo{uncertainprice} = 0 if $orderinfo{listprice};
259
        $orderinfo{uncertainprice} = 0 if $orderinfo{listprice};
237
        my $basketno;
260
        my ( $basketno, $ordernumber ) = NewOrder( \%orderinfo );
238
        ( $basketno, $ordernumber ) = NewOrder( \%orderinfo );
239
261
240
        # 4th, add items if applicable
262
        # 4th, add items if applicable
241
        # parse the item sent by the form, and create an item just for the import_record_id we are dealing with
263
        # parse the item sent by the form, and create an item just for the import_record_id we are dealing with
Lines 255-266 if ($op eq ""){ Link Here
255
            push @{ $item->{indicator} },    $indicator[0];
277
            push @{ $item->{indicator} },    $indicator[0];
256
            my $xml = TransformHtmlToXml( \@tags, \@subfields, \@field_values, \@ind_tag, \@indicator );
278
            my $xml = TransformHtmlToXml( \@tags, \@subfields, \@field_values, \@ind_tag, \@indicator );
257
            my $record = MARC::Record::new_from_xml( $xml, 'UTF-8' );
279
            my $record = MARC::Record::new_from_xml( $xml, 'UTF-8' );
258
            for (my $qtyloop=1;$qtyloop <=$quantity;$qtyloop++) {
280
            for (my $qtyloop=1;$qtyloop <= $c_quantity;$qtyloop++) {
259
                my ( $biblionumber, $bibitemnum, $itemnumber ) = AddItemFromMarc( $record, $biblionumber );
281
                my ( $biblionumber, $bibitemnum, $itemnumber ) = AddItemFromMarc( $record, $biblionumber );
260
                NewOrderItem( $itemnumber, $ordernumber );
282
                NewOrderItem( $itemnumber, $ordernumber );
261
            }
283
            }
262
        } else {
263
            SetImportRecordStatus( $biblio->{'import_record_id'}, 'imported' );
264
        }
284
        }
265
    }
285
    }
266
    # go to basket page
286
    # go to basket page
Lines 277-284 my $budget = GetBudget($budget_id); Link Here
277
297
278
# build budget list
298
# build budget list
279
my $budget_loop = [];
299
my $budget_loop = [];
280
$budgets = GetBudgetHierarchy;
300
my $budgets_hierarchy = GetBudgetHierarchy;
281
foreach my $r ( @{$budgets} ) {
301
foreach my $r ( @{$budgets_hierarchy} ) {
282
    next unless (CanUserUseBudget($borrower, $r, $userflags));
302
    next unless (CanUserUseBudget($borrower, $r, $userflags));
283
    if ( !defined $r->{budget_amount} || $r->{budget_amount} == 0 ) {
303
    if ( !defined $r->{budget_amount} || $r->{budget_amount} == 0 ) {
284
        next;
304
        next;
Lines 286-291 foreach my $r ( @{$budgets} ) { Link Here
286
    push @{$budget_loop},
306
    push @{$budget_loop},
287
      { b_id  => $r->{budget_id},
307
      { b_id  => $r->{budget_id},
288
        b_txt => $r->{budget_name},
308
        b_txt => $r->{budget_name},
309
        b_sort1_authcat => $r->{'sort1_authcat'},
310
        b_sort2_authcat => $r->{'sort2_authcat'},
289
        b_sel => ( $r->{budget_id} == $budget_id ) ? 1 : 0,
311
        b_sel => ( $r->{budget_id} == $budget_id ) ? 1 : 0,
290
      };
312
      };
291
}
313
}
Lines 297-303 if ($budget) { # its a mod .. Link Here
297
        $CGIsort1 = GetAuthvalueDropbox(  $budget->{'sort1_authcat'}, $data->{'sort1'} );
319
        $CGIsort1 = GetAuthvalueDropbox(  $budget->{'sort1_authcat'}, $data->{'sort1'} );
298
    }
320
    }
299
} elsif ( scalar(@$budgets) ) {
321
} elsif ( scalar(@$budgets) ) {
300
    $CGIsort1 = GetAuthvalueDropbox(  @$budgets[0]->{'sort1_authcat'}, '' );
322
} elsif ( scalar(@$budgets_hierarchy) ) {
323
    $CGIsort1 = GetAuthvalueDropbox( @$budgets_hierarchy[0]->{'sort1_authcat'}, '' );
301
}
324
}
302
# if CGIsort is successfully fetched, the use it
325
# if CGIsort is successfully fetched, the use it
303
# else - failback to plain input-field
326
# else - failback to plain input-field
Lines 312-319 if ($budget) { Link Here
312
    if ( defined $budget->{'sort2_authcat'} ) {
335
    if ( defined $budget->{'sort2_authcat'} ) {
313
        $CGIsort2 = GetAuthvalueDropbox(  $budget->{'sort2_authcat'}, $data->{'sort2'} );
336
        $CGIsort2 = GetAuthvalueDropbox(  $budget->{'sort2_authcat'}, $data->{'sort2'} );
314
    }
337
    }
315
} elsif ( scalar(@$budgets) ) {
338
} elsif ( scalar(@$budgets_hierarchy) ) {
316
    $CGIsort2 = GetAuthvalueDropbox(  @$budgets[0]->{sort2_authcat}, '' );
339
    $CGIsort2 = GetAuthvalueDropbox( @$budgets_hierarchy[0]->{sort2_authcat}, '' );
317
}
340
}
318
if ($CGIsort2) {
341
if ($CGIsort2) {
319
    $template->param( CGIsort2 => $CGIsort2 );
342
    $template->param( CGIsort2 => $CGIsort2 );
Lines 378-386 sub import_biblios_list { Link Here
378
            record_sequence => $biblio->{'record_sequence'},
401
            record_sequence => $biblio->{'record_sequence'},
379
            overlay_status => $biblio->{'overlay_status'},
402
            overlay_status => $biblio->{'overlay_status'},
380
            match_biblionumber => $#$match > -1 ? $match->[0]->{'biblionumber'} : 0,
403
            match_biblionumber => $#$match > -1 ? $match->[0]->{'biblionumber'} : 0,
381
            match_citation => $#$match > -1 ? $match->[0]->{'title'} . ' ' . $match->[0]->{'author'} : '',
404
            match_citation     => $#$match > -1 ? $match->[0]->{'title'} || '' . ' ' . $match->[0]->{'author'} || '': '',
382
            match_score => $#$match > -1 ? $match->[0]->{'score'} : 0,
405
            match_score => $#$match > -1 ? $match->[0]->{'score'} : 0,
383
        );
406
        );
407
        my ( $marcblob, $encoding ) = GetImportRecordMarc( $biblio->{'import_record_id'} );
408
        my $marcrecord = MARC::Record->new_from_usmarc($marcblob) || die "couldn't translate marc information";
409
        my $infos = get_infos_syspref($marcrecord, ['price', 'quantity', 'budget_code', 'rrp', 'discount', 'sort1', 'sort2']);
410
        my $price = $infos->{price};
411
        my $quantity = $infos->{quantity};
412
        my $budget_code = $infos->{budget_code};
413
        my $rrp = $infos->{rrp};
414
        my $discount = $infos->{discount};
415
        my $sort1 = $infos->{sort1};
416
        my $sort2 = $infos->{sort2};
417
        my $budget_id;
418
        if($budget_code) {
419
            my $biblio_budget = GetBudgetByCode($budget_code);
420
            if($biblio_budget) {
421
                $budget_id = $biblio_budget->{budget_id};
422
            }
423
        }
424
        $cellrecord{price} = $price || '';
425
        $cellrecord{quantity} = $quantity || '';
426
        $cellrecord{budget_id} = $budget_id || '';
427
        $cellrecord{rrp} = $rrp || '';
428
        $cellrecord{discount} = $discount || '';
429
        $cellrecord{sort1} = $sort1 || '';
430
        $cellrecord{sort2} = $sort2 || '';
431
384
        push @list, \%cellrecord;
432
        push @list, \%cellrecord;
385
    }
433
    }
386
    my $num_biblios = $batch->{'num_biblios'};
434
    my $num_biblios = $batch->{'num_biblios'};
Lines 440-442 sub add_matcher_list { Link Here
440
    }
488
    }
441
    $template->param(available_matchers => \@matchers);
489
    $template->param(available_matchers => \@matchers);
442
}
490
}
491
492
sub get_infos_syspref {
493
    my ($record, $field_list) = @_;
494
    my $syspref = C4::Context->preference('MarcFieldsToOrder');
495
    my $yaml = YAML::Load($syspref);
496
    my $r;
497
    for my $field_name ( @$field_list ) {
498
        my @fields = split /\|/, $yaml->{$field_name};
499
        for my $field ( @fields ) {
500
            my ( $f, $sf ) = split /\$/, $field;
501
            next unless $f and $sf;
502
            if ( my $v = $record->subfield( $f, $sf ) ) {
503
                $r->{$field_name} = $v;
504
            }
505
            last if $yaml->{$field};
506
        }
507
    }
508
    return $r;
509
}
(-)a/acqui/ajax-getauthvaluedropbox.pl (+73 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
# Copyright 2012 BibLibre
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU General Public License as published by the Free Software
9
# Foundation; either version 2 of the License, or (at your option) any later
10
# version.
11
#
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License along
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
20
=head1 NAME
21
22
ajax-getauthvaluedropbox.pl - returns an authorised values dropbox
23
24
=head1 DESCRIPTION
25
26
this script returns an authorised values dropbox
27
28
=head1 CGI PARAMETERS
29
30
=over 4
31
32
=item name
33
34
The name of the dropbox.
35
36
=item category
37
38
The category of authorised values.
39
40
=item default
41
42
Default value for the dropbox.
43
44
=back
45
46
=cut
47
48
use Modern::Perl;
49
50
use CGI;
51
use C4::Budgets;
52
use C4::Charset;
53
54
my $input = new CGI;
55
my $name = $input->param('name');
56
my $category = $input->param('category');
57
my $default = $input->param('default');
58
$default = C4::Charset::NormalizeString($default);
59
60
binmode STDOUT, ':encoding(UTF-8)';
61
print $input->header(-type => 'text/plain', -charset => 'UTF-8');
62
my $avs = GetAuthvalueDropbox($category, $default);
63
my $html = qq|<select id="$name", name="$name">|;
64
for my $av ( @$avs ) {
65
    if ( $av->{default} ) {
66
        $html .= qq|<option value="$av->{value}" selected="selected">$av->{label}</option>|;
67
    } else {
68
        $html .= qq|<option value="$av->{value}">$av->{label}</option>|;
69
    }
70
}
71
$html .= qq|</select>|;
72
73
print $html;
(-)a/installer/data/mysql/updatedatabase.pl (+9 lines)
Lines 8243-8248 if ( CheckVersion($DBversion) ) { Link Here
8243
    SetVersion ($DBversion);
8243
    SetVersion ($DBversion);
8244
}
8244
}
8245
8245
8246
8247
8248
$DBversion = "3.15.00.XXX";
8249
if ( CheckVersion($DBversion) ) {
8250
    $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('MarcFieldsToOrder','','Set the mapping values for a new order line created from a marcrecord (staged file). In a YAML format.', NULL, 'textarea')");
8251
   print "Upgrade to $DBversion done (Bug 7180: Added MarcFieldsToOrder syspref)\n";
8252
   SetVersion ($DBversion);
8253
}
8254
8246
=head1 FUNCTIONS
8255
=head1 FUNCTIONS
8247
8256
8248
=head2 TableExists($table)
8257
=head2 TableExists($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/js/acq.js (-74 / +19 lines)
Lines 214-297 function calcNewsuggTotal(){ Link Here
214
    return true;
214
    return true;
215
}
215
}
216
216
217
217
function getAuthValueDropbox( name, cat, destination, selected ) {
218
// ----------------------------------------
218
    if (cat == null || cat == "") {
219
//USED BY NEWORDEREMPTY.PL
219
        $(destination).replaceWith(' <input type="text" name="' + name + '" />' );
220
/*
221
function fetchSortDropbox(f) {
222
    var  budgetId=f.budget_id.value;
223
    var handleSuccess = function(o){
224
        if(o.responseText !== undefined){
225
            sort_dropbox.innerHTML   = o.responseText;
226
        }
227
    }
228
229
    var callback = {   success:handleSuccess };
230
    var sUrl = '../acqui/fetch_sort_dropbox.pl?sort=1&budget_id='+budgetId
231
    var sort_dropbox = document.getElementById('sort1');
232
    var request1 = YAHOO.util.Connect.asyncRequest('GET', sUrl, callback);
233
    var rr = '00';
234
235
// FIXME: ---------  twice , coz the 2 requests get mixed up otherwise
236
237
    var handleSuccess2 = function(o){
238
    if(o.responseText !== undefined){
239
        sort2_dropbox.innerHTML   = o.responseText;
240
        }
241
    }
242
243
    var callback2 = {   success:handleSuccess };
244
    var sUrl2 = '../acqui/fetch_sort_dropbox.pl?sort=2&budget_id='+budgetId;
245
    var sort2_dropbox = document.getElementById('sort2');
246
    var request2 = YAHOO.util.Connect.asyncRequest('GET', sUrl2, callback2);
247
248
}
249
*/
250
251
252
253
//USED BY NEWORDEREMPTY.PL
254
function fetchSortDropbox(f) {
255
    var  budgetId=f.budget_id.value;
256
257
for (i=1;i<=2;i++) {
258
259
    var sort_zone = document.getElementById('sort'+i+'_zone');
260
    var url = '../acqui/fetch_sort_dropbox.pl?sort='+i+'&budget_id='+budgetId;
261
262
    var xmlhttp = null;
263
    xmlhttp = new XMLHttpRequest();
264
    if ( typeof xmlhttp.overrideMimeType != 'undefined') {
265
        xmlhttp.overrideMimeType('text/xml');
266
    }
267
268
    xmlhttp.open('GET', url, false);
269
    xmlhttp.send(null);
270
271
    xmlhttp.onreadystatechange = function() {
272
        if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
273
    // stupid JS...
274
        } else {
275
    // wait for the call to complete
276
        }
277
    };
278
    // rc =  eval ( xmlhttp.responseText );
279
    var retRootType = xmlhttp.responseXML.firstChild.nodeName;
280
    var existingInputs = sort_zone.getElementsByTagName('input');
281
    if (existingInputs.length > 0 && retRootType == 'input') {
282
        // when sort is already an input, do not override to preseve value
283
        return;
220
        return;
284
    }
221
    }
285
    sort_zone.innerHTML = xmlhttp.responseText;
222
    $.ajax({
286
}
223
        url: "/cgi-bin/koha/acqui/ajax-getauthvaluedropbox.pl",
224
        data: {
225
            name: name,
226
            category: cat,
227
            default: selected
228
        },
229
        async: false,
230
        success: function(data){
231
            if(data === "0"){
232
                $(destination).replaceWith(' <input type="text" name="' + name + '" />' );
233
            }else{
234
                $(destination).replaceWith(data);
235
            }
236
        }
237
    });
287
}
238
}
288
239
289
290
291
292
293
294
295
//USED BY NEWORDEREMPTY.PL
240
//USED BY NEWORDEREMPTY.PL
296
function totalExceedsBudget(budgetId, total) {
241
function totalExceedsBudget(budgetId, total) {
297
242
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt (-227 / +298 lines)
Lines 10-21 Link Here
10
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
10
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
11
[% INCLUDE 'doc-head-close.inc' %]
11
[% INCLUDE 'doc-head-close.inc' %]
12
[% INCLUDE 'datatables.inc' %]
12
[% INCLUDE 'datatables.inc' %]
13
<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
13
<script type="text/javascript" src="[% themelang %]/js/acq.js"></script>
14
<script type="text/javascript" src="[% themelang %]/js/acq.js"></script>
14
<script type="text/javascript" src="[% themelang %]/js/cataloging.js"></script>
15
<script type="text/JavaScript">
15
<script type="text/JavaScript">
16
//<![CDATA[
16
//<![CDATA[
17
    $(document).ready(function() {
17
    $(document).ready(function() {
18
        $("#files,#recordst").dataTable($.extend(true, {}, dataTablesDefaults, {
18
        $("#files").dataTable($.extend(true, {}, dataTablesDefaults, {
19
            "aoColumnDefs": [
19
            "aoColumnDefs": [
20
                { "bSortable": false, "bSearchable": false, 'aTargets': [ 'NoSort' ] },
20
                { "bSortable": false, "bSearchable": false, 'aTargets': [ 'NoSort' ] },
21
                { "sType": "anti-the", "aTargets" : [ "anti-the" ] },
21
                { "sType": "anti-the", "aTargets" : [ "anti-the" ] },
Lines 25-42 Link Here
25
            "aaSorting": []
25
            "aaSorting": []
26
        } ) );
26
        } ) );
27
27
28
        $("form#Aform").submit(function() {
28
        $("select[name='budget_id']").change(function(){
29
            var total_errors = CheckMandatorySubfields(this);
29
            var sort1_authcat = $(this).find("option:selected").attr('data-sort1-authcat');
30
            if (total_errors > 0) {
30
            var sort2_authcat = $(this).find("option:selected").attr('data-sort2-authcat');
31
                var alertString  = _("Form not submitted because of the following problem(s)");
31
            var destination_sort1 = $(this).siblings('span.sort1').find('input[name="sort1"]');
32
                alertString += "\n------------------------------------------------------------------------------------\n";
32
            var sort1 = $(destination_sort1).val();
33
                alertString += "\n- " + _("%s mandatory fields empty (highlighted)").format(total_errors);
33
            if ( destination_sort1.length < 1 ) {
34
                alert(alertString);
34
                destination_sort1 = $(this).siblings('span.sort1').find('select[name="sort1"]');
35
                return false;
36
            }
35
            }
37
            return true;
36
            var destination_sort2 = $(this).siblings('span.sort2').find('input[name="sort2"]');
37
            var sort2 = $(destination_sort2).val();
38
            if ( destination_sort2.length < 1 ) {
39
                destination_sort2 = $(this).siblings('span.sort2').find('select[name="sort2"]');
40
            }
41
            getAuthValueDropbox( 'sort1', sort1_authcat, destination_sort1, sort1 );
42
43
            getAuthValueDropbox( 'sort2', sort2_authcat, destination_sort2, sort2 );
44
        } );
45
46
        $("select[name='budget_id']").change();
47
48
        $("select[name='all_budget_id']").change(function(){
49
            var sort1_authcat = $(this).find("option:selected").attr('data-sort1-authcat');
50
            var sort2_authcat = $(this).find("option:selected").attr('data-sort2-authcat');
51
            var destination_sort1 = $(this).parent().siblings('li').find('input[name="all_sort1"]');
52
            if ( destination_sort1.length < 1 ) {
53
                destination_sort1 = $(this).parent().siblings('li').find('select[name="all_sort1"]');
54
            }
55
            var destination_sort2 = $(this).parent().siblings('li').find('input[name="all_sort2"]');
56
            if ( destination_sort2.length < 1 ) {
57
                destination_sort2 = $(this).parent().siblings('li').find('select[name="all_sort2"]');
58
            }
59
            getAuthValueDropbox( 'sort1', sort1_authcat, destination_sort1 );
60
            getAuthValueDropbox( 'sort2', sort2_authcat, destination_sort2 );
61
            $(this).parent().siblings('li').find('select[name="sort1"]').attr('name', 'all_sort1');
62
            $(this).parent().siblings('li').find('input[name="sort1"]').attr('name', 'all_sort1');
63
            $(this).parent().siblings('li').find('select[name="sort2"]').attr('name', 'all_sort2');
64
            $(this).parent().siblings('li').find('input[name="sort2"]').attr('name', 'all_sort2');
65
        } );
66
67
        $('input:checkbox[name="import_record_id"]').change(function(){
68
            if ( $(this).is(':checked') ) {
69
                $(this).parent().addClass("selected");
70
                $(this).parent().removeClass("unselected");
71
            } else {
72
                $(this).parent().addClass("unselected");
73
                $(this).parent().removeClass("selected");
74
            }
75
        } );
76
77
        $("input:checkbox").attr("checked", false);
78
        $("div.biblio.unselected select").attr("disabled", false);
79
        $("div.biblio.unselected input").attr("disabled", false);
80
81
        $("#checkAll").click(function(){
82
            $("#Aform").checkCheckboxes();
83
            $("input:checkbox[name='import_record_id']").change();
84
            return false;
85
        });
86
        $("#unCheckAll").click(function(){
87
            $("#Aform").unCheckCheckboxes();
88
            $("input:checkbox[name='import_record_id']").change();
89
            return false;
38
        });
90
        });
91
39
    });
92
    });
93
94
    function disableUnchecked(form){
95
        $("div.biblio.unselected").each(function(){
96
            $(this).find('select').attr('disabled', 'disabled');
97
            $(this).find('input').attr('disabled', 'disabled');
98
        });
99
        form.submit();
100
    }
40
//]]>
101
//]]>
41
</script>
102
</script>
42
</head>
103
</head>
Lines 49-75 Link Here
49
       <div id="yui-main">
110
       <div id="yui-main">
50
           <div class="yui-b">
111
           <div class="yui-b">
51
             [% IF ( batch_details ) %]
112
             [% IF ( batch_details ) %]
52
                  <h1>Add orders from [% comments %]
113
                <h1>Add orders from [% comments %]
53
                    ([% file_name %] staged on [% upload_timestamp | $KohaDates with_hours => 1 %])
114
                    ([% file_name %] staged on [% upload_timestamp | $KohaDates with_hours => 1 %])
54
                  </h1>
115
                </h1>
55
               <div>
116
                <div>
56
                   <form action="[% scriptname %]" method="post" name="import_biblios">
117
                    <span class="checkall"><a id="checkAll" href="#">Check All</a></span>
57
                     <table id="recordst">
118
                    <span class="uncheckall"><a id="unCheckAll" href="#">Uncheck All</a></span>
58
                     <thead>
119
                    <form action="/cgi-bin/koha/acqui/addorderiso2709.pl" method="post" id="Aform" onsubmit="disableUnchecked(this); return false;">
59
                     <tr>
120
                        <input type="hidden" name="op" value="import_records"/>
60
                         <th class="anti-the">Citation</th>
121
                        <input type="hidden" name="basketno" value="[% basketno %]" />
61
                         <th>Match?</th>
122
                        <input type="hidden" name="booksellerid" value="[% booksellerid %]" />
62
                         <th>Order</th>
123
                        <input type="hidden" name="import_batch_id" value="[%import_batch_id %]" />
63
                       </tr>
124
                        <input type="hidden" name="ordernumber" value="[% ordernumber %]" />
64
                       </thead>
125
65
                       <tbody>
126
                        [% FOREACH cur IN loop_currencies %]
66
                       [% FOREACH biblio_lis IN biblio_list %]
127
                            <input type="hidden" name="[% cur.currency %]" value="[% cur.rate %]" />
67
                         <tr>
128
                        [% END %]
68
                             <td>
69
                                [% biblio_lis.citation %]
70
129
71
                             </td>
130
                        [% FOREACH biblio IN biblio_list %]
72
                             <td>
131
                        <div class="biblio unselected" style="border-radius: 5px 5px; -moz-border-radius: 5px; padding: 5px; margin:5px; border-style : solid; border-color : grey; border-width:1px;">
132
                            <input type="checkbox" name="import_record_id" id="record_[% biblio.import_record_id %]" value="[% biblio.import_record_id %]" />
133
                            <input type="hidden" value="[% biblio.rrp %]" name="rrp" />
134
                            <label for="record_[% biblio.import_record_id %]"><span class="citation" style="font-weight:bold;">[% biblio.citation %]</span></label>
135
                            <span class="match" style="display:block;">
73
                                [% IF ( biblio_lis.overlay_status == 'no_match' ) %]
136
                                [% IF ( biblio_lis.overlay_status == 'no_match' ) %]
74
                                    No match
137
                                    No match
75
                                [% ELSIF ( biblio_lis.overlay_status == 'match_applied' ) %]
138
                                [% ELSIF ( biblio_lis.overlay_status == 'match_applied' ) %]
Lines 79-290 Link Here
79
                                [% ELSE %]
142
                                [% ELSE %]
80
                                    [% biblio_lis.overlay_status %]
143
                                    [% biblio_lis.overlay_status %]
81
                                [% END %]
144
                                [% END %]
82
                             </td>
145
                            </span>
83
                             <td><a href="/cgi-bin/koha/acqui/neworderempty.pl?booksellerid=[% booksellerid %]&amp;basketno=[% basketno %]&amp;booksellerid=[% booksellerid %]&amp;breedingid=[% biblio_lis.import_record_id %]&amp;import_batch_id=[% biblio_lis.import_batch_id %]&amp;biblionumber=[% biblio_lis.match_biblionumber %]">Add order</a></td>
146
                            [% IF ( biblio.match_biblionumber ) %]
84
                         </tr>
147
                                Matches biblio [% biblio.match_biblionumber %] (score = [% biblio.match_score %]): <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblio.match_biblionumber %]">[% biblio.match_citation %]</a>
85
     [% IF ( biblio_lis.match_biblionumber ) %]
148
                            [% END %]
86
    <tr>
149
                            <span class="quantity" style="display:block;">
87
      <td class="highlight" colspan="3">&nbsp;&nbsp;&nbsp;Matches biblio [% biblio_lis.match_biblionumber %] (score = [% biblio_lis.match_score %]): <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblio_lis.match_biblionumber %]">[% biblio_lis.match_citation %]</a></td>
150
                                Quantity: <input type="text" value="[% biblio.quantity %]" name="quantity" />
88
    </tr>
151
                            </span>
89
    [% END %]
152
                            <span class="price" style="display:block;">
90
                      [% END %]
153
                                Price: <input type="text" value="[% biblio.price %]" name="price" />
91
                      </tbody>
154
                            </span>
92
                     </table>
155
                            <span class="discount" style="display:block;">
93
                   </form>
156
                                Discount: <input type="text" value="[% biblio.discount %]" name="discount" />
94
               </div>
157
                            </span>
95
              [% IF ( pages ) %]
158
                            <span class="budget" style="display:block;">
96
                <div class="pages">
159
                                [% IF ( close ) %]
97
                Page 
160
                                <span class="label">Budget: </span>
98
                  [% FOREACH page IN pages %]
161
                                    <input type="hidden" size="20" name="budget_id" value="[% budget_id %]" />[% Budget_name %]
99
                    [% IF ( page.current_page ) %]
100
                      <span class="current">[% page.page_number %]</span>
101
                    [% ELSE %]
102
                      <a class="nav" href="[% page.script_name %]?import_batch_id=[% page.import_batch_id %]&amp;offset=[% page.offset %]">[% page.page_number %]</a>
103
                    [% END %]
104
                  [% END %]
105
              [% END %]
106
             [% ELSE %]
107
               <div>
108
                <h1>Choose the file to add to the basket</h1>
109
                   <table id="files">
110
                     <thead>
111
                     <tr>
112
                       <th>File name</th>
113
                       <th>Comments</th>
114
                       <th>Status</th>
115
                       <th class="title-string">Staged</th>
116
                       <th># Bibs</th>
117
                       <th class="NoSort">&nbsp;</th>
118
                     </tr>
119
                     </thead>
120
                     <tbody>
121
                     [% FOREACH batch_lis IN batch_list %]
122
                     <tr>
123
                        <td>[% batch_lis.file_name %]</td>
124
                       <td>[% batch_lis.comments %]</td>
125
                       <td>
126
                        [% IF ( batch_lis.import_status == 'cleaned' ) %]
127
                            Cleaned
128
                        [% ELSIF ( batch_lis.import_status == 'imported' ) %]
129
                            Imported
130
                        [% ELSIF ( batch_lis.import_status == 'importing' ) %]
131
                            Importing
132
                        [% ELSIF ( batch_lis.import_status == 'reverted' ) %]
133
                            Reverted
134
                        [% ELSIF ( batch_lis.import_status == 'reverting' ) %]
135
                            Reverting
136
                        [% ELSIF ( batch_lis.import_status == 'staged' ) %]
137
                            Staged
138
                        [% ELSE %]
139
                            [% batch_lis.import_status %]
140
                        [% END %]
141
                       </td>
142
                       <td><span title="[% batch_lis.staged_date %]">[% batch_lis.staged_date | $KohaDates with_hours => 1 %]</span></td>
143
                       <td>[% batch_lis.num_biblios %]</td>
144
                       <td><a href="[% batch_lis.scriptname %]?import_batch_id=[% batch_lis.import_batch_id %]&amp;basketno=[% basketno %]&amp;booksellerid=[% booksellerid %]">Add orders</a></td>
145
                     </tr>
146
                     [% END %]
147
                     </tbody>
148
                   </table>
149
               </div>
150
             [% END %]
151
           </div>
152
        [% IF ( import_batch_id ) %]
153
            <div class="yui-b">
154
            <h2>Import all</h2>
155
            <p>Import all the lines in the basket with the following parameters:</p>
156
            <form action="/cgi-bin/koha/acqui/addorderiso2709.pl" method="post" id="Aform">
157
                    <input type="hidden" name="op" value="import_records"/>
158
                    <input type="hidden" name="ordernumber" value="[% ordernumber %]" />
159
                    <input type="hidden" name="basketno" value="[% basketno %]" />
160
                    <input type="hidden" name="booksellerid" value="[% booksellerid %]" />
161
                    <input type="hidden" name="import_batch_id" value="[% import_batch_id %]" />
162
163
                    [% FOREACH loop_currencie IN loop_currencies %]
164
                        <input type="hidden" name="[% loop_currencie.currency %]" value="[% loop_currencie.rate %]" />
165
                    [% END %]
166
167
                [% IF ( items ) %]
168
                <fieldset class="rows">
169
                    <legend>Item</legend>
170
                    [% IF ( NoACQframework ) %]
171
                        <div class="dialog message">No ACQ framework, using default. You should create a framework with code ACQ, the items framework would be used</div>
172
                    [% END %]
173
174
                    [% FOREACH item IN items %]
175
                    <div id="outeritemblock">
176
                    <div id="itemblock">
177
                        <ol>[% FOREACH iteminformatio IN item.iteminformation %]<li style="[% iteminformatio.hidden %];">
178
                            <div class="subfield_line" id="subfield[% iteminformatio.serialid %][% iteminformatio.countitems %][% iteminformatio.subfield %][% iteminformatio.random %]">
179
                                [% IF (iteminformatio.mandatory) %]
180
                                    <label class="required">[% iteminformatio.subfield %] - [% iteminformatio.marc_lib %]</label>
181
                                [% ELSE %]
162
                                [% ELSE %]
182
                                    <label>[% iteminformatio.subfield %] - [% iteminformatio.marc_lib %]</label>
163
                                <label for="budget_id">Budget: </label>
164
                                <select size="1" name="budget_id">
165
                                    <option value=""></option>
166
                                    [% FOREACH budget IN budget_loop %]
167
                                        [% IF ( budget.b_id == biblio.budget_id ) %]
168
                                            <option value="[% budget.b_id %]" data-sort1-authcat="[% budget.b_sort1_authcat %]" data-sort2-authcat="[% budget.b_sort2_authcat %]" selected="selected">[% budget.b_txt %]</option>
169
                                        [% ELSE %]
170
                                            <option value="[% budget.b_id %]" data-sort1-authcat="[% budget.b_sort1_authcat %]" data-sort2-authcat="[% budget.b_sort2_authcat %]">[% budget.b_txt %]</option>
171
                                        [% END %]
172
                                    [% END %]
173
                                </select>
183
                                [% END %]
174
                                [% END %]
184
                                [% iteminformatio.marc_value %]
175
                                <span class="sort1">
185
                                <input type="hidden" name="itemid" value="1" />
176
                                    <label for="sort1">Planning value1: </label>
186
                                <input type="hidden" name="kohafield" value="[% iteminformatio.kohafield %]" />
177
                                    <input type="text" id="sort1" size="20" name="sort1" value="[% biblio.sort1 %]" />
187
                                <input type="hidden" name="tag" value="[% iteminformatio.tag %]" />
178
                                </span>
188
                                <input type="hidden" name="subfield" value="[% iteminformatio.subfield %]" />
179
                                <span class="sort2">
189
                                <input type="hidden" name="mandatory" value="[% iteminformatio.mandatory %]" />
180
                                    <label for="sort2">Planning value2: </label>
190
                                [% IF ( iteminformatio.mandatory ) %] <span class="required">Required</span>[% END %]
181
                                    <input type="text" id="sort2" size="20" name="sort2" value="[% biblio.sort2 %]" />
191
                            </div></li>
182
                                </span>
183
                            </span>
184
                        </div>
192
                        [% END %]
185
                        [% END %]
193
                        </ol>
186
                        <div>
194
                    </div><!-- /iteminformation -->
187
                        <h2>Import all</h2>
195
                    </div>
188
                        <p>Import all the lines in the basket with the following parameters:</p>
196
189
197
                    [% END %] <!-- /items -->
190
                        [% IF ( items ) %]
198
                </fieldset>
191
                        <fieldset class="rows">
199
                [% END %] <!-- items -->
192
                            <legend>Item</legend>
200
                <fieldset class="rows">
193
                            [% IF ( NoACQframework ) %]
201
                    <legend>Accounting details</legend>
194
                                <div class="dialog message">No ACQ framework, using default. You should create a framework with code ACQ, the items framework would be used</div>
202
                    <ol>
203
                        <li>
204
                            <!-- origquantityrec only here for javascript compatibility (additem.js needs it, useless here, usefull when receiveing an order -->
205
                            <input id="origquantityrec" readonly="readonly" type="hidden" name="origquantityrec" value="1" />
206
                        </li>
207
                        <li>
208
                            [% IF ( close ) %]
209
                        <span class="label">Budget: </span>
210
                                <input type="hidden" size="20" name="budget_id" id="budget_id" value="[% budget_id %]" />[% Budget_name %]
211
                            [% ELSE %]
212
                            <li>
213
                            <label for="currency">Currency:</label>
214
                            <select name="currency" id="currency">
215
                            [% FOREACH loop_currencie IN loop_currencies %]
216
                                    [% IF ( loop_currencie.selected ) %]<option value="[% loop_currencie.currcode %]" selected="selected">[% loop_currencie.currcode %]</option>[% ELSE %]<option value="[% loop_currencie.currcode %]">[% loop_currencie.currcode %]</option>[% END %][% END %]
217
                            </select>
218
                            </li>
219
                            <li>
220
                            <label for="budget_id">Budget: </label>
221
                            <select id="budget_id" onchange="fetchSortDropbox(this.form)" size="1" name="budget_id">
222
                            [% FOREACH budget_loo IN budget_loop %]
223
                                [% IF ( budget_loo.b_sel ) %]
224
                                    <option value="[% budget_loo.b_id %]" selected="selected">[% budget_loo.b_txt %]</option>
225
                                [% ELSE %]
226
                                    <option value="[% budget_loo.b_id %]">[% budget_loo.b_txt %]</option>
227
                                [% END %]
228
                            [% END %]
229
                            </select>
230
                            </li>
231
                            [% END %]
195
                            [% END %]
232
                        </li>
196
                            [% FOREACH item IN items %]
233
                        <li>
197
                            <div id="outeritemblock">
234
                            <label for="order_internalnote">Internal note: </label>
198
                            <div id="itemblock">
235
                            <textarea id="order_internalnote" cols="30" rows="3" name="order_internalnote"></textarea>
199
                                <ol>
236
                        </li>
200
                                [% FOREACH iteminformatio IN item.iteminformation %]<li style="[% iteminformatio.hidden %];">
237
                        <li>
201
                                    <div class="subfield_line" id="subfield[% iteminformatio.serialid %][% iteminformatio.countitems %][% iteminformatio.subfield %][% iteminformatio.random %]">
238
                            <label for="order_vendornote">Vendor note: </label>
202
                                        [% IF (iteminformatio.mandatory) %]
239
                            <textarea id="order_vendornote" cols="30" rows="3" name="order_vendornote"></textarea>
203
                                            <label class="required">[% iteminformatio.subfield %] - [% iteminformatio.marc_lib %]</label>
240
                        </li>
204
                                        [% ELSE %]
241
                        <li><div class="hint">The 2 following fields are available for your own usage. They can be useful for statistical purposes</div>
205
                                            <label>[% iteminformatio.subfield %] - [% iteminformatio.marc_lib %]</label>
242
                            <label for="sort1">Planning value1: </label>
206
                                        [% END %]
243
                            <span id="sort1_zone">
207
244
                            [% IF CGIsort1 %]
208
                                        [% iteminformatio.marc_value %]
245
                                <select id="sort1" size="1" name="sort1">
209
                                        <input type="hidden" name="itemid" value="1" />
246
                                [% FOREACH sort_opt IN CGIsort1 %]
210
                                        <input type="hidden" name="kohafield" value="[% iteminformatio.kohafield %]" />
247
                                    [% IF sort_opt.default %]
211
                                        <input type="hidden" name="tag" value="[% iteminformatio.tag %]" />
248
                                        <option value="[% sort_opt.id %]" selected="selected">[% sort_opt.label %]</option>
212
                                        <input type="hidden" name="subfield" value="[% iteminformatio.subfield %]" />
213
                                        <input type="hidden" name="mandatory" value="[% iteminformatio.mandatory %]" />
214
                                        [% IF ( iteminformatio.mandatory ) %] <span class="required">Required</span>[% END %]
215
                                    </div></li>
216
                                [% END %]
217
                                </ol>
218
                            </div><!-- /iteminformation -->
219
                            </div>
220
                            [% END %] <!-- /items -->
221
                        </fieldset>
222
                        [% END %] <!-- items -->
223
224
                        <fieldset class="rows">
225
                            <legend>Accounting details</legend>
226
                            <ol>
227
                                <li>
228
                                    <!-- origquantityrec only here for javascript compatibility (additem.js needs it, useless here, usefull when receiveing an order -->
229
                                    <input id="origquantityrec" readonly="readonly" type="hidden" name="origquantityrec" value="1" />
230
                                </li>
231
                                <li>
232
                                    [% IF ( close ) %]
233
                                        <span class="label">Budget: </span>
234
                                        <input type="hidden" size="20" name="budget_id" id="budget_id" value="[% budget_id %]" />[% Budget_name %]
249
                                    [% ELSE %]
235
                                    [% ELSE %]
250
                                        <option value="[% sort_opt.id %]">[% sort_opt.label %]</option>
236
                                        <li>
237
                                            <label for="all_currency">Currency:</label>
238
                                            <select name="all_currency" id="all_currency">
239
                                            [% FOREACH loop_currencie IN loop_currencies %]
240
                                                [% IF ( loop_currencie.selected ) %]
241
                                                    <option value="[% loop_currencie.currcode %]" selected="selected">[% loop_currencie.currcode %]</option>
242
                                                [% ELSE %]
243
                                                    <option value="[% loop_currencie.currcode %]">[% loop_currencie.currcode %]</option>
244
                                                [% END %]
245
                                            [% END %]
246
                                            </select>
247
                                        </li>
248
                                        <li>
249
                                            <label for="all_budget_id">Budget: </label>
250
                                            <select id="all_budget_id" size="1" name="all_budget_id">
251
                                            [% FOREACH budget_loo IN budget_loop %]
252
                                                [% IF ( budget_loo.b_sel ) %]
253
                                                    <option value="[% budget_loo.b_id %]" data-sort1-authcat="[% budget_loo.b_sort1_authcat %]" data-sort2-authcat="[% budget_loo.b_sort2_authcat %]" selected="selected">[% budget_loo.b_txt %]</option>
254
                                                [% ELSE %]
255
                                                    <option value="[% budget_loo.b_id %]" data-sort1-authcat="[% budget_loo.b_sort1_authcat %]" data-sort2-authcat="[% budget_loo.b_sort2_authcat %]">[% budget_loo.b_txt %]</option>
256
                                                [% END %]
257
                                            [% END %]
258
                                            </select>
259
                                        </li>
251
                                    [% END %]
260
                                    [% END %]
252
                                [% END %]
261
                                </li>
253
                                </select>
262
                                <li>
254
                            [% ELSE %]
263
                                    <label for="all_order_internalnote">Internal note: </label>
255
                                <input type="text" id="sort1" size="20" name="sort1" value="[% sort1 %]" />
264
                                    <textarea id="all_order_internalnote" cols="30" rows="3" name="all_order_internalnote"></textarea>
256
                            [% END %]
265
                                </li>
257
                            </span>
266
                                <li>
258
                        </li>
267
                                    <label for="all_order_vendornote">Vendor note: </label>
259
                        <li>
268
                                    <textarea id="all_order_vendornote" cols="30" rows="3" name="all_order_vendornote"></textarea>
260
                            <label for="sort2">Planning value2: </label>
269
                                </li>
261
                            <span id="sort2_zone">
270
                                <li>
262
                            [% IF CGIsort2 %]
271
                                    <div class="hint">The 2 following fields are available for your own usage. They can be useful for statistical purposes</div>
263
                                <select id="sort2" size="1" name="sort1">
272
                                    <label for="sort1">Planning value1: </label>
264
                                [% FOREACH sort_opt IN CGIsort2 %]
273
                                    [% IF CGIsort1 %]
265
                                    [% IF sort_opt.default %]
274
                                        <select id="all_sort1" size="1" name="all_sort1">
266
                                        <option value="[% sort_opt.id %]" selected="selected">[% sort_opt.label %]</option>
275
                                        [% FOREACH sort_opt IN CGIsort1 %]
276
                                            [% IF sort_opt.default %]
277
                                                <option value="[% sort_opt.id %]" selected="selected">[% sort_opt.label %]</option>
278
                                            [% ELSE %]
279
                                                <option value="[% sort_opt.id %]">[% sort_opt.label %]</option>
280
                                            [% END %]
281
                                        [% END %]
282
                                        </select>
267
                                    [% ELSE %]
283
                                    [% ELSE %]
268
                                        <option value="[% sort_opt.id %]">[% sort_opt.label %]</option>
284
                                        <input type="text" id="all_sort1" size="20" name="all_sort1" value="[% sort1 %]" />
269
                                    [% END %]
285
                                    [% END %]
270
                                [% END %]
286
                                </li>
271
                                </select>
287
                                <li>
272
                            [% ELSE %]
288
                                  <span id="sort2_zone">
273
                                 <input type="text" id="sort2" size="20" name="sort2" value="[% sort2 %]" />
289
                                    <label for="sort2">Planning value2: </label>
274
                            [% END %]
290
                                    [% IF CGIsort2 %]
275
                            </span>
291
                                        <select id="all_sort2" size="1" name="all_sort1">
276
                        </li>
292
                                        [% FOREACH sort_opt IN CGIsort2 %]
277
                        <li>
293
                                            [% IF sort_opt.default %]
278
                            
294
                                                <option value="[% sort_opt.id %]" selected="selected">[% sort_opt.label %]</option>
279
                        </li>
295
                                            [% ELSE %]
280
            </ol>
296
                                                <option value="[% sort_opt.id %]">[% sort_opt.label %]</option>
281
                </fieldset>
297
                                            [% END %]
282
                <fieldset class="action">
298
                                        [% END %]
283
                    <input type="submit" value="Save" /><a class="cancel" href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basketno %]">Cancel</a>
299
                                        </select>
284
                </fieldset>
300
                                    [% ELSE %]
285
            </form>
301
                                         <input type="text" id="all_sort2" size="20" name="all_sort2" value="[% sort2 %]" />
286
            </div>
302
                                    [% END %]
287
        [% END %]
303
                                  </span>
304
                                </li>
305
                            </ol>
306
                        </fieldset>
307
                        <fieldset class="action">
308
                            <input type="submit" value="Save" /><a class="cancel" href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basketno %]">Cancel</a>
309
                        </fieldset>
310
311
                        </div>
312
                    </form>
313
                [% ELSE %]
314
                <div>
315
                  <h1>Choose the file to add to the basket</h1>
316
                  <table id="files">
317
                    <thead>
318
                      <tr>
319
                        <th>File name</th>
320
                        <th>Comments</th>
321
                        <th>Status</th>
322
                        <th class="title-string">Staged</th>
323
                        <th># Bibs</th>
324
                        <th class="NoSort">&nbsp;</th>
325
                      </tr>
326
                    </thead>
327
                    <tbody>
328
                      [% FOREACH batch_lis IN batch_list %]
329
                      <tr>
330
                        <td>[% batch_lis.file_name %]</td>
331
                        <td>[% batch_lis.comments %]</td>
332
                        <td>
333
                          [% IF ( batch_lis.import_status == 'cleaned' ) %]
334
                            Cleaned
335
                          [% ELSIF ( batch_lis.import_status == 'imported' ) %]
336
                            Imported
337
                          [% ELSIF ( batch_lis.import_status == 'importing' ) %]
338
                            Importing
339
                          [% ELSIF ( batch_lis.import_status == 'reverted' ) %]
340
                            Reverted
341
                          [% ELSIF ( batch_lis.import_status == 'reverting' ) %]
342
                            Reverting
343
                          [% ELSIF ( batch_lis.import_status == 'staged' ) %]
344
                            Staged
345
                          [% ELSE %]
346
                            [% batch_lis.import_status %]
347
                          [% END %]
348
                        </td>
349
                        <td><span title="[% batch_lis.staged_date %]">[% batch_lis.staged_date | $KohaDates with_hours => 1 %]</span></td>
350
                        <td>[% batch_lis.num_biblios %]</td>
351
                        <td><a href="[% batch_lis.scriptname %]?import_batch_id=[% batch_lis.import_batch_id %]&amp;basketno=[% basketno %]&amp;booksellerid=[% booksellerid %]">Add orders</a></td>
352
                      </tr>
353
                      [% END %]
354
                    </tbody>
355
                  </table>
356
                </div>
357
                [% END %]
358
           </div>
288
       </div>
359
       </div>
289
   </div>
360
   </div>
290
</div>
361
</div>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref (-1 / +4 lines)
Lines 45-50 Acquisitions: Link Here
45
        -
45
        -
46
            - Upon receiving items, update their subfields if they were created when placing an order (e.g. o=5|a="foo bar").
46
            - Upon receiving items, update their subfields if they were created when placing an order (e.g. o=5|a="foo bar").
47
            - pref: AcqItemSetSubfieldsWhenReceived
47
            - pref: AcqItemSetSubfieldsWhenReceived
48
        -
49
            - Set the mapping values for a new order line created from a marcrecord (staged file). In a YAML format, so you have to finished with an empty line.
50
            - pref: MarcFieldsToOrder
51
              type: textarea
48
52
49
    Printing:
53
    Printing:
50
        -
54
        -
51
- 

Return to bug 7180