Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 0b1cca5d

Von Tamino Steinert vor etwa 1 Jahr hinzugefügt

  • ID 0b1cca5d2b4452f21cae8879c8b9d80196568778
  • Vorgänger 569d24f3
  • Nachfolger d72796a6

Model::Record: Überprüfe ob Positionen vorhanden sind

Unterschiede anzeigen:

SL/Controller/DeliveryOrder.pm
1641 1641
sub save {
1642 1642
  my ($self) = @_;
1643 1643

  
1644
  if (scalar @{$self->order->items} == 0 && !grep { $self->type eq $_ } @{$::instance_conf->get_allowed_documents_with_no_positions() || []}) {
1645
    return [t8('The action you\'ve chosen has not been executed because the document does not contain any item yet.')];
1646
  }
1647

  
1648 1644
  # link records
1649 1645
  if ($::form->{converted_from_oe_id}) {
1650 1646
    my @converted_from_oe_ids = split ' ', $::form->{converted_from_oe_id};
SL/Controller/Order.pm
2067 2067
sub save {
2068 2068
  my ($self) = @_;
2069 2069

  
2070
  if (scalar @{$self->order->items} == 0 && !grep { $self->type eq $_ } @{$::instance_conf->get_allowed_documents_with_no_positions() || []}) {
2071
    return [t8('The action you\'ve chosen has not been executed because the document does not contain any item yet.')];
2072
  }
2073

  
2074 2070
  $self->parse_phone_note if $::form->{phone_note}->{subject} || $::form->{phone_note}->{body};
2075 2071

  
2076 2072
  # create first version if none exists
SL/Controller/Reclamation.pm
1582 1582
sub save {
1583 1583
  my ($self) = @_;
1584 1584

  
1585
  if (scalar @{$self->reclamation->items} == 0 && !grep { $self->type eq $_ } @{$::instance_conf->get_allowed_documents_with_no_positions() || []}) {
1586
    return [t8('The action you\'ve chosen has not been executed because the document does not contain any item yet.')];
1587
  }
1588

  
1589 1585
  my $items_to_delete  = scalar @{ $self->item_ids_to_delete || [] }
1590 1586
                       ? SL::DB::Manager::ReclamationItem->get_all(where => [id => $self->item_ids_to_delete])
1591 1587
                       : undef;
SL/Model/Record.pm
142 142
sub save {
143 143
  my ($class, $record, %params) = @_;
144 144

  
145
  # Test for no items
146
  if (scalar @{$record->items} == 0
147
      && !grep { $record->record_type eq $_ }
148
         @{$::instance_conf->get_allowed_documents_with_no_positions() || []}) {
149
    die t8('The action you\'ve chosen has not been executed because the document does not contain any item yet.');
150
  }
151

  
145 152
  $record->calculate_prices_and_taxes() if $record->type_data->features('price_tax');
146 153

  
147 154
  foreach my $item (@{ $record->items }) {

Auch abrufbar als: Unified diff