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

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



Revision: 2310
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2310&view=rev
Author:   einhverfr
Date:     2008-09-03 18:15:41 +0000 (Wed, 03 Sep 2008)

Log Message:
-----------
Adding button to generate entity control code

Modified Paths:
--------------
    trunk/LedgerSMB/Setting.pm
    trunk/UI/Contact/contact.html
    trunk/scripts/vendor.pl

Modified: trunk/LedgerSMB/Setting.pm
===================================================================
--- trunk/LedgerSMB/Setting.pm	2008-09-03 17:14:13 UTC (rev 2309)
+++ trunk/LedgerSMB/Setting.pm	2008-09-03 18:15:41 UTC (rev 2310)
@@ -47,23 +47,14 @@
 =cut
 
 package LedgerSMB::Setting;
-use LedgerSMB;
-use LedgerSMB::DBObject;
+use base qw(LedgerSMB::DBObject);
 use strict;
 our $VERSION = '1.0.0';
 
-our @ISA = qw(LedgerSMB::DBObject);
 
-sub AUTOLOAD {
-    my $self     = shift;
-    my $AUTOLOAD = $LedgerSMB::Setting::AUTOLOAD;
-    $AUTOLOAD =~ s/^.*:://;
-    $self->exec_method( procname => "setting_$AUTOLOAD", args => ..hidden.. );
-}
-
 sub get {
     my $self = shift;
-    my $hashref = shift @{ $self->exec_method( procname => 'setting_get' ) };
+    my $hashref = shift @{ $self->exec_method( funcname => 'setting_get' ) };
     $self->merge( $hashref, 'value' );
 }
 

Modified: trunk/UI/Contact/contact.html
===================================================================
--- trunk/UI/Contact/contact.html	2008-09-03 17:14:13 UTC (rev 2309)
+++ trunk/UI/Contact/contact.html	2008-09-03 18:15:41 UTC (rev 2310)
@@ -166,7 +166,13 @@
 		name = "control_code"
 		value = control_code
 		size = "20"
-	} ?><br/>
+	} ?><?lsmb PROCESS button element_data = {
+		text = text('Generate')
+		type = "submit"
+		name = "action"
+		value = "generate_control_code"
+		class = "submit"
+        } ?><br/>
 	<?lsmb PROCESS input element_data = {
 		label = text('Name:')
 		type= "text"
@@ -301,14 +307,14 @@
 			size = "20"
 		} #' ?>
             </td>
-            <td>
+            <td><span id="terms-span">
 		<?lsmb INCLUDE input element_data = {
 			label = text('Terms:'),
 			name = "terms",
 			value = terms,
 			type = "text",
 			size = "5"
-		} ?> <?lsmb text('days') ?>
+		} ?> <?lsmb text('days') ?></span>
             </td>
 	</tr>
 	<tr id="discount-gifi-row">

Modified: trunk/scripts/vendor.pl
===================================================================
--- trunk/scripts/vendor.pl	2008-09-03 17:14:13 UTC (rev 2309)
+++ trunk/scripts/vendor.pl	2008-09-03 18:15:41 UTC (rev 2310)
@@ -41,7 +41,6 @@
 
 =cut
 
-
 sub get {
     
     my ($request) = @_;
@@ -69,6 +68,24 @@
 	
 }
 
+sub generate_control_code {
+    my ($request) = @_;
+    my $vendor= LedgerSMB::DBObject::Vendor->new({base => $request, copy => 'all'});
+    
+    my ($ref) = $vendor->call_procedure(
+                             procname => 'setting_increment', 
+                             args     => ['entity_control']
+                           );
+    ($vendor->{control_code}) = values %$ref;
+    $vendor->{dbh}->commit;
+    if ($vendor->{meta_number}){
+        edit($vendor);
+    } else {
+       _render_main_screen($vendor);
+    }
+    
+}
+
 =pod
 
 =over


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