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

(-)a/C4/Budgets.pm (+24 lines)
Lines 34-39 BEGIN { Link Here
34
	@EXPORT = qw(
34
	@EXPORT = qw(
35
35
36
        &GetBudget
36
        &GetBudget
37
        &GetBudgetByCode
37
        &GetBudgets
38
        &GetBudgets
38
        &GetBudgetHierarchy
39
        &GetBudgetHierarchy
39
	    &AddBudget
40
	    &AddBudget
Lines 636-641 sub GetBudget { Link Here
636
    return $result;
637
    return $result;
637
}
638
}
638
639
640
=head2 GetBudgetByCode
641
642
    my $budget = &GetBudgetByCode($budget_code);
643
644
Retrieve all aqbudgets fields as a hashref for the budget that has
645
given budget_code
646
647
=cut
648
649
sub GetBudgetByCode {
650
    my ( $budget_code ) = @_;
651
652
    my $dbh = C4::Context->dbh;
653
    my $query = qq{
654
        SELECT *
655
        FROM aqbudgets
656
        WHERE budget_code = ?
657
    };
658
    my $sth = $dbh->prepare( $query );
659
    $sth->execute( $budget_code );
660
    return $sth->fetchrow_hashref;
661
}
662
639
=head2 GetChildBudgetsSpent
663
=head2 GetChildBudgetsSpent
640
664
641
  &GetChildBudgetsSpent($budget-id);
665
  &GetChildBudgetsSpent($budget-id);
(-)a/acqui/addorderiso2709.pl (-54 / +118 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 189-244 if ($op eq ""){ Link Here
189
            SetImportRecordStatus( $biblio->{'import_record_id'}, 'imported' );
205
            SetImportRecordStatus( $biblio->{'import_record_id'}, 'imported' );
190
        }
206
        }
191
        # 3rd add order
207
        # 3rd add order
192
        my $patron = C4::Members->GetMember( borrowernumber => $loggedinuser );
208
193
        my $branch = C4::Branch->GetBranchDetail( $patron->{branchcode} );
209
        my $patron = GetMember( borrowernumber => $loggedinuser );
194
        # get quantity in the MARC record (1 if none)
210
        my ($invoice);
195
        my $quantity = GetMarcQuantity($marcrecord, C4::Context->preference('marcflavour')) || 1;
196
        my %orderinfo = (
211
        my %orderinfo = (
197
            "biblionumber", $biblionumber, "basketno", $cgiparams->{'basketno'},
212
            biblionumber => $biblionumber,
198
            "quantity", $quantity, "branchcode", $branch, 
213
            basketno => $cgiparams->{'basketno'},
199
            "budget_id", $budget_id, "uncertainprice", 1,
214
            quantity => $c_quantity,
200
            "sort1", $cgiparams->{'sort1'},"sort2", $cgiparams->{'sort2'},
215
            branchcode => $patron->{branchcode},
201
            "notes", $cgiparams->{'notes'}, "budget_id", $cgiparams->{'budget_id'},
216
            booksellerinvoicenumber => $invoice,
202
            "currency",$cgiparams->{'currency'},
217
            budget_id => $c_budget_id,
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};
232
            my $c = $c_discount ? $c_discount / 100 : $bookseller->{discount} / 100;
225
            if ( $bookseller->{listincgst} ) {
233
            if ( $bookseller->{listincgst} ) {
226
                $orderinfo{ecost} = $price;
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
                }
227
            } else {
241
            } else {
228
                $orderinfo{ecost} = $price * ( 1 + $orderinfo{gstrate} );
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
                }
229
            }
249
            }
230
            $orderinfo{rrp} = ( $orderinfo{ecost} * 100 ) / ( 100 - $bookseller->{discount} );
250
            $orderinfo{listprice} = $orderinfo{rrp} / $cur->{rate};
231
            $orderinfo{listprice} = $orderinfo{rrp};
232
            $orderinfo{unitprice} = $orderinfo{ecost};
251
            $orderinfo{unitprice} = $orderinfo{ecost};
233
            $orderinfo{total} = $orderinfo{ecost};
252
            $orderinfo{total} = $orderinfo{ecost} * $c_quantity;
234
        } else {
253
        } else {
235
            $orderinfo{'listprice'} = 0;
254
            $orderinfo{listprice} = 0;
236
        }
255
        }
237
256
238
        # 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
239
        $orderinfo{uncertainprice} = 0 if $orderinfo{listprice};
258
        $orderinfo{uncertainprice} = 0 if $orderinfo{listprice};
240
        my $basketno;
259
        my ( $basketno, $ordernumber ) = NewOrder( \%orderinfo );
241
        ( $basketno, $ordernumber ) = NewOrder( \%orderinfo );
242
260
243
        # 4th, add items if applicable
261
        # 4th, add items if applicable
244
        # 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 258-269 if ($op eq ""){ Link Here
258
            push @{ $item->{indicator} },    $indicator[0];
276
            push @{ $item->{indicator} },    $indicator[0];
259
            my $xml = TransformHtmlToXml( \@tags, \@subfields, \@field_values, \@ind_tag, \@indicator );
277
            my $xml = TransformHtmlToXml( \@tags, \@subfields, \@field_values, \@ind_tag, \@indicator );
