summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2008-09-03 18:15:41 +0000
committereinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2008-09-03 18:15:41 +0000
commit9b24d1041b7c8e96962d1aa95dd4efba39f912b2 (patch)
tree219d12b0d005eefd19b46e12e1be3f3b836a2a9f
parent26e09a22f9226776ed00998ad77712808c8fdb67 (diff)
Adding button to generate entity control code
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@2310 4979c152-3d1c-0410-bac9-87ea11338e46
-rw-r--r--LedgerSMB/Setting.pm13
-rw-r--r--UI/Contact/contact.html12
-rw-r--r--scripts/vendor.pl19
3 files changed, 29 insertions, 15 deletions
diff --git a/LedgerSMB/Setting.pm b/LedgerSMB/Setting.pm
index 7da680c2..57630c97 100644
--- a/LedgerSMB/Setting.pm
+++ b/LedgerSMB/Setting.pm
@@ -47,23 +47,14 @@ your software.
=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 => \@_ );
-}
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' );
}
diff --git a/UI/Contact/contact.html b/UI/Contact/contact.html
index 2d15adc1..341ef154 100644
--- a/UI/Contact/contact.html
+++ b/UI/Contact/contact.html
@@ -166,7 +166,13 @@ problems with multi-word single-quoted constructs in PI tags. -CT -->
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 @@ problems with multi-word single-quoted constructs in PI tags. -CT -->
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">
diff --git a/scripts/vendor.pl b/scripts/vendor.pl
index 7e5c5371..ed415140 100644
--- a/scripts/vendor.pl
+++ b/scripts/vendor.pl
@@ -41,7 +41,6 @@ of the vendor informations.
=cut
-
sub get {
my ($request) = @_;
@@ -69,6 +68,24 @@ sub add_location {
}
+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