Line # Revision Author
1 628 ahitrov <% $json %>
2 <%once>
3
4 use JSON::XS;
5
6 </%once>
7 <%args>
8
9 $id => undef
10
11 </%args>
12 <%init>
13
14 my %result;
15
16 if ( $id && $id =~ /^\d+$/ && $id > 0 ) {
17 my $order = $keeper->get_document_by_id( $id, class => 'webshop::Order');
18 if ( ref $order ) {
19 $result{html} = Encode::decode('utf-8', $m->scomp('/contenido/webshop/components/order_found.msn', order => $order));
20 $result{success} = 1;
21 } else {
22 $result{error} = Encode::decode('utf-8', 'Заказ с данным идентификатором не найден.');
23 }
24 } else {
25 $result{error} = Encode::decode('utf-8', 'Неверный идентификатор заказа. Должно быть целое число.');
26 }
27
28 my $json = encode_json \%result;
29
30 </%init>