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

(-)a/acqui/addorderiso2709.pl (-9 / +9 lines)
Lines 166-171 if ($op eq ""){ Link Here
166
        $c_discount = $c_discount / 100 if $c_discount > 1;
166
        $c_discount = $c_discount / 100 if $c_discount > 1;
167
        my $c_sort1 = shift( @sort1 ) || $input->param('all_sort1') || '';
167
        my $c_sort1 = shift( @sort1 ) || $input->param('all_sort1') || '';
168
        my $c_sort2 = shift( @sort2 ) || $input->param('all_sort2') || '';
168
        my $c_sort2 = shift( @sort2 ) || $input->param('all_sort2') || '';
169
        my $c_replacement_price = shift( @orderreplacementprices );
170
        my $c_price = shift( @prices ) || GetMarcPrice($marcrecord, C4::Context->preference('marcflavour'));
169
171
170
        # Insert the biblio, or find it through matcher
172
        # Insert the biblio, or find it through matcher
171
        unless ( $biblionumber ) {
173
        unless ( $biblionumber ) {
Lines 326-349 if ($op eq ""){ Link Here
326
                order_internalnote => $cgiparams->{'all_order_internalnote'},
328
                order_internalnote => $cgiparams->{'all_order_internalnote'},
327
                order_vendornote   => $cgiparams->{'all_order_vendornote'},
329
                order_vendornote   => $cgiparams->{'all_order_vendornote'},
328
                currency           => $cgiparams->{'all_currency'},
330
                currency           => $cgiparams->{'all_currency'},
329
                replacementprice   => shift( @orderreplacementprices ),
331
                replacementprice   => $c_replacement_price,
330
            );
332
            );
331
            # get the price if there is one.
333
            # get the price if there is one.
332
            my $price= shift( @prices ) || GetMarcPrice($marcrecord, C4::Context->preference('marcflavour'));
334
            if ($c_price){
333
            if ($price){
334
                # in France, the cents separator is the , but sometimes, ppl use a .
335
                # in France, the cents separator is the , but sometimes, ppl use a .
335
                # in this case, the price will be x100 when unformatted ! Replace the . by a , to get a proper price calculation
336
                # in this case, the price will be x100 when unformatted ! Replace the . by a , to get a proper price calculation
336
                $price =~ s/\./,/ if C4::Context->preference("CurrencyFormat") eq "FR";
337
                $c_price =~ s/\./,/ if C4::Context->preference("CurrencyFormat") eq "FR";
337
                $price = Koha::Number::Price->new($price)->unformat;
338
                $c_price = Koha::Number::Price->new($c_price)->unformat;
338
                $orderinfo{tax_rate} = $bookseller->tax_rate;
339
                $orderinfo{tax_rate} = $bookseller->tax_rate;
339
                my $c = $c_discount ? $c_discount : $bookseller->discount / 100;
340
                my $c = $c_discount ? $c_discount : $bookseller->discount / 100;
340
                $orderinfo{discount} = $c;
341
                $orderinfo{discount} = $c;
341
                if ( $c_discount ) {
342
                if ( $c_discount ) {
342
                    $orderinfo{ecost} = $price;
343
                    $orderinfo{ecost} = $c_price;
343
                    $orderinfo{rrp}   = $orderinfo{ecost} / ( 1 - $c );
344
                    $orderinfo{rrp}   = $orderinfo{ecost} / ( 1 - $c );
344
                } else {
345
                } else {
345
                    $orderinfo{ecost} = $price * ( 1 - $c );
346
                    $orderinfo{ecost} = $c_price * ( 1 - $c );
346
                    $orderinfo{rrp}   = $price;
347
                    $orderinfo{rrp}   = $c_price;
347
                }
348
                }
348
                $orderinfo{listprice} = $orderinfo{rrp} / $active_currency->rate;
349
                $orderinfo{listprice} = $orderinfo{rrp} / $active_currency->rate;
349
                $orderinfo{unitprice} = $orderinfo{ecost};
350
                $orderinfo{unitprice} = $orderinfo{ecost};
350
- 

Return to bug 14999