- # set the version for version checking
- $VERSION = 3.07.00.049;
- require Exporter;
- @ISA = qw(Exporter);
- @EXPORT = qw(
- get_report_types get_report_areas get_columns build_query get_criteria
- save_report get_saved_reports execute_query get_saved_report create_compound run_compound
- get_column_type get_distinct_values save_dictionary get_from_dictionary
- delete_definition delete_report format_results get_sql
- nb_rows update_sql
- );
-}
-
-our %table_areas;
-$table_areas{'1'} =
- [ 'borrowers', 'statistics','items', 'biblioitems' ]; # circulation
-$table_areas{'2'} = [ 'items', 'biblioitems', 'biblio' ]; # catalogue
-$table_areas{'3'} = [ 'borrowers' ]; # patrons
-$table_areas{'4'} = ['aqorders', 'biblio', 'items']; # acquisitions
-$table_areas{'5'} = [ 'borrowers', 'accountlines' ]; # accounts
-our %keys;
-$keys{'1'} = [
- 'statistics.borrowernumber=borrowers.borrowernumber',
- 'items.itemnumber = statistics.itemnumber',
- 'biblioitems.biblioitemnumber = items.biblioitemnumber'
-];
-$keys{'2'} = [
- 'items.biblioitemnumber=biblioitems.biblioitemnumber',
- 'biblioitems.biblionumber=biblio.biblionumber'
-];
-$keys{'3'} = [ ];
-$keys{'4'} = [
- 'aqorders.biblionumber=biblio.biblionumber',
- 'biblio.biblionumber=items.biblionumber'
-];
-$keys{'5'} = ['borrowers.borrowernumber=accountlines.borrowernumber'];
-
-# have to do someting here to know if its dropdown, free text, date etc
-
-our %criteria;
-# reports on circulation
-$criteria{'1'} = [
- 'statistics.type', 'borrowers.categorycode',
- 'statistics.branch',
- 'biblioitems.publicationyear|date',
- 'items.dateaccessioned|date'
-];
-# reports on catalogue
-$criteria{'2'} =
- [ 'items.itemnumber|textrange', 'items.biblionumber|textrange', 'items.barcode|textrange',
- 'biblio.frameworkcode', 'items.holdingbranch', 'items.homebranch',
- 'biblio.datecreated|daterange', 'biblio.timestamp|daterange', 'items.onloan|daterange',
- 'items.ccode', 'items.itemcallnumber|textrange', 'items.itype',
- 'items.itemlost', 'items.location' ];
-# reports on borrowers
-$criteria{'3'} = ['borrowers.branchcode', 'borrowers.categorycode'];
-# reports on acquisition
-$criteria{'4'} = ['aqorders.datereceived|date'];
-
-# reports on accounting
-$criteria{'5'} = ['borrowers.branchcode', 'borrowers.categorycode'];
-
-# Adds itemtypes to criteria, according to the syspref
-if (C4::Context->preference('item-level_itypes')) {
- unshift @{ $criteria{'1'} }, 'items.itype';
- unshift @{ $criteria{'2'} }, 'items.itype';
-} else {
- unshift @{ $criteria{'1'} }, 'biblioitems.itemtype';
- unshift @{ $criteria{'2'} }, 'biblioitems.itemtype';