260
            my $record = MARC::Record::new_from_xml( $xml, 'UTF-8' );
278
            my $record = MARC::Record::new_from_xml( $xml, 'UTF-8' );
261
            for (my $qtyloop=1;$qtyloop <=$quantity;$qtyloop++) {
279
            for (my $qtyloop=1;$qtyloop <= $c_quantity;$qtyloop++) {
262
                my ( $biblionumber, $bibitemnum, $itemnumber ) = AddItemFromMarc( $record, $biblionumber );
280
                my ( $biblionumber, $bibitemnum, $itemnumber ) = AddItemFromMarc( $record, $biblionumber );
263
                NewOrderItem( $itemnumber, $ordernumber );
281
                NewOrderItem( $itemnumber, $ordernumber );
264
            }
282
            }
265
        } else {
266
            SetImportRecordStatus( $biblio->{'import_record_id'}, 'imported' );
267
        }
283
        }
268
    }
284
    }
269
    # go to basket page
285
    # go to basket page
Lines 280-287 my $budget = GetBudget($budget_id); Link Here
280
296
281
# build budget list
297
# build budget list
282
my $budget_loop = [];
298
my $budget_loop = [];
283
$budgets = GetBudgetHierarchy;
299
my $budgets_hierarchy = GetBudgetHierarchy;
284
foreach my $r ( @{$budgets} ) {
300
foreach my $r ( @{$budgets_hierarchy} ) {
285
    next unless (CanUserUseBudget($borrower, $r, $userflags));
301
    next unless (CanUserUseBudget($borrower, $r, $userflags));
286
    if ( !defined $r->{budget_amount} || $r->{budget_amount} == 0 ) {
302
    if ( !defined $r->{budget_amount} || $r->{budget_amount} == 0 ) {
287
        next;
303
        next;
Lines 289-294 foreach my $r ( @{$budgets} ) { Link Here
289
    push @{$budget_loop},
305
    push @{$budget_loop},
290
      { b_id  => $r->{budget_id},
306
      { b_id  => $r->{budget_id},
291
        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'},
292
        b_sel => ( $r->{budget_id} == $budget_id ) ? 1 : 0,
310
        b_sel => ( $r->{budget_id} == $budget_id ) ? 1 : 0,
293
      };
311
      };
294
}
312
}
Lines 300-306 if ($budget) { # its a mod .. Link Here
300
        $CGIsort1 = GetAuthvalueDropbox(  $budget->{'sort1_authcat'}, $data->{'sort1'} );
318
        $CGIsort1 = GetAuthvalueDropbox(  $budget->{'sort1_authcat'}, $data->{'sort1'} );
301
    }
319
    }
302
} elsif ( scalar(@$budgets) ) {
320
} elsif ( scalar(@$budgets) ) {
303
    $CGIsort1 = GetAuthvalueDropbox(  @$budgets[0]->{'sort1_authcat'}, '' );
321
} elsif ( scalar(@$budgets_hierarchy) ) {
322
    $CGIsort1 = GetAuthvalueDropbox( @$budgets_hierarchy[0]->{'sort1_authcat'}, '' );
304
}
323
}
305
# if CGIsort is successfully fetched, the use it
324
# if CGIsort is successfully fetched, the use it
306
# else - failback to plain input-field
325
# else - failback to plain input-field
Lines 315-322 if ($budget) { Link Here
315
    if ( defined $budget->{'sort2_authcat'} ) {
334
    if ( defined $budget->{'sort2_authcat'} ) {
316
        $CGIsort2 = GetAuthvalueDropbox(  $budget->{'sort2_authcat'}, $data->{'sort2'} );
335
        $CGIsort2 = GetAuthvalueDropbox(  $budget->{'sort2_authcat'}, $data->{'sort2'} );
317
    }
336
    }
318
} elsif ( scalar(@$budgets) ) {
337
} elsif ( scalar(@$budgets_hierarchy) ) {
319
    $CGIsort2 = GetAuthvalueDropbox(  @$budgets[0]->{sort2_authcat}, '' );
338
    $CGIsort2 = GetAuthvalueDropbox( @$budgets_hierarchy[0]->{sort2_authcat}, '' );
320
}
339
}
321
if ($CGIsort2) {
340
if ($CGIsort2) {
322
    $template->param( CGIsort2 => $CGIsort2 );
341
    $template->param( CGIsort2 => $CGIsort2 );
Lines 382-390 sub import_biblios_list { Link Here
382
            record_sequence => $biblio->{'record_sequence'},
401
            record_sequence => $biblio->{'record_sequence'},
383
            overlay_status => $biblio->{'overlay_status'},
402
            overlay_status => $biblio->{'overlay_status'},
384
            match_biblionumber => $#$match > -1 ? $match->[0]->{'biblionumber'} : 0,
403
            match_biblionumber => $#$match > -1 ? $match->[0]->{'biblionumber'} : 0,
385
            match_citation => $#$match > -1 ? $match->[0]->{'title'} . ' ' . $match->[0]->{'author'} : '',
404
            match_citation     => $#$match > -1 ? $match->[0]->{'title'} || '' . ' ' . $match->[0]->{'author'} || '': '',
386
            match_score => $#$match > -1 ? $match->[0]->{'score'} : 0,
405
            match_score => $#$match > -1 ? $match->[0]->{'score'} : 0,
387
        );
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
388
        push @list, \%cellrecord;
432
        push @list, \%cellrecord;
389
    }
433
    }
