X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=C4%2FAcquisition.pm;h=99933e4d5a17d591e67cafd31ee116365db0bb2d;hb=9e74700b5b4cee8f92a85f18cc2304569c30a910;hp=cf7e7b7f92ed44b51287a82e07d2b7b224f06f5b;hpb=7180eb1153cbb2849b0171014cf84eda0993b465;p=koha.git diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm index cf7e7b7f92..99933e4d5a 100644 --- a/C4/Acquisition.pm +++ b/C4/Acquisition.pm @@ -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";