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

SF.net SVN: ledger-smb:[3663] trunk



Revision: 3663
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=3663&view=rev
Author:   einhverfr
Date:     2011-08-16 23:32:45 +0000 (Tue, 16 Aug 2011)

Log Message:
-----------
Retrieving by entity control code now works

Modified Paths:
--------------
    trunk/LedgerSMB/DBObject/Company.pm
    trunk/LedgerSMB/ScriptLib/Company.pm
    trunk/UI/Contact/contact.css
    trunk/UI/Contact/contact.html
    trunk/sql/modules/Company.sql

Modified: trunk/LedgerSMB/DBObject/Company.pm
===================================================================
--- trunk/LedgerSMB/DBObject/Company.pm	2011-08-16 22:34:16 UTC (rev 3662)
+++ trunk/LedgerSMB/DBObject/Company.pm	2011-08-16 23:32:45 UTC (rev 3663)
@@ -48,6 +48,30 @@
 
 =over
 
+=item get_by_cc
+
+This retrieves the company header information by control code.  Leaves the 
+overall account class untouched.
+
+=back
+
+=cut
+
+sub get_by_cc {
+    my $self = shift @_;
+    my $entity_class = $self->{entity_class};
+    my ($ref) = $self->exec_method({funcname => 'entity__get_by_cc'});
+    $self->merge($ref);
+    $self->{entity_id} = $self->{id};
+    delete $self->{id};
+    $self->get;
+    $self->get_metadata;
+    $self->{entity_class} = $entity_class;
+}
+
+
+=over
+
 =item save()
 
 This stores the company record including a credit account in the database.

Modified: trunk/LedgerSMB/ScriptLib/Company.pm
===================================================================
--- trunk/LedgerSMB/ScriptLib/Company.pm	2011-08-16 22:34:16 UTC (rev 3662)
+++ trunk/LedgerSMB/ScriptLib/Company.pm	2011-08-16 23:32:45 UTC (rev 3663)
@@ -47,6 +47,21 @@
        "directly!");
 }
 
+
+=item get_by_cc 
+
+Populates the company area with info on the company, pulled up through the 
+control code
+
+=cut
+
+sub get_by_cc {
+   my ($request) = @_;
+   my $company = new_company($request);
+   $company->get_by_cc();   
+   _render_main_screen($company);
+}
+
 =item dispatch_legacy
 
 This is a semi-private method which interfaces with the old code.  Note that

Modified: trunk/UI/Contact/contact.css
===================================================================
--- trunk/UI/Contact/contact.css	2011-08-16 22:34:16 UTC (rev 3662)
+++ trunk/UI/Contact/contact.css	2011-08-16 23:32:45 UTC (rev 3663)
@@ -52,7 +52,7 @@
 }
 div.input_group2 {
         display: block;
-        float: left;
+        float: left; 
 }
 div.input_group3 {
         display: block;
@@ -72,7 +72,6 @@
 }
 
 #company_div div.input_group2 {
-        width: 28em;
 }
 
 #company_div label {

Modified: trunk/UI/Contact/contact.html
===================================================================
--- trunk/UI/Contact/contact.html	2011-08-16 22:34:16 UTC (rev 3662)
+++ trunk/UI/Contact/contact.html	2011-08-16 23:32:45 UTC (rev 3663)
@@ -292,6 +292,13 @@
 		value = "generate_control_code"
 		class = "submit"
         } ?>
+        <?lsmb PROCESS button element_data = {
+                text = text('Retrieve')
+                type = 'submit'
+                name = 'action'
+               value = 'get_by_cc'
+               class = 'submit'
+        } ?>
 </div>
 </div>
 <div class="input_line">

Modified: trunk/sql/modules/Company.sql
===================================================================
--- trunk/sql/modules/Company.sql	2011-08-16 22:34:16 UTC (rev 3662)
+++ trunk/sql/modules/Company.sql	2011-08-16 23:32:45 UTC (rev 3663)
@@ -526,6 +526,13 @@
 COMMENT ON FUNCTION company_retrieve (in_entity_id int) IS
 $$ Returns all attributes for the company attached to the entity.$$;
 
+CREATE OR REPLACE FUNCTION entity__get_by_cc (in_control_code text)
+RETURNS SETOF entity AS $$
+SELECT * FROM entity WHERE control_code = $1 $$ language sql;
+
+COMMENT ON entity__get_by_cc (in_control_code text) IS
+$$ Returns the entity row attached to the control code. $$;
+
 create or replace function save_taxform 
 (in_country_code int, in_taxform_name text)
 RETURNS bool AS
@@ -1292,3 +1299,4 @@
     in_entity_class int
 ) IS 
 $$ Returns a list of all entity credit accounts attached to that entity.$$;
+


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