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