Bug 11363: make units in label printer profile form translatable
[koha.git] / C4 / Acquisition.pm
index cf7e7b7..99933e4 100644 (file)
@@ -1696,7 +1696,7 @@ sub SearchOrders {
 
     my $userenv = C4::Context->userenv;
     if ( C4::Context->preference("IndependentBranches") ) {
-        if ( ( $userenv ) and ( $userenv->{flags} != 1 ) ) {
+        unless ( C4::Context->IsSuperLibrarian() ) {
             $query .= q{
                 AND (
                     borrowers.branchcode = ?
@@ -1892,11 +1892,10 @@ sub GetParcel {
 
     my @query_params = ( $supplierid, $code, $datereceived );
     if ( C4::Context->preference("IndependentBranches") ) {
-        my $userenv = C4::Context->userenv;
-        if ( ($userenv) && ( $userenv->{flags} != 1 ) ) {
+        unless ( C4::Context->IsSuperLibrarian() ) {
             $strsth .= " and (borrowers.branchcode = ?
                         or borrowers.branchcode  = '')";
-            push @query_params, $userenv->{branch};
+            push @query_params, C4::Context->userenv->{branch};
         }
     }
     $strsth .= " ORDER BY aqbasket.basketno";
@@ -2111,8 +2110,7 @@ sub GetLateOrders {
         $from .= ' AND ADDDATE(aqbasket.closedate, INTERVAL aqbooksellers.deliverytime DAY) <= CAST(now() AS date)';
     }
     if (C4::Context->preference("IndependentBranches")
-            && C4::Context->userenv
-            && C4::Context->userenv->{flags} != 1 ) {
+            && !C4::Context->IsSuperLibrarian() ) {
         $from .= ' AND borrowers.branchcode LIKE ? ';
         push @query_params, C4::Context->userenv->{branch};
     }
@@ -2142,10 +2140,19 @@ params:
   title
   author
   name
+  isbn
+  ean
   from_placed_on
   to_placed_on
   basket                  - search both basket name and number
   booksellerinvoicenumber 
+  basketgroupname
+  budget
+  orderstatus (note that orderstatus '' will retrieve orders
+               of any status except cancelled)
+  biblionumber
+  get_canceled_order (if set to a true value, cancelled orders will
+                      be included)
 
 returns:
     $order_loop is a list of hashrefs that each look like this:
@@ -2241,8 +2248,9 @@ sub GetHistory {
 
     $query .= " WHERE 1 ";
 
-    $query .= " AND (datecancellationprinted is NULL or datecancellationprinted='0000-00-00') "
-        if not $get_canceled_order or ( defined $orderstatus and $orderstatus ne 'cancelled' );
+    unless ($get_canceled_order or (defined $orderstatus and $orderstatus eq 'cancelled')) {
+        $query .= " AND (datecancellationprinted is NULL or datecancellationprinted='0000-00-00') ";
+    }
 
     my @query_params  = ();
 
@@ -2316,10 +2324,9 @@ sub GetHistory {
     }
 
     if ( C4::Context->preference("IndependentBranches") ) {
-        my $userenv = C4::Context->userenv;
-        if ( $userenv && ($userenv->{flags} || 0) != 1 ) {
+        unless ( C4::Context->IsSuperLibrarian() ) {
             $query .= " AND (borrowers.branchcode = ? OR borrowers.branchcode ='' ) ";
-            push @query_params, $userenv->{branch};
+            push @query_params, C4::Context->userenv->{branch};
         }
     }
     $query .= " ORDER BY id";