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

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



Revision: 1882
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=1882&view=rev
Author:   einhverfr
Date:     2007-11-20 11:43:27 -0800 (Tue, 20 Nov 2007)

Log Message:
-----------
A few more Customer improvements

Modified Paths:
--------------
    trunk/LedgerSMB/DBObject/Customer.pm
    trunk/UI/Customer/customer.html
    trunk/scripts/customer.pl
    trunk/sql/modules/Customer.sql

Modified: trunk/LedgerSMB/DBObject/Customer.pm
===================================================================
--- trunk/LedgerSMB/DBObject/Customer.pm	2007-11-20 07:37:25 UTC (rev 1881)
+++ trunk/LedgerSMB/DBObject/Customer.pm	2007-11-20 19:43:27 UTC (rev 1882)
@@ -9,7 +9,9 @@
 
     # This saves both the entity and the credit account. -- CT
     $self->{entity_class} = 2;
-    $self->{id} = $self->exec_method(funcname => 'entity_credit_save');
+    
+    $self->{entity_id} = $self->exec_method(funcname => 'entity_credit_save');
+    $self->{dbh}->commit;
 }
 
 sub get_metadata {

Modified: trunk/UI/Customer/customer.html
===================================================================
--- trunk/UI/Customer/customer.html	2007-11-20 07:37:25 UTC (rev 1881)
+++ trunk/UI/Customer/customer.html	2007-11-20 19:43:27 UTC (rev 1882)
@@ -1,13 +1,21 @@
 <?lsmb script_css = "Customer/customer.css" ?><?lsmb PROCESS 'ui-header.html' ?>
 <?lsmb PROCESS 'elements.html' ?>
 <body>
+    <?lsmb IF name ?> 
+    <div class="pageheading"><?lsmb name?></font>
+    <?lsmb END ?>
 <div class="navigation" id="nav_div">
+<ul class="navigation">
+	<li><a href="#customer_div"><?lsmb text('Account') ?></a></li>
+	<?lsmb IF entity_id ?>
+	<li><a href="#location_div"><?lsmb text('Addresses') ?></a></li>
+	<li><a href="#contact_div"><?lsmb text('Contact Info') ?></a></li>
+	<li><a href="#bank_div"><?lsmb text('Bank Accounts') ?></a></li>
+	<?lsmb END ?>
+</ul>
 </div>
 <div class="container" id="customer_div">
 <div class="listtop"><strong><?lsmb text('Add/Edit Customer') ?></strong></div>
-    <?lsmb IF name ?> 
-    <font size="17"><?lsmb name?></font>
-    <?lsmb END ?>
 <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>
@@ -43,7 +51,8 @@
         <?lsmb END ?>
         <tr>
             <td>
-                <label for="startdate"><?lsmb text('Starting Date:') ?></label>
+                <label for="startdate"><?lsmb text('Starting Date:') ?>
+			"<?lsmb startdate ?>"</label>
                     <input id="startdate" type="text" name="startdate" 
 			class="date" value="<?lsmb startdate ?>">
             </td>
@@ -81,11 +90,11 @@
         </tr>
 	<tr>
             <td>
-                <label for="discount"><?lsmb text('Discount %:') ?></label>
+                <label for="discount"><?lsmb text('Discount:') ?></label>
                 <input id="discount" name="discount" type="text" size="3" 
-			maxlength="3" value="<?lsmb discount ?>">/
-		<input id="discountdays" name="discountdays" type="text" 
-		size="3" value="<?lsmb discount_days ?>">  
+			maxlength="3" value="<?lsmb discount ?>">%/
+		<input id="discountdays" name="discount_terms" type="text" 
+		size="3" value="<?lsmb discount_terms ?>">  days
             </td>
             <td>
                 <label for="sic_code"><?lsmb text('SIC Code:') ?></label>
@@ -151,8 +160,8 @@
 			<?lsmb text('Pricelist') ?></button>
     </form>
 </div>
-<?lsmb #IF id ?>
-<div id="locations" class="container">
+<?lsmb IF entity_id ?>
+<div id="location_div" 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 -->

Modified: trunk/scripts/customer.pl
===================================================================
--- trunk/scripts/customer.pl	2007-11-20 07:37:25 UTC (rev 1881)
+++ trunk/scripts/customer.pl	2007-11-20 19:43:27 UTC (rev 1882)
@@ -150,13 +150,16 @@
     my ($request) = @_;
 
     my $customer = LedgerSMB::DBObject::Customer->new({base => $request});
+    $customer->save();
+    $customer->get_metadata();
 
-    my $result = $customer->save();
-
-    my $template = LedgerSMB::Template->new( user => $request->{_user}, 
-    	template => 'customer', locale => $request->{_locale},
+    my $template = LedgerSMB::Template->new( 
+	user => $request->{_user}, 
+    	template => 'customer', 
+	locale => $request->{_locale},
 	path => 'UI/Customer',
-            format => 'HTML');
+        format => 'HTML'
+    );
     $template->render($customer);
 }
 

Modified: trunk/sql/modules/Customer.sql
===================================================================
--- trunk/sql/modules/Customer.sql	2007-11-20 07:37:25 UTC (rev 1881)
+++ trunk/sql/modules/Customer.sql	2007-11-20 19:43:27 UTC (rev 1882)
@@ -54,10 +54,6 @@
     
 ) 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;
         new_entity_id int;
@@ -99,7 +95,7 @@
             VALUES (
                 new_entity_id,
                 in_entity_class,
-                in_discount, 
+                in_discount / 100, 
                 in_taxincluded,
                 in_creditlimit,
                 in_terms,
@@ -116,6 +112,7 @@
             -- 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


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