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

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



Revision: 1880
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=1880&view=rev
Author:   einhverfr
Date:     2007-11-19 23:36:30 -0800 (Mon, 19 Nov 2007)

Log Message:
-----------
Customer screen now renders reasonably well.
TODO:  Needs a lot of CSS work to beautify.
Also CSS/Javascript could be used to create a tabbed interface for this screen.
Also, a lot of issues with stored procedures have been fixed.

Modified Paths:
--------------
    trunk/LedgerSMB/DBObject/Customer.pm
    trunk/UI/Customer/customer.html
    trunk/UI/lib/ui-header.html
    trunk/scripts/customer.pl
    trunk/sql/modules/Customer.sql
    trunk/sql/modules/Location.sql
    trunk/sql/modules/Settings.sql
    trunk/sql/modules/Vendor.sql

Modified: trunk/LedgerSMB/DBObject/Customer.pm
===================================================================
--- trunk/LedgerSMB/DBObject/Customer.pm	2007-11-18 20:35:31 UTC (rev 1879)
+++ trunk/LedgerSMB/DBObject/Customer.pm	2007-11-20 07:36:30 UTC (rev 1880)
@@ -5,41 +5,26 @@
 use LedgerSMB::Entity;
 
 sub save {
-    
-    # this is doing way too much.
-    
     my $self = shift @_;
-    
-    my $entity;
-    
-    # this is a fairly effective way of telling if we need to create a new
-    # entity or not.
-    
-    if (!$self->{entity_id}) {
-        
-        $entity = LedgerSMB::Entity->new(base=>$request);
-    }
-    else {
-        
-        $entity = LedgerSMB::Entity->get(id=>$self->{entity_id});
-    }
-    
-    $entity->set(name=> $reqeust->{first_name}." ".$request->{last_name} );
-    $entity->set(entity_class=>2);
 
-    $self->set(entity_id=>$entity->{id});
-    $self->set(entity_class=> 2);
-    
-    $entity->save();
-    if (!self->{entity_id}) {
-        
-        $self->{entity_id} = $entity->{id};
-    }
-    $self->SUPER::save();
-    
-    return $self->{id};
+    # This saves both the entity and the credit account. -- CT
+    $self->{entity_class} = 2;
+    $self->{id} = $self->exec_method(funcname => 'entity_credit_save');
 }
 