390
    my $num_biblios = $batch->{'num_biblios'};
434
    my $num_biblios = $batch->{'num_biblios'};
Lines 444-446 sub add_matcher_list { Link Here
444
    }
488
    }
445
    $template->param(available_matchers => \@matchers);
489
    $template->param(available_matchers => \@matchers);
446
}
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
}
510
(-)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 (+7 lines)
Lines 6019-6024 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
6019
   SetVersion ($DBversion);
6019
   SetVersion ($DBversion);
6020
}
6020
}
6021
6021
6022
$DBversion = "3.09.00.XXX";
6023
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
6024
    $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')");
6025
   print "Upgrade to $DBversion done (Bug 7180: Added MarcFieldsToOrder syspref)\n";
6026
   SetVersion ($DBversion);
6027
}
6028
6022
=head1 FUNCTIONS
6029
=head1 FUNCTIONS
6023
6030
6024
=head2 TableExists($table)
6031
=head2 TableExists($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css (+4 lines)
Lines 2494-2496 div.authorizedheading { Link Here
2494
.ui-timepicker-div dl dd { margin: 0 10px 10px 65px; }
2494
.ui-timepicker-div dl dd { margin: 0 10px 10px 65px; }
2495
.ui-timepicker-div td { font-size: 90%; }
2495
.ui-timepicker-div td { font-size: 90%; }
2496
.ui-tpicker-grid-label { background: none; border: none; margin: 0; padding: 0; }
2496
.ui-tpicker-grid-label { background: none; border: none; margin: 0; padding: 0; }
2497
2498
div.selected {
2499
   background-color: #99FF66;
2500
}
(-)a/koha-tmpl/intranet-tmpl/prog/en/js/acq.js (-74 / +19 lines)
Lines 678-761 function calcNewsuggTotal(){ Link Here
678
    return true;
678
    return true;
679
}
679
}
680
680
681
681
function getAuthValueDropbox( name, cat, destination, selected ) {
682
// ----------------------------------------
682
    if (cat == null || cat == "") {
683
//USED BY NEWORDEREMPTY.PL
683
        $(destination).replaceWith(' <input type="text" name="' + name + '" />' );
684
/*
685
function fetchSortDropbox(f) {
686
    var  budgetId=f.budget_id.value;
687
    var handleSuccess = function(o){
688
        if(o.responseText !== undefined){
689
            sort_dropbox.innerHTML   = o.responseText;
690
        }
691
    }
692
693
    var callback = {   success:handleSuccess };
694
    var sUrl = '../acqui/fetch_sort_dropbox.pl?sort=1&budget_id='+budgetId
695
    var sort_dropbox = document.getElementById('sort1');
696
    var request1 = YAHOO.util.Connect.asyncRequest('GET', sUrl, callback);
697
    var rr = '00';
698
699
// FIXME: ---------  twice , coz the 2 requests get mixed up otherwise
700
701
    var handleSuccess2 = function(o){
702
    if(o.responseText !== undefined){
703
        sort2_dropbox.innerHTML   = o.responseText;
704
        }
705
    }
706
707
    var callback2 = {   success:handleSuccess };
708
    var sUrl2 = '../acqui/fetch_sort_dropbox.pl?sort=2&budget_id='+budgetId;
709
    var sort2_dropbox = document.getElementById('sort2');
710
    var request2 = YAHOO.util.Connect.asyncRequest('GET', sUrl2, callback2);
711
712
}
713
*/
714
715
716
717
//USED BY NEWORDEREMPTY.PL
718
function fetchSortDropbox(f) {
719
    var  budgetId=f.budget_id.value;
720
721
for (i=1;i<=2;i++) {
722
723
    var sort_zone = document.getElementById('sort'+i+'_zone');
724
    var url = '../acqui/fetch_sort_dropbox.pl?sort='+i+'&budget_id='+budgetId;
725
726
    var xmlhttp = null;
727
    xmlhttp = new XMLHttpRequest();
728
    if ( typeof xmlhttp.overrideMimeType != 'undefined') {
729
        xmlhttp.overrideMimeType('text/xml');
730
    }
731
732
    xmlhttp.open('GET', url, false);
733
    xmlhttp.send(null);
734
735
    xmlhttp.onreadystatechange = function() {
736
        if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
737
    // stupid JS...
738
        } else {
739
    // wait for the call to complete
740
        }
741
    };
742
    // rc =  eval ( xmlhttp.responseText );
743
    var retRootType = xmlhttp.responseXML.firstChild.nodeName;
744
    var existingInputs = sort_zone.getElementsByTagName('input');
745
    if (existingInputs.length > 0 && retRootType == 'input') {
746
        // when sort is already an input, do not override to preseve value
747
        return;
684
        return;
748
    }
685
    }
749
    sort_zone.innerHTML = xmlhttp.responseText;
686
    $.ajax({
750
}
687
        url: "/cgi-bin/koha/acqui/ajax-getauthvaluedropbox.pl",
688
        data: {
689
            name: name,
690
            category: cat,
691
            default: selected
692
        },
693
        async: false,
694
        success: function(data){
695
            if(data === "0"){
696
                $(destination).replaceWith(' <input type="text" name="' + name + '" />' );
697
            }else{
698
                $(destination).replaceWith(data);
699
            }
700
        }
701
    });
751
}
702
}
752
703
753
754
755
756
757
758
759
//USED BY NEWORDEREMPTY.PL
704
//USED BY NEWORDEREMPTY.PL
760
function totalExceedsBudget(budgetId, total) {
705
function totalExceedsBudget(budgetId, total) {
761
706
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt (-187 / +272 lines)
Lines 12-17 Link Here
12
<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.dataTables.min.js"></script>
12
<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.dataTables.min.js"></script>
13
[% INCLUDE 'datatables-strings.inc' %]
13
[% INCLUDE 'datatables-strings.inc' %]
14
<script type="text/javascript" src="[% themelang %]/js/datatables.js"></script>
14
<script type="text/javascript" src="[% themelang %]/js/datatables.js"></script>
15
<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
15
<script type="text/javascript" src="[% themelang %]/js/acq.js"></script>
16
<script type="text/javascript" src="[% themelang %]/js/acq.js"></script>
16
<script type="text/JavaScript">
17
<script type="text/JavaScript">
17
//<![CDATA[
18
//<![CDATA[
Lines 22-28 Link Here
22
            ],
23
            ],
