summaryrefslogtreecommitdiff
path: root/LedgerSMB/Location.pm
blob: 790b70502535c6a8a8809b1443040df643c1de93 (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. my $self = shift;
  39. my $ref = shift @{ $self->exec_method( procname => "location_save" ) };
  40. $self->merge( $ref, 'id' );
  41. }
  42. sub get {
  43. my $self = shift;
  44. my $ref = shift @{ $self->exec_method( procname => 'location_get' ) };
  45. $self->merge( $ref, keys %{$ref} );
  46. }
  47. sub search {
  48. my $self = shift;
  49. my $self->{search_results} =
  50. $self->exec_method( procname => 'location_search' );
  51. }
  52. sub list_all {
  53. my $self = shift;
  54. my $self->{search_results} =
  55. $self->exec_method( procname => 'location_list_all' );
  56. }
  57. 1;