Bug 11016 - Move SQL query from acqui/spent.pl to C4/Acquisitions.pm ?
Summary: Move SQL query from acqui/spent.pl to C4/Acquisitions.pm ?
Status: CLOSED WONTFIX
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: Main
Hardware: All All
: P5 - low minor (vote)
Assignee: Galen Charlton
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-10-08 08:50 UTC by Mathieu Saby
Modified: 2018-12-03 20:04 UTC (History)
1 user (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mathieu Saby 2013-10-08 08:50:44 UTC
I'm surprised to see a big SQL query in acqui/spent.pl.
Is not that kind of stuff supposed to be rather in C4/Aquisitions.pm ?

my $query = <<EOQ;
SELECT
    aqorders.basketno, aqorders.ordernumber,
    quantity-quantityreceived AS tleft,
    ecost, budgetdate, entrydate,
    aqbasket.booksellerid,
    itype,
    title,
    aqorders.invoiceid,
    aqinvoices.invoicenumber,
    quantityreceived,
    unitprice,
    datereceived,
    aqorders.biblionumber
FROM (aqorders, aqbasket)
LEFT JOIN biblio ON
    biblio.biblionumber=aqorders.biblionumber
LEFT JOIN items ON
    biblio.biblionumber = items.biblionumber
LEFT JOIN aqorders_items ON
     items.itemnumber = aqorders_items.itemnumber
LEFT JOIN aqinvoices ON
    aqorders.invoiceid = aqinvoices.invoiceid
WHERE
    aqorders.ordernumber=aqorders_items.ordernumber AND
    aqorders.basketno=aqbasket.basketno AND
    budget_id=? AND
    (datecancellationprinted IS NULL OR
        datecancellationprinted='0000-00-00')
    GROUP BY aqorders.ordernumber
EOQ



M. Saby
Comment 1 Katrin Fischer 2018-05-16 01:53:37 UTC
spent and ordered can be seen as reports for which an exception has been made:
https://wiki.koha-community.org/wiki/Coding_Guidelines#SQL8:_SQL_code_in_.pl_scripts

Maybe we will move it to Koha:* later, but marking this WONTFIX for now.