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

(-)a/acqui/addorderiso2709.pl (-8 / +16 lines)
Lines 168-189 if ($op eq ""){ Link Here
168
    for my $biblio (@$biblios){
168
    for my $biblio (@$biblios){
169
        # Check if this import_record_id was selected
169
        # Check if this import_record_id was selected
170
        next if not grep { $_ eq $$biblio{import_record_id} } @import_record_id_selected;
170
        next if not grep { $_ eq $$biblio{import_record_id} } @import_record_id_selected;
171
172
        # With this we know from which index from the http params we get the data
173
        my $index;
174
        for (my $i = 0; $i <= $#import_record_id_selected; $i++) {
175
            if ($import_record_id_selected[$i] eq $$biblio{import_record_id}) {
176
              $index = $i;
177
              last;
178
            }
179
        }
171
        my ( $marcblob, $encoding ) = GetImportRecordMarc( $biblio->{'import_record_id'} );
180
        my ( $marcblob, $encoding ) = GetImportRecordMarc( $biblio->{'import_record_id'} );
172
        my $marcrecord = MARC::Record->new_from_usmarc($marcblob) || die "couldn't translate marc information";
181
        my $marcrecord = MARC::Record->new_from_usmarc($marcblob) || die "couldn't translate marc information";
173
        my $match = GetImportRecordMatches( $biblio->{'import_record_id'}, 1 );
182
        my $match = GetImportRecordMatches( $biblio->{'import_record_id'}, 1 );
174
        my $biblionumber=$#$match > -1?$match->[0]->{'biblionumber'}:0;
183
        my $biblionumber=$#$match > -1?$match->[0]->{'biblionumber'}:0;
175
        my $c_overlay = shift @overlay;
184
        my $c_overlay = $overlay[$index];
176
        my $c_quantity = shift( @quantities ) || GetMarcQuantity($marcrecord, C4::Context->preference('marcflavour') ) || 1;
185
        my $c_quantity = $quantities[$index] || GetMarcQuantity($marcrecord, C4::Context->preference('marcflavour') ) || 1;
177
        my $c_budget_id = shift( @budgets_id ) || $input->param('all_budget_id') || $budget_id;
186
        my $c_budget_id = $budgets_id[$index] || $input->param('all_budget_id') || $budget_id;
178
        my $c_discount = shift ( @discount);
187
        my $c_discount = $discount[$index];
179
        if ($c_discount) {
188
        if ($c_discount) {
180
            $c_discount =~ s/%//g; #This screws up number conversion badly
189
            $c_discount =~ s/%//g; #This screws up number conversion badly
181
            $c_discount =~ s/,/./g; #Make this an actual digit for Perl
190
            $c_discount =~ s/,/./g; #Make this an actual digit for Perl
182
            $c_discount = $c_discount / 100 if $c_discount >= 1;
191
            $c_discount = $c_discount / 100 if $c_discount >= 1;
183
        }
192
        }
184
        $c_discount = $c_discount / 100 if $c_discount && $c_discount > 1;
193
        $c_discount = $c_discount / 100 if $c_discount && $c_discount > 1;
185
        my $c_sort1 = shift( @sort1 ) || $input->param('all_sort1') || '';
194
        my $c_sort1 = $sort1[$index] || $input->param('all_sort1') || '';
186
        my $c_sort2 = shift( @sort2 ) || $input->param('all_sort2') || '';
195
        my $c_sort2 = $sort2[$index] || $input->param('all_sort2') || '';
187
196
188
        # INSERT the biblio if no match found, or if we want to overlay the existing match
197
        # INSERT the biblio if no match found, or if we want to overlay the existing match
189
        if ( not($biblionumber) || $c_overlay ) {
198
        if ( not($biblionumber) || $c_overlay ) {
Lines 235-241 if ($op eq ""){ Link Here
235
            currency           => $cgiparams->{'all_currency'},
244
            currency           => $cgiparams->{'all_currency'},
236
        );
245
        );
237
        # get the price if there is one.
246
        # get the price if there is one.
238
        my $price= shift( @prices ) || GetMarcPrice($marcrecord, C4::Context->preference('marcflavour'));
247
        my $price = $prices[$index] || GetMarcPrice($marcrecord, C4::Context->preference('marcflavour'));
239
        if ($price){
248
        if ($price){
240
            # in France, the cents separator is the , but sometimes, ppl use a .
249
            # in France, the cents separator is the , but sometimes, ppl use a .
241
            # in this case, the price will be x100 when unformatted ! Replace the . by a , to get a proper price calculation
250
            # in this case, the price will be x100 when unformatted ! Replace the . by a , to get a proper price calculation
242
- 

Return to bug 14999