23
            "sPaginationType": "four_button"
24
            "sPaginationType": "four_button"
24
        } ) );
25
        } ) );
26
27
        $("select[name='budget_id']").change(function(){
28
            var sort1_authcat = $(this).find("option:selected").attr('data-sort1-authcat');
29
            var sort2_authcat = $(this).find("option:selected").attr('data-sort2-authcat');
30
            var destination_sort1 = $(this).siblings('span.sort1').find('input[name="sort1"]');
31
            var sort1 = $(destination_sort1).val();
32
            if ( destination_sort1.length < 1 ) {
33
                destination_sort1 = $(this).siblings('span.sort1').find('select[name="sort1"]');
34
            }
35
            var destination_sort2 = $(this).siblings('span.sort2').find('input[name="sort2"]');
36
            var sort2 = $(destination_sort2).val();
37
            if ( destination_sort2.length < 1 ) {
38
                destination_sort2 = $(this).siblings('span.sort2').find('select[name="sort2"]');
39
            }
40
            getAuthValueDropbox( 'sort1', sort1_authcat, destination_sort1, sort1 );
41
42
            getAuthValueDropbox( 'sort2', sort2_authcat, destination_sort2, sort2 );
43
        } );
44
45
        $("select[name='budget_id']").change();
46
47
        $("select[name='all_budget_id']").change(function(){
48
            var sort1_authcat = $(this).find("option:selected").attr('data-sort1-authcat');
49
            var sort2_authcat = $(this).find("option:selected").attr('data-sort2-authcat');
50
            var destination_sort1 = $(this).parent().siblings('li').find('input[name="all_sort1"]');
51
            if ( destination_sort1.length < 1 ) {
52
                destination_sort1 = $(this).parent().siblings('li').find('select[name="all_sort1"]');
53
            }
54
            var destination_sort2 = $(this).parent().siblings('li').find('input[name="all_sort2"]');
55
            if ( destination_sort2.length < 1 ) {
56
                destination_sort2 = $(this).parent().siblings('li').find('select[name="all_sort2"]');
57
            }
58
            getAuthValueDropbox( 'sort1', sort1_authcat, destination_sort1 );
59
            getAuthValueDropbox( 'sort2', sort2_authcat, destination_sort2 );
60
            $(this).parent().siblings('li').find('select[name="sort1"]').attr('name', 'all_sort1');
61
            $(this).parent().siblings('li').find('input[name="sort1"]').attr('name', 'all_sort1');
62
            $(this).parent().siblings('li').find('select[name="sort2"]').attr('name', 'all_sort2');
63
            $(this).parent().siblings('li').find('input[name="sort2"]').attr('name', 'all_sort2');
64
        } );
65
66
        $('input:checkbox[name="biblionumber"]').change(function(){
67
            if ( $(this).is(':checked') ) {
68
                $(this).parent().addClass("selected");
69
                $(this).parent().removeClass("unselected");
70
            } else {
71
                $(this).parent().addClass("unselected");
72
                $(this).parent().removeClass("selected");
73
            }
74
        } );
75
76
        $("input:checkbox").attr("checked", false);
77
        $("div.biblio.unselected select").attr("disabled", false);
78
        $("div.biblio.unselected input").attr("disabled", false);
79
80
        $("#checkAll").click(function(){
81
            $("#Aform").checkCheckboxes();
82
            $("input:checkbox[name='biblionumber']").change();
83
            return false;
84
        });
85
        $("#unCheckAll").click(function(){
86
            $("#Aform").unCheckCheckboxes();
87
            $("input:checkbox[name='biblionumber']").change();
88
            return false;
89
        });
90
25
    });
91
    });
92
93
    function disableUnchecked(form){
94
        $("div.biblio.unselected").each(function(){
95
            $(this).find('select').attr('disabled', 'disabled');
96
            $(this).find('input').attr('disabled', 'disabled');
97
        });
98
        form.submit();
99
    }
26
//]]>
100
//]]>
27
</script>
101
</script>
28
</head>
102
</head>
Lines 35-238 Link Here
35
       <div id="yui-main">
