Revision 303

Date:
2013/04/10 11:04:35
Author:
ahitrov
Revision Log:
Права пользователей и скрипт очистки
Files:

Legend:

 
Added
 
Removed
 
Modified
  • utf8/plugins/webshop/comps/contenido/webshop/components/order_browse.msn

     
    133 133 % $actions = join (' | ', map { '<a href="./'.$_->{href}.'?id='.$document->id.($params_unclassed ? '&'.$params_unclassed : '').'">'.$_->{name}.'</a>' } @actions);
    134 134 % }
    135 135 % }
    136 % if ( $active_rights == 0 ) {
    137 % if ( $document->$user_id && $document->$user_id != $user->id ) {
    138 % $actions .= ' (<a href="/contenido/webshop/?drop_owner=1&id='.$document->id.($params_unclassed ? '&'.$params_unclassed : '').'&field='.$user_id.'">unlock</a>)'
    139 % } else {
    140 % $actions = join (' | ', map { '<a href="./'.$_->{href}.'?id='.$document->id.($params_unclassed ? '&'.$params_unclassed : '').'">'.$_->{name}.'</a>' } @actions);
    141 % }
    142 % }
    136 143 <td nowrap><% $actions %>\
    137 144 % if ( $inline_status ) {
    138 145 <input type="hidden" name="update_<% $document->id %>_class" value="<% $document->class %>">
  • utf8/plugins/webshop/comps/contenido/webshop/components/order_form.msn

     
    47 47 </tr>
    48 48 </table>
    49 49
    50 % my @properties = $object->structure();
    51 <pre><% Dumper \@properties %></pre>
    50 52 <center>
    51 53 <table width="98%" cellpadding="1" cellspacing="0" border="0">
    52 54
    53 55 <%perl>
    54 56
    55 my @properties = $object->structure();
    57 # my @properties = $object->structure();
    56 58
    57 59 for (0..$#properties)
    58 60 {
  • utf8/plugins/webshop/comps/contenido/webshop/delivery.html

     
    31 31 % }
    32 32
    33 33 % } else {
    34 % if ( $document->postman_id == $user->id ) {
    34 % if ( $document->postman_id == $user->id || $active_rights == 0 ) {
    35 35 <& "/contenido/components/obj_list_js.msn", object => $document &>
    36 36 <& "/contenido/webshop/components/order_form.msn",
    37 37 context => 'post',
  • utf8/plugins/webshop/comps/contenido/webshop/facility.html

     
    32 32
    33 33 % } else {
    34 34
    35 % if ( $document->vault_id == $user->id ) {
    35 % if ( $document->vault_id == $user->id || $active_rights == 0 ) {
    36 36 <& "/contenido/components/obj_list_js.msn", object => $document &>
    37 37 <& "/contenido/webshop/components/order_form.msn",
    38 38 context => 'facil',
     
    129 129 return undef;
    130 130 }
    131 131
    132 if ( ref $document ) {
    132 if ( ref $document && !$document->vault_id ) {
    133 133 $document->vault_id( $user->id );
    134 134 $document->store;
    135 135 }
  • utf8/plugins/webshop/comps/contenido/webshop/index.html

     
    54 54 $ost => 1
    55 55 $p => 1
    56 56 $delete => undef
    57 $drop_owner => undef
    57 58
    58 59 </%args>
    59 60 <%init>
     
    115 116 }
    116 117 }
    117 118 $m->redirect("/contenido/webshop/".($return_params ? '?'.$return_params : ''));
    119 } elsif ( $active_rights == 0 && $drop_owner ) {
    120 my $id = $ARGS{id};
    121 my $doc = $keeper->get_document_by_id( $id,
    122 class => 'webshop::Order',
    123 ) if $id && $id =~ /^\d+$/;
    124 if ( ref $doc ) {
    125 my $user_id = $ARGS{field};
    126 $doc->$user_id( 0 );
    127 $doc->store;
    128 $m->redirect( $r->header_in('Referer') );
    129 }
    118 130 }
    119 131
    120 132 </%init>
  • utf8/plugins/webshop/comps/contenido/webshop/take_care.html

     
    32 32
    33 33 % } else {
    34 34
    35 % if ( $document->vault_id == $user->id || $active_rights == 0 ) {
    35 36 <& "/contenido/components/obj_list_js.msn", object => $document &>
    36 37 <& "/contenido/webshop/components/order_form.msn",
    37 38 object => $document,
     
    39 40 sect_id => $owner->id,
    40 41 filter_params => \%filter_params,
    41 42 &>
    43 % } else {
    44 % my $profile = $keeper->get_user_by_id( $document->manager_id );
    45 <div style="padding:10px;">
    46 <b style="font-size:110%">Оформление ЗАКАЗА</b>
    47 <p style="color:red"><b>Внимание!</b> Комплектацией заказа занимается <% $profile->name %></p>
    48 <p><a href="./?ost=1">&lt;&lt; Вернуться в список комплектации</a></p>
    49 </div>
    50 % }
    42 51 % }
    43 52
    44 53 </body>
     
    64 73 my $new;
    65 74 my $now = Contenido::DateTime->new;
    66 75
    76 my $active_rights = $m->comp('/contenido/webshop/subs/user_rights.msn');
    77
    67 78 if ($id && ($id !~ /\D/) && ($id > 0)) {
    68 79 $document = $keeper->get_document_by_id($id, class=>$class);
    69 80 } elsif ( ($class) && (length($class)>0) && (! ref($document)) ) {
     
    112 123 return undef;
    113 124 }
    114 125
    115 if ( ref $document ) {
    126 if ( ref $document && !$document->manager_id ) {
    116 127 $document->manager_id( $user->id );
    117 128 $document->store;
    118 129 }
  • utf8/plugins/webshop/lib/webshop/Order.pm

     
    59 59 mandatory => 1, rel => 'Не указан город' },
    60 60 { 'attr' => 'metro', 'type' => 'string', 'rusname' => 'Ближайшее метро', manager_hidden => 1, postshow => 1 },
    61 61 { 'attr' => 'timeline', 'type' => 'string', 'rusname' => 'Предпочтительное время', postshow => 1, },
    62 { 'attr' => 'description', 'type' => 'text', 'rusname' => 'Описание для курьера', rows => 5, manager_hidden => 1, postshow => 1 },
    62 { 'attr' => 'description', 'type' => 'text', 'rusname' => 'Описание для курьера', rows => 5, postshow => 1 },
    63 63 { 'attr' => 'facility_comment', 'type' => 'text', 'rusname' => 'Описание проблем с комплектацией', rows => 5, manager_hidden => 1, faciledit => 1 },
    64 64 { 'attr' => 'delivery_comment', 'type' => 'text', 'rusname' => 'Описание проблем с доставкой', rows => 5, manager_hidden => 1, postedit => 1 },
    65 65 )
  • utf8/plugins/webshop/lib/webshop/SQL/Order.pm

     
    24 24 _s_filter
    25 25
    26 26 _uid_filter
    27 _manager_filter
    28 _vault_filter
    29 _postman_filter
    27 30 )];
    28 31
    29 32 sub available_filters {
     
    191 194 return &SQL::Common::_generic_int_filter('d.uid', $opts{uid});
    192 195 }
    193 196
    197 sub _manager_filter {
    198 my ($self,%opts)=@_;
    199 return undef unless ( exists $opts{manager} );
    200 return &SQL::Common::_generic_int_filter('d.manager_id', $opts{manager});
    201 }
    202
    203 sub _vault_filter {
    204 my ($self,%opts)=@_;
    205 return undef unless ( exists $opts{vault} );
    206 return &SQL::Common::_generic_int_filter('d.vault_id', $opts{vault});
    207 }
    208
    209 sub _postman_filter {
    210 my ($self,%opts)=@_;
    211 return undef unless ( exists $opts{postman} );
    212 return &SQL::Common::_generic_int_filter('d.postman_id', $opts{postman});
    213 }
    214
    194 215 1;
  • utf8/plugins/webshop/services/order_manager_clean.pl

     
    1 #!/usr/bin/perl
    2
    3 use strict;
    4 use warnings "all";
    5 use locale;
    6
    7 use FindBin;
    8 BEGIN {
    9 require "$FindBin::RealBin/../lib/Modules.pm";
    10 }
    11
    12 use Contenido::Globals;
    13 use Contenido::Init;
    14 use ErrorTee;
    15 use PidFile;
    16
    17
    18 # begin
    19 Contenido::Init->init();
    20
    21 my $keeper_module = $state->project.'::Keeper';
    22 $keeper = $keeper_module->new($state);
    23
    24 #PidFile->new($keeper, compat=>1); # db-based locking (run only on one host)
    25 #PidFile->new($keeper, compat=>1, per_host=>1); # db-based locking (run on whole cluster)
    26
    27 ############################################
    28 # please use:
    29 # $state->{log_dir} for logging
    30 # $state->{tmp_dir} for temporary files
    31 ###########################################
    32 my $SALES_TIMEOUT = 3600;
    33 my $VAULT_TIMEOUT = 10800;
    34
    35 my $now = Contenido::DateTime->new;
    36 my $request = "UPDATE orders SET manager_id = 0 WHERE status = 1 AND mtime < (CURRENT_DATE - '$SALES_TIMEOUT seconds'::INTERVAL)";
    37 my $sql = $keeper->SQL->prepare( $request );
    38 $sql->execute();
    39 $sql->finish();
    40
    41 $request = "UPDATE orders SET vault_id = 0 WHERE status = 2 AND mtime < (CURRENT_DATE - '$VAULT_TIMEOUT seconds'::INTERVAL)";
    42 $sql = $keeper->SQL->prepare( $request );
    43 $sql->execute();
    44 $sql->finish();