[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[4796] trunk
- Subject: SF.net SVN: ledger-smb:[4796] trunk
- From: ..hidden..
- Date: Mon, 28 May 2012 11:29:39 +0000
Revision: 4796
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4796&view=rev
Author: einhverfr
Date: 2012-05-28 11:29:38 +0000 (Mon, 28 May 2012)
Log Message:
-----------
All buttons on Company tab now work again
Modified Paths:
--------------
trunk/LedgerSMB/DBObject/Entity/Company.pm
trunk/LedgerSMB/DBObject/Entity.pm
trunk/LedgerSMB/Scripts/contact.pm
trunk/UI/Contact/divs/company.html
trunk/sql/modules/Company.sql
Modified: trunk/LedgerSMB/DBObject/Entity/Company.pm
===================================================================
--- trunk/LedgerSMB/DBObject/Entity/Company.pm 2012-05-28 10:24:21 UTC (rev 4795)
+++ trunk/LedgerSMB/DBObject/Entity/Company.pm 2012-05-28 11:29:38 UTC (rev 4796)
@@ -133,6 +133,9 @@
my ($self) = @_;
my ($ref) = $self->exec_method({funcname => 'company__save'});
$self->prepare_dbhash($ref);
+ $ref->{control_code} = $self->{control_code};
+ $ref->{entity_class} = $self->{entity_class};
+ $ref->{country_id} = $self->{country_id};
$self = $self->new(%$ref);
}
Modified: trunk/LedgerSMB/DBObject/Entity.pm
===================================================================
--- trunk/LedgerSMB/DBObject/Entity.pm 2012-05-28 10:24:21 UTC (rev 4795)
+++ trunk/LedgerSMB/DBObject/Entity.pm 2012-05-28 11:29:38 UTC (rev 4796)
@@ -45,7 +45,7 @@
=cut
-has 'control_code' => (is => 'rw', isa => 'Maybe[Str]', required => 1, default => 'DEFAULT');
+has 'control_code' => (is => 'rw', isa => 'Str', required => 1);
=item name
@@ -63,7 +63,7 @@
=cut
-has 'country_id' => (is => 'rw', isa => 'Int', required => '1', default => '0');
+has 'country_id' => (is => 'rw', isa => 'Int', required => '1');
=item country_name
@@ -71,7 +71,7 @@
=cut
-has 'country_name' => (is => 'rw', isa => 'Maybe[Str]', required => '0');
+has 'country_name' => (is => 'rw', isa => 'Maybe[Str]');
=item entity_class
@@ -83,7 +83,7 @@
=cut
-has 'entity_class' => (is => 'rw', isa => 'Int', required => '1', default => 0);
+has 'entity_class' => (is => 'rw', isa => 'Int');
=head1 METHODS
@@ -130,4 +130,6 @@
=cut
+__PACKAGE__->meta->make_immutable;
+
return 1;
Modified: trunk/LedgerSMB/Scripts/contact.pm
===================================================================
--- trunk/LedgerSMB/Scripts/contact.pm 2012-05-28 10:24:21 UTC (rev 4795)
+++ trunk/LedgerSMB/Scripts/contact.pm 2012-05-28 11:29:38 UTC (rev 4796)
@@ -147,14 +147,22 @@
#use Data::Dumper;
#$Data::Dumper::Sortkeys = 1;
+ @country_list = $request->call_procedure(
+ procname => 'location_list_country'
+ );
+ @entity_classes = $request->call_procedure(
+ procname => 'entity__list_classes'
+ );
$template->render({
DIVS => ..hidden..,
DIV_LABEL => \%DIV_LABEL,
request => $request,
company => $company,
+ country_list => ..hidden..,
credit_act => $credit_act,
credit_list => ..hidden..,
+ entity_classes => ..hidden..,
locations => ..hidden..,
contacts => ..hidden..,
bank_account => ..hidden..,
@@ -163,6 +171,23 @@
});
}
+=item generate_control_code
+
+Generates a control code and hands off execution to other routines
+
+=cut
+
+sub generate_control_code {
+ my ($request) = @_;
+ my ($ref) = $request->call_procedure(
+ procname => 'setting_increment',
+ args => ['entity_control']
+ );
+ ($request->{control_code}) = values %$ref;
+ $request->{dbh}->commit;
+ _main_screen($request, $request);
+}
+
=item dispatch_legacy
This is a semi-private method which interfaces with the old code. Note that
@@ -293,7 +318,22 @@
sub add {
my ($request) = @_;
- _main_screen($request);
+ _main_screen($request, $request);
}
+=item save_company
+
+Saves a company and moves on to the next screen
+
+=cut
+
+sub save_company {
+ my ($request) = @_;
+ my $company = LedgerSMB::DBObject::Entity::Company->new(%$request);
+ use Data::Dumper;
+ $Data::Dumper::Sortkeys => 1;
+ $company = $company->save;
+ _main_screen($request, $company);
+}
+
1;
Modified: trunk/UI/Contact/divs/company.html
===================================================================
--- trunk/UI/Contact/divs/company.html 2012-05-28 10:24:21 UTC (rev 4795)
+++ trunk/UI/Contact/divs/company.html 2012-05-28 11:29:38 UTC (rev 4796)
@@ -46,10 +46,10 @@
<div class="input_group2">
<?lsmb company_entity_class = company.entity_class;
IF !company_entity_class;
- company_entity_class = entity_class;
+ company_entity_class = request.entity_class;
END;
PROCESS select element_data = {
- name = "created_as_class"
+ name = "entity_class"
options = entity_classes
default_values = [company_entity_class]
text_attr = 'class'
@@ -149,7 +149,7 @@
class="submit"
type="submit"
name="action"
- value="save"
+ value="save_company"
accesskey="S"
title="Save [Alt-S]"
} ?>
Modified: trunk/sql/modules/Company.sql
===================================================================
--- trunk/sql/modules/Company.sql 2012-05-28 10:24:21 UTC (rev 4795)
+++ trunk/sql/modules/Company.sql 2012-05-28 11:29:38 UTC (rev 4796)
@@ -692,10 +692,11 @@
in_legal_name text, in_tax_id TEXT,
in_entity_id int, in_sic_code text,in_country_id int,
in_sales_tax_id text, in_license_number text
-) RETURNS INT AS $$
+) RETURNS company AS $$
DECLARE t_entity_id INT;
t_company_id INT;
t_control_code TEXT;
+ t_retval COMPANY;
BEGIN
t_company_id := in_id;
@@ -735,7 +736,8 @@
in_sales_tax_id, in_license_number);
END IF;
- RETURN t_entity_id;
+ SELECT * INTO t_retval FROM company WHERE entity_id = t_entity_id;
+ RETURN t_retval;
END;
$$ LANGUAGE PLPGSQL;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.