109
       <div id="yui-main">
36
           <div class="yui-b">
110
           <div class="yui-b">
37
             [% IF ( batch_details ) %]
111
             [% IF ( batch_details ) %]
38
                  <h1>Add orders from [% comments %]
112
                <h1>Add orders from [% comments %]
39
                    ([% file_name %] staged on [% upload_timestamp %])
113
                    ([% file_name %] staged on [% upload_timestamp %])
40
                  </h1>
114
                </h1>
41
               <div>
115
                <div>
42
                   <form action="[% scriptname %]" method="post" name="import_biblios">
116
                    <span class="checkall"><a id="checkAll" href="#">Check All</a></span>
43
                     <table>
117
                    <span class="uncheckall"><a id="unCheckAll" href="#">Uncheck All</a></span>
44
                     <tr>
118
                    <form action="/cgi-bin/koha/acqui/addorderiso2709.pl" method="post" id="Aform" onsubmit="disableUnchecked(this); return false;">
45
                         <th>Citation</th>
119
                        <input type="hidden" name="op" value="import_records"/>
46
                         <th>Match?</th>
120
                        <input type="hidden" name="basketno" value="[% basketno %]" />
47
                         <th>Order</th>
121
                        <input type="hidden" name="booksellerid" value="[% booksellerid %]" />
48
                       </tr>
122
                        <input type="hidden" name="import_batch_id" value="[%import_batch_id %]" />
49
                       [% FOREACH biblio_lis IN biblio_list %]
123
                        <input type="hidden" name="ordernumber" value="[% ordernumber %]" />
50
                         <tr>
51
                             <td>
52
                                [% biblio_lis.citation %]
53
124
54
                             </td>
125
                        [% FOREACH cur IN loop_currencies %]
55
                             <td>[% biblio_lis.overlay_status %]</td>
126
                            <input type="hidden" name="[% cur.currency %]" value="[% cur.rate %]" />
56
                             <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>
57
                         </tr>
58
     [% IF ( biblio_lis.match_biblionumber ) %]
59
    <tr>
60
      <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>
61
    </tr>
62
    [% END %]
63
                      [% END %]
64
                     </table>
65
                   </form>
66
               </div>
67
              [% IF ( pages ) %]
68
                <div class="pages">
69
                Page 
70
                  [% FOREACH page IN pages %]
71
                    [% IF ( page.current_page ) %]
72
                      <span class="current">[% page.page_number %]</span>
73
                    [% ELSE %]
74
                      <a class="nav" href="[% page.script_name %]?import_batch_id=[% page.import_batch_id %]&amp;offset=[% page.offset %]">[% page.page_number %]</a>
75
                    [% END %]
76
                  [% END %]
77
              [% END %]
78
             [% ELSE %]
79
               <div>
80
                <h1>Choose the file to add to the basket</h1>
81
                   <table id="files">
82
                     <thead>
83
                     <tr>
84
                       <th>File name</th>
85
                       <th>Comments</th>
86
                       <th>Status</th>
87
                       <th>Staged</th>
88
                       <th># Bibs</th>
89
                       <th>&nbsp;</th>
90
                     </tr>
91
                     </thead>
92
                     <tbody>
93
                     [% FOREACH batch_lis IN batch_list %]
94
                     <tr>
95
                        <td>[% batch_lis.file_name %]</td>
96
                       <td>[% batch_lis.comments %]</td>
97
                       <td>[% batch_lis.import_status %]</td>
98
                       <td>[% batch_lis.staged_date | $KohaDates %] [% batch_lis.staged_hour %]</td>
99
                       <td>[% batch_lis.num_biblios %]</td>
100
                       <td><a href="[% batch_lis.scriptname %]?import_batch_id=[% batch_lis.import_batch_id %]&amp;basketno=[% basketno %]&amp;booksellerid=[% booksellerid %]">Add orders</a></td>
101
                     </tr>
102
                     [% END %]
103
                     </tbody>
104
                   </table>
105
               </div>
106
             [% END %]
107
           </div>
108
        [% IF ( import_batch_id ) %]
109
            <div class="yui-b">
110
            <h2>Import All</h2>
111
            <p>Import all the lines in the basket with the following parameters:</p>
112
            <form action="/cgi-bin/koha/acqui/addorderiso2709.pl" method="post" id="Aform">
113
                    <input type="hidden" name="op" value="import_records"/>
114
                    <input type="hidden" name="ordernumber" value="[% ordernumber %]" />
115
                    <input type="hidden" name="basketno" value="[% basketno %]" />
116
                    <input type="hidden" name="booksellerid" value="[% booksellerid %]" />
117
                    <input type="hidden" name="import_batch_id" value="[% import_batch_id %]" />
118
119
                    [% FOREACH loop_currencie IN loop_currencies %]
120
                        <input type="hidden" name="[% loop_currencie.currency %]" value="[% loop_currencie.rate %]" />
121
                    [% END %]
122
123
                [% IF ( items ) %]
124
                <fieldset class="rows">
125
                    <legend>Item</legend>
126
                    [% IF ( NoACQframework ) %]
127
                        <div class="dialog message">No ACQ framework, using default. You should create a framework with code ACQ, the items framework would be used</div>
128
                    [% END %]
