summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--LedgerSMB/DBObject/Company.pm3
-rw-r--r--UI/Contact/contact.html13
-rw-r--r--sql/modules/Entity.sql13
3 files changed, 28 insertions, 1 deletions
diff --git a/LedgerSMB/DBObject/Company.pm b/LedgerSMB/DBObject/Company.pm
index a0cce914..4d11d858 100644
--- a/LedgerSMB/DBObject/Company.pm
+++ b/LedgerSMB/DBObject/Company.pm
@@ -137,6 +137,9 @@ $self->{cash_acc_list} = qw(list of cash accounts)
sub get_metadata {
my $self = shift @_;
+ @{$self->{entity_classes}} =
+ $self->exec_method(funcname => 'entity__list_classes');
+
@{$self->{ar_ap_acc_list}} =
$self->exec_method(funcname => 'chart_get_ar_ap');
diff --git a/UI/Contact/contact.html b/UI/Contact/contact.html
index 2ccd5491..3b69c902 100644
--- a/UI/Contact/contact.html
+++ b/UI/Contact/contact.html
@@ -166,7 +166,18 @@ problems with multi-word single-quoted constructs in PI tags. -CT -->
name = "control_code"
value = control_code
size = "20"
- } ?><?lsmb PROCESS button element_data = {
+ } ?>
+ <?lsmb IF !created_as_class;
+ created_as_class = entity_class;
+ END; # IF !created_as_class ?>
+ <?lsmb PROCESS select element_data = {
+ name = "created_as_class"
+ options = entity_classes
+ default_values = [created_as_class]
+ text_attr = 'class'
+ value_attr = 'id'
+ } ?>
+ <?lsmb PROCESS button element_data = {
text = text('Generate')
type = "submit"
name = "action"
diff --git a/sql/modules/Entity.sql b/sql/modules/Entity.sql
index 71eca451..9f7a5ac8 100644
--- a/sql/modules/Entity.sql
+++ b/sql/modules/Entity.sql
@@ -37,6 +37,19 @@ CREATE OR REPLACE FUNCTION entity_save(
$$ language 'plpgsql';
+CREATE OR REPLACE FUNCTION entity__list_classes ()
+RETURNS SETOF entity_class AS $$
+DECLARE out_row entity_class;
+BEGIN
+ FOR out_row IN
+ SELECT * FROM entity_class
+ WHERE active
+ ORDER BY id
+ LOOP
+ RETURN NEXT out_row;
+ END LOOP;
+END;
+$$ LANGUAGE PLPGSQL;
CREATE OR REPLACE FUNCTION entity__get_entity (
in_entity_id int