Bug 13321: Rename variables
[koha.git] / acqui / addorderiso2709.pl
index e5159dc..e425051 100755 (executable)
@@ -39,7 +39,6 @@ use C4::Koha;
 use C4::Budgets;
 use C4::Acquisition;
 use C4::Suggestions;    # GetSuggestion
-use C4::Branch;         # GetBranches
 use C4::Members;
 
 use Koha::Number::Price;
@@ -99,7 +98,8 @@ if ($op eq ""){
                      "allmatch" => $allmatch,
                      );
     import_biblios_list($template, $cgiparams->{'import_batch_id'});
-    if ( C4::Context->preference('AcqCreateItem') eq 'ordering' ) {
+    my $basket = GetBasket($cgiparams->{basketno});
+    if ( C4::Context->preference('AcqCreateItem') eq 'ordering' && !$basket->{is_standing} ) {
         # prepare empty item form
         my $cell = PrepareItemrecordDisplay( '', '', '', 'ACQ' );
 
@@ -205,7 +205,7 @@ if ($op eq ""){
             # in this case, the price will be x100 when unformatted ! Replace the . by a , to get a proper price calculation
             $price =~ s/\./,/ if C4::Context->preference("CurrencyFormat") eq "FR";
             $price = Koha::Number::Price->new($price)->unformat;
-            $orderinfo{gstrate} = $bookseller->{gstrate};
+            $orderinfo{tax_rate} = $bookseller->{tax_rate};
             my $c = $c_discount ? $c_discount : $bookseller->{discount} / 100;
             if ( $bookseller->{listincgst} ) {
                 if ( $c_discount ) {
@@ -217,10 +217,10 @@ if ($op eq ""){
                 }
             } else {
                 if ( $c_discount ) {
-                    $orderinfo{ecost} = $price / ( 1 + $orderinfo{gstrate} );
+                    $orderinfo{ecost} = $price / ( 1 + $orderinfo{tax_rate} );
                     $orderinfo{rrp}   = $orderinfo{ecost} / ( 1 - $c );
                 } else {
-                    $orderinfo{rrp}   = $price / ( 1 + $orderinfo{gstrate} );
+                    $orderinfo{rrp}   = $price / ( 1 + $orderinfo{tax_rate} );
                     $orderinfo{ecost} = $orderinfo{rrp} * ( 1 - $c );
                 }
             }
@@ -238,7 +238,8 @@ if ($op eq ""){
         # 4th, add items if applicable
         # parse the item sent by the form, and create an item just for the import_record_id we are dealing with
         # this is not optimised, but it's working !
-        if ( C4::Context->preference('AcqCreateItem') eq 'ordering' ) {
+        my $basket = GetBasket($cgiparams->{basketno});
+        if ( C4::Context->preference('AcqCreateItem') eq 'ordering' && !$basket->{is_standing} ) {
             my @tags         = $input->multi_param('tag');
             my @subfields    = $input->multi_param('subfield');
             my @field_values = $input->multi_param('field_value');