129
130
                    [% FOREACH item IN items %]
131
                    <div id="outeritemblock">
132
                    <div id="itemblock">
133
                        <ol>[% FOREACH iteminformatio IN item.iteminformation %]<li style="[% iteminformatio.hidden %];">
134
                            <div class="subfield_line" id="subfield[% iteminformatio.serialid %][% iteminformatio.countitems %][% iteminformatio.subfield %][% iteminformatio.random %]">
135
136
                                <label>[% iteminformatio.subfield %] - [% IF ( iteminformatio.mandatory ) %]<b>[% END %][% iteminformatio.marc_lib %][% IF ( iteminformatio.mandatory ) %] *</b>[% END %]</label>
137
                                [% iteminformatio.marc_value %]
138
                                <input type="hidden" name="itemid" value="1" />
139
                                <input type="hidden" name="kohafield" value="[% iteminformatio.kohafield %]" />
140
                                <input type="hidden" name="tag" value="[% iteminformatio.tag %]" />
141
                                <input type="hidden" name="subfield" value="[% iteminformatio.subfield %]" />
142
                                <input type="hidden" name="mandatory" value="[% iteminformatio.mandatory %]" />
143
                            </div></li>
144
                        [% END %]
127
                        [% END %]
145
                        </ol>
146
                    </div><!-- /iteminformation -->
147
                    </div>
148
128
149
                    [% END %] <!-- /items -->
129
                        [% FOREACH biblio IN biblio_list %]
150
                </fieldset>
130
                        <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;">
151
                [% END %] <!-- items -->
131
                            <input type="checkbox" name="biblionumber" id="biblionumber[% biblio.biblionumber %]" />
152
                <fieldset class="rows">
132
                            <input type="hidden" name="import_record_id" value="[% biblio.import_record_id %]" />
153
                    <legend>Accounting details</legend>
133
                            <label for="biblionumber[% biblionumber %]"><span class="citation" style="font-weight:bold;">[% biblio.citation %]</span></label>
154
                    <ol>
134
                            <span class="match" style="display:block;">[% biblio.overlay_status %]</span>
155
                        <li>
135
                            [% IF ( biblio.match_biblionumber ) %]
