Revision 565

Date:
2016/04/12 21:46:57
Author:
ahitrov
Revision Log:
Autocomplete payments::Operation if applicable

Files:

Legend:

 
Added
 
Removed
 
Modified
  • utf8/plugins/webshop/comps/contenido/webshop/delivery.html

     
    144 144
    145 145 # Удаление...
    146 146 if (defined($id) && ($id > 0) && $delete) {
    147 $document->status( 5 );
    148 $document->store;
    149
    147 $document->reject;
    150 148 $m->redirect("./?ost=3".($return_params ? '&'.$return_params : ''));
    151 149 }
    152 150
  • utf8/plugins/webshop/comps/contenido/webshop/facility.html

     
    145 145
    146 146 # Удаление...
    147 147 if (defined($id) && ($id > 0) && $delete) {
    148 $document->status( 5 );
    149 $document->store;
    150
    148 $document->reject;
    151 149 $m->redirect("./?ost=2".($return_params ? '&'.$return_params : ''));
    152 150 }
    153 151
  • utf8/plugins/webshop/comps/contenido/webshop/take_care.html

     
    137 137
    138 138 # Удаление...
    139 139 if (defined($id) && ($id > 0) && $delete) {
    140 $document->status( 5 );
    141 $document->store;
    142
    143 $m->redirect("./?ost=1".($return_params ? '&'.$return_params : ''));
    140 $document->reject;
    141 $m->redirect("./?ost=5".($return_params ? '&'.$return_params : ''));
    144 142 }
    145 143
    146 144 # Сохранение существующего документа или создание нового...
  • utf8/plugins/webshop/lib/webshop/Order.pm

     
    112 112
    113 113 # my $query = $self->{keeper}->SQL->prepare("delete from basket where order_id = ? and uid = ?");
    114 114 # $query->execute( $self->id, $self->uid );
    115
    115 116 $self->status(5);
    116 117 $self->store;
    117 118 }
     
    139 140 ];
    140 141 }
    141 142
    143 sub pre_store
    144 {
    145 my $self = shift;
    142 146
    147 if ( grep { $_ eq 'payments' } split /\s+/, $state->plugins ) {
    148 my $action;
    149 my ($lastop) = $keeper->get_documents( class => 'payments::Operation', order_id => $self->id, order_by => 'id desc', limit => 1 );
    150 if ( ref $lastop ) {
    151 if ( $self->status == 1 || $self->status == 2 || $self->status == 6 ) {
    152 if ( $lastop->name eq 'suspend' || $lastop->name eq 'cancel' || $lastop->name eq 'close' ) {
    153 $action = 'resume';
    154 }
    155 } elsif ( $self->status == 7 ) {
    156 if ( $lastop->name ne 'suspend' ) {
    157 $action = 'suspend';
    158 }
    159 } elsif ( $self->status == 4 ) {
    160 if ( $lastop->name ne 'close' ) {
    161 $action = 'close';
    162 }
    163 } elsif ( $self->status == 5 ) {
    164 if ( $lastop->name ne 'cancel' ) {
    165 $action = 'cancel';
    166 }
    167 }
    168 } else {
    169 if ( $self->status == 1 || $self->status == 2 || $self->status == 6 ) {
    170 $action = 'create';
    171 } elsif ( $self->status == 7 ) {
    172 $action = 'suspend';
    173 } elsif ( $self->status == 4 ) {
    174 $action = 'close';
    175 } elsif ( $self->status == 5 ) {
    176 $action = 'cancel';
    177 }
    178 }
    179 if ( $action ) {
    180 my $op = payments::Operation->new( $keeper );
    181 $op->name( $action );
    182 $op->order_id( $self->id );
    183 $op->uid( $self->uid );
    184 if ( ref $user ) {
    185 $op->uuid( $user->id );
    186 }
    187 $op->sum( $self->sum_total );
    188 $op->store;
    189 }
    190 }
    191 return 1;
    192 }
    193
    194
    143 195 sub post_delete
    144 196 {
    145 197 my $self = shift;