+sub get_metadata {
+    my $self = shift @_;
+
+    @{$self->{location_class}} = 
+         $self->exec_method(funcname => 'location_list_class');
+
+    @{$self->{country}} = 
+         $self->exec_method(funcname => 'location_list_country');
+
+    @{$self->{contact_class}} = 
+         $self->exec_method(funcname => 'entity_list_contact_class');
+}
+
 sub search {
     
     

Modified: trunk/UI/Customer/customer.html
===================================================================
--- trunk/UI/Customer/customer.html	2007-11-18 20:35:31 UTC (rev 1879)
+++ trunk/UI/Customer/customer.html	2007-11-20 07:36:30 UTC (rev 1880)
@@ -1,13 +1,20 @@
-<?lsmb PROCESS 'ui-header.html' ?>
+<?lsmb script_css = "Customer/customer.css" ?><?lsmb PROCESS 'ui-header.html' ?>
+<?lsmb PROCESS 'elements.html' ?>
 <body>
+<div class="navigation" id="nav_div">
+</div>
+<div class="container" id="customer_div">
 <div class="listtop"><strong><?lsmb text('Add/Edit Customer') ?></strong></div>
-<div class="customer">
     <?lsmb IF name ?> 
     <font size="17"><?lsmb name?></font>
     <?lsmb END ?>
-<form name="customer" method="POST" action="vendor.pl">
+<form name="customer" method="POST" action="customer.pl">
+	<input type="hidden" name="entity_id" value="<?lsmb entity_id ?>">
 	<label for="name"><?lsmb text('Name:') ?></label>
 	<input name="name" id="name" type="text" value="<?lsmb name ?>"><br/>
+	<label for="meta_number"><?lsmb text('Account Number:') ?></label>
+	<input name="meta_number" id="meta_number" type="text" 
+		value="<?lsmb meta_number?>"><br/>
         <table>
        <?lsmb IF ordered ?> 
         <tr>
@@ -48,7 +55,7 @@
         </tr>
         <tr>
             <td>
-                <label for"creditlimit"><?lsmb text('Credit Limit:') ?></label>
+                <label for="creditlimit"><?lsmb text('Credit Limit:') ?></label>
                 <input id="creditlimit" name="creditlimit" type="text" 
 			value="<?lsmb creditlimit ?>">
             </td>
@@ -66,7 +73,7 @@
 			value="<?lsmb taxnumber ?>">                
             </td>
             <td>
-                <label for"gifi_accno"><?lsmb text('Subcontract GIFI:') ?>
+                <label for="gifi_accno"><?lsmb text('Subcontract GIFI:') ?>
 		</label>
                 <input id="gifi_accno" name="gifi_accno" type="text" 
 			value="<?lsmb gifi_accno ?>">
@@ -81,34 +88,22 @@
 		size="3" value="<?lsmb discount_days ?>">  
             </td>
             <td>
-                <label for"sic_code"><?lsmb text('SIC Code:') ?></label>
+                <label for="sic_code"><?lsmb text('SIC Code:') ?></label>
                 <input id="sic_code" name="sic_code" type="text" 
 			value="<?lsmb sic_code ?>">
             </td>
         </tr>
         <tr>
             
-            <td>
-                <label for"bic"><?lsmb text('BIC:') ?></label>
-                <input id="bic" name="bic" type="text" 
-			value="<?lsmb bic ?>">
-            </td>
-            <td>
-                <label for="iban"><?lsmb text('IBAN:') ?></label>
-                <input id="iban" name="iban" type="text" 
-			value="<?lsmb iban ?>">
-            </td>
-        </tr>
-        
         <tr>
             <td>
                 <label for="notes"><?lsmb text('Notes:') ?></label><br/>
                 <textarea name="notes" rows="3" cols="40" id="notes"><?lsmb 
 			notes
 		?></textarea>
-		<!-- The prior funny whitespace may look funny but it prevents
-		additional whitespace from being added to the data every time 
-		it is saved -->
+		<!-- CT: The prior funny whitespace may look funny but it 
+		prevents additional whitespace from being added to the data 
+		every time it is saved.  -->
             </td>
         </tr>
     </table>
@@ -156,13 +151,166 @@
 			<?lsmb text('Pricelist') ?></button>
     </form>
 </div>
-<div id="locations">
+<?lsmb #IF id ?>
+<div id="locations" class="container">
     <div class="listtop"><?lsmb text('Locations') ?></div>
 	<!-- This entire form should probably be optionaly automated with AJAX
 	in oder to prevent user confusion -->
     <form id="location_form" action="vendor.pl">
-	<!-- todo, add location management! -->
+	<input type="hidden" name="entity_id" value="<?lsmb entity_id ?>">
+	<input type="hidden" name="location_id" value="<?lsmb location_id ?>">
+    <table width="100%">
+    <tr class="listheading">
+        <th class="type"><?lsmb text('Type') ?></th>
+        <th class="line_one"><?lsmb text('Address1') ?></th>
+        <th class="city"><?lsmb text('City') ?></th>
+        <th class="state"><?lsmb text('State/Province') ?></th>
+        <th class="mail_code"><?lsmb text('ZIP/Post Code') ?></th>
+        <th class="country"><?lsmb text('Country') ?></th>
+	<th class="actions"><?lsmb text('Actions') ?></th>
+    </tr>
+	<?lsmb FOREACH loc = locations ?>
+    <tr>
+	<td class="type"><?lsmb loc.type ?></td>
+	<td class="line_one"><?lsmb loc.line_one ?></td>
+	<td class="city"><?lsmb loc.city ?></td>
+	<td class="state"><?lsmb loc.state ?></td>
+	<td class="mail_code"><?lsmb loc.mail_code ?></td>
+	<td class="country"><?lsmb loc.country ?></td>
+	<td class="actions">
+		<!--  TODO:  Automate links with AJAX -->
+		<a href="customer.pl?action=edit&entity_id=<?lsmb id 
+			?>&location_id=<?lsmb loc.id ?>">[edit]</a> 
+		<a href="customer.pl?action=delete_location&entity_id=<?lsmb
+			id ?>&location_id=<?lmb loc.id ?>">[delete]</a>
+	</td>
+    </tr>
+	<?lsmb END ?>
+    </table>
+	<div> 
+		<label for="loc_type"><?lsmb text('Type:') ?></label>
+		<select name='loc_type'>
+		<?lsmb FOREACH lc = location_class ?>
+		<option value="<?lsmb lc.id ?>"><?lsmb lc.class ?></option>
+		<?lsmb END ?>
+		</select>
+	</div>
+	<div> 
+		<label for="line_one"><?lsmb text('Address:') ?></label>
+		<input name="line_one" id="line_one"/>
+	</div>
+	<div> 
+		<input name="line_two" id="line_two"/>
+	</div>
+	<div> 
+		<input name="line_three" id="line_three"/>
+	</div>
+	<div> 
+		<label for="city"><?lsmb text('City:') ?></label>
+		<input name="city" id="city"/>
+	</div>
+	<div> 
+		<label for="state"><?lsmb text('State/Province:') ?></label>
+		<input name="state" id="state"/>
+	</div>
+	<div> 
+		<label for="mail_code"><?lsmb text('Zip/Post Code:') ?></label>
+		<input name="mail_code" id="mail_code"/>
+	</div>
+	<div> 
+		<label for="country"><?lsmb text('Country:') ?></label>
+		<select name="country" id="country">
+		<?lsmb FOREACH c = country ?>
+		<option value="<?lsmb c.id ?>"><?lsmb c.name ?></option>
+		<?lsmb END ?>
+		</select>
+	</div>
+	<div><button type=submit class="submit" name=submit value="add_location"
+		id="loc_save_location">Save Location</button>
+	</div>
     </form>
 </div>
+<div class="container" id="contact_div">
+	<div class="listtop"><?lsmb text('Contact Information') ?></div>
+	<table width="100%">
+	<tr class="listheading">
+		<th class="contact_class"><?lsmb text('Type:') ?></th>
+		<th class="contact"><?lsmb text('Contact Info:') ?></th>
+		<th class="contact_actions"><?lsmb text('Actions:') ?></th>
+	</tr>
+	<?lsmb FOREACH ct = contacts ?>
+	<tr>
+		<td class="contact_class"><?lsmb ct.class ?></td>
+		<td class="contact"><?lsmb ct.contact ?></td>
+		<td class="contact_actions">
+			<a href="customer.pl?entity_id=<?lsmb entity_id 
+				?>&contact_id=<?lsmb ct.id 
+				?>&action=edit_contact"
+			>[<?lsmb text('Edit'); ?>]</a>&nbsp;&nbsp;
+			<a href="customer.pl?entity_id=<?lsmb entity_id 
+				?>&contact_id=<?lsmb ct.id 
+				?>&action=delete_contact"
+			>[<?lsmb text('Delete'); ?>]</a>
+		</td>
+	</tr>
+	<?lsmb END ?>
+	</table>
+	<form action="customer.pl">
+	<input type="hidden" name="entity_id" value="<?lsmb entity_id ?>">
+	<input type="hidden" name="contact_id" value="<?lsmb contact_id ?>">
+	<div><label for="contact_type"><?lsmb text('Type:') ?></label>
+		<select name="contact_class" id="contact_type">
+		<?lsmb FOREACH cc = contact_class ?>
+		<option value="<?lsmb cc.id ?>"><?lsmb cc.class ?></option>
+		<?lsmb END ?>
+		</select>
+	</div>
+	<div><label for="contact_info"><?lsmb text('Contact Info:') ?></label>
+	<input type="text" id="contact_info" name="contact" 
+		value="<?lsmb contact ?>">
+	</div>
+	<div><button name="action" id="contact_action_save" 
+		value="save_contact"><?lsmb text('Save Contact') ?></button>
+	</div>
+	
+</div>
+<div class="container" id="bank_div">
+<div class="listtop"><?lsmb text('Bank Accounts') ?></div>
+<table width="100%">
+<tr class="listheading">
+	<th class="bic"><?lsmb text('BIC/SWIFT Code') ?></th>
+	<th class="iban"><?lsmb text('Account Number') ?></th>
+	<th class="actions"><?lsmb text('Actions>') ?></th>
+</tr>
+<?lsmb FOREACH ba = bank_account ?>
+<tr>
+	<td class="bic"><?lsmb ba.bic ?></td>
+	<td class="iban"><?lsmb ba.iban ?></td>
+	<td class="actions">
+		<a href="customer.pl?action=edit_bank_acct&entity_id=<?lsmb
+			entity_id ?>&bank_account_id=<?lsmb ba.id ?>"
+			>[Edit]</a> 
+		<a href="customer.pl?action=delete_bank_acct&entity_id=<?lsmb
+			entity_id ?>&bank_account_id=<?lsmb ba.id ?>"
+			>[Delete]</a> 
+	</td>
+</tr>
+<?lsmb END ?>
+</table>
+<form action="customer.pl">
+	<input type="hidden" name="entity_id" value="<?lsmb entity_id ?>">
+	<input type="hidden" name="bank_account_id" 
+		value="<?lsmb bank_account_id ?>">
+	<div><label for="bic"><?lsmb text('BIC/SWIFT Code:') ?></label>
+		<input type="text" name="bic" id="bic" value="<?lsmb bic ?>">
+	</div>
+	<div><label for="iban"><?lsmb text('Bank Account:') ?></label>
+		<input type="text" name="iban" id="iban" value="<?lsmb iban ?>">
+	</div>
+	<div><button id="bank_account_save" name="action" 
+		value="save_bank_account"><?lsmb text('Save') ?></button>
+	</div>
+</div>
+<?lsmb #END ?>
 </body>
 </html>

Modified: trunk/UI/lib/ui-header.html
===================================================================
--- trunk/UI/lib/ui-header.html	2007-11-18 20:35:31 UTC (rev 1879)
+++ trunk/UI/lib/ui-header.html	2007-11-20 07:36:30 UTC (rev 1880)
@@ -11,8 +11,8 @@
 	<?lsmb ELSE ?>
 	<link rel="stylesheet" href="css/<?lsmb stylesheet ?>" type="text/css" title="LedgerSMB stylesheet" />
 	<?lsmb END ?>
-	<?lsmb IF script ?>
-	<link rel="stylesheet" href="css/<?lsmb script ?>.css" type="text/css" title="LedgerSMB stylesheet" />
+	<?lsmb IF script_css ?>
+	<link rel="stylesheet" href="UI/<?lsmb script_css ?>" type="text/css" title="LedgerSMB stylesheet" />
 	<?lsmb END ?>
 	
 

Modified: trunk/scripts/customer.pl
===================================================================
--- trunk/scripts/customer.pl	2007-11-18 20:35:31 UTC (rev 1879)
+++ trunk/scripts/customer.pl	2007-11-20 07:36:30 UTC (rev 1880)
@@ -72,6 +72,9 @@
     my ($request) = @_;
     my $customer = LedgerSMB::DBObject::Customer->new(base => $request, copy => 'all');
     $customer->set(entity_class=>2);
+
+    $customer->get_metadata();
+
     my $template = LedgerSMB::Template->new( 
 	user => $user, 
 	template => 'customer', 
@@ -79,7 +82,7 @@
 	locale => $request->{_locale}, 
         format => 'HTML');
     $request->{script} = 'Customer/customer';
-    $template->render($request);
+    $template->render($customer);
 }
 
 =pod
