summaryrefslogtreecommitdiff
path: root/LedgerSMB/RESTXML/Document/Customer.pm
blob: b2e19753d96910f457d3da42ca79ed10abe76821 (plain)
  1. package LedgerSMB::RESTXML::Document::Customer;
  2. use strict;
  3. use warnings;
  4. use base qw(LedgerSMB::RESTXML::Document::Base);
  5. sub handle_get {
  6. my ( $self, $args ) = @_;
  7. my $user = $args->{user};
  8. my $dbh = $args->{dbh};
  9. my $handler = $args->{handler};
  10. my $res = $dbh->selectrow_hashref( q{SELECT * from customer where id = ?},
  11. undef, $args->{args}[0] );
  12. if ( !$res ) {
  13. $handler->not_found("No customer with the id $args->{args}[0] found");
  14. }
  15. else {
  16. $handler->respond(
  17. $self->hash_to_twig( { name => 'Customer', hash => $res } ) );
  18. }
  19. }
  20. 1;