summaryrefslogtreecommitdiff
path: root/LedgerSMB/RESTXML/Document/Customer.pm
blob: 3a494965e47d11bdf4bf74f2651a9799821ce848 (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 = ?}, undef, $args->{args}[0]);
  11. if(!$res) {
  12. $handler->not_found("No customer with the id $args->{args}[0] found");
  13. } else {
  14. $handler->respond($self->hash_to_twig({name=>'Customer',hash=>$res}));
  15. }
  16. }
  17. 1;