Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 7174b83e

Von Moritz Bunkus vor mehr als 13 Jahren hinzugefügt

  • ID 7174b83edb310d3a2c7dd4ddc651619ed6f16877
  • Vorgänger c90b4dcd
  • Nachfolger 686cba23

Beim Neuanlegen von Artikeln aus Beleg heraus $::form in Session speichern

Unterschiede anzeigen:

bin/mozilla/ic.pl
1759 1759

  
1760 1760
  $auth->assert('part_service_assembly_edit');
1761 1761

  
1762
  my ($parts_id, %newform, $previousform, $amount, $callback);
1762
  my ($parts_id, %newform, $amount, $callback);
1763 1763

  
1764 1764
  # check if there is a part number - commented out, cause there is an automatic allocation of numbers
1765 1765
  # $form->isblank("partnumber", $locale->text(ucfirst $form->{item}." Part Number missing!"));
......
1800 1800
    # save the new form variables before splitting previousform
1801 1801
    map { $newform{$_} = $form->{$_} } keys %$form;
1802 1802

  
1803
    $previousform = $form->unescape($form->{previousform});
1804

  
1805 1803
    # don't trample on previous variables
1806 1804
    map { delete $form->{$_} } keys %newform;
1807 1805

  
1808 1806
    my $ic_cvar_configs = CVar->get_configs(module => 'IC');
1809 1807
    my @ic_cvar_fields  = map { "cvar_$_->{name}" } @{ $ic_cvar_configs };
1810 1808

  
1811
    # now take it apart and restore original values
1812
    foreach my $item (split /&/, $previousform) {
1813
      my ($key, $value) = split m/=/, $item, 2;
1814
      $value =~ s/%26/&/g;
1815
      $form->{$key} = $value;
1816
    }
1809
    # restore original values
1810
    $::auth->restore_form_from_session($newform{previousform}, form => $form);
1817 1811
    $form->{taxaccounts} = $newform{taxaccount2};
1818 1812

  
1819 1813
    if ($form->{item} eq 'assembly') {
bin/mozilla/io.pl
703 703
  $form->{old_callback} = $form->escape($form->{callback}, 1);
704 704
  $form->{callback}     = $form->escape("$form->{script}?action=display_form", 1);
705 705

  
706
  # save all form variables except action in a previousform variable
707
  my $previousform = join '&', map { my $value = $form->{$_}; $value =~ s/&/%26/; "$_=$value" } grep { !/action/ } keys %$form;
706
  # save all form variables except action in the session and keep the key in the previousform variable
707
  my $previousform = $::auth->save_form_in_session(skip_keys => [ qw(action) ]);
708 708

  
709 709
  my @HIDDENS;
710
  push @HIDDENS,      { 'name' => 'previousform', 'value' => $form->escape($previousform, 1) };
710
  push @HIDDENS,      { 'name' => 'previousform', 'value' => $previousform };
711 711
  push @HIDDENS, map +{ 'name' => $_,             'value' => $form->{$_} },                       qw(rowcount vc);
712 712
  push @HIDDENS, map +{ 'name' => $_,             'value' => $form->{"${_}_$form->{rowcount}"} }, qw(partnumber description unit);
713 713
  push @HIDDENS,      { 'name' => 'taxaccount2',  'value' => $form->{taxaccounts} };

Auch abrufbar als: Unified diff