summaryrefslogtreecommitdiff
path: root/LedgerSMB/Vendor.pm
diff options
context:
space:
mode:
authoraurynn_cmd <aurynn_cmd@4979c152-3d1c-0410-bac9-87ea11338e46>2007-08-06 20:28:31 +0000
committeraurynn_cmd <aurynn_cmd@4979c152-3d1c-0410-bac9-87ea11338e46>2007-08-06 20:28:31 +0000
commitf1756b69854a21b50da387f32f394d4b6fb80be7 (patch)
treea41cf10135ad979ec6fce5d6c924feba94f53fed /LedgerSMB/Vendor.pm
parenta68e3e4e78cd1bb7efe35a39d0fdd376f60e2fae (diff)
Addition of Vendor and Customer-specific save, get, and search functions in Pgsql stored procedures.
Cleanup and modification of Employee.sql, to fit the new Entity framework, as well as the modifications to support trigram searching. Addition of customer.pl and vendor.pl scripts, to support new perl framework code, as well as .pm modules for the same. Some cleanup of Pg-database.sql. addition of note_class = 1 check on entity_note, removal of check id = 1. git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1454 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'LedgerSMB/Vendor.pm')
-rw-r--r--LedgerSMB/Vendor.pm33
1 files changed, 33 insertions, 0 deletions
diff --git a/LedgerSMB/Vendor.pm b/LedgerSMB/Vendor.pm
new file mode 100644
index 00000000..52aa4944
--- /dev/null
+++ b/LedgerSMB/Vendor.pm
@@ -0,0 +1,33 @@
+package LedgerSMB::DBObject::Vendor;
+
+use base qw(LedgerSMB);
+use LedgerSMB::DBObject;
+
+sub save_to_db {
+
+ my $self = shift @_;
+
+ my $id;
+ if ($self->{id} >= 1) {
+ $id = $self->{id};
+ }
+ else {
+ $id = $self->next_vendor_id();
+ }
+ $id = $self->save($id, $self->{discount}, $self->{tax_included},
+ $self->{creditlimit}, $self->{terms}, $self->{vendornumber},
+ $self->{cc}, $self->{bcc}, $self->{business_id}, $self->{language},
+ $self->{pricegroup}, $self->{currency}, $self->{startdate},
+ $self->{enddate}
+ );
+
+ # Undef in the created field causes the system to use now() as the current
+ # creation date.
+ $self->location_save(
+ $id, 1, $self->{line_one}, $self->{line_two}, $self->{line_three},
+ $self->{city_province}, $self->{mailing_code}, $self->{country}, undef
+
+ );
+ return $id;
+}
+1; \ No newline at end of file