%# vim:syn=mason <& "/contenido/components/header.msn" &> <& "/contenido/components/naviline.msn", sect_id => $owner->id &> % if ($error) {
<% $error %>


% } % if (!ref($document)) { % if ($id) {
Документ с идентификатором <% $id %> не найден


% } elsif ($class) {
Выберите тип документа для создания <& "/contenido/components/new_objects_form.msn", proto => 'documents', sect_id => $owner->id &>
% } else {
Неверный вызов документа!!! (отсутствуют id и class одновременно)


% } % } else { % if ( $document->vault_id == $user->id ) { <& "/contenido/components/obj_list_js.msn", object => $document &> <& "/contenido/webshop/components/order_form.msn", context => 'facil', object => $document, proto => 'documents', sect_id => $owner->id, clone => $clone, filter_params => \%filter_params, &> % } else { % my $profile = $keeper->get_user_by_id( $document->vault_id );
Комплектация ЗАКАЗА

Внимание! Комплектацией заказа занимается <% $profile->name %>

<< Вернуться в список комплектации

% } % } <%ARGS> $p => 1 $class => 'webshop::Order' $sect_id => undef $s_alias => undef $id => undef $delete => undef $save => undef $clone => undef $activate => undef $deactivate => undef <%INIT> &abort404 unless $class; my $error=''; ### !!! При добавлении переменных в ARGS их надо внести в список исключений в структуре ниже my $filter = $m->comp('/contenido/components/context.msn', name => 'filter'); my $document; my $new; my $now = Contenido::DateTime->new; if ($id && ($id !~ /\D/) && ($id > 0)) { $document = $keeper->get_document_by_id($id, class=>$class); if ( $clone && exists $document->{'attributes'}->{'dtime'} ) { $document->dtime(undef); } } elsif ( ($class) && (length($class)>0) && (! ref($document)) ) { $document = new $class ($keeper); $new = 1; my @properties = $document->structure(); foreach my $prop ( @properties ) { my $attr = $prop->{attr}; ### !!! Если не стандартная переменная, то можем инициализировать if ( exists $ARGS{$attr} && ! grep { $prop->{attr} eq $_ } qw( class sect_id id delete save clone s_alias activate deactivate p s use_section alpha alpha_search search_by search ) ) { $document->$attr($ARGS{$attr}); } } } &abort404 unless ref $document; my @props = $document->structure(); my %filter_params; if ($ARGS{use_section} && !grep { $_->{attr} eq 'use_section' } @props ) { $filter_params{use_section} = $ARGS{use_section}; $filter_params{class} = $document->class; } $filter_params{alpha} = $ARGS{alpha} if $ARGS{alpha} && !grep { $_->{attr} eq 'alpha' } @props; $filter_params{alpha_search} = $ARGS{alpha_search} if $ARGS{alpha_search} && !grep { $_->{attr} eq 'alpha_search' } @props; $filter_params{search_by} = $ARGS{search_by} if $ARGS{search_by} && !grep { $_->{attr} eq 'search_by' } @props; $filter_params{search} = $ARGS{search} if $ARGS{search} && !grep { $_->{attr} eq 'search' } @props; $filter_params{s} = $ARGS{s} if $ARGS{s} && !grep { $_->{attr} eq 's' } @props; $filter_params{p} = $p if $p > 1; my $return_params = join ('&', map { $_.'='.$filter_params{$_} } grep { $_ ne 's' } keys %filter_params ); if ($s_alias) { $sect_id = $project->s_alias->{$s_alias}; } if ( (! $sect_id) && (ref($document)) && ($document->id) ) { $sect_id = $document->section(); } my $owner = $keeper->get_section_by_id ($sect_id || $Contenido::Section::ROOT || 1); if (! ref($owner)) { $owner = $keeper->get_section_by_id ($Contenido::Section::ROOT || 1); } if (! ref($owner)) { warn "Contenido Die: Не могу найти корневую секцию\n"; return undef; } if ( ref $document ) { $document->vault_id( $user->id ); $document->store; } if (ref($document) && $document->id() && $document->section()) { my $document_access = $user->section_accesses($user, $owner); if ($document_access != 2) { $m->clear_buffer; $m->abort(403); } } # Удаление... if (defined($id) && ($id > 0) && $delete) { $document->status( 5 ); $document->store; $m->redirect("./?ost=2".($return_params ? '&'.$return_params : '')); } # Сохранение существующего документа или создание нового... # Кстати, пока никак не обрабатываются связи... elsif ( $save == 1 ) { if ($m->comp('/contenido/webshop/components/set_properties.msn', object => $document, SETS => \%ARGS, context => 'facil') != 1) { # Ошибка, надо бы обработать... warn "Contenido Warning: Не могу установить значения полей!\n"; } if ( $ARGS{_save_and_deliver} ) { $document->vault_id( $user->id ); $document->ftime( $now->ymd('-').' '.$now->hms ); $document->status(3); } elsif ( $ARGS{_ret_manager} ) { $document->status(1); } elsif ( $ARGS{_save_and_leave} ) { $document->vault_id( undef ); $document->status(1); } unless ($document->store()) { # Ошибка, надо бы обработать... $error="Ошибка сохранения ($keeper->{last_error})"; } else { if ($ARGS{_save_and_deliver}) { $m->redirect("./?ost=3"); } elsif ($ARGS{_ret_manager}) { $m->redirect("./?ost=2"); } elsif ($ARGS{_save_and_leave}) { $m->redirect("./?ost=2"); } elsif ($ARGS{_save_and_leave}) { $m->redirect("./?ost=1".($return_params ? '&'.$return_params : '')); } $m->redirect("take_care.html?id=".$document->id.($return_params ? '&'.$return_params : '')); } }