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

(-)a/C4/Acquisition.pm (-73 / +1 lines)
Lines 65-71 BEGIN { Link Here
65
        &GetLastOrderNotReceivedFromSubscriptionid &GetLastOrderReceivedFromSubscriptionid
65
        &GetLastOrderNotReceivedFromSubscriptionid &GetLastOrderReceivedFromSubscriptionid
66
        &ModItemOrder
66
        &ModItemOrder
67
67
68
        &GetParcels &GetParcel
68
        &GetParcels
69
69
70
        &GetInvoices
70
        &GetInvoices
71
        &GetInvoice
71
        &GetInvoice
Lines 1895-1971 sub TransferOrder { Link Here
1895
1895
1896
=head2 FUNCTIONS ABOUT PARCELS
1896
=head2 FUNCTIONS ABOUT PARCELS
1897
1897
1898
=cut
1899
1900
#------------------------------------------------------------#
1901
1902
=head3 GetParcel
1903
1904
  @results = &GetParcel($booksellerid, $code, $date);
1905
1906
Looks up all of the received items from the supplier with the given
1907
bookseller ID at the given date, for the given code (bookseller Invoice number). Ignores cancelled and completed orders.
1908
1909
C<@results> is an array of references-to-hash. The keys of each element are fields from
1910
the aqorders, biblio, and biblioitems tables of the Koha database.
1911
1912
C<@results> is sorted alphabetically by book title.
1913
1914
=cut
1915
1916
sub GetParcel {
1917
    #gets all orders from a certain supplier, orders them alphabetically
1918
    my ( $supplierid, $code, $datereceived ) = @_;
1919
    my $dbh     = C4::Context->dbh;
1920
    my @results = ();
1921
    $code .= '%'
1922
    if $code;  # add % if we search on a given code (otherwise, let him empty)
1923
    my $strsth ="
1924
        SELECT  authorisedby,
1925
                creationdate,
1926
                aqbasket.basketno,
1927
                closedate,surname,
1928
                firstname,
1929
                aqorders.biblionumber,
1930
                aqorders.ordernumber,
1931
                aqorders.parent_ordernumber,
1932
                aqorders.quantity,
1933
                aqorders.quantityreceived,
1934
                aqorders.unitprice,
1935
                aqorders.listprice,
1936
                aqorders.rrp,
1937
                aqorders.ecost,
1938
                aqorders.gstrate,
1939
                biblio.title
1940
        FROM aqorders
1941
        LEFT JOIN aqbasket ON aqbasket.basketno=aqorders.basketno
1942
        LEFT JOIN borrowers ON aqbasket.authorisedby=borrowers.borrowernumber
1943
        LEFT JOIN biblio ON aqorders.biblionumber=biblio.biblionumber
1944
        LEFT JOIN aqinvoices ON aqorders.invoiceid = aqinvoices.invoiceid
1945
        WHERE
1946
            aqbasket.booksellerid = ?
1947
            AND aqinvoices.invoicenumber LIKE ?
1948
            AND aqorders.datereceived = ? ";
1949
1950
    my @query_params = ( $supplierid, $code, $datereceived );
1951
    if ( C4::Context->preference("IndependentBranches") ) {
1952
        unless ( C4::Context->IsSuperLibrarian() ) {
1953
            $strsth .= " and (borrowers.branchcode = ?
1954
                        or borrowers.branchcode  = '')";
1955
            push @query_params, C4::Context->userenv->{branch};
1956
        }
1957
    }
1958
    $strsth .= " ORDER BY aqbasket.basketno";
1959
    my $result_set = $dbh->selectall_arrayref(
1960
        $strsth,
1961
        { Slice => {} },
1962
        @query_params);
1963
1964
    return @{$result_set};
1965
}
1966
1967
#------------------------------------------------------------#
1968
1969
=head3 GetParcels
1898
=head3 GetParcels
1970
1899
1971
  $results = &GetParcels($bookseller, $order, $code, $datefrom, $dateto);
1900
  $results = &GetParcels($bookseller, $order, $code, $datefrom, $dateto);
1972
- 

Return to bug 13318