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 697-702 sub GetBudgetByOrderNumber { Link Here
697
    return $result;
698
    return $result;
698
}
699
}
699
700
701
=head2 GetBudgetByCode
702
703
    my $budget = &GetBudgetByCode($budget_code);
704
705
Retrieve all aqbudgets fields as a hashref for the budget that has
706
given budget_code
707
708
=cut
709
710
sub GetBudgetByCode {
711
    my ( $budget_code ) = @_;
712
713
    my $dbh = C4::Context->dbh;
714
    my $query = qq{
715
        SELECT *
716
        FROM aqbudgets
717
        WHERE budget_code = ?
718
    };
719
    my $sth = $dbh->prepare( $query );
720
    $sth->execute( $budget_code );
721
    return $sth->fetchrow_hashref;
722
}
723
700
=head2 GetChildBudgetsSpent
724
=head2 GetChildBudgetsSpent
701
725
702
  &GetChildBudgetsSpent($budget-id);
726
  &GetChildBudgetsSpent($budget-id);
(-)a/acqui/addorderiso2709.pl (-49 / +116 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-240 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
            "notes", $cgiparams->{'notes'}, "budget_id", $cgiparams->{'budget_id'},
217
            budget_id => $c_budget_id,
202
            "currency",$cgiparams->{'currency'},
218
            uncertainprice => 1,
219
            sort1 => $c_sort1,
220
            sort2 => $c_sort2,
221
            notes => $cgiparams->{'all_notes'},
222
            currency => $cgiparams->{'all_currency'},
203
        );
223
        );
204
224
        # get the price if there is one.
205
        my $price = GetMarcPrice($marcrecord, C4::Context->preference('marcflavour'));
225
        my $price= shift( @prices ) || GetMarcPrice($marcrecord, C4::Context->preference('marcflavour'));
206
207
        if ($price){
226
        if ($price){
208
            eval {
227
            # in France, the cents separator is the , but sometimes, ppl use a .
209
		require C4::Acquisition;
228
            # in this case, the price will be x100 when unformatted ! Replace the . by a , to get a proper price calculation
210
		import C4::Acquisition qw/GetBasket/;
229
            $price =~ s/\./,/ if C4::Context->preference("CurrencyFormat") eq "FR";
211
	    };
230
            $price = $num->unformat_number($price);
212
	    if ($@){
213
		croak $@;
214
	    }
215
            eval {
216
		require C4::Bookseller;
217
	        import C4::Bookseller qw/GetBookSellerFromId/;
218
	    };
219
	    if ($@){
220
		croak $@;
221
	    }
222
            my $basket     = GetBasket( $orderinfo{basketno} );
223
            my $bookseller = GetBookSellerFromId( $basket->{booksellerid} );
224
            $orderinfo{gstrate} = $bookseller->{gstrate};
231
            $orderinfo{gstrate} = $bookseller->{gstrate};
225
            $orderinfo{rrp}   = $price;
232
            my $c = $c_discount ? $c_discount / 100 : $bookseller->{discount} / 100;
226
            $orderinfo{ecost} = $orderinfo{rrp} * ( 1 - $bookseller->{discount} / 100 );
233
            if ( $bookseller->{listincgst} ) {
227
            $orderinfo{listprice} = $orderinfo{rrp};
234
                if ( $c_discount ) {
235
                    $orderinfo{ecost} = $price;
236
                    $orderinfo{rrp}   = $orderinfo{ecost} / ( 1 - $c );
237
                } else {
238
                    $orderinfo{ecost} = $price * ( 1 - $c );
239
                    $orderinfo{rrp}   = $price;
240
                }
241
            } else {
242
                if ( $c_discount ) {
243
                    $orderinfo{ecost} = $price / ( 1 + $orderinfo{gstrate} );
244
                    $orderinfo{rrp}   = $orderinfo{ecost} / ( 1 - $c );
245
                } else {
246
                    $orderinfo{rrp}   = $price / ( 1 + $orderinfo{gstrate} );
247
                    $orderinfo{ecost} = $orderinfo{rrp} * ( 1 - $c );
248
                }
249
            }
250
            $orderinfo{listprice} = $orderinfo{rrp} / $cur->{rate};
228
            $orderinfo{unitprice} = $orderinfo{ecost};
251
            $orderinfo{unitprice} = $orderinfo{ecost};
229
            $orderinfo{total} = $orderinfo{ecost};
252
            $orderinfo{total} = $orderinfo{ecost} * $c_quantity;
230
        } else {
253
        } else {
231
            $orderinfo{'listprice'} = 0;
254
            $orderinfo{listprice} = 0;
232
        }
255
        }
233
256
234
        # remove uncertainprice flag if we have found a price in the MARC record
257
        # remove uncertainprice flag if we have found a price in the MARC record
