[open-ils-commits] r8941 -
branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Acq
svn at svn.open-ils.org
svn at svn.open-ils.org
Sun Mar 9 20:52:59 EDT 2008
Author: erickson
Date: 2008-03-09 20:19:58 -0400 (Sun, 09 Mar 2008)
New Revision: 8941
Modified:
branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Acq/Picklist.pm
Log:
updated json_query to use left join to pull in lineitems that do not have the requested sort_attr. removed stop-gap code
Modified: branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Acq/Picklist.pm
===================================================================
--- branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Acq/Picklist.pm 2008-03-09 19:48:44 UTC (rev 8940)
+++ branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Acq/Picklist.pm 2008-03-10 00:19:58 UTC (rev 8941)
@@ -465,28 +465,25 @@
);
-# some defaults are filled in for reference
my $PL_ENTRY_JSON_QUERY = {
- select => {jub => ['id']}, # display fields
- from => {
- jub => { # selecting from lineitem_attr
- acqlia => {field => 'lineitem', fkey => 'id'}
+ select => {jub => ["id"], "acqlia" => ["attr_value"]},
+ "from" => {
+ "jub" => {
+ "acqlia" => {
+ "fkey" => "id",
+ "field" => "lineitem",
+ "type" => "left",
+ "filter" => {
+ "attr_type" => "lineitem_marc_attr_definition",
+ "attr_name" => "author"
+ }
+ }
}
- },
- where => {
- '+jub' => {picklist => 1},
- '+acqlia' => { # grab attr rows with the requested type and name for sorting
- 'attr_type' => 'lineitem_marc_attr_definition',
- 'attr_name' => 'title'
- }
- },
- 'order_by' => {
- acqlia => {
- 'attr_value' => {direction => 'asc'}
- }
- },
- limit => 10,
- offset => 0
+ },
+ "order_by" => {"acqlia" => {"attr_value" => {"direction"=>"asc"}}},
+ "limit" => 10,
+ "where" => {"+jub" => {"picklist"=>2}},
+ "offset" => 0
};
sub retrieve_pl_lineitem {
@@ -502,8 +499,8 @@
my $offset = $$options{offset} || 0;
$PL_ENTRY_JSON_QUERY->{where}->{'+jub'}->{picklist} = $picklist_id;
- $PL_ENTRY_JSON_QUERY->{where}->{'+acqlia'}->{attr_name} = $sort_attr;
- $PL_ENTRY_JSON_QUERY->{where}->{'+acqlia'}->{attr_type} = $sort_attr_type;
+ $PL_ENTRY_JSON_QUERY->{from}->{jub}->{acqlia}->{filter}->{attr_name} = $sort_attr;
+ $PL_ENTRY_JSON_QUERY->{from}->{jub}->{acqlia}->{filter}->{attr_type} = $sort_attr_type;
$PL_ENTRY_JSON_QUERY->{order_by}->{acqlia}->{attr_value}->{direction} = $sort_dir;
$PL_ENTRY_JSON_QUERY->{limit} = $limit;
$PL_ENTRY_JSON_QUERY->{offset} = $offset;
@@ -512,15 +509,8 @@
my @ids;
push(@ids, $_->{id}) for @$entries;
+ return \@ids if $$options{idlist} or not @ids;
- # collect lineitems that don't have the requested sort attr
- my $other_entries = $e->search_acq_lineitem(
- {id => {'not in' => [@ids]}, picklist=>$picklist_id},{idlist=>1});
- push(@ids, $_) for @$other_entries;
-
- return \@ids if $$options{idlist};
- return [] unless @ids;
-
if($$options{flesh_attrs}) {
$entries = $e->search_acq_lineitem([
{id => \@ids},
More information about the open-ils-commits
mailing list