[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[5378] trunk/LedgerSMB
- Subject: SF.net SVN: ledger-smb:[5378] trunk/LedgerSMB
- From: ..hidden..
- Date: Tue, 18 Dec 2012 06:52:33 +0000
Revision: 5378
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=5378&view=rev
Author: einhverfr
Date: 2012-12-18 06:52:33 +0000 (Tue, 18 Dec 2012)
Log Message:
-----------
Moving Business Units from LedgerSMB::DBObject to LedgerSMB in order to provide clearer namespaces as to code that will need to be rewritten post-1.3 and code that can be presumed relatively stable
Modified Paths:
--------------
trunk/LedgerSMB/Report/Aging.pm
trunk/LedgerSMB/Report/GL.pm
trunk/LedgerSMB/Report/Unapproved/Batch_Detail.pm
trunk/LedgerSMB/Report/Unapproved/Batch_Overview.pm
trunk/LedgerSMB/Report/Unapproved/Drafts.pm
trunk/LedgerSMB/Scripts/budgets.pm
trunk/LedgerSMB/Scripts/business_unit.pm
trunk/LedgerSMB/Scripts/journal.pm
trunk/LedgerSMB/Scripts/report_aging.pm
trunk/LedgerSMB/Scripts/reports.pm
Added Paths:
-----------
trunk/LedgerSMB/Budget.pm
trunk/LedgerSMB/Business_Unit.pm
trunk/LedgerSMB/Business_Unit_Class.pm
Removed Paths:
-------------
trunk/LedgerSMB/DBObject/Budget.pm
trunk/LedgerSMB/DBObject/Business_Unit.pm
trunk/LedgerSMB/DBObject/Business_Unit_Class.pm
Copied: trunk/LedgerSMB/Budget.pm (from rev 5377, trunk/LedgerSMB/DBObject/Budget.pm)
===================================================================
--- trunk/LedgerSMB/Budget.pm (rev 0)
+++ trunk/LedgerSMB/Budget.pm 2012-12-18 06:52:33 UTC (rev 5378)
@@ -0,0 +1,403 @@
+=head1 NAME
+
+LedgerSMB::DBObject::Budget
+
+=cut
+
+package LedgerSMB::DBObject::Budget;
+use LedgerSMB::PGDate;
+use strict;
+our $VERSION = 0.1;
+
+=head1 SYNOPSIS
+
+This module provides budget management routines, such as entering budgets,
+approving or rejecting them, and marking them obsolete. It does not include
+more free-form areas like reporting. For those, see
+LedgerSMB::DBObject::Budget_Report.
+
+=head1 INHERITANCE
+
+=over
+
+=item LedgerSMB
+
+=item LedgerSMB::DBObject
+
+=back
+
+=cut
+
+use Moose;
+with 'LedgerSMB::DBObject_Moose';
+
+=head1 PROPERTIES
+
+=over
+
+=item $id INT
+ The id of the budget
+
+=cut
+
+has 'id' => (is => 'rw', isa => 'Maybe[Int]');
+
+=item $start_date date
+ The start date of the budget, inclusive
+
+=cut
+
+has 'start_date' => (is => 'rw', isa => 'Maybe[LedgerSMB::PGDate]');
+
+=item $end_date date
+ The end date of the budget, inclusive
+
+=cut
+
+has 'end_date' => (is => 'rw', isa => 'Maybe[LedgerSMB::PGDate]');
+
+=item $reference text
+ This is a text reference identifier for the budget
+
+=cut
+
+has 'reference' => (is => 'rw', isa => 'Maybe[Str]');
+
+=item $description text
+ This is a text field for the budget description. It is searchable.
+
+=cut
+
+has 'description' => (is => 'rw', isa => 'Maybe[Str]');
+
+=item $entered_by int
+ Entity id of the employee or contractor who entered the budget
+
+=cut
+
+has 'entered_by' => (is => 'rw', isa => 'Maybe[Int]');
+
+=item $approved_by int
+ Entity id of the employee or contractor who approved the budget
+
+=cut
+
+has 'approved_by' => (is => 'rw', isa => 'Maybe[Int]');
+
+=item $obsolete_by int
+ Entity id for the employee or contractor who marked the budget obsolete
+
+=cut
+
+has 'obsolete_by' => (is => 'rw', isa => 'Maybe[Int]');
+
+=item $entered_at timestamp
+ Time the budget was entered
+
+=cut
+
+has 'entered_at' => (is => 'rw', isa => 'Maybe[LedgerSMB::PGDate]');
+
+=item $approved_at timestamp
+ Time the budget was approved
+
+=cut
+
+has 'approved_at' => (is => 'rw', isa => 'Maybe[LedgerSMB::PGDate]');
+
+=item $obsolete_at timestamp
+ Time the budget was deleted
+
+=cut
+
+has 'obsolete_at' => (is => 'rw', isa => 'Maybe[LedgerSMB::PGDate]');
+
+=item $entered_by_name text
+ Name of entity who entered the budget.
+
+=cut
+
+has 'entered_by_name' => (is => 'rw', isa => 'Maybe[Str]');
+
+=item $approved_by_name text
+ Name of entity who approved the budget
+
+=cut
+
+has 'approved_by_name' => (is => 'rw', isa => 'Maybe[Str]');
+
+=item $obsolete_by_name text
+ Name of entity who obsoleted the budget
+
+=cut
+
+has 'obsolete_by_name' => (is => 'rw', isa => 'Maybe[Str]');
+
+=item @business_unit_ids
+
+List of id's of business units which the budget covers
+
+=cut
+
+has 'business_unit_ids' => (is => 'rw', isa => 'Maybe[ArrayRef[Int]]');
+
+=item @lines
+ These are the actual lines of the budget. Each one is a hashref containing
+
+=cut
+
+has 'lines' => (is => 'rw', isa => 'Maybe[ArrayRef[HashRef[Any]]]');
+=over
+
+=item $budget_id int
+ Optional. Don't use. Use the $id field of the parent instead.
+
+=item $account_id int
+ The id of the chart of accounts entry
+
+=item $accno text
+ The account number for the coa entry
+
+=item $amount numeric
+ The amount budgetted
+
+=item $description text
+ Description of line item
+
+=back
+
+=item @notes
+Where each note is a hashref containing
+
+=over
+
+=item $subject string
+ Subject of note
+
+=item $note string
+ The body of the note.
+
+=item $created timestamp
+ This is when the note was created
+
+=item $created_by string
+ Username of the individual who created the note at the time of its creation.
+
+=back
+
+=back
+
+=head1 METHODS
+
+=over
+
+=item save
+
+Saves the current budget.
+
+=cut
+
+sub save {
+ my ($self) = @_;
+ my ($ref) = $self->exec_method({funcname => 'budget__save_info'});
+ $self->id($ref->{id});
+ $self->{details} = [];
+ for my $line (@{$self->lines}){
+ my $l_info = [$line->{account_id},
+ $line->{description},
+ $line->{amount},
+ ];
+ push @{$self->{details}}, $l_info;
+ }
+ $self->exec_method({funcname => 'budget__save_details'});
+ $self->get($ref->{id});
+}
+
+
+=item from_input
+
+Prepares dates as PGDate formats
+
+=cut
+
+sub from_input {
+ my ($self, $input) = @_;
+ $input->{start_date} = LedgerSMB::PGDate->from_input($input->{start_date});
+ $input->{end_date} = LedgerSMB::PGDate->from_input($input->{end_date});
+ for my $rownum (1 .. $input->{rowcount}){
+ my $line = {};
+ $input->{"debit_$rownum"} = $input->parse_amount(
+ amount => $input->{"debit_$rownum"}
+ );
+ $input->{"debit_$rownum"} = $input->format_amount(
+ {amount => $input->{"debit_$rownum"}, format => '1000.00'}
+ );
+ $input->{"credit_$rownum"} = $input->parse_amount(
+ amount => $input->{"credit_$rownum"}
+ );
+ $input->{"credit_$rownum"} = $input->format_amount(
+ {amount => $input->{"credit_$rownum"}, format => '1000.00'}
+ );
+ if ($input->{"debit_$rownum"} and $input->{"credit_$rownum"}){
+ $input->error($input->{_locale}->text(
+ 'Cannot specify both debits and credits for budget line [_1]',
+ $rownum
+ ));
+ } elsif(!$input->{"debit_$rownum"} and !$input->{"credit_$rownum"}){
+ next;
+ } else {
+ $line->{amount} = $input->{"credit_$rownum"}
+ - $input->{"debit_$rownum"};
+ }
+ my ($accno) = split /--/, $input->{"account_id_$rownum"};
+ my ($ref) = $input->call_procedure(
+ procname => 'account__get_from_accno',
+ args => [$accno]
+ );
+ $line->{description} = $input->{"description_$rownum"};
+ $line->{account_id} = $ref->{id};
+ push @{$input->{lines}}, $line;
+ }
+ return $self->new(%$input);
+}
+
+=item search
+This method uses the object as the search criteria. Nulls/undefs match all
+values. The properties used are:
+
+=over
+
+=item start_date
+Matches the start date of the budget. Full match only.
+
+=item end_date
+Matches the end date of the budget. Full match only
+
+=item includes_date
+This date is between start date and end date of budget, inclusive.
+
+=item reference
+Partial match on budget reference
+
+=item description
+Full text search against description
+
+=item entered_by
+Exact match of entered by.
+
+=item approved_by
+Exact match of approved by
+
+=item department_id
+Exact match of department_id
+
+=item project_id
+Exact match of project_id
+
+=item is_approved
+true lists approved budgets, false lists unapproved budgets. null/undef lists
+all.
+
+=item is_obsolete
+true lists obsolete budgets. False lists non-obsolete budgets. null/undef lists
+all.
+
+=back
+
+=cut
+
+sub search {
+ my ($self) = @_; # self is search criteria here.
+ @{$self->{search_results}}
+ = $self->exec_method({funcname => 'budget__search'});
+ return @{$self->{search_results}};
+}
+
+=item get(id)
+takes a new (base) object and populates with info for the budget.
+
+=cut
+
+sub get {
+ my ($self, $id) = @_;
+ my ($info) = $self->call_procedure(
+ procname => 'budget__get_info', args => [$id]
+ );
+ $self->prepare_dbhash($info);
+ $self = $self->new(%$info);
+ my @lines = $self->exec_method({funcname => 'budget__get_details'});
+ $self->lines(..hidden..);
+ @{$self->{notes}} = $self->exec_method({funcname => 'budget__get_notes'});
+ return $self;
+}
+
+=item approve
+Marks the budget as approved.
+
+=cut
+
+sub approve {
+ my ($self) = @_;
+ $self->exec_method({funcname => 'budget__approve'});
+}
+
+=item reject
+Reject and deletes the budget.
+
+=cut
+
+sub reject {
+ my ($self) = @_;
+ $self->exec_method({funcname => 'budget__reject'});
+}
+
+=item obsolete
+Marks the budget as obsolete/superceded.
+
+=cut
+
+sub obsolete {
+ my ($self) = @_;
+ $self->exec_method({funcname => 'budget__mark_obsolete'});
+}
+
+=item save_note(subject string, note string)
+Attaches a note with this subject and content to the budget.
+
+=cut
+
+sub save_note {
+ my ($self, $subject, $note) = @_;
+ my ($info) = $self->call_procedure(
+ procname => 'budget__save_note',
+ args => [$self->{id}, $subject, $note]
+ );
+}
+
+=back
+
+=head1 SEE ALSO
+
+=over
+
+=item LedgerSMB
+
+=item LedgerSMB::DBObject
+
+=item LedgerSMB::DBObject::Budget_Report
+
+=back
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright (C) 2011 LedgerSMB Core Team. This file is licensed under the GNU
+General Public License version 2, or at your option any later version. Please
+see the included License.txt for details.
+
+=cut
+
+__PACKAGE__->meta->make_immutable;
+return 1;
+
+
+
Copied: trunk/LedgerSMB/Business_Unit.pm (from rev 5367, trunk/LedgerSMB/DBObject/Business_Unit.pm)
===================================================================
--- trunk/LedgerSMB/Business_Unit.pm (rev 0)
+++ trunk/LedgerSMB/Business_Unit.pm 2012-12-18 06:52:33 UTC (rev 5378)
@@ -0,0 +1,199 @@
+=head1 NAME
+
+LedgerSMB::Business_Unit_Class
+
+=head1 SYNOPSYS
+
+This holds the information as to the handling of classes of buisness units.
+Business units are reporting units which can be used to classify various line
+items of transactions in different ways and include handling for departments,
+funds, and projects.
+
+=cut
+
+package LedgerSMB::Business_Unit;
+use Moose;
+use LedgerSMB::DBObject_Moose;
+with 'LedgerSMB::DBObject_Moose';
+
+=head1 PROPERTIES
+
+=over
+
+=item id
+
+This is the internal id of the unit class. It is undef when the class has not
+yet been saved in the database
+
+=cut
+
+has 'id' => (is => 'rw', isa => 'Maybe[Int]');
+
+=item class_id
+
+Required. Internal id of class (1 for department, 2 for project, etc)
+
+=cut
+
+has 'class_id' => (is => 'ro', isa => 'Int', required => '1');
+
+=item control_code
+
+This is a textual reference to the business reporting unit. It must be unique
+to the business units of its class.
+
+=cut
+
+has 'control_code' => (is => 'ro', isa => 'Str', required => '1');
+
+=item description
+
+Textual description of the reporting unit.
+
+=cut
+
+has 'description' => (is => 'rw', isa => 'Maybe[Str]');
+
+=item start_date
+
+The first date the business reporting unit is valid. We use the PGDate class
+here for conversion to/from input and to/from strings for the db.
+
+=cut
+
+has 'start_date' => (is => 'rw', isa => 'Maybe[LedgerSMB::PGDate]');
+
+=item end_date
+
+The last date the business reporting unit is valid. We use the PGDate class
+here for conversion to/from input and to/from strings for the db.
+
+=cut
+
+has 'end_date' => (is => 'rw', isa => 'Maybe[LedgerSMB::PGDate]');
+
+=item parent_id
+
+The internal id of the parent, if applicable. undef means no parent.
+
+=cut
+
+has 'parent_id' => (is => 'rw', isa => 'Maybe[Int]');
+
+=item parent
+
+A reference to the parent business reporting unit
+
+=cut
+
+has 'parent' => (is => 'rw', isa => 'Maybe[LedgerSMB::Business_Unit]');
+
+=item credit_id
+
+The internal id of the customer, vendor, employee, etc. attached to this
+unit.
+
+=cut
+
+has 'credit_id' => (is => 'rw', isa => 'Maybe[Int]');
+
+=item children
+
+The children of the current unit, if applicable, and desired.
+
+This is not set unless get_tree has already been called.
+
+=back
+
+=cut
+
+has 'children' => (is => 'rw', isa => 'Maybe[ArrayRef[LedgerSMB::Business_Unit]]');
+
+=head1 METHODS
+
+=over
+
+=item get($id)
+
+Returns the business reporting unit referenced by the id.
+
+=cut
+
+sub get {
+ my ($self, $id) = @_;
+ my ($unit) = $self->call_procedure(procname => 'business_unit__get',
+ args => [$id]
+ );
+ $self->prepare_dbhash($unit);
+ return $self->new(%$unit);
+}
+
+=item save
+
+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->prepare_dbhash($ref);
+ $self = $self->new($ref);
+ $self->dbh->commit;
+}
+
+=item list ($date, $class_id, $credit_id, $strict, $active_on)
+
+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.
+
+=cut
+
+sub list {
+ my ($self, $class_id, $credit_id, $strict, $active_on) = @_;
+ my @rows = $self->call_procedure(procname => 'business_unit__list_by_class',
+ args => [$class_id, $active_on,
+ $credit_id, $strict]);
+ for my $row(@rows){
+ $self->prepare_dbhash($row);
+ $row = $self->new($row);
+ }
+ return @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
+
+=head1 COPYRIGHT
+
+Copyright (C) 2012 The LedgerSMB Core Team. This module may be used under the
+GNU GPL in accordance with the LICENSE file listed.
+
+=cut
+
+__PACKAGE__->meta->make_immutable;
+1;
Copied: trunk/LedgerSMB/Business_Unit_Class.pm (from rev 5367, trunk/LedgerSMB/DBObject/Business_Unit_Class.pm)
===================================================================
--- trunk/LedgerSMB/Business_Unit_Class.pm (rev 0)
+++ trunk/LedgerSMB/Business_Unit_Class.pm 2012-12-18 06:52:33 UTC (rev 5378)
@@ -0,0 +1,207 @@
+=head1 NAME
+
+LedgerSMB::Business_Unit_Class
+
+=head1 SYNOPSYS
+
+This holds the information as to the handling of classes of buisness units.
+Business units are reporting units which can be used to classify various line
+items of transactions in different ways and include handling for departments,
+funds, and projects.
+
+=cut
+
+package LedgerSMB::Business_Unit_Class;
+use Moose;
+use LedgerSMB::DBObject_Moose;
+use LedgerSMB::DBObject::App_Module;
+with 'LedgerSMB::DBObject_Moose';
+
+=head1 PROPERTIES
+
+=over
+
+=item id
+
+This is the internal id of the unit class. It is undef when the class has not
+yet been saved in the database
+
+=cut
+
+has 'id' => (is => 'rw', isa => 'Maybe[Int]');
+
+=item label
+
+This is the human-readible label for the class. It must be unique among
+classes.
+
+=cut
+
+has 'label' => (is => 'rw', isa => 'Str');
+
+=item active bool
+
+If true, indicates that this will show up on screens. If not, it will be
+hidden.
+
+=cut
+
+has 'active' => (is => 'rw', isa => 'Bool');
+
+# Hmm should we move this to per-module restrictions? --CT
+
+=item modules bool
+
+If true, indicates that this will not show up on accounting transaction screens.
+this is indivated for CRM and other applications.
+
+=cut
+
+has 'modules' => (is => 'rw',
+ isa => 'ArrayRef[LedgerSMB::DBObject::App_Module]'
+);
+
+=item ordering
+
+The entry boxes (drop down or text entry) are set arranged from low to high
+by this field on the data entry screens.
+
+=cut
+
+has 'ordering' => (is => 'rw', isa => 'Int');
+
+=back
+
+=head1 METHODS
+
+=over
+
+=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]
+ );
+ my $ref = shift @classes;
+ my @modules = $self->call_procedure(procname => 'business_unit_class__get_modules',
+ args => [$id]
+ );
+ $self->prepare_dbhash($ref);
+ my $class = $self->new(shift @classes);
+ $class->modules(..hidden..);
+}
+
+=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->save_modules();
+ $self->prepare_dbhash($ref);
+ $self = $self->new(%$ref);
+ $self->dbh->commit;
+}
+
+=item save_modules
+
+This saves only the module permissions. This takes the list of modules and prepares an array for the saving and then saves the modules. This is broken off as a public
+interface because it makes it possible to activate/deactive regarding modules after the
+fact without changing anything else.
+
+=cut
+
+sub save_modules {
+ my ($self) = @_;
+ my $mod_ids = [];
+ for my $mod (@{$self->modules}){
+ push @$mod_ids, $mod->id;
+ }
+ $self->call_procedure(procname => 'business_unit_class__save_modules',
+ args => [$self->id, $mod_ids]
+ );
+}
+
+=item list(bool $active, string $mod_name)
+
+Returns a list of all business unit classes.
+
+=cut
+
+sub list {
+ my ($self, $active, $mod_name) = @_;
+ my @classes = $self->call_procedure(
+ procname => 'business_unit__list_classes',
+ args => [$active, $mod_name]);
+ for my $class (@classes){
+ $self->prepare_dbhash($class);
+ $class = $self->new(%$class);
+ my @modules = $self->call_procedure(procname => 'business_unit_class__get_modules',
+ args => [$class->id]
+ );
+ for my $m (@modules){
+ $self->prepare_dbhash($m);
+ $m = LedgerSMB::DBObject::App_Module->new($m);
+ }
+ $class->modules(..hidden..);
+ }
+ 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
+
+=over
+
+=item Department, ID: 1
+
+=item Project, ID: 2
+
+=item Job, ID: 3
+
+Used for manufacturing lots
+
+=item Fund, ID: 4
+
+Used by non-profits for funds accounting
+
+=item Customer, ID 5
+
+Used in some countries/industries for multi-customer receipts
+
+=item Vendor, ID 6
+
+Used in some countries/industries for multi-vendor payments
+
+=back
+
+=head1 COPYRIGHT
+
+Copyright (C) 2012 The LedgerSMB Core Team. This module may be used under the
+GNU GPL in accordance with the LICENSE file listed.
+
+=cut
+
+__PACKAGE__->meta->make_immutable;
+1;
Deleted: trunk/LedgerSMB/DBObject/Budget.pm
===================================================================
--- trunk/LedgerSMB/DBObject/Budget.pm 2012-12-18 06:39:37 UTC (rev 5377)
+++ trunk/LedgerSMB/DBObject/Budget.pm 2012-12-18 06:52:33 UTC (rev 5378)
@@ -1,403 +0,0 @@
-=head1 NAME
-
-LedgerSMB::DBObject::Budget
-
-=cut
-
-package LedgerSMB::DBObject::Budget;
-use LedgerSMB::PGDate;
-use strict;
-our $VERSION = 0.1;
-
-=head1 SYNOPSIS
-
-This module provides budget management routines, such as entering budgets,
-approving or rejecting them, and marking them obsolete. It does not include
-more free-form areas like reporting. For those, see
-LedgerSMB::DBObject::Budget_Report.
-
-=head1 INHERITANCE
-
-=over
-
-=item LedgerSMB
-
-=item LedgerSMB::DBObject
-
-=back
-
-=cut
-
-use Moose;
-with 'LedgerSMB::DBObject_Moose';
-
-=head1 PROPERTIES
-
-=over
-
-=item $id INT
- The id of the budget
-
-=cut
-
-has 'id' => (is => 'rw', isa => 'Maybe[Int]');
-
-=item $start_date date
- The start date of the budget, inclusive
-
-=cut
-
-has 'start_date' => (is => 'rw', isa => 'Maybe[LedgerSMB::PGDate]');
-
-=item $end_date date
- The end date of the budget, inclusive
-
-=cut
-
-has 'end_date' => (is => 'rw', isa => 'Maybe[LedgerSMB::PGDate]');
-
-=item $reference text
- This is a text reference identifier for the budget
-
-=cut
-
-has 'reference' => (is => 'rw', isa => 'Maybe[Str]');
-
-=item $description text
- This is a text field for the budget description. It is searchable.
-
-=cut
-
-has 'description' => (is => 'rw', isa => 'Maybe[Str]');
-
-=item $entered_by int
- Entity id of the employee or contractor who entered the budget
-
-=cut
-
-has 'entered_by' => (is => 'rw', isa => 'Maybe[Int]');
-
-=item $approved_by int
- Entity id of the employee or contractor who approved the budget
-
-=cut
-
-has 'approved_by' => (is => 'rw', isa => 'Maybe[Int]');
-
-=item $obsolete_by int
- Entity id for the employee or contractor who marked the budget obsolete
-
-=cut
-
-has 'obsolete_by' => (is => 'rw', isa => 'Maybe[Int]');
-
-=item $entered_at timestamp
- Time the budget was entered
-
-=cut
-
-has 'entered_at' => (is => 'rw', isa => 'Maybe[LedgerSMB::PGDate]');
-
-=item $approved_at timestamp
- Time the budget was approved
-
-=cut
-
-has 'approved_at' => (is => 'rw', isa => 'Maybe[LedgerSMB::PGDate]');
-
-=item $obsolete_at timestamp
- Time the budget was deleted
-
-=cut
-
-has 'obsolete_at' => (is => 'rw', isa => 'Maybe[LedgerSMB::PGDate]');
-
-=item $entered_by_name text
- Name of entity who entered the budget.
-
-=cut
-
-has 'entered_by_name' => (is => 'rw', isa => 'Maybe[Str]');
-
-=item $approved_by_name text
- Name of entity who approved the budget
-
-=cut
-
-has 'approved_by_name' => (is => 'rw', isa => 'Maybe[Str]');
-
-=item $obsolete_by_name text
- Name of entity who obsoleted the budget
-
-=cut
-
-has 'obsolete_by_name' => (is => 'rw', isa => 'Maybe[Str]');
-
-=item @business_unit_ids
-
-List of id's of business units which the budget covers
-
-=cut
-
-has 'business_unit_ids' => (is => 'rw', isa => 'Maybe[ArrayRef[Int]]');
-
-=item @lines
- These are the actual lines of the budget. Each one is a hashref containing
-
-=cut
-
-has 'lines' => (is => 'rw', isa => 'Maybe[ArrayRef[HashRef[Any]]]');
-=over
-
-=item $budget_id int
- Optional. Don't use. Use the $id field of the parent instead.
-
-=item $account_id int
- The id of the chart of accounts entry
-
-=item $accno text
- The account number for the coa entry
-
-=item $amount numeric
- The amount budgetted
-
-=item $description text
- Description of line item
-
-=back
-
-=item @notes
-Where each note is a hashref containing
-
-=over
-
-=item $subject string
- Subject of note
-
-=item $note string
- The body of the note.
-
-=item $created timestamp
- This is when the note was created
-
-=item $created_by string
- Username of the individual who created the note at the time of its creation.
-
-=back
-
-=back
-
-=head1 METHODS
-
-=over
-
-=item save
-
-Saves the current budget.
-
-=cut
-
-sub save {
- my ($self) = @_;
- my ($ref) = $self->exec_method({funcname => 'budget__save_info'});
- $self->id($ref->{id});
- $self->{details} = [];
- for my $line (@{$self->lines}){
- my $l_info = [$line->{account_id},
- $line->{description},
- $line->{amount},
- ];
- push @{$self->{details}}, $l_info;
- }
- $self->exec_method({funcname => 'budget__save_details'});
- $self->get($ref->{id});
-}
-
-
-=item from_input
-
-Prepares dates as PGDate formats
-
-=cut
-
-sub from_input {
- my ($self, $input) = @_;
- $input->{start_date} = LedgerSMB::PGDate->from_input($input->{start_date});
- $input->{end_date} = LedgerSMB::PGDate->from_input($input->{end_date});
- for my $rownum (1 .. $input->{rowcount}){
- my $line = {};
- $input->{"debit_$rownum"} = $input->parse_amount(
- amount => $input->{"debit_$rownum"}
- );
- $input->{"debit_$rownum"} = $input->format_amount(
- {amount => $input->{"debit_$rownum"}, format => '1000.00'}
- );
- $input->{"credit_$rownum"} = $input->parse_amount(
- amount => $input->{"credit_$rownum"}
- );
- $input->{"credit_$rownum"} = $input->format_amount(
- {amount => $input->{"credit_$rownum"}, format => '1000.00'}
- );
- if ($input->{"debit_$rownum"} and $input->{"credit_$rownum"}){
- $input->error($input->{_locale}->text(
- 'Cannot specify both debits and credits for budget line [_1]',
- $rownum
- ));
- } elsif(!$input->{"debit_$rownum"} and !$input->{"credit_$rownum"}){
- next;
- } else {
- $line->{amount} = $input->{"credit_$rownum"}
- - $input->{"debit_$rownum"};
- }
- my ($accno) = split /--/, $input->{"account_id_$rownum"};
- my ($ref) = $input->call_procedure(
- procname => 'account__get_from_accno',
- args => [$accno]
- );
- $line->{description} = $input->{"description_$rownum"};
- $line->{account_id} = $ref->{id};
- push @{$input->{lines}}, $line;
- }
- return $self->new(%$input);
-}
-
-=item search
-This method uses the object as the search criteria. Nulls/undefs match all
-values. The properties used are:
-
-=over
-
-=item start_date
-Matches the start date of the budget. Full match only.
-
-=item end_date
-Matches the end date of the budget. Full match only
-
-=item includes_date
-This date is between start date and end date of budget, inclusive.
-
-=item reference
-Partial match on budget reference
-
-=item description
-Full text search against description
-
-=item entered_by
-Exact match of entered by.
-
-=item approved_by
-Exact match of approved by
-
-=item department_id
-Exact match of department_id
-
-=item project_id
-Exact match of project_id
-
-=item is_approved
-true lists approved budgets, false lists unapproved budgets. null/undef lists
-all.
-
-=item is_obsolete
-true lists obsolete budgets. False lists non-obsolete budgets. null/undef lists
-all.
-
-=back
-
-=cut
-
-sub search {
- my ($self) = @_; # self is search criteria here.
- @{$self->{search_results}}
- = $self->exec_method({funcname => 'budget__search'});
- return @{$self->{search_results}};
-}
-
-=item get(id)
-takes a new (base) object and populates with info for the budget.
-
-=cut
-
-sub get {
- my ($self, $id) = @_;
- my ($info) = $self->call_procedure(
- procname => 'budget__get_info', args => [$id]
- );
- $self->prepare_dbhash($info);
- $self = $self->new(%$info);
- my @lines = $self->exec_method({funcname => 'budget__get_details'});
- $self->lines(..hidden..);
- @{$self->{notes}} = $self->exec_method({funcname => 'budget__get_notes'});
- return $self;
-}
-
-=item approve
-Marks the budget as approved.
-
-=cut
-
-sub approve {
- my ($self) = @_;
- $self->exec_method({funcname => 'budget__approve'});
-}
-
-=item reject
-Reject and deletes the budget.
-
-=cut
-
-sub reject {
- my ($self) = @_;
- $self->exec_method({funcname => 'budget__reject'});
-}
-
-=item obsolete
-Marks the budget as obsolete/superceded.
-
-=cut
-
-sub obsolete {
- my ($self) = @_;
- $self->exec_method({funcname => 'budget__mark_obsolete'});
-}
-
-=item save_note(subject string, note string)
-Attaches a note with this subject and content to the budget.
-
-=cut
-
-sub save_note {
- my ($self, $subject, $note) = @_;
- my ($info) = $self->call_procedure(
- procname => 'budget__save_note',
- args => [$self->{id}, $subject, $note]
- );
-}
-
-=back
-
-=head1 SEE ALSO
-
-=over
-
-=item LedgerSMB
-
-=item LedgerSMB::DBObject
-
-=item LedgerSMB::DBObject::Budget_Report
-
-=back
-
-=head1 COPYRIGHT AND LICENSE
-
-Copyright (C) 2011 LedgerSMB Core Team. This file is licensed under the GNU
-General Public License version 2, or at your option any later version. Please
-see the included License.txt for details.
-
-=cut
-
-__PACKAGE__->meta->make_immutable;
-return 1;
-
-
-
Deleted: trunk/LedgerSMB/DBObject/Business_Unit.pm
===================================================================
--- trunk/LedgerSMB/DBObject/Business_Unit.pm 2012-12-18 06:39:37 UTC (rev 5377)
+++ trunk/LedgerSMB/DBObject/Business_Unit.pm 2012-12-18 06:52:33 UTC (rev 5378)
@@ -1,199 +0,0 @@
-=head1 NAME
-
-LedgerSMB::DBObject::Business_Unit_Class
-
-=head1 SYNOPSYS
-
-This holds the information as to the handling of classes of buisness units.
-Business units are reporting units which can be used to classify various line
-items of transactions in different ways and include handling for departments,
-funds, and projects.
-
-=cut
-
-package LedgerSMB::DBObject::Business_Unit;
-use Moose;
-use LedgerSMB::DBObject_Moose;
-with 'LedgerSMB::DBObject_Moose';
-
-=head1 PROPERTIES
-
-=over
-
-=item id
-
-This is the internal id of the unit class. It is undef when the class has not
-yet been saved in the database
-
-=cut
-
-has 'id' => (is => 'rw', isa => 'Maybe[Int]');
-
-=item class_id
-
-Required. Internal id of class (1 for department, 2 for project, etc)
-
-=cut
-
-has 'class_id' => (is => 'ro', isa => 'Int', required => '1');
-
-=item control_code
-
-This is a textual reference to the business reporting unit. It must be unique
-to the business units of its class.
-
-=cut
-
-has 'control_code' => (is => 'ro', isa => 'Str', required => '1');
-
-=item description
-
-Textual description of the reporting unit.
-
-=cut
-
-has 'description' => (is => 'rw', isa => 'Maybe[Str]');
-
-=item start_date
-
-The first date the business reporting unit is valid. We use the PGDate class
-here for conversion to/from input and to/from strings for the db.
-
-=cut
-
-has 'start_date' => (is => 'rw', isa => 'Maybe[LedgerSMB::PGDate]');
-
-=item end_date
-
-The last date the business reporting unit is valid. We use the PGDate class
-here for conversion to/from input and to/from strings for the db.
-
-=cut
-
-has 'end_date' => (is => 'rw', isa => 'Maybe[LedgerSMB::PGDate]');
-
-=item parent_id
-
-The internal id of the parent, if applicable. undef means no parent.
-
-=cut
-
-has 'parent_id' => (is => 'rw', isa => 'Maybe[Int]');
-
-=item parent
-
-A reference to the parent business reporting unit
-
-=cut
-
-has 'parent' => (is => 'rw', isa => 'Maybe[LedgerSMB::DBObject::Business_Unit]');
-
-=item credit_id
-
-The internal id of the customer, vendor, employee, etc. attached to this
-unit.
-
-=cut
-
-has 'credit_id' => (is => 'rw', isa => 'Maybe[Int]');
-
-=item children
-
-The children of the current unit, if applicable, and desired.
-
-This is not set unless get_tree has already been called.
-
-=back
-
-=cut
-
-has 'children' => (is => 'rw', isa => 'Maybe[ArrayRef[LedgerSMB::DBObject::Business_Unit]]');
-
-=head1 METHODS
-
-=over
-
-=item get($id)
-
-Returns the business reporting unit referenced by the id.
-
-=cut
-
-sub get {
- my ($self, $id) = @_;
- my ($unit) = $self->call_procedure(procname => 'business_unit__get',
- args => [$id]
- );
- $self->prepare_dbhash($unit);
- return $self->new(%$unit);
-}
-
-=item save
-
-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->prepare_dbhash($ref);
- $self = $self->new($ref);
- $self->dbh->commit;
-}
-
-=item list ($date, $class_id, $credit_id, $strict, $active_on)
-
-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.
-
-=cut
-
-sub list {
- my ($self, $class_id, $credit_id, $strict, $active_on) = @_;
- my @rows = $self->call_procedure(procname => 'business_unit__list_by_class',
- args => [$class_id, $active_on,
- $credit_id, $strict]);
- for my $row(@rows){
- $self->prepare_dbhash($row);
- $row = $self->new($row);
- }
- return @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
-
-=head1 COPYRIGHT
-
-Copyright (C) 2012 The LedgerSMB Core Team. This module may be used under the
-GNU GPL in accordance with the LICENSE file listed.
-
-=cut
-
-__PACKAGE__->meta->make_immutable;
-1;
Deleted: trunk/LedgerSMB/DBObject/Business_Unit_Class.pm
===================================================================
--- trunk/LedgerSMB/DBObject/Business_Unit_Class.pm 2012-12-18 06:39:37 UTC (rev 5377)
+++ trunk/LedgerSMB/DBObject/Business_Unit_Class.pm 2012-12-18 06:52:33 UTC (rev 5378)
@@ -1,207 +0,0 @@
-=head1 NAME
-
-LedgerSMB::DBObject::Business_Unit_Class
-
-=head1 SYNOPSYS
-
-This holds the information as to the handling of classes of buisness units.
-Business units are reporting units which can be used to classify various line
-items of transactions in different ways and include handling for departments,
-funds, and projects.
-
-=cut
-
-package LedgerSMB::DBObject::Business_Unit_Class;
-use Moose;
-use LedgerSMB::DBObject_Moose;
-use LedgerSMB::DBObject::App_Module;
-with 'LedgerSMB::DBObject_Moose';
-
-=head1 PROPERTIES
-
-=over
-
-=item id
-
-This is the internal id of the unit class. It is undef when the class has not
-yet been saved in the database
-
-=cut
-
-has 'id' => (is => 'rw', isa => 'Maybe[Int]');
-
-=item label
-
-This is the human-readible label for the class. It must be unique among
-classes.
-
-=cut
-
-has 'label' => (is => 'rw', isa => 'Str');
-
-=item active bool
-
-If true, indicates that this will show up on screens. If not, it will be
-hidden.
-
-=cut
-
-has 'active' => (is => 'rw', isa => 'Bool');
-
-# Hmm should we move this to per-module restrictions? --CT
-
-=item modules bool
-
-If true, indicates that this will not show up on accounting transaction screens.
-this is indivated for CRM and other applications.
-
-=cut
-
-has 'modules' => (is => 'rw',
- isa => 'ArrayRef[LedgerSMB::DBObject::App_Module]'
-);
-
-=item ordering
-
-The entry boxes (drop down or text entry) are set arranged from low to high
-by this field on the data entry screens.
-
-=cut
-
-has 'ordering' => (is => 'rw', isa => 'Int');
-
-=back
-
-=head1 METHODS
-
-=over
-
-=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]
- );
- my $ref = shift @classes;
- my @modules = $self->call_procedure(procname => 'business_unit_class__get_modules',
- args => [$id]
- );
- $self->prepare_dbhash($ref);
- my $class = $self->new(shift @classes);
- $class->modules(..hidden..);
-}
-
-=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->save_modules();
- $self->prepare_dbhash($ref);
- $self = $self->new(%$ref);
- $self->dbh->commit;
-}
-
-=item save_modules
-
-This saves only the module permissions. This takes the list of modules and prepares an array for the saving and then saves the modules. This is broken off as a public
-interface because it makes it possible to activate/deactive regarding modules after the
-fact without changing anything else.
-
-=cut
-
-sub save_modules {
- my ($self) = @_;
- my $mod_ids = [];
- for my $mod (@{$self->modules}){
- push @$mod_ids, $mod->id;
- }
- $self->call_procedure(procname => 'business_unit_class__save_modules',
- args => [$self->id, $mod_ids]
- );
-}
-
-=item list(bool $active, string $mod_name)
-
-Returns a list of all business unit classes.
-
-=cut
-
-sub list {
- my ($self, $active, $mod_name) = @_;
- my @classes = $self->call_procedure(
- procname => 'business_unit__list_classes',
- args => [$active, $mod_name]);
- for my $class (@classes){
- $self->prepare_dbhash($class);
- $class = $self->new(%$class);
- my @modules = $self->call_procedure(procname => 'business_unit_class__get_modules',
- args => [$class->id]
- );
- for my $m (@modules){
- $self->prepare_dbhash($m);
- $m = LedgerSMB::DBObject::App_Module->new($m);
- }
- $class->modules(..hidden..);
- }
- 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
-
-=over
-
-=item Department, ID: 1
-
-=item Project, ID: 2
-
-=item Job, ID: 3
-
-Used for manufacturing lots
-
-=item Fund, ID: 4
-
-Used by non-profits for funds accounting
-
-=item Customer, ID 5
-
-Used in some countries/industries for multi-customer receipts
-
-=item Vendor, ID 6
-
-Used in some countries/industries for multi-vendor payments
-
-=back
-
-=head1 COPYRIGHT
-
-Copyright (C) 2012 The LedgerSMB Core Team. This module may be used under the
-GNU GPL in accordance with the LICENSE file listed.
-
-=cut
-
-__PACKAGE__->meta->make_immutable;
-1;
Modified: trunk/LedgerSMB/Report/Aging.pm
===================================================================
--- trunk/LedgerSMB/Report/Aging.pm 2012-12-18 06:39:37 UTC (rev 5377)
+++ trunk/LedgerSMB/Report/Aging.pm 2012-12-18 06:52:33 UTC (rev 5378)
@@ -22,8 +22,8 @@
use Moose;
extends 'LedgerSMB::Report';
-use LedgerSMB::DBObject::Business_Unit_Class;
-use LedgerSMB::DBObject::Business_Unit;
+use LedgerSMB::Business_Unit_Class;
+use LedgerSMB::Business_Unit;
use LedgerSMB::App_State;
Modified: trunk/LedgerSMB/Report/GL.pm
===================================================================
--- trunk/LedgerSMB/Report/GL.pm 2012-12-18 06:39:37 UTC (rev 5377)
+++ trunk/LedgerSMB/Report/GL.pm 2012-12-18 06:52:33 UTC (rev 5378)
@@ -27,8 +27,8 @@
use Moose;
extends 'LedgerSMB::Report';
-use LedgerSMB::DBObject::Business_Unit_Class;
-use LedgerSMB::DBObject::Business_Unit;
+use LedgerSMB::Business_Unit_Class;
+use LedgerSMB::Business_Unit;
use LedgerSMB::App_State;
=head1 PROPERTIES
@@ -159,7 +159,7 @@
type => 'text',
pwidth => '3', },
);
- my @bclasses = LedgerSMB::DBObject::Business_Unit_Class->list('1', 'gl');
+ my @bclasses = LedgerSMB::Business_Unit_Class->list('1', 'gl');
for my $class (@bclasses){
push @COLS, {col_id => "bc_" . $class->id,
name => LedgerSMB::Report::text($class->label),
Modified: trunk/LedgerSMB/Report/Unapproved/Batch_Detail.pm
===================================================================
--- trunk/LedgerSMB/Report/Unapproved/Batch_Detail.pm 2012-12-18 06:39:37 UTC (rev 5377)
+++ trunk/LedgerSMB/Report/Unapproved/Batch_Detail.pm 2012-12-18 06:52:33 UTC (rev 5378)
@@ -32,8 +32,8 @@
use Moose;
extends 'LedgerSMB::Report';
-use LedgerSMB::DBObject::Business_Unit_Class;
-use LedgerSMB::DBObject::Business_Unit;
+use LedgerSMB::Business_Unit_Class;
+use LedgerSMB::Business_Unit;
=head1 PROPERTIES
Modified: trunk/LedgerSMB/Report/Unapproved/Batch_Overview.pm
===================================================================
--- trunk/LedgerSMB/Report/Unapproved/Batch_Overview.pm 2012-12-18 06:39:37 UTC (rev 5377)
+++ trunk/LedgerSMB/Report/Unapproved/Batch_Overview.pm 2012-12-18 06:52:33 UTC (rev 5378)
@@ -30,8 +30,8 @@
use Moose;
extends 'LedgerSMB::Report';
-use LedgerSMB::DBObject::Business_Unit_Class;
-use LedgerSMB::DBObject::Business_Unit;
+use LedgerSMB::Business_Unit_Class;
+use LedgerSMB::Business_Unit;
=head1 PROPERTIES
Modified: trunk/LedgerSMB/Report/Unapproved/Drafts.pm
===================================================================
--- trunk/LedgerSMB/Report/Unapproved/Drafts.pm 2012-12-18 06:39:37 UTC (rev 5377)
+++ trunk/LedgerSMB/Report/Unapproved/Drafts.pm 2012-12-18 06:52:33 UTC (rev 5378)
@@ -28,8 +28,8 @@
use Moose;
extends 'LedgerSMB::Report';
-use LedgerSMB::DBObject::Business_Unit_Class;
-use LedgerSMB::DBObject::Business_Unit;
+use LedgerSMB::Business_Unit_Class;
+use LedgerSMB::Business_Unit;
=head1 PROPERTIES
Modified: trunk/LedgerSMB/Scripts/budgets.pm
===================================================================
--- trunk/LedgerSMB/Scripts/budgets.pm 2012-12-18 06:39:37 UTC (rev 5377)
+++ trunk/LedgerSMB/Scripts/budgets.pm 2012-12-18 06:52:33 UTC (rev 5378)
@@ -13,17 +13,17 @@
=over
-=item LedgerSMB::DBObject::Budget
-=item LedgerSMB::DBObject::Budget_Report
+=item LedgerSMB::Budget
+=item LedgerSMB::Budget_Report
=back
=cut
-use LedgerSMB::DBObject::Budget;
+use LedgerSMB::Budget;
use LedgerSMB::DBObject::Budget_Report;
-use LedgerSMB::DBObject::Business_Unit;
-use LedgerSMB::DBObject::Business_Unit_Class;
+use LedgerSMB::Business_Unit;
+use LedgerSMB::Business_Unit_Class;
=head1 METHODS
@@ -53,8 +53,8 @@
$additional_rows = 0 if $budget->{id};
$budget->{class_id} = 0 unless $budget->{class_id};
$budget->{control_code} = '' unless $budget->{control_code};
- my $buc = LedgerSMB::DBObject::Business_Unit_Class->new(%$budget);
- my $bu = LedgerSMB::DBObject::Business_Unit->new(%$budget);
+ my $buc = LedgerSMB::Business_Unit_Class->new(%$budget);
+ my $bu = LedgerSMB::Business_Unit->new(%$budget);
@{$budget->{bu_classes}} = $buc->list(1, 'gl');
for my $bc (@{$budget->{bu_classes}}){
@{$budget->{b_units}->{$bc->{id}}}
@@ -89,13 +89,13 @@
if (!$budget->{id}){
$budget->{buttons} = [
{ name => 'action',
- text => $budget->{_locale}->text('Update'),
+ text => $LedgerSMB::App_State::Locale->text('Update'),
type => 'submit',
value => 'update',
class => 'submit',
},
{ name => 'action',
- text => $budget->{_locale}->text('Save'),
+ text => $LedgerSMB::App_State::Locale->text('Save'),
type => 'submit',
value => 'save',
class => 'submit',
@@ -104,13 +104,13 @@
} elsif (!$budget->{approved_by}){
$budget->{buttons} = [
{ name => 'action',
- text => $budget->{_locale}->text('Approve'),
+ text => $LedgerSMB::App_State::Locale->text('Approve'),
type => 'submit',
value => 'approve',
class => 'submit',
},
{ name => 'action',
- text => $budget->{_locale}->text('Reject'),
+ text => $LedgerSMB::App_State::Locale->text('Reject'),
type => 'submit',
value => 'reject',
class => 'submit',
@@ -119,7 +119,7 @@
} else {
$budget->{buttons} = [
{ name => 'action',
- text => $budget->{_locale}->text('Obsolete'),
+ text => $LedgerSMB::App_State::Locale->text('Obsolete'),
type => 'submit',
value => 'obsolete',
class => 'submit',
Modified: trunk/LedgerSMB/Scripts/business_unit.pm
===================================================================
--- trunk/LedgerSMB/Scripts/business_unit.pm 2012-12-18 06:39:37 UTC (rev 5377)
+++ trunk/LedgerSMB/Scripts/business_unit.pm 2012-12-18 06:52:33 UTC (rev 5378)
@@ -5,9 +5,9 @@
=cut
package LedgerSMB::Scripts::business_unit;
-use LedgerSMB::DBObject::Business_Unit_Class;
+use LedgerSMB::Business_Unit_Class;
use LedgerSMB::DBObject::App_Module;
-use LedgerSMB::DBObject::Business_Unit;
+use LedgerSMB::Business_Unit;
use LedgerSMB::Template;
use Carp;
@@ -29,7 +29,7 @@
sub list_classes {
my ($request) = @_;
- my $bu_class = LedgerSMB::DBObject::Business_Unit_Class->new(%$request);
+ my $bu_class = LedgerSMB::Business_Unit_Class->new(%$request);
my $lsmb_modules = LedgerSMB::DBObject::App_Module->new(%$request);
@{$request->{classes}} = $bu_class->list;
@{$request->{modules}} = $lsmb_modules->list;
@@ -55,7 +55,7 @@
$request->{class_id} = $request->{id};
}
$request->{control_code} = '';
- my $b_unit = LedgerSMB::DBObject::Business_Unit->new(%$request);
+ my $b_unit = LedgerSMB::Business_Unit->new(%$request);
@{$request->{parent_options}} = $b_unit->list($request->{class_id});
$request->{id} = undef;
_display($request);
@@ -71,7 +71,7 @@
my ($request) = @_;
$request->{control_code} = '';
$request->{class_id} = 0 unless $request->{class_id} != 0;
- my $b_unit = LedgerSMB::DBObject::Business_Unit->new(%$request);
+ my $b_unit = LedgerSMB::Business_Unit->new(%$request);
my $bu = $b_unit->get($request->{id});
@{$bu->{parent_options}} = $b_unit->list($bu->{class_id});
@@ -123,7 +123,7 @@
my ($request) = @_;
$request->{control_code} = '';
$request->{class_id} = 0 unless $request->{class_id} = 0;
- my $b_unit = LedgerSMB::DBObject::Business_Unit->new(%$request);
+ my $b_unit = LedgerSMB::Business_Unit->new(%$request);
my $template = LedgerSMB::Template->new(
user =>$request->{_user},
locale => $request->{_locale},
@@ -166,7 +166,7 @@
sub delete {
my ($request) = @_;
- my $unit = LedgerSMB::DBObject::Business_Unit->new(%$request);
+ my $unit = LedgerSMB::Business_Unit->new(%$request);
$unit->delete;
list($request);
}
@@ -181,7 +181,7 @@
sub delete_class {
my ($request) = @_;
- my $bu_class = LedgerSMB::DBObject::Business_Unit_Class->new($request);
+ my $bu_class = LedgerSMB::Business_Unit_Class->new($request);
$bu_class->delete;
list_classes($request);
}
@@ -189,7 +189,7 @@
=item save
Saves the existing unit. Standard properties of
-LedgerSMB::DBObject::Business_Unit must be set for $request.
+LedgerSMB::Business_Unit must be set for $request.
=cut
@@ -199,7 +199,7 @@
if defined $request->{start_date};
$request->{end_date} = LedgerSMB::PGDate->from_input($request->{end_date}, 0)
if defined $request->{end_date};
- my $unit = LedgerSMB::DBObject::Business_Unit->new(%$request);
+ my $unit = LedgerSMB::Business_Unit->new(%$request);
$unit->save;
add($request);
}
@@ -207,7 +207,7 @@
=item save_class
Saves the existing unit class. Standard properties for
-LedgerSMB::DBObject::Business_Unit_Class must be set for $request.
+LedgerSMB::Business_Unit_Class must be set for $request.
=cut
@@ -226,7 +226,7 @@
$request->{$key} = 0;
}
}
- my $bu_class = LedgerSMB::DBObject::Business_Unit_Class->new(%$request);
+ my $bu_class = LedgerSMB::Business_Unit_Class->new(%$request);
$bu_class->modules($modlist);
$bu_class->save;
list_classes($request);
Modified: trunk/LedgerSMB/Scripts/journal.pm
===================================================================
--- trunk/LedgerSMB/Scripts/journal.pm 2012-12-18 06:39:37 UTC (rev 5377)
+++ trunk/LedgerSMB/Scripts/journal.pm 2012-12-18 06:52:33 UTC (rev 5378)
@@ -19,7 +19,7 @@
use LedgerSMB;
use LedgerSMB::Template;
-use LedgerSMB::DBObject::Business_Unit;
+use LedgerSMB::Business_Unit;
use LedgerSMB::Report::GL;
use LedgerSMB::Report::COA;
use strict;
Modified: trunk/LedgerSMB/Scripts/report_aging.pm
===================================================================
--- trunk/LedgerSMB/Scripts/report_aging.pm 2012-12-18 06:39:37 UTC (rev 5377)
+++ trunk/LedgerSMB/Scripts/report_aging.pm 2012-12-18 06:52:33 UTC (rev 5378)
@@ -15,7 +15,7 @@
use LedgerSMB;
use LedgerSMB::Template;
-use LedgerSMB::DBObject::Business_Unit;
+use LedgerSMB::Business_Unit;
use LedgerSMB::Report::Aging;
use strict;
Modified: trunk/LedgerSMB/Scripts/reports.pm
===================================================================
--- trunk/LedgerSMB/Scripts/reports.pm 2012-12-18 06:39:37 UTC (rev 5377)
+++ trunk/LedgerSMB/Scripts/reports.pm 2012-12-18 06:52:33 UTC (rev 5378)
@@ -15,8 +15,8 @@
use LedgerSMB;
use LedgerSMB::Template;
-use LedgerSMB::DBObject::Business_Unit;
-use LedgerSMB::DBObject::Business_Unit_Class;
+use LedgerSMB::Business_Unit;
+use LedgerSMB::Business_Unit_Class;
use strict;
=pod
@@ -50,8 +50,8 @@
if ($request->{module_name}){
$request->{class_id} = 0 unless $request->{class_id};
$request->{control_code} = '' unless $request->{control_code};
- my $buc = LedgerSMB::DBObject::Business_Unit_Class->new(%$request);
- my $bu = LedgerSMB::DBObject::Business_Unit->new(%$request);
+ my $buc = LedgerSMB::Business_Unit_Class->new(%$request);
+ my $bu = LedgerSMB::Business_Unit->new(%$request);
@{$request->{bu_classes}} = $buc->list(1, $request->{module_name});
for my $bc (@{$request->{bu_classes}}){
@{$request->{b_units}->{$bc->{id}}}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.