@@ -145,26 +148,16 @@
 sub save {
     
     my ($request) = @_;
-    
-    if ($request->type() == 'POST') {
-        
-        my $customer = LedgerSMB::DBObject::Customer->get(base=>$request, copy=>'all');
-        
-        unless ($customer) {
-            
-            $customer = LedgerSMB::DBObject::Customer->new(base=>$reqest, copy=>'all');
-        }
-        
-        my $result = $customer->save();
 
-        my $template = LedgerSMB::Template->new( user => $user, 
-    	template => 'Customer/customer', language => $user->{language}, 
+    my $customer = LedgerSMB::DBObject::Customer->new({base => $request});
+
+    my $result = $customer->save();
+
+    my $template = LedgerSMB::Template->new( user => $request->{_user}, 
+    	template => 'customer', locale => $request->{_locale},
+	path => 'UI/Customer',
             format => 'HTML');
-        $template->render($result);
-    } 
-    else {
-        
-    }
+    $template->render($customer);
 }
 
 1;

Modified: trunk/sql/modules/Customer.sql
===================================================================
--- trunk/sql/modules/Customer.sql	2007-11-18 20:35:31 UTC (rev 1879)
+++ trunk/sql/modules/Customer.sql	2007-11-20 07:36:30 UTC (rev 1880)
@@ -1,5 +1,17 @@
 BEGIN;
 
+CREATE OR REPLACE FUNCTION entity_list_contact_class() 
+RETURNS SETOF contact_class AS
+$$
+DECLARE out_row RECORD;
+BEGIN
+	FOR out_row IN
+		SELECT * FROM contact_class ORDER BY id
+	LOOP
+		RETURN NEXT out_row;
+	END LOOP;
+END;
+$$ language plpgsql;
 
 CREATE TYPE customer_search_return AS (
         legal_name text,
@@ -28,25 +40,23 @@
 -- $$ This structure will change greatly in 1.4.  
 -- If you want to reply on it heavily, be prepared for breakage later.  $$;
 
-CREATE OR REPLACE FUNCTION customer_save (
-    in_id int,
+CREATE OR REPLACE FUNCTION entity_credit_save (
+    in_id int, in_entity_class int,
     
     in_discount numeric, in_taxincluded bool, in_creditlimit numeric, 
     in_discount_terms int,
-    in_terms int, in_meta_number varchar(32), in_cc text, in_bcc text, 
-    in_business_id int, in_language varchar(6), in_pricegroup_id int, 
+    in_terms int, in_meta_number varchar(32), in_business_id int, 
+    in_language varchar(6), in_pricegroup_id int, 
     in_curr char, in_startdate date, in_enddate date, 
-    
-    in_bic text, in_iban text, 
-    
     in_notes text, 
-    
     in_name text, in_tax_id TEXT,
     in_threshold NUMERIC
     
 ) returns INT as $$
     
     -- does not require entity_class, as entity_class is a known given to be 1
+
+    -- Maybe we should make this generic and pass through?  -- CT
     
     DECLARE
         t_entity_class int;
@@ -55,20 +65,19 @@
         l_id int;
     BEGIN
         
-        t_entity_class := 1;
         
         SELECT INTO v_row * FROM company WHERE id = in_id;
         
         IF NOT FOUND THEN
             -- do some inserts
             
-            new_entity_id := nextval('entity_id_seq');
+            select nextval('entity_id_seq') into new_entity_id;
             
             insert into entity (id, name, entity_class) 
-                VALUES (new_entity_id, in_name, t_entity_class);
+                VALUES (new_entity_id, in_name, in_entity_class);
             
-            INSERT INTO company ( id, entity_id, legal_name, tax_id ) 
-                VALUES ( in_id, new_entity_id, in_name, in_tax_id );
+            INSERT INTO company ( entity_id, legal_name, tax_id ) 
+                VALUES ( new_entity_id, in_name, in_tax_id );
             
             INSERT INTO entity_credit_account (
                 entity_id,
@@ -78,27 +87,23 @@
                 creditlimit,
                 terms,
                 meta_number,
-                cc,
-                bcc,
                 business_id,
                 language_code,
                 pricegroup_id,
                 curr,
                 startdate,
                 enddate,
-                discountterms,
+                discount_terms,
                 threshold
             )
             VALUES (
                 new_entity_id,
-                t_entity_class,
+                in_entity_class,
                 in_discount, 
                 in_taxincluded,
                 in_creditlimit,
                 in_terms,
                 in_meta_number,
-                in_cc,
-                in_bcc,
                 in_business_id,
                 in_language,
                 in_pricegroup_id,
@@ -106,22 +111,13 @@
                 in_startdate,
                 in_enddate,
                 in_discount_terms,
-                in_threashold
+                in_threshold
             );
-            INSERT INTO entity_bank_account (
-                entity_id,
-                bic,
-                iban
-            )
-            VALUES (
-                new_entity_id,
-                in_bic,
-                in_iban
-            );            
             -- entity note class
             insert into entity_note (note_class, note, ref_key, vector) VALUES (
                 1, in_notes, new_entity_id, '');
-             
+            return new_entity_id;
+
         ELSIF FOUND THEN
         
             update company set tax_id = in_tax_id where id = in_id;
@@ -131,8 +127,6 @@
                 creditlimit = in_creditlimit,
                 terms = in_terms,
                 meta_number = in_meta_number,
-                cc = in_cc,
-                bcc = in_bcc,
                 business_id = in_business_id,
                 language_code = in_language,
                 pricegroup_id = in_pricegroup_id,
@@ -143,17 +137,13 @@
                 discount_terms = in_discount_terms
             where entity_id = v_row.entity_id;
             
-            UPDATE entity_bank_account SET
-                bic = in_bic,
-                iban = in_iban
-            WHERE entity_id = v_row.entity_id;
             
             UPDATE entity_note SET
                 note = in_note
             WHERE ref_key = v_row.entity_id;
+            return in_id;
         
         END IF;
-        return in_id;
     END;
     
 $$ language 'plpgsql';
@@ -161,15 +151,14 @@
 CREATE OR REPLACE FUNCTION customer_location_save (
     in_company_id int,
     in_location_class int, in_line_one text, in_line_two text, 
-    in_city_province TEXT, in_mail_code text, in_country_code int,
-    in_created date
+    in_line_three text,
+    in_city TEXT, in_state text, in_mail_code text, in_country_code int
 ) returns int AS $$
     BEGIN
     return _entity_location_save(
         in_company_id,
-        in_location_class, in_line_one, in_line_two, 
-        in_city_province , in_mail_code, in_country_code,
-        in_created);
+        in_location_class, in_line_one, in_line_two, in_line_three,
+        in_city, in_state, in_mail_code, in_country_code);
     END;
 
 $$ language 'plpgsql';

Modified: trunk/sql/modules/Location.sql
===================================================================
--- trunk/sql/modules/Location.sql	2007-11-18 20:35:31 UTC (rev 1879)
+++ trunk/sql/modules/Location.sql	2007-11-20 07:36:30 UTC (rev 1880)
@@ -1,4 +1,31 @@
 -- VERSION 1.3.0
+
+CREATE OR REPLACE FUNCTION location_list_class()
+RETURNS SETOF location_class AS
+$$
+DECLARE out_row RECORD;
+BEGIN
+	FOR out_row IN
+		SELECT * FROM location_class ORDER BY id
+	LOOP
+		RETURN NEXT out_row;
+	END LOOP;
+END;
+$$ language plpgsql;
+
+CREATE OR REPLACE FUNCTION location_list_country()
+RETURNS SETOF country AS
+$$
+DECLARE out_row RECORD;
+BEGIN
+	FOR out_row IN
+		SELECT * FROM country ORDER BY id
+	LOOP
+		RETURN NEXT out_row;
+	END LOOP;
+END;
+$$ language plpgsql;
+
 CREATE OR REPLACE FUNCTION location_save
 (in_address1 text, in_address2 text, in_address3 text,
 	in_city text, in_state text, in_zipcode text, in_country text) 
@@ -16,13 +43,13 @@
 		city = in_city AND
 		state = in_state AND
 		zipcode = in_zipcode AND
-		country = in_country
+		country_id = in_country
 	LIMIT 1;
 	IF FOUND THEN
 		return location_row.id;
 	END IF;
 	INSERT INTO location 
-	(companyname, address1, address2, city, state, zipcode, country)
+	(companyname, address1, address2, city, state, zipcode, country_id)
 	VALUES
 	(in_companyname, in_address1, in_address2, in_city, in_state,
 		in_zipcode, in_country);

Modified: trunk/sql/modules/Settings.sql
===================================================================
--- trunk/sql/modules/Settings.sql	2007-11-18 20:35:31 UTC (rev 1879)
+++ trunk/sql/modules/Settings.sql	2007-11-20 07:36:30 UTC (rev 1880)
@@ -7,6 +7,7 @@
 	UPDATE defaults SET value = in_value WHERE setting_key = in_key;
 	RETURN;
 END;
+$$ language plpgsql;
 
 CREATE OR REPLACE FUNCTION setting_get (in_key varchar) RETURNS varchar AS
 $$
@@ -23,7 +24,7 @@
 $$
 DECLARE
 	account defaults%ROWTYPE;
-BEGIN;
+BEGIN
 	FOR account IN 
 		SELECT * FROM defaults 
 		WHERE setting_key like '%accno_id'
@@ -33,13 +34,13 @@
 END;
 $$ LANGUAGE plpgsql;
 
-CREATE OR REPLACE FUNCTION setting_incriment (in_key varchar) returns varchar
+CREATE OR REPLACE FUNCTION setting_increment (in_key varchar) returns varchar
 AS
 $$
 DECLARE
 	base_value VARCHAR;
 	raw_value VARCHAR;
-	incriment INTEGER;
+	increment INTEGER;
 	inc_length INTEGER;
 	new_value VARCHAR;
 BEGIN
@@ -51,10 +52,10 @@
 	INTO base_value;
 
 	IF base_value like '0%' THEN
-		incriment := base_value::integer + 1;
-		SELECT char_length(incriment::text) INTO inc_length;
+		increment := base_value::integer + 1;
+		SELECT char_length(increment::text) INTO inc_length;
 
-		SELECT overlay(base_value placing incriment::varchar
+		SELECT overlay(base_value placing increment::varchar
 			from (select char_length(base_value) 
 				- inc_length + 1) for inc_length)
 		INTO new_value;

Modified: trunk/sql/modules/Vendor.sql
===================================================================
--- trunk/sql/modules/Vendor.sql	2007-11-18 20:35:31 UTC (rev 1879)
+++ trunk/sql/modules/Vendor.sql	2007-11-20 07:36:30 UTC (rev 1880)
@@ -171,9 +171,9 @@
 
 create or replace function _entity_location_save(
     in_company_id int, in_location_id int,
-    in_location_class int, in_line_one text, in_line_two text,
-    in_city TEXT, in_state TEXT, in_mail_code text, in_country_code int,
-    in_created date
+    in_location_class int, in_line_one text, in_line_two text, 
+    in_line_three text, in_city TEXT, in_state TEXT, in_mail_code text, 
+    in_country_code int
 ) returns int AS $$
 
     DECLARE
@@ -185,7 +185,7 @@
 		AND location_class = in_location_class
 		AND location_id = in_location_id;
 
-	SELECT location_save(in_line_one, in_line_two, NULL, in_city,
+	SELECT location_save(in_line_one, in_line_two, in_line_three, in_city,
 		in_state, in_mail_code, in_mail_code, in_country_code) 
 	INTO l_id;
 


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