[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[4320] trunk
- Subject: SF.net SVN: ledger-smb:[4320] trunk
- From: ..hidden..
- Date: Thu, 16 Feb 2012 07:42:23 +0000
Revision: 4320
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4320&view=rev
Author: einhverfr
Date: 2012-02-16 07:42:22 +0000 (Thu, 16 Feb 2012)
Log Message:
-----------
More buisness reporting unit stuff
Modified Paths:
--------------
trunk/LedgerSMB/DBObject/Business_Unit.pm
trunk/LedgerSMB/DBObject/Business_Unit_Class.pm
trunk/sql/Pg-database.sql
Modified: trunk/LedgerSMB/DBObject/Business_Unit.pm
===================================================================
--- trunk/LedgerSMB/DBObject/Business_Unit.pm 2012-02-16 01:54:42 UTC (rev 4319)
+++ trunk/LedgerSMB/DBObject/Business_Unit.pm 2012-02-16 07:42:22 UTC (rev 4320)
@@ -114,17 +114,59 @@
=item get($id)
+Returns the business reporting unit referenced by the id.
+
+=cut
+
+sub get {
+ my ($self, $id) = @_;
+ my @units = $self->call_procedure(procname => 'business_unit__get',
+ args => [$id]
+ );
+ return $self->new(shift @units);
+}
+
=item save
-=item list
+Saves the business reporting unit ot the database and updates changes to object.
+=cut
+
+sub save {
+ my ($self) = @_;
+ my ($ref) = $self->exec_method({funcname => 'business_unit__save'});
+ $self = $self->new($ref);
+}
+
+=item list ($date, $credit_id, $class)
+
+Lists all business reporting units active on $date, for $credit_id (or for all
+credit_ids), and of $class. Undef on date and credit_id match all rows.
+
=item delete
+Deletes the buisness reporting unit. A unit can only be deleted if it has no
+children and no transactions attached.
+
+=cut
+
+sub delete {
+ my ($self) = @_;
+ my ($ref) = $self->exec_method({funcname => 'business_unit__delete'});
+}
+
=item search
+Returns a list of buisness reporting units matching search criteria.
+
=item get_tree
+Retrieves children recursively from the database and populates children
+appropriately
+
=item tree_to_list
+
+Returns tree as a list.
=back
Modified: trunk/LedgerSMB/DBObject/Business_Unit_Class.pm
===================================================================
--- trunk/LedgerSMB/DBObject/Business_Unit_Class.pm 2012-02-16 01:54:42 UTC (rev 4319)
+++ trunk/LedgerSMB/DBObject/Business_Unit_Class.pm 2012-02-16 07:42:22 UTC (rev 4320)
@@ -63,12 +63,57 @@
=item get($id)
+returns the business unit class that corresponds to the id requested.
+
+=cut
+
+sub get {
+ my ($self, $id) = @_;
+ my @classes = $self->call_procedure(procname => 'business_unit_class__get',
+ args => [$id]
+ );
+ return $self->new(shift @classes);
+}
+
=item save
+Saves the existing buisness unit class to the database, and updates any fields
+changed in the process.
+
+=cut
+
+sub save {
+ my ($self) = @_;
+ my ($ref) = $self->exec_method({funcname => 'business_unit_class__save'});
+ $self = $self->new($ref);
+}
+
=item list
+Returns a list of all business unit classes.
+
+=cut
+
+sub list {
+ my ($self) = @_;
+ my @classes = $self->exec_method({funcname => 'business_unit_class__list'});
+ for my $class (@classes){
+ $class = $self->new($class);
+ }
+ return @classes;
+}
+
=item delete
+
+Deletes a business unit class. Such classes may not have business units attached.
+
+=cut
+sub delete {
+ my ($self) = @_;
+ my ($ref) = $self->exec_method({funcname => 'business_unit_class__delete'});
+}
+
=back
=head1 PREDEFINED CLASSES
@@ -99,3 +144,7 @@
Copyright (C) 2012 The LedgerSMB Core Team. This module may be used under the
GNU GPL in accordance with the LICENSE file listed.
+
+=cut
+
+1;
Modified: trunk/sql/Pg-database.sql
===================================================================
--- trunk/sql/Pg-database.sql 2012-02-16 01:54:42 UTC (rev 4319)
+++ trunk/sql/Pg-database.sql 2012-02-16 07:42:22 UTC (rev 4320)
@@ -1800,7 +1800,8 @@
end_date date,
parent_id int references business_unit(id),
credit_id int references entity_credit_account(id),
- UNIQUE(id, class_id)
+ UNIQUE(id, class_id), -- needed for foreign keys
+ UNIQUE(class_id, control_code)
);
CREATE TABLE job (
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.