Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 57657390

Von Bernd Bleßmann vor fast 2 Jahren hinzugefügt

  • ID 576573901b610c914069da2b7d85972065406c89
  • Vorgänger 587efe1a
  • Nachfolger 7e4a1765

Gültigkeitstoken in Transaction abfragen und löschen ("neue" Controller)

Unterschiede anzeigen:

SL/Controller/DeliveryOrder.pm
1658 1658
sub save {
1659 1659
  my ($self) = @_;
1660 1660

  
1661
  my $validity_token;
1662
  if (!$self->order->id) {
1663
    $validity_token = SL::DB::Manager::ValidityToken->fetch_valid_token(
1664
      scope => SL::DB::ValidityToken::SCOPE_DELIVERY_ORDER_SAVE(),
1665
      token => $::form->{form_validity_token},
1666
    );
1667

  
1668
    return [t8('The form is not valid anymore.')] if !$validity_token;
1669
  }
1670

  
1671 1661
  my $errors = [];
1672 1662
  my $db     = $self->order->db;
1673 1663

  
1674 1664
  $db->with_transaction(sub {
1665
    my $validity_token;
1666
    if (!$self->order->id) {
1667
      $validity_token = SL::DB::Manager::ValidityToken->fetch_valid_token(
1668
        scope => SL::DB::ValidityToken::SCOPE_DELIVERY_ORDER_SAVE(),
1669
        token => $::form->{form_validity_token},
1670
      );
1671

  
1672
      die $::locale->text('The form is not valid anymore.') if !$validity_token;
1673
    }
1674

  
1675 1675
    # delete custom shipto if it is to be deleted or if it is empty
1676 1676
    if ($self->order->custom_shipto && ($self->is_custom_shipto_to_delete || $self->order->custom_shipto->is_empty)) {
1677 1677
      $self->order->custom_shipto->delete if $self->order->custom_shipto->shipto_id;
SL/Controller/Order.pm
2120 2120
sub save {
2121 2121
  my ($self) = @_;
2122 2122

  
2123
  my $validity_token;
2124
  if (!$self->order->id) {
2125
    $validity_token = SL::DB::Manager::ValidityToken->fetch_valid_token(
2126
      scope => SL::DB::ValidityToken::SCOPE_ORDER_SAVE(),
2127
      token => $::form->{form_validity_token},
2128
    );
2129

  
2130
    return [t8('The form is not valid anymore.')] if !$validity_token;
2131
  }
2132

  
2133 2123
  $self->recalc();
2134 2124
  $self->get_unalterable_data();
2135 2125

  
......
2160 2150
  }
2161 2151

  
2162 2152
  $db->with_transaction(sub {
2153
    my $validity_token;
2154
    if (!$self->order->id) {
2155
      $validity_token = SL::DB::Manager::ValidityToken->fetch_valid_token(
2156
        scope => SL::DB::ValidityToken::SCOPE_ORDER_SAVE(),
2157
        token => $::form->{form_validity_token},
2158
      );
2159

  
2160
      die $::locale->text('The form is not valid anymore.') if !$validity_token;
2161
    }
2162

  
2163 2163
    # delete custom shipto if it is to be deleted or if it is empty
2164 2164
    if ($self->order->custom_shipto && ($self->is_custom_shipto_to_delete || $self->order->custom_shipto->is_empty)) {
2165 2165
      $self->order->custom_shipto->delete if $self->order->custom_shipto->shipto_id;
SL/Controller/Reclamation.pm
1746 1746
sub save {
1747 1747
  my ($self) = @_;
1748 1748

  
1749
  my $validity_token;
1750
  if (!$self->reclamation->id) {
1751
    $validity_token = SL::DB::Manager::ValidityToken->fetch_valid_token(
1752
      scope => SL::DB::ValidityToken::SCOPE_RECLAMATION_SAVE(),
1753
      token => $::form->{form_validity_token},
1754
    );
1755

  
1756
    die t8('The form is not valid anymore.') if !$validity_token;
1757
  }
1758

  
1759 1749
  my $errors = [];
1760 1750
  my $db     = $self->reclamation->db;
1761 1751

  
1762 1752
  $db->with_transaction(sub {
1753
    my $validity_token;
1754
    if (!$self->reclamation->id) {
1755
      $validity_token = SL::DB::Manager::ValidityToken->fetch_valid_token(
1756
        scope => SL::DB::ValidityToken::SCOPE_RECLAMATION_SAVE(),
1757
        token => $::form->{form_validity_token},
1758
      );
1759

  
1760
      die $::locale->text('The form is not valid anymore.') if !$validity_token;
1761
    }
1762

  
1763 1763
    # delete custom shipto if it is to be deleted or if it is empty
1764 1764
    if ($self->reclamation->custom_shipto
1765 1765
        && ($self->is_custom_shipto_to_delete

Auch abrufbar als: Unified diff