summaryrefslogtreecommitdiff
path: root/LedgerSMB/RESTXML/Document/Part.pm
blob: 9739449420540848d8f67e1ec43d36335babfdba (plain)
  1. package LedgerSMB::RESTXML::Document::Part;
  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 part where id = ?},
  11. undef, $args->{args}[0] );
  12. if ( !$res ) {
  13. $handler->not_found("No part 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;