156
                            <!-- origquantityrec only here for javascript compatibility (additem.js needs it, useless here, usefull when receiveing an order -->
136
                                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>
157
                            <input id="origquantityrec" readonly="readonly" type="hidden" name="origquantityrec" value="1" />
137
                            [% END %]
158
                        </li>
138
                            <span class="quantity" style="display:block;">
159
                        <li>
139
                                Quantity : <input type="text" value="[% biblio.quantity %]" name="quantity" />
160
                            [% IF ( close ) %]
140
                            </span>
161
                        <span class="label">Budget: </span>
141
                            <span class="price" style="display:block;">
162
                                <input type="hidden" size="20" name="budget_id" id="budget_id" value="[% budget_id %]" />[% Budget_name %]
142
                                Price : <input type="text" value="[% biblio.price %]" name="price" />
163
                            [% ELSE %]
143
                                <input type="hidden" value="[% biblio.rrp %]" name="rrp" />
164
                            <li>
144
                                <input type="hidden" value="[% biblio.discount %]" name="discount" />
165
                            <label for="currency">Currency:</label>
145
                            </span>
166
                            <select name="currency" id="currency">
146
                            <span class="budget" style="display:block;">
167
                            [% FOREACH loop_currencie IN loop_currencies %]
147
                                [% IF ( close ) %]
168
                                    [% 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 %]
148
                                <span class="label">Budget: </span>
169
                            </select>
149
                                    <input type="hidden" size="20" name="budget_id" value="[% budget_id %]" />[% Budget_name %]
170
                            </li>
171
                            <li>
172
                            <label for="budget_id">Budget: </label>
173
                            <select id="budget_id" onchange="fetchSortDropbox(this.form)" size="1" name="budget_id">
174
                            [% FOREACH budget_loo IN budget_loop %]
175
                                [% IF ( budget_loo.b_sel ) %]
176
                                    <option value="[% budget_loo.b_id %]" selected="selected">[% budget_loo.b_txt %]</option>
177
                                [% ELSE %]
150
                                [% ELSE %]
178
                                    <option value="[% budget_loo.b_id %]">[% budget_loo.b_txt %]</option>
151
                                <label for="budget_id">Budget: </label>
152
                                <select size="1" name="budget_id">
153
                                    <option value=""></option>
154
                                    [% FOREACH budget IN budget_loop %]
155
                                        [% IF ( budget.b_id == biblio.budget_id ) %]
156
                                            <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>
157
                                        [% ELSE %]
158
                                            <option value="[% budget.b_id %]" data-sort1-authcat="[% budget.b_sort1_authcat %]" data-sort2-authcat="[% budget.b_sort2_authcat %]">[% budget.b_txt %]</option>
159
                                        [% END %]
160
                                    [% END %]
161
                                </select>
179
                                [% END %]
162
                                [% END %]
163
                                <span class="sort1">
164
                                    <label for="sort1">Planning value1: </label>
165
                                    <input type="text" id="sort1" size="20" name="sort1" value="[% biblio.sort1 %]" />
166
                                </span>
167
                                <span class="sort2">
168
                                    <label for="sort2">Planning value2: </label>
169
                                    <input type="text" id="sort2" size="20" name="sort2" value="[% biblio.sort2 %]" />
170
                                </span>
171
                            </span>
172
                        </div>
173
                        [% END %]
174
                        <div>
175
                        <h2>Import All</h2>
176
                        <p>Import all the lines in the basket with the following parameters:</p>
177
178
                        [% IF ( items ) %]
179
                        <fieldset class="rows">
180
                            <legend>Item</legend>
181
                            [% IF ( NoACQframework ) %]
182
                                <div class="dialog message">No ACQ framework, using default. You should create a framework with code ACQ, the items framework would be used</div>
180
                            [% END %]
183
                            [% END %]
181
                            </select>
184
                            [% FOREACH item IN items %]
182
                            </li>
185
                            <div id="outeritemblock">
183
                            [% END %]
186
                            <div id="itemblock">
184
                        </li>
187
                                <ol>
185
                        <li>
188
                                [% FOREACH iteminformatio IN item.iteminformation %]<li style="[% iteminformatio.hidden %];">
186
                            <label for="notes">Notes: </label>
189
                                    <div class="subfield_line" id="subfield[% iteminformatio.serialid %][% iteminformatio.countitems %][% iteminformatio.subfield %][% iteminformatio.random %]">
187
                            <textarea id="notes" cols="30" rows="3" name="notes"></textarea>
190
                                        <label>[% iteminformatio.subfield %] - [% IF ( iteminformatio.mandatory ) %]<b>[% END %][% iteminformatio.marc_lib %][% IF ( iteminformatio.mandatory ) %] *</b>[% END %]</label>
188
                        </li>
191
                                        [% iteminformatio.marc_value %]
189
                        <li><div class="hint">The 2 following fields are available for your own usage. They can be useful for statistical purposes</div>
192
                                        <input type="hidden" name="itemid" value="1" />
190
                            <label for="sort1">Planning value1: </label>
193
                                        <input type="hidden" name="kohafield" value="[% iteminformatio.kohafield %]" />
191
                            <span id="sort1_zone">
194
                                        <input type="hidden" name="tag" value="[% iteminformatio.tag %]" />
192
                            [% IF CGIsort1 %]
195
                                        <input type="hidden" name="subfield" value="[% iteminformatio.subfield %]" />
193
                                <select id="sort1" size="1" name="sort1">
196
                                        <input type="hidden" name="mandatory" value="[% iteminformatio.mandatory %]" />
194
                                [% FOREACH sort_opt IN CGIsort1 %]
197
                                    </div></li>
195
                                    [% IF sort_opt.default %]
198
                                [% END %]
196
                                        <option value="[% sort_opt.id %]" selected="selected">[% sort_opt.label %]</option>
199
                                </ol>
200
                            </div><!-- /iteminformation -->
201
                            </div>
202
                            [% END %] <!-- /items -->
203
                        </fieldset>
204
                        [% END %] <!-- items -->
205
206
                        <fieldset class="rows">
207
                            <legend>Accounting details</legend>
208
                            <ol>
209
                                <li>
210
                                    <!-- origquantityrec only here for javascript compatibility (additem.js needs it, useless here, usefull when receiveing an order -->
211
                                    <input id="origquantityrec" readonly="readonly" type="hidden" name="origquantityrec" value="1" />
212
                                </li>
213
                                <li>
214
                                    [% IF ( close ) %]
215
                                        <span class="label">Budget: </span>
216
                                        <input type="hidden" size="20" name="budget_id" id="budget_id" value="[% budget_id %]" />[% Budget_name %]
197
                                    [% ELSE %]
217
                                    [% ELSE %]
198
                                        <option value="[% sort_opt.id %]">[% sort_opt.label %]</option>
218
                                        <li>
219
                                            <label for="all_currency">Currency:</label>
220
                                            <select name="all_currency" id="all_currency">
221
                                            [% FOREACH loop_currencie IN loop_currencies %]
222
                                                [% IF ( loop_currencie.selected ) %]
223
                                                    <option value="[% loop_currencie.currcode %]" selected="selected">[% loop_currencie.currcode %]</option>
224
                                                [% ELSE %]
225
                                                    <option value="[% loop_currencie.currcode %]">[% loop_currencie.currcode %]</option>
226
                                                [% END %]
227
                                            [% END %]
228
                                            </select>
229
                                        </li>
230
                                        <li>
231
                                            <label for="all_budget_id">Budget: </label>
232
                                            <select id="all_budget_id" size="1" name="all_budget_id">
233
                                            [% FOREACH budget_loo IN budget_loop %]
234
                                                [% IF ( budget_loo.b_sel ) %]
235
                                                    <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>
236
                                                [% ELSE %]
237
                                                    <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>
238
                                                [% END %]
239
                                            [% END %]
240
                                            </select>
241
                                        </li>
199
                                    [% END %]
242
                                    [% END %]
200
                                [% END %]
243
                                </li>
201
                                </select>
244
                                <li>
202
                            [% ELSE %]
245
                                    <label for="notes">Notes: </label>
203
                                <input type="text" id="sort1" size="20" name="sort1" value="[% sort1 %]" />
246
                                    <textarea id="notes" cols="30" rows="3" name="all_notes"></textarea>
204
                            [% END %]
247
                                </li>
205
                            </span>
248
                                <li>
206
                        </li>
249
                                    <div class="hint">The 2 following fields are available for your own usage. They can be useful for statistical purposes</div>
207
                        <li>
250
                                    <label for="sort1">Planning value1: </label>
208
                            <label for="sort2">Planning value2: </label>
251
                                    [% IF CGIsort1 %]
209
                            <span id="sort2_zone">
252
                                        <select id="all_sort1" size="1" name="all_sort1">
210
                            [% IF CGIsort2 %]
253
                                        [% FOREACH sort_opt IN CGIsort1 %]
211
                                <select id="sort2" size="1" name="sort1">
254
                                            [% IF sort_opt.default %]
212
                                [% FOREACH sort_opt IN CGIsort2 %]
255
                                                <option value="[% sort_opt.id %]" selected="selected">[% sort_opt.label %]</option>
213
                                    [% IF sort_opt.default %]
256
                                            [% ELSE %]
214
                                        <option value="[% sort_opt.id %]" selected="selected">[% sort_opt.label %]</option>
257
                                                <option value="[% sort_opt.id %]">[% sort_opt.label %]</option>
258
                                            [% END %]
259
                                        [% END %]
260
                                        </select>
215
                                    [% ELSE %]
261
                                    [% ELSE %]
216
                                        <option value="[% sort_opt.id %]">[% sort_opt.label %]</option>
262
                                        <input type="text" id="all_sort1" size="20" name="all_sort1" value="[% sort1 %]" />
217
                                    [% END %]
263
                                    [% END %]
218
                                [% END %]
264
                                </li>
219
                                </select>
265
                                <li>
220
                            [% ELSE %]
266
                                  <span id="sort2_zone">
221
                                 <input type="text" id="sort2" size="20" name="sort2" value="[% sort2 %]" />
267
                                    <label for="sort2">Planning value2: </label>
222
                            [% END %]
268
                                    [% IF CGIsort2 %]
223
                            </span>
269
                                        <select id="all_sort2" size="1" name="all_sort1">
224
                        </li>
270
                                        [% FOREACH sort_opt IN CGIsort2 %]
225
                        <li>
271
                                            [% IF sort_opt.default %]
226
                            
272
                                                <option value="[% sort_opt.id %]" selected="selected">[% sort_opt.label %]</option>
227
                        </li>
273
                                            [% ELSE %]
228
            </ol>
274
                                                <option value="[% sort_opt.id %]">[% sort_opt.label %]</option>
229
                </fieldset>
275
                                            [% END %]
230
                <fieldset class="action">
276
                                        [% END %]
231
                    <input type="submit" value="Save" /><a class="cancel" href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basketno %]">Cancel</a>
277
                                        </select>
232
                </fieldset>
278
                                    [% ELSE %]
233
            </form>
279
                                         <input type="text" id="all_sort2" size="20" name="all_sort2" value="[% sort2 %]" />
234
            </div>
280
                                    [% END %]
235
        [% END %]
281
                                  </span>
282
                                </li>
283
                            </ol>
284
                        </fieldset>
285
                        <fieldset class="action">
286
                            <input type="submit" value="Save" /><a class="cancel" href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basketno %]">Cancel</a>
