summaryrefslogtreecommitdiff
path: root/LedgerSMB/Location.pm
blob: dc4b012396d5af30674121e380fec17319610003 (plain)
  1. =head1 NAME
  2. LedgerSMB::Location - LedgerSMB class for managing Business Locations
  3. =head1 SYOPSIS
  4. This module creates object instances based on LedgerSMB's in-database ORM.
  5. =head1 METHODS
  6. The following method is static:
  7. =item new ($LedgerSMB object);
  8. The following methods are passed through to stored procedures:
  9. =item save
  10. =item get
  11. =item search
  12. =item list_all
  13. =item delete (via Autoload)
  14. The above list may grow over time, and may depend on other installed modules.
  15. =head1 Copyright (C) 2007, The LedgerSMB core team.
  16. This file is licensed under the Gnu General Public License version 2, or at your
  17. option any later version. A copy of the license should have been included with
  18. your software.
  19. =back
  20. =cut
  21. package LedgerSMB::Location;
  22. use LedgerSMB;
  23. use LedgerSMB::DBObject;
  24. use strict;
  25. our $VERSION = '1.0.0';
  26. our @ISA = qw(LedgerSMB::DBObject);
  27. sub AUTOLOAD {
  28. my $self = shift;
  29. my $AUTOLOAD = $LedgerSMB::Location::AUTOLOAD;
  30. $AUTOLOAD =~ s/^.*:://;
  31. my $procname = "location_$AUTOLOAD";
  32. $self->exec_method(procname => "location_$AUTOLOAD", args => \@_);
  33. }
  34. sub save {
  35. $ref = shift @{$self->exec_method(procname =>"location_save")};
  36. $self->merge($ref, 'id');
  37. }
  38. sub get {
  39. $ref = shift @{$self->exec_method(procname =>'location_get')};
  40. $self->merge($ref, keys %{$ref});
  41. }
  42. sub search {
  43. $self->{search_results} =
  44. $self->exec_method(procname => 'location_search');
  45. }
  46. sub list_all {
  47. $self->{search_results} =
  48. $self->exec_method(procname => 'location_list_all');
  49. }