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

SF.net SVN: ledger-smb:[4518] branches/1.3



Revision: 4518
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4518&view=rev
Author:   einhverfr
Date:     2012-03-21 12:40:21 +0000 (Wed, 21 Mar 2012)
Log Message:
-----------
Parts search object added

Modified Paths:
--------------
    branches/1.3/LedgerSMB/ScriptLib/Common_Search/Part.pm
    branches/1.3/UI/Contact/pricelist.html

Added Paths:
-----------
    branches/1.3/LedgerSMB/DBObject/Part.pm

Added: branches/1.3/LedgerSMB/DBObject/Part.pm
===================================================================
--- branches/1.3/LedgerSMB/DBObject/Part.pm	                        (rev 0)
+++ branches/1.3/LedgerSMB/DBObject/Part.pm	2012-03-21 12:40:21 UTC (rev 4518)
@@ -0,0 +1,72 @@
+=head1 NAME
+
+LedgerSMB::DBObject::Part - Base parts functions to support new 1.3 stuff
+
+=head1 SYNOPSIS
+
+ my $psearch  = LedgerSMB::DBObject::Part->new({base => $request});
+ my $results = $psearch->search_lite(
+           {partnumber => '124', 
+           description => '200GB USB Drive' };
+
+
+=cut
+
+package LedgerSMB::DBObject::Part;
+use base qw(LedgerSMB::DBObject);
+use strict;
+use warnings;
+
+=head1 DESCRIPTION
+
+This package contains the basic parts search functions for 1.3.  In future
+versions this may be heavily expanded.
+
+=head1 PROPERTIES
+
+None yet
+
+=head1 METHODS
+
+=over
+
+=item search_lite($args)
+
+This performs a light-weight search, suitable for parts lookups, not heavy parts
+searching.  It takes a single hashref as an argument, which contains any of the
+following attributes
+
+=over
+
+=item partnumber 
+
+This matches on the beginning of the string of the partnumber only.
+
+=item description
+
+This is a full text search of the description.  So '200GB USB Drive' matches
+'USB Hard Drive, 200GB' as well as 'Thumb drive, USB, 200gb'.  This is believed
+to currently be the most forgiving yet useful way of doing this part of the
+search.
+
+=back
+
+=cut
+
+sub search_lite {
+    my ($self, $args) = @_;
+    return $self->call_procedure(procname => 'parts__search_lite',
+                                     args => [$args->{partnumber},
+                                              $args->{description},]
+    );
+}
+
+=head1 COPYRIGHT
+
+Copyright (C) 2012 The LedgerSMB Core Team.  This file may be re-used under the
+terms of the GNU General Public License version 2 or at your option any later
+version.  Please see the included LICENSE.txt for more information.
+
+=cut
+
+return 1;

Modified: branches/1.3/LedgerSMB/ScriptLib/Common_Search/Part.pm
===================================================================
--- branches/1.3/LedgerSMB/ScriptLib/Common_Search/Part.pm	2012-03-21 12:21:55 UTC (rev 4517)
+++ branches/1.3/LedgerSMB/ScriptLib/Common_Search/Part.pm	2012-03-21 12:40:21 UTC (rev 4518)
@@ -88,7 +88,7 @@
 
 sub search {
     my ($self, $args) = @_;
-    @results = $self->{_part}->search($args);
+    @results = $self->{_part}->search_lite($args);
     $self->{_results} = ..hidden..;
     return $self->{_results};
 }

Modified: branches/1.3/UI/Contact/pricelist.html
===================================================================
--- branches/1.3/UI/Contact/pricelist.html	2012-03-21 12:21:55 UTC (rev 4517)
+++ branches/1.3/UI/Contact/pricelist.html	2012-03-21 12:40:21 UTC (rev 4518)
@@ -68,7 +68,8 @@
       PROCESS dynatable
     attributes = { id = 'pricematrix' }
          tbody = { rows = pricematrix }
-         tfoot = { coltypes = { int_partnumber = 'input_text' }
+         tfoot = { coltypes = { int_partnumber = 'input_text',
+                                   description = 'input_text', }
                    rows = [{}]} ?>
 <?lsmb PROCESS button element_data = {
     type = "submit"

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