287
                        </fieldset>
288
289
                        </div>
290
                    </form>
291
                [% ELSE %]
292
                <div>
293
                  <h1>Choose the file to add to the basket</h1>
294
                  <table id="files">
295
                    <thead>
296
                      <tr>
297
                        <th>File name</th>
298
                        <th>Comments</th>
299
                        <th>Status</th>
300
                        <th>Staged</th>
301
                        <th># Bibs</th>
302
                        <th>&nbsp;</th>
303
                      </tr>
304
                    </thead>
305
                    <tbody>
306
                      [% FOREACH batch_lis IN batch_list %]
307
                      <tr>
308
                        <td>[% batch_lis.file_name %]</td>
309
                        <td>[% batch_lis.comments %]</td>
310
                        <td>[% batch_lis.import_status %]</td>
311
                        <td>[% batch_lis.staged_date | $KohaDates %] [% batch_lis.staged_hour %]</td>
312
                        <td>[% batch_lis.num_biblios %]</td>
313
                        <td><a href="[% batch_lis.scriptname %]?import_batch_id=[% batch_lis.import_batch_id %]&amp;basketno=[% basketno %]&amp;booksellerid=[% booksellerid %]">Add orders</a></td>
314
                      </tr>
315
                      [% END %]
316
                    </tbody>
317
                  </table>
318
                </div>
319
                [% END %]
320
           </div>
236
       </div>
321
       </div>
237
   </div>
322
   </div>
238
</div>
323
</div>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref (-1 / +4 lines)
Lines 35-40 Acquisitions: Link Here
35
            - Default tax rates are
35
            - Default tax rates are
36
            - pref: gist
36
            - pref: gist
37
            - (enter in numeric form, 0.12 for 12%. First is the default. If you want more than 1 value, please separate with |)
37
            - (enter in numeric form, 0.12 for 12%. First is the default. If you want more than 1 value, please separate with |)
38
        -
39
            - 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.
40
            - pref: MarcFieldsToOrder
41
              type: textarea
38
42
39
    Printing:
43
    Printing:
40
        -
44
        -
41
- 

Return to bug 7180