Line # Revision Author
1 198 ahitrov <& "/contenido/components/header.msn" &>
2
3 <style>
4 <!--
5 .inverted td { font-weight:bold; color:white; background-color:#8093B0; }
6 .inverted td a { color:white; font-weight:bold; }
7 //-->
8 </style>
9
10 <table width="100%" cellspacing="0" cellpadding="0" border="0">
11 <tr valign="top">
12 <td width="35%">
13
14 <& /contenido/webshop/components/block_order_status_changer.msn, status => $ost &>
15
16 </td>
17 <td width="1%">&nbsp;</td>
18 <td width="65%">
19
20 <fieldset>
21 <legend>Заказы со статусом "<span style="color:yellow"><% $current_status->[1] %></span>"</legend>
22
23 % if ( $total ) {
24
25 <div style="font-size:75%; font-family:Arial;">
26 <& /inc/pages_.msn, p=>$p, n=>$size, total=>$total, params=>\%filter_params, &>
27 <div style="height:5px"><spacer type="block" height="5"></div>
28 </div>
29
30 <& /contenido/webshop/components/order_browse.msn, documents => \@documents, columns => \@columns, filter => \%filter_params, status => $ost, %ARGS &>
31
32 <div style="font-size:75%; font-family:Arial;">
33 <& /inc/pages_.msn, p=>$p, n=>$size, total=>$total, params=>\%filter_params, &>
34 <div style="height:5px"><spacer type="block" height="5"></div>
35 </div>
36
37 % } else {
38 <h4 align="center"><i>---- Нет документов -----</i></h4>
39 % }
40
41 </td>
42 <td width="1%">&nbsp;</td>
43 </tr>
44 </table>
45
46 </body>
47 </html>
48 <%args>
49
50 $ost => 1
51 $p => 1
52 205 ahitrov $delete => undef
53 198 ahitrov
54 </%args>
55 <%init>
56
57 my %filter_params;
58
59 my (@documents, $total);
60 $filter_params{ost} = $ost if $ost != 1;
61 my $size = 40;
62
63 @documents = $keeper->get_documents(
64 class => 'webshop::Order',
65 status => $ost,
66 limit => $size,
67 offset => ($p-1)*$size,
68 );
69 $total = $keeper->get_documents(
70 class => 'webshop::Order',
71 status => $ost,
72 count => 1,
73 );
74 my @structure = webshop::Order->new( $keeper->{webshop} )->structure;
75 my @columns = sort { $a->{column} <=> $b->{column} }
76 grep { $_->{column} } @structure;
77 push @columns, {attr => '_act_', rusname => 'Действия'};
78 my ($status_map) = grep { $_->{attr} eq 'status' } @structure;
79 my ($current_status) = grep { $_->[0] == $ost } @{$status_map->{cases}};
80
81 205 ahitrov my $active_rights = $m->comp('/contenido/webshop/subs/user_rights.msn');
82 if ( !$active_rights && $delete ) {
83 my $return_params = join ('&', map { $_.'='.$filter_params{$_} } grep { $_ ne 's' } keys %filter_params );
84 my %deleted;
85 while ( my ($field, $value) = each %ARGS ) {
86 if ( $field =~ /^delete_(\d+)_(\w+)$/ ) {
87 my $oid = $1;
88 my $attr = $2;
89 $deleted{$oid}{$attr} = $value;
90 }
91 }
92 my %classes = map { $_->{class} => 1 } values %deleted;
93 foreach my $delete_class ( keys %classes ) {
94 my @ids;
95 while ( my ($oid, $attr) = each %deleted) {
96 push @ids, $oid if exists $attr->{id} && $attr->{id} && ($attr->{class} eq $delete_class);
97 }
98 my @objects = $keeper->get_documents (
99 id => \@ids,
100 class => $delete_class
101 ) if @ids;
102 foreach my $object ( @objects ) {
103 my $document_access = $user->section_accesses($user, $object->section);
104 next unless $document_access == 2;
105 $object->delete;
106 }
107 }
108 $m->redirect("/contenido/webshop/".($return_params ? '?'.$return_params : ''));
109 }
110
111 198 ahitrov </%init>