235
        $orderinfo{uncertainprice} = 0 if $orderinfo{listprice};
258
        $orderinfo{uncertainprice} = 0 if $orderinfo{listprice};
236
        my $basketno;
259
        my ( $basketno, $ordernumber ) = NewOrder( \%orderinfo );
237
        ( $basketno, $ordernumber ) = NewOrder( \%orderinfo );
238
260
239
        # 4th, add items if applicable
261
        # 4th, add items if applicable
240
        # parse the item sent by the form, and create an item just for the import_record_id we are dealing with
262
        # parse the item sent by the form, and create an item just for the import_record_id we are dealing with
Lines 254-265 if ($op eq ""){ Link Here
254
            push @{ $item->{indicator} },    $indicator[0];
276
            push @{ $item->{indicator} },    $indicator[0];
255
            my $xml = TransformHtmlToXml( \@tags, \@subfields, \@field_values, \@ind_tag, \@indicator );
277
            my $xml = TransformHtmlToXml( \@tags, \@subfields, \@field_values, \@ind_tag, \@indicator );
256
            my $record = MARC::Record::new_from_xml( $xml, 'UTF-8' );
278
            my $record = MARC::Record::new_from_xml( $xml, 'UTF-8' );
257
            for (my $qtyloop=1;$qtyloop <=$quantity;$qtyloop++) {
279
            for (my $qtyloop=1;$qtyloop <= $c_quantity;$qtyloop++) {
258
                my ( $biblionumber, $bibitemnum, $itemnumber ) = AddItemFromMarc( $record, $biblionumber );
280
                my ( $biblionumber, $bibitemnum, $itemnumber ) = AddItemFromMarc( $record, $biblionumber );
259
                NewOrderItem( $itemnumber, $ordernumber );
281
                NewOrderItem( $itemnumber, $ordernumber );
260
            }
282
            }
261
        } else {
262
            SetImportRecordStatus( $biblio->{'import_record_id'}, 'imported' );
263
        }
283
        }
264
    }
284
    }
265
    # go to basket page
285
    # go to basket page
Lines 276-283 my $budget = GetBudget($budget_id); Link Here
276
296
277
# build budget list
297
# build budget list
278
my $budget_loop = [];
298
my $budget_loop = [];
279
$budgets = GetBudgetHierarchy;
299
my $budgets_hierarchy = GetBudgetHierarchy;
280
foreach my $r ( @{$budgets} ) {
300
foreach my $r ( @{$budgets_hierarchy} ) {
281
    next unless (CanUserUseBudget($borrower, $r, $userflags));
301
    next unless (CanUserUseBudget($borrower, $r, $userflags));
282
    if ( !defined $r->{budget_amount} || $r->{budget_amount} == 0 ) {
302
    if ( !defined $r->{budget_amount} || $r->{budget_amount} == 0 ) {
283
        next;
303
        next;
Lines 285-290 foreach my $r ( @{$budgets} ) { Link Here
285
    push @{$budget_loop},
305
    push @{$budget_loop},
286
      { b_id  => $r->{budget_id},
306
      { b_id  => $r->{budget_id},
287
        b_txt => $r->{budget_name},
307
        b_txt => $r->{budget_name},
308
        b_sort1_authcat => $r->{'sort1_authcat'},
309
        b_sort2_authcat => $r->{'sort2_authcat'},
288
        b_sel => ( $r->{budget_id} == $budget_id ) ? 1 : 0,
310
        b_sel => ( $r->{budget_id} == $budget_id ) ? 1 : 0,
289
      };
311
      };
290
}
312
}
Lines 296-302 if ($budget) { # its a mod .. Link Here
296
        $CGIsort1 = GetAuthvalueDropbox(  $budget->{'sort1_authcat'}, $data->{'sort1'} );
318
        $CGIsort1 = GetAuthvalueDropbox(  $budget->{'sort1_authcat'}, $data->{'sort1'} );
297
    }
319
    }
298
} elsif ( scalar(@$budgets) ) {
320
} elsif ( scalar(@$budgets) ) {
299
    $CGIsort1 = GetAuthvalueDropbox(  @$budgets[0]->{'sort1_authcat'}, '' );
321
} elsif ( scalar(@$budgets_hierarchy) ) {
322
    $CGIsort1 = GetAuthvalueDropbox( @$budgets_hierarchy[0]->{'sort1_authcat'}, '' );
300
}
323
}
301
# if CGIsort is successfully fetched, the use it
324
# if CGIsort is successfully fetched, the use it
302
# else - failback to plain input-field
325
# else - failback to plain input-field
Lines 311-318 if ($budget) { Link Here
311
    if ( defined $budget->{'sort2_authcat'} ) {
334
    if ( defined $budget->{'sort2_authcat'} ) {
312
        $CGIsort2 = GetAuthvalueDropbox(  $budget->{'sort2_authcat'}, $data->{'sort2'} );
335
        $CGIsort2 = GetAuthvalueDropbox(  $budget->{'sort2_authcat'}, $data->{'sort2'} );
313
    }
336
    }
314
} elsif ( scalar(@$budgets) ) {
337
} elsif ( scalar(@$budgets_hierarchy) ) {
315
    $CGIsort2 = GetAuthvalueDropbox(  @$budgets[0]->{sort2_authcat}, '' );
338
    $CGIsort2 = GetAuthvalueDropbox( @$budgets_hierarchy[0]->{sort2_authcat}, '' );
316
}
339
}
317
if ($CGIsort2) {
340
if ($CGIsort2) {
318
    $template->param( CGIsort2 => $CGIsort2 );
341
    $template->param( CGIsort2 => $CGIsort2 );
Lines 377-385 sub import_biblios_list { Link Here
377
            record_sequence => $biblio->{'record_sequence'},
400
            record_sequence => $biblio->{'record_sequence'},
378
            overlay_status => $biblio->{'overlay_status'},
401
            overlay_status => $biblio->{'overlay_status'},
379
            match_biblionumber => $#$match > -1 ? $match->[0]->{'biblionumber'} : 0,
402
            match_biblionumber => $#$match > -1 ? $match->[0]->{'biblionumber'} : 0,
380
            match_citation => $#$match > -1 ? $match->[0]->{'title'} . ' ' . $match->[0]->{'author'} : '',
403
            match_citation     => $#$match > -1 ? $match->[0]->{'title'} || '' . ' ' . $match->[0]->{'author'} || '': '',
381
            match_score => $#$match > -1 ? $match->[0]->{'score'} : 0,
404
            match_score => $#$match > -1 ? $match->[0]->{'score'} : 0,
382
        );
405
        );
406
        my ( $marcblob, $encoding ) = GetImportRecordMarc( $biblio->{'import_record_id'} );
407
        my $marcrecord = MARC::Record->new_from_usmarc($marcblob) || die "couldn't translate marc information";
408
        my $infos = get_infos_syspref($marcrecord, ['price', 'quantity', 'budget_code', 'rrp', 'discount', 'sort1', 'sort2']);
409
        my $price = $infos->{price};
410
        my $quantity = $infos->{quantity};
411
        my $budget_code = $infos->{budget_code};
412
        my $rrp = $infos->{rrp};
413
        my $discount = $infos->{discount};
414
        my $sort1 = $infos->{sort1};
415
        my $sort2 = $infos->{sort2};
416
        my $budget_id;
417
        if($budget_code) {
418
            my $biblio_budget = GetBudgetByCode($budget_code);
419
            if($biblio_budget) {
420
                $budget_id = $biblio_budget->{budget_id};
421
            }
422
        }
423
        $cellrecord{price} = $price || '';
424
        $cellrecord{quantity} = $quantity || '';
425
        $cellrecord{budget_id} = $budget_id || '';
426
        $cellrecord{rrp} = $rrp || '';
427
        $cellrecord{discount} = $discount || '';
428
        $cellrecord{sort1} = $sort1 || '';
429
        $cellrecord{sort2} = $sort2 || '';
430
383
        push @list, \%cellrecord;
431
        push @list, \%cellrecord;
384
    }
432
    }
385
    my $num_biblios = $batch->{'num_biblios'};
433
    my $num_biblios = $batch->{'num_biblios'};
Lines 439-441 sub add_matcher_list { Link Here
439
    }
487
    }
440
    $template->param(available_matchers => \@matchers);
488
    $template->param(available_matchers => \@matchers);
441
}
489
}
490
491
sub get_infos_syspref {
492
    my ($record, $field_list) = @_;
493
    my $syspref = C4::Context->preference('MarcFieldsToOrder');
494
    my $yaml = YAML::Load($syspref);
495
    my $r;
496
    for my $field_name ( @$field_list ) {
497
        my @fields = split /\|/, $yaml->{$field_name};
498
        for my $field ( @fields ) {
499
            my ( $f, $sf ) = split /\$/, $field;
500
            next unless $f and $sf;
501
            if ( my $v = $record->subfield( $f, $sf ) ) {
502
                $r->{$field_name} = $v;
503
            }
504
            last if $yaml->{$field};
505
        }
506
    }
507
    return $r;
508
}
(-)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 (+11 lines)
Lines 8106-8111 if(CheckVersion($DBversion)) { Link Here
8106
    SetVersion($DBversion);
8106
    SetVersion($DBversion);
8107
}
8107
}
8108
8108
8109
8110
8111
8112
8113
$DBversion = "3.15.00.XXX";
8114
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
8115
    $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')");
8116
   print "Upgrade to $DBversion done (Bug 7180: Added MarcFieldsToOrder syspref)\n";
8117
   SetVersion ($DBversion);
8118
}
8119
8109
=head1 FUNCTIONS
8120
=head1 FUNCTIONS
8110
8121
8111
=head2 TableExists($table)
8122
=head2 TableExists($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/js/acq.js (-74 / +19 lines)
Lines 672-755 function calcNewsuggTotal(){ Link Here
672
    return true;
672
    return true;
673
}
673
}
674
674
675
675
function getAuthValueDropbox( name, cat, destination, selected ) {
676
// ----------------------------------------
676
    if (cat == null || cat == "") {
677
//USED BY NEWORDEREMPTY.PL
677
        $(destination).replaceWith(' <input type="text" name="' + name + '" />' );
678
/*
679
function fetchSortDropbox(f) {
680
    var  budgetId=f.budget_id.value;
681
    var handleSuccess = function(o){
682
        if(o.responseText !== undefined){
683
            sort_dropbox.innerHTML   = o.responseText;
684
        }
685
    }
686
687
    var callback = {   success:handleSuccess };
688
    var sUrl = '../acqui/fetch_sort_dropbox.pl?sort=1&budget_id='+budgetId
689
    var sort_dropbox = document.getElementById('sort1');
690
    var request1 = YAHOO.util.Connect.asyncRequest('GET', sUrl, callback);
691
    var rr = '00';
692
693
// FIXME: ---------  twice , coz the 2 requests get mixed up otherwise
694
695
    var handleSuccess2 = function(o){
696
    if(o.responseText !== undefined){
697
        sort2_dropbox.innerHTML   = o.responseText;
698
        }
699
    }
700
701
    var callback2 = {   success:handleSuccess };
702
    var sUrl2 = '../acqui/fetch_sort_dropbox.pl?sort=2&budget_id='+budgetId;
703
    var sort2_dropbox = document.getElementById('sort2');
704
    var request2 = YAHOO.util.Connect.asyncRequest('GET', sUrl2, callback2);
705
706
}
707
*/
708
709
710
711
//USED BY NEWORDEREMPTY.PL
712
function fetchSortDropbox(f) {
713
    var  budgetId=f.budget_id.value;
714
715
for (i=1;i<=2;i++) {
716
717
    var sort_zone = document.getElementById('sort'+i+'_zone');
718
    var url = '../acqui/fetch_sort_dropbox.pl?sort='+i+'&budget_id='+budgetId;
719
720
    var xmlhttp = null;
721
    xmlhttp = new XMLHttpRequest();
722
    if ( typeof xmlhttp.overrideMimeType != 'undefined') {
723
        xmlhttp.overrideMimeType('text/xml');
724
    }
725
726
    xmlhttp.open('GET', url, false);
727
    xmlhttp.send(null);
728
729
    xmlhttp.onreadystatechange = function() {
730
        if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
731
    // stupid JS...
732
        } else {
733
    // wait for the call to complete
734
        }
735
    };
736
    // rc =  eval ( xmlhttp.responseText );
737
    var retRootType = xmlhttp.responseXML.firstChild.nodeName;
738
    var existingInputs = sort_zone.getElementsByTagName('input');
739
    if (existingInputs.length > 0 && retRootType == 'input') {
740
        // when sort is already an input, do not override to preseve value
741
        return;
678
        return;
742
    }
679
    }
743
    sort_zone.innerHTML = xmlhttp.responseText;
680
    $.ajax({
744
}
681
        url: "/cgi-bin/koha/acqui/ajax-getauthvaluedropbox.pl",
682
        data: {
683
            name: name,
684
            category: cat,
685
            default: selected
686
        },
687
        async: false,
688
        success: function(data){
689
            if(data === "0"){
690
                $(destination).replaceWith(' <input type="text" name="' + name + '" />' );
691
            }else{
692
                $(destination).replaceWith(data);
693
            }
694
        }
695
    });
745
}
696
}
746
697
747
748
749
750
751
752
753
//USED BY NEWORDEREMPTY.PL
698
//USED BY NEWORDEREMPTY.PL
754
function totalExceedsBudget(budgetId, total) {
699
function totalExceedsBudget(budgetId, total) {
755
700
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt (-218 / +293 lines)
Lines 10-17 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
    [% IF (dateformat == 'metric') %]
17
    [% IF (dateformat == 'metric') %]
Lines 29-46 Link Here
29
            "aaSorting": []
29
            "aaSorting": []
30
        } ) );
30
        } ) );
31
31
32
        $("form#Aform").submit(function() {
32
        $("select[name='budget_id']").change(function(){
33
            var total_errors = CheckMandatorySubfields(this);
33
            var sort1_authcat = $(this).find("option:selected").attr('data-sort1-authcat');
34
            if (total_errors > 0) {
34
            var sort2_authcat = $(this).find("option:selected").attr('data-sort2-authcat');
35
                var alertString  = _("Form not submitted because of the following problem(s)");
35
            var destination_sort1 = $(this).siblings('span.sort1').find('input[name="sort1"]');
36
                alertString += "\n------------------------------------------------------------------------------------\n";
36
            var sort1 = $(destination_sort1).val();
37
                alertString += "\n- "+ total_errors + _(" mandatory fields empty (highlighted)");
37
            if ( destination_sort1.length < 1 ) {
38
                alert(alertString);
38
                destination_sort1 = $(this).siblings('span.sort1').find('select[name="sort1"]');
39
                return false;
40
            }
39
            }
41
            return true;
40
            var destination_sort2 = $(this).siblings('span.sort2').find('input[name="sort2"]');
41
            var sort2 = $(destination_sort2).val();
42
            if ( destination_sort2.length < 1 ) {
43
                destination_sort2 = $(this).siblings('span.sort2').find('select[name="sort2"]');
44
            }
45
            getAuthValueDropbox( 'sort1', sort1_authcat, destination_sort1, sort1 );
46
47
            getAuthValueDropbox( 'sort2', sort2_authcat, destination_sort2, sort2 );
48
        } );
49
50
        $("select[name='budget_id']").change();
51
52
        $("select[name='all_budget_id']").change(function(){
53
            var sort1_authcat = $(this).find("option:selected").attr('data-sort1-authcat');
54
            var sort2_authcat = $(this).find("option:selected").attr('data-sort2-authcat');
55
            var destination_sort1 = $(this).parent().siblings('li').find('input[name="all_sort1"]');
56
            if ( destination_sort1.length < 1 ) {
57
                destination_sort1 = $(this).parent().siblings('li').find('select[name="all_sort1"]');
58
            }
59
            var destination_sort2 = $(this).parent().siblings('li').find('input[name="all_sort2"]');
60
            if ( destination_sort2.length < 1 ) {
61
                destination_sort2 = $(this).parent().siblings('li').find('select[name="all_sort2"]');
62
            }
63
            getAuthValueDropbox( 'sort1', sort1_authcat, destination_sort1 );
64
            getAuthValueDropbox( 'sort2', sort2_authcat, destination_sort2 );
65
            $(this).parent().siblings('li').find('select[name="sort1"]').attr('name', 'all_sort1');
66
            $(this).parent().siblings('li').find('input[name="sort1"]').attr('name', 'all_sort1');
67
            $(this).parent().siblings('li').find('select[name="sort2"]').attr('name', 'all_sort2');
68
            $(this).parent().siblings('li').find('input[name="sort2"]').attr('name', 'all_sort2');
69
        } );
70
71
        $('input:checkbox[name="import_record_id"]').change(function(){
72
            if ( $(this).is(':checked') ) {
73
                $(this).parent().addClass("selected");
74
                $(this).parent().removeClass("unselected");
75
            } else {
76
                $(this).parent().addClass("unselected");
77
                $(this).parent().removeClass("selected");
78
            }
79
        } );
80
81
        $("input:checkbox").attr("checked", false);
82
        $("div.biblio.unselected select").attr("disabled", false);
83
        $("div.biblio.unselected input").attr("disabled", false);
84
85
        $("#checkAll").click(function(){
86
            $("#Aform").checkCheckboxes();
87
            $("input:checkbox[name='import_record_id']").change();
88
            return false;
89
        });
90
        $("#unCheckAll").click(function(){
91
            $("#Aform").unCheckCheckboxes();
92
            $("input:checkbox[name='import_record_id']").change();
93
            return false;
42
        });
94
        });
95
43
    });
96
    });
97
98
    function disableUnchecked(form){
99
        $("div.biblio.unselected").each(function(){
100
            $(this).find('select').attr('disabled', 'disabled');
101
            $(this).find('input').attr('disabled', 'disabled');
102
        });
103
        form.submit();
104
    }
44
//]]>
105
//]]>
45
</script>
106
</script>
46
</head>
107
</head>
Lines 53-76 Link Here
53
       <div id="yui-main">
114
       <div id="yui-main">
54
           <div class="yui-b">
115
           <div class="yui-b">
55
             [% IF ( batch_details ) %]
116
             [% IF ( batch_details ) %]
56
                  <h1>Add orders from [% comments %]
117
                <h1>Add orders from [% comments %]
57
                    ([% file_name %] staged on [% upload_timestamp | $KohaDates with_hours => 1 %])
118
                    ([% file_name %] staged on [% upload_timestamp | $KohaDates with_hours => 1 %])
58
                  </h1>
119
                </h1>
59
               <div>
120
                <div>
60
                   <form action="[% scriptname %]" method="post" name="import_biblios">
121
                    <span class="checkall"><a id="checkAll" href="#">Check All</a></span>
61
                     <table>
122
                    <span class="uncheckall"><a id="unCheckAll" href="#">Uncheck All</a></span>
62
                     <tr>
123
                    <form action="/cgi-bin/koha/acqui/addorderiso2709.pl" method="post" id="Aform" onsubmit="disableUnchecked(this); return false;">
63
                         <th>Citation</th>
124
                        <input type="hidden" name="op" value="import_records"/>
64
                         <th>Match?</th>
125
                        <input type="hidden" name="basketno" value="[% basketno %]" />
65
                         <th>Order</th>
126
                        <input type="hidden" name="booksellerid" value="[% booksellerid %]" />
66
                       </tr>
127
                        <input type="hidden" name="import_batch_id" value="[%import_batch_id %]" />
67
                       [% FOREACH biblio_lis IN biblio_list %]
128
                        <input type="hidden" name="ordernumber" value="[% ordernumber %]" />
68
                         <tr>
129
69
                             <td>
130
                        [% FOREACH cur IN loop_currencies %]
70
                                [% biblio_lis.citation %]
131
                            <input type="hidden" name="[% cur.currency %]" value="[% cur.rate %]" />
132
                        [% END %]
71
133
72
                             </td>
134
                        [% FOREACH biblio IN biblio_list %]
73
                             <td>
135
                        <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;">
136
                            <input type="checkbox" name="import_record_id" id="record_[% biblio.import_record_id %]" value="[% biblio.import_record_id %]" />
137
                            <input type="hidden" value="[% biblio.rrp %]" name="rrp" />
138
                            <label for="record_[% biblio.import_record_id %]"><span class="citation" style="font-weight:bold;">[% biblio.citation %]</span></label>
139
                            <span class="match" style="display:block;">
74
                                [% IF ( biblio_lis.overlay_status == 'no_match' ) %]
140
                                [% IF ( biblio_lis.overlay_status == 'no_match' ) %]
75
                                    No match
141
                                    No match
76
                                [% ELSIF ( biblio_lis.overlay_status == 'match_applied' ) %]
142
                                [% ELSIF ( biblio_lis.overlay_status == 'match_applied' ) %]
Lines 80-286 Link Here
80
                                [% ELSE %]
146
                                [% ELSE %]
81
                                    [% biblio_lis.overlay_status %]
147
                                    [% biblio_lis.overlay_status %]
82
                                [% END %]
148
                                [% END %]
83
                             </td>
149
                            </span>
84
                             <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>
150
                            [% IF ( biblio.match_biblionumber ) %]
85
                         </tr>
151
                                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>
86
     [% IF ( biblio_lis.match_biblionumber ) %]
152
                            [% END %]
87
    <tr>
153
                            <span class="quantity" style="display:block;">
88
      <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>
154
                                Quantity: <input type="text" value="[% biblio.quantity %]" name="quantity" />
89
    </tr>
155
                            </span>
90
    [% END %]
156
                            <span class="price" style="display:block;">
91
                      [% END %]
157
                                Price: <input type="text" value="[% biblio.price %]" name="price" />
92
                     </table>
158
                            </span>
93
                   </form>
159
                            <span class="discount" style="display:block;">
94
               </div>
160
                                Discount: <input type="text" value="[% biblio.discount %]" name="discount" />
95
              [% IF ( pages ) %]
161
                            </span>
96
                <div class="pages">
162
                            <span class="budget" style="display:block;">
97
                Page 
163
                                [% IF ( close ) %]
98
                  [% FOREACH page IN pages %]
164
                                <span class="label">Budget: </span>
99
                    [% IF ( page.current_page ) %]
165
                                    <input type="hidden" size="20" name="budget_id" value="[% budget_id %]" />[% Budget_name %]
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>Staged</th>
116
                       <th># Bibs</th>
117
                       <th>&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 %]
166
                                [% ELSE %]
182
                                    <label>[% iteminformatio.subfield %] - [% iteminformatio.marc_lib %]</label>
167
                                <label for="budget_id">Budget: </label>
168
                                <select size="1" name="budget_id">
169
                                    <option value=""></option>
170
                                    [% FOREACH budget IN budget_loop %]
171
                                        [% IF ( budget.b_id == biblio.budget_id ) %]
172
                                            <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>
173
                                        [% ELSE %]
174
                                            <option value="[% budget.b_id %]" data-sort1-authcat="[% budget.b_sort1_authcat %]" data-sort2-authcat="[% budget.b_sort2_authcat %]">[% budget.b_txt %]</option>
175
                                        [% END %]
176
                                    [% END %]
177
                                </select>
183
                                [% END %]
178
                                [% END %]
184
                                [% iteminformatio.marc_value %]
179
                                <span class="sort1">
185
                                <input type="hidden" name="itemid" value="1" />
180
                                    <label for="sort1">Planning value1: </label>
186
                                <input type="hidden" name="kohafield" value="[% iteminformatio.kohafield %]" />
181
                                    <input type="text" id="sort1" size="20" name="sort1" value="[% biblio.sort1 %]" />
187
                                <input type="hidden" name="tag" value="[% iteminformatio.tag %]" />
182
                                </span>
188
                                <input type="hidden" name="subfield" value="[% iteminformatio.subfield %]" />
183
                                <span class="sort2">
189
                                <input type="hidden" name="mandatory" value="[% iteminformatio.mandatory %]" />
184
                                    <label for="sort2">Planning value2: </label>
190
                                [% IF ( iteminformatio.mandatory ) %] <span class="required">Required</span>[% END %]
185
                                    <input type="text" id="sort2" size="20" name="sort2" value="[% biblio.sort2 %]" />
191
                            </div></li>
186
                                </span>
187
                            </span>
188
                        </div>
192
                        [% END %]
189
                        [% END %]
193
                        </ol>
190
                        <div>
194
                    </div><!-- /iteminformation -->
191
                        <h2>Import all</h2>
195
                    </div>
192
                        <p>Import all the lines in the basket with the following parameters:</p>
196
193
197
                    [% END %] <!-- /items -->
194
                        [% IF ( items ) %]
198
                </fieldset>
195
                        <fieldset class="rows">
199
                [% END %] <!-- items -->
196
                            <legend>Item</legend>
200
                <fieldset class="rows">
197
                            [% IF ( NoACQframework ) %]
201
                    <legend>Accounting details</legend>
198
                                <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 %]
199
                            [% END %]
232
                        </li>
200
                            [% FOREACH item IN items %]
233
                        <li>
201
                            <div id="outeritemblock">
234
                            <label for="notes">Notes: </label>
202
                            <div id="itemblock">
235
                            <textarea id="notes" cols="30" rows="3" name="notes"></textarea>
203
                                <ol>
236
                        </li>
204
                                [% FOREACH iteminformatio IN item.iteminformation %]<li style="[% iteminformatio.hidden %];">
237
                        <li><div class="hint">The 2 following fields are available for your own usage. They can be useful for statistical purposes</div>
205
                                    <div class="subfield_line" id="subfield[% iteminformatio.serialid %][% iteminformatio.countitems %][% iteminformatio.subfield %][% iteminformatio.random %]">
238
                            <label for="sort1">Planning value1: </label>
206
                                        [% IF (iteminformatio.mandatory) %]
239
                            <span id="sort1_zone">
207
                                            <label class="required">[% iteminformatio.subfield %] - [% iteminformatio.marc_lib %]</label>
240
                            [% IF CGIsort1 %]
208
                                        [% ELSE %]
241
                                <select id="sort1" size="1" name="sort1">
209
                                            <label>[% iteminformatio.subfield %] - [% iteminformatio.marc_lib %]</label>
242
                                [% FOREACH sort_opt IN CGIsort1 %]
210
                                        [% END %]
243
                                    [% IF sort_opt.default %]
211
244
                                        <option value="[% sort_opt.id %]" selected="selected">[% sort_opt.label %]</option>
212
                                        [% iteminformatio.marc_value %]
213
                                        <input type="hidden" name="itemid" value="1" />
214
                                        <input type="hidden" name="kohafield" value="[% iteminformatio.kohafield %]" />
215
                                        <input type="hidden" name="tag" value="[% iteminformatio.tag %]" />
216
                                        <input type="hidden" name="subfield" value="[% iteminformatio.subfield %]" />
217
                                        <input type="hidden" name="mandatory" value="[% iteminformatio.mandatory %]" />
218
                                        [% IF ( iteminformatio.mandatory ) %] <span class="required">Required</span>[% END %]
219
                                    </div></li>
220
                                [% END %]
221
                                </ol>
222
                            </div><!-- /iteminformation -->
223
                            </div>
224
                            [% END %] <!-- /items -->
225
                        </fieldset>
226
                        [% END %] <!-- items -->
227
228
                        <fieldset class="rows">
229
                            <legend>Accounting details</legend>
230
                            <ol>
231
                                <li>
232
                                    <!-- origquantityrec only here for javascript compatibility (additem.js needs it, useless here, usefull when receiveing an order -->
233
                                    <input id="origquantityrec" readonly="readonly" type="hidden" name="origquantityrec" value="1" />
234
                                </li>
235
                                <li>
236
                                    [% IF ( close ) %]
237
                                        <span class="label">Budget: </span>
238
                                        <input type="hidden" size="20" name="budget_id" id="budget_id" value="[% budget_id %]" />[% Budget_name %]
245
                                    [% ELSE %]
239
                                    [% ELSE %]
246
                                        <option value="[% sort_opt.id %]">[% sort_opt.label %]</option>
240
                                        <li>
241
                                            <label for="all_currency">Currency:</label>
242
                                            <select name="all_currency" id="all_currency">
243
                                            [% FOREACH loop_currencie IN loop_currencies %]
244
                                                [% IF ( loop_currencie.selected ) %]
245
                                                    <option value="[% loop_currencie.currcode %]" selected="selected">[% loop_currencie.currcode %]</option>
246
                                                [% ELSE %]
247
                                                    <option value="[% loop_currencie.currcode %]">[% loop_currencie.currcode %]</option>
248
                                                [% END %]
249
                                            [% END %]
250
                                            </select>
251
                                        </li>
252
                                        <li>
253
                                            <label for="all_budget_id">Budget: </label>
254
                                            <select id="all_budget_id" size="1" name="all_budget_id">
255
                                            [% FOREACH budget_loo IN budget_loop %]
256
                                                [% IF ( budget_loo.b_sel ) %]
257
                                                    <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>
258
                                                [% ELSE %]
259
                                                    <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>
260
                                                [% END %]
261
                                            [% END %]
262
                                            </select>
263
                                        </li>
247
                                    [% END %]
264
                                    [% END %]
248
                                [% END %]
265
                                </li>
249
                                </select>
266
                                <li>
250
                            [% ELSE %]
267
                                    <label for="notes">Notes: </label>
251
                                <input type="text" id="sort1" size="20" name="sort1" value="[% sort1 %]" />
268
                                    <textarea id="notes" cols="30" rows="3" name="all_notes"></textarea>
252
                            [% END %]
269
                                </li>
253
                            </span>
270
                                <li>
254
                        </li>
271
                                    <div class="hint">The 2 following fields are available for your own usage. They can be useful for statistical purposes</div>
255
                        <li>
272
                                    <label for="sort1">Planning value1: </label>
256
                            <label for="sort2">Planning value2: </label>
273
                                    [% IF CGIsort1 %]
257
                            <span id="sort2_zone">
274
                                        <select id="all_sort1" size="1" name="all_sort1">
258
                            [% IF CGIsort2 %]
275
                                        [% FOREACH sort_opt IN CGIsort1 %]
259
                                <select id="sort2" size="1" name="sort1">
276
                                            [% IF sort_opt.default %]
260
                                [% FOREACH sort_opt IN CGIsort2 %]
277
                                                <option value="[% sort_opt.id %]" selected="selected">[% sort_opt.label %]</option>
261
                                    [% IF sort_opt.default %]
278
                                            [% ELSE %]
262
                                        <option value="[% sort_opt.id %]" selected="selected">[% sort_opt.label %]</option>
279
                                                <option value="[% sort_opt.id %]">[% sort_opt.label %]</option>
280
                                            [% END %]
281
                                        [% END %]
282
                                        </select>
263
                                    [% ELSE %]
283
                                    [% ELSE %]
264
                                        <option value="[% sort_opt.id %]">[% sort_opt.label %]</option>
284
                                        <input type="text" id="all_sort1" size="20" name="all_sort1" value="[% sort1 %]" />
265
                                    [% END %]
285
                                    [% END %]
266
                                [% END %]
286
                                </li>
267
                                </select>
287
                                <li>
268
                            [% ELSE %]
288
                                  <span id="sort2_zone">
269
                                 <input type="text" id="sort2" size="20" name="sort2" value="[% sort2 %]" />
289
                                    <label for="sort2">Planning value2: </label>
270
                            [% END %]
290
                                    [% IF CGIsort2 %]
271
                            </span>
291
                                        <select id="all_sort2" size="1" name="all_sort1">
272
                        </li>
292
                                        [% FOREACH sort_opt IN CGIsort2 %]
273
                        <li>
293
                                            [% IF sort_opt.default %]
274
                            
294
                                                <option value="[% sort_opt.id %]" selected="selected">[% sort_opt.label %]</option>
275
                        </li>
295
                                            [% ELSE %]
276
            </ol>
296
                                                <option value="[% sort_opt.id %]">[% sort_opt.label %]</option>
277
                </fieldset>
297
                                            [% END %]
278
                <fieldset class="action">
298
                                        [% END %]
279
                    <input type="submit" value="Save" /><a class="cancel" href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basketno %]">Cancel</a>
299
                                        </select>
280
                </fieldset>
300
                                    [% ELSE %]
281
            </form>
301
                                         <input type="text" id="all_sort2" size="20" name="all_sort2" value="[% sort2 %]" />
282
            </div>
302
                                    [% END %]
283
        [% 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>Staged</th>
323
                        <th># Bibs</th>
324
                        <th>&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>
284
       </div>
359
       </div>
285
   </div>
360
   </div>
286
</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