[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb:[5454] trunk/LedgerSMB/PE.pm



Revision: 5454
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=5454&view=rev
Author:   einhverfr
Date:     2013-01-01 10:24:09 +0000 (Tue, 01 Jan 2013)
Log Message:
-----------
Centralizing use of old code partsgroup list on new stored procedure

Modified Paths:
--------------
    trunk/LedgerSMB/PE.pm

Modified: trunk/LedgerSMB/PE.pm
===================================================================
--- trunk/LedgerSMB/PE.pm	2013-01-01 10:08:03 UTC (rev 5453)
+++ trunk/LedgerSMB/PE.pm	2013-01-01 10:24:09 UTC (rev 5454)
@@ -314,43 +314,10 @@
 
 sub partsgroups {
     my ( $self, $myconfig, $form ) = @_;
-
-    my $var;
-
     my $dbh = $form->{dbh};
-
-    $form->{sort} = "partsgroup" unless $form->{partsgroup};
-    my @a         = qw(partsgroup);
-    my $sortorder = $form->sort_order( ..hidden.. );
-
-    my $query = qq|SELECT g.* FROM partsgroup g|;
-
-    my $where = "1 = 1";
-
-    if ( $form->{partsgroup} ne "" ) {
-        $var = $dbh->quote( $form->like( lc $form->{partsgroup} ) );
-        $where .= " AND lower(partsgroup) LIKE $var";
-    }
-    $query .= qq| WHERE $where ORDER BY $sortorder|;
-
-    if ( $form->{status} eq 'orphaned' ) {
-        $query = qq|
-			   SELECT g.*
-			     FROM partsgroup g
-			LEFT JOIN parts p ON (p.partsgroup_id = g.id)
-			    WHERE $where
-			EXCEPT
-			   SELECT g.*
-			     FROM partsgroup g
-			     JOIN parts p ON (p.partsgroup_id = g.id)
-			    WHERE $where
-			 ORDER BY $sortorder|;
-    }
-
-    $sth = $dbh->prepare($query);
-    $sth->execute || $form->dberror($query);
-
-    my $i = 0;
+    my $sth = $dbh->prepare("select * from partsgroup__search(null)");
+    $sth->execute;
+    
     while ( my $ref = $sth->fetchrow_hashref(NAME_lc) ) {
         push @{ $form->{item_list} }, $ref;
         $i++;

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.