[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[3450] trunk
- Subject: SF.net SVN: ledger-smb:[3450] trunk
- From: ..hidden..
- Date: Wed, 06 Jul 2011 06:01:08 +0000
Revision: 3450
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=3450&view=rev
Author: einhverfr
Date: 2011-07-06 06:01:07 +0000 (Wed, 06 Jul 2011)
Log Message:
-----------
Location.pm doc strings, minor corrections to Location.sql and Location.pm
Modified Paths:
--------------
trunk/Changelog
trunk/LedgerSMB/Location.pm
trunk/sql/modules/Location.sql
Modified: trunk/Changelog
===================================================================
--- trunk/Changelog 2011-07-06 01:23:53 UTC (rev 3449)
+++ trunk/Changelog 2011-07-06 06:01:07 UTC (rev 3450)
@@ -44,6 +44,9 @@
* Multiple bank accounts per customer/vendor account (Josh D and Chris T)
* Track 1099 or equiv. forms for customers/vendors (Chris T and John W)
+Invoicing:
+* Can now set sales tax amounts and rates per invoice if necessary (Chris T).
+
Development:
* New API structure for new code (Entire Team)
* Better error handling/display (Jason and Chris T)
Modified: trunk/LedgerSMB/Location.pm
===================================================================
--- trunk/LedgerSMB/Location.pm 2011-07-06 01:23:53 UTC (rev 3449)
+++ trunk/LedgerSMB/Location.pm 2011-07-06 06:01:07 UTC (rev 3450)
@@ -4,42 +4,17 @@
=head1 SYOPSIS
-This module creates object instances based on LedgerSMB's in-database ORM.
+This module contains location management routines. This subclasses
+LedgerSMB::DBObject to provide access to automatice mapping of function
+arguments and the like.
=head1 METHODS
-The following method is static:
-=over
+=item delete
-=item new ($LedgerSMB object);
-=back
-The following methods are passed through to stored procedures:
-
-=over
-
-=item save
-
-=item get
-
-=item search
-
-=item list_all
-
-=item delete (via Autoload)
-
-=back
-
-The above list may grow over time, and may depend on other installed modules.
-
-=head1 Copyright (C) 2007, The LedgerSMB core team.
-
-This file is licensed under the Gnu General Public License version 2, or at your
-option any later version. A copy of the license should have been included with
-your software.
-
=cut
package LedgerSMB::Location;
@@ -48,38 +23,94 @@
use strict;
our $VERSION = '1.0.0';
-our @ISA = qw(LedgerSMB::DBObject);
+use base qw(LedgerSMB::DBObject);
-sub AUTOLOAD {
- my $self = shift;
- my $AUTOLOAD = $LedgerSMB::Location::AUTOLOAD;
- $AUTOLOAD =~ s/^.*:://;
- my $procname = "location_$AUTOLOAD";
- $self->exec_method( procname => "location_$AUTOLOAD", args => ..hidden.. );
-}
+=item save
+Saves the location. Properties to be set to be saved are:
+
+* location_id: Optional: Overwrite location with this id.
+* address1: First line of the address.
+* address2: Second line of the address
+* address3: Third line of the address
+* city
+* state: state or province
+* zipcode: zipcode or mail code,
+* country: The id of the country as per the country table
+
+=cut
+
sub save {
my $self = shift;
my $ref = shift @{ $self->exec_method( procname => "location_save" ) };
$self->merge( $ref, 'id' );
}
+=item get
+
+Retrieves a location record based on the id field of the object. Merges the
+properties into the object.
+
+=cut
+
sub get {
my $self = shift;
my $ref = shift @{ $self->exec_method( procname => 'location__get' ) };
$self->merge( $ref, keys %{$ref} );
}
+=item search
+Returns anarrayref (and stores it on $self->{search_results} based on the
+search of addresses. Not currently used.
+
+Attributes used as search criteria:
+address1: Partial match for address line 1
+address2: Partial match for address line 2,
+city: Partial match for city name
+state: Partial match for state or province name,
+zipcode: Partial match for zip or postal code,
+country: Partial name for country name)
+
+=cut
+
sub search {
my $self = shift;
- my $self->{search_results} =
+ $self->{search_results} =
$self->exec_method( procname => 'location_search' );
}
+=item list_all
+
+Provides a list of all locations, ordered by country, then city, then state.
+
+=cut
+
sub list_all {
my $self = shift;
- my $self->{search_results} =
+ $self->{search_results} =
$self->exec_method( procname => 'location_list_all' );
}
+=item delete
+
+Deletes the location identified by id
+
+=cut
+
+sub delete {
+ my $self = shift;
+ $self->exec_method( procname => 'location_delete' );
+ $sehf->{dbh}->commit;
+}
+
+=back
+
+=head1 Copyright (C) 2007, The LedgerSMB core team.
+
+This file is licensed under the Gnu General Public License version 2, or at your
+option any later version. A copy of the license should have been included with
+your software.
+
+=cut
+
1;
Modified: trunk/sql/modules/Location.sql
===================================================================
--- trunk/sql/modules/Location.sql 2011-07-06 01:23:53 UTC (rev 3449)
+++ trunk/sql/modules/Location.sql 2011-07-06 06:01:07 UTC (rev 3450)
@@ -160,7 +160,7 @@
BEGIN
FOR out_location IN
SELECT * FROM location
- ORDER BY city, state, country
+ ORDER BY country, state, city
LOOP
RETURN NEXT out_location;
END LOOP;
@@ -168,7 +168,7 @@
$$ LANGUAGE plpgsql;
COMMENT ON FUNCTION location_list_all () is
-$$ Returns all locations, ordered by city, state, and country. $$;
+$$ Returns all locations, ordered by country, state, and city. $$;
CREATE OR REPLACE FUNCTION location_delete (in_id integer) RETURNS VOID AS
$$
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.