Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision db7ddbbe

Von Moritz Bunkus vor fast 4 Jahren hinzugefügt

  • ID db7ddbbe88d50488f5d1f5a09ab2d3455f614e7f
  • Vorgänger 1b7759ed
  • Nachfolger 8f07fac1

Order-Controller: Historienfunktion implementiert (aufzeichnen & anzeigen)

Unterschiede anzeigen:

SL/Controller/Order.pm
13 13
use SL::MIME;
14 14
use SL::Util qw(trim);
15 15
use SL::YAML;
16
use SL::DB::History;
16 17
use SL::DB::Order;
17 18
use SL::DB::Default;
18 19
use SL::DB::Unit;
......
346 347
      $self->js->flash('error', t8('Storing PDF in storage backend failed: #1', $@));
347 348
    }
348 349
  }
350

  
351
  $self->save_history('PRINTED');
352

  
349 353
  $self->js->render;
350 354
}
351 355

  
......
466 470

  
467 471
  $self->order->update_attributes(intnotes => $intnotes);
468 472

  
473
  $self->save_history('MAILED');
474

  
469 475
  flash_later('info', t8('The email has been sent.'));
470 476

  
471 477
  my @redirect_params = (
......
1545 1551
      my $spool = $::lx_office_conf{paths}->{spool};
1546 1552
      unlink map { "$spool/$_" } @spoolfiles if $spool;
1547 1553

  
1554
      $self->save_history('DELETED');
1555

  
1548 1556
      1;
1549 1557
  }) || push(@{$errors}, $db->error);
1550 1558

  
......
1592 1600
        }
1593 1601
      }
1594 1602
    }
1603

  
1604
    $self->save_history('SAVED');
1605

  
1595 1606
    1;
1596 1607
  }) || push(@{$errors}, $db->error);
1597 1608

  
......
1766 1777
  $self->get_item_cvpartnumber($_) for @{$self->order->items_sorted};
1767 1778

  
1768 1779
  $::request->{layout}->use_javascript("${_}.js") for qw(kivi.SalesPurchase kivi.Order kivi.File ckeditor/ckeditor ckeditor/adapters/jquery
1769
                                                         edit_periodic_invoices_config calculate_qty kivi.Validator follow_up);
1780
                                                         edit_periodic_invoices_config calculate_qty kivi.Validator follow_up show_history);
1770 1781
  $self->setup_edit_action_bar;
1771 1782
}
1772 1783

  
......
1879 1890
          disabled => !$self->order->id ? t8('This object has not been saved yet.') : undef,
1880 1891
          only_if  => $::auth->assert('productivity', 1),
1881 1892
        ],
1893
        action => [
1894
          t8('History'),
1895
          call     => [ 'set_history_window', $self->order->id, 'id' ],
1896
          disabled => !$self->order->id ? t8('This record has not been saved yet.') : undef,
1897
        ],
1882 1898
      ], # end of combobox "more"
1883 1899
    );
1884 1900
  }
......
2106 2122
  $self->redirect_to(%params, id => $self->order->id);
2107 2123
}
2108 2124

  
2125
sub save_history {
2126
  my ($self, $addition) = @_;
2127

  
2128
  my $number_type = $self->order->type =~ m{order} ? 'ordnumber' : 'quonumber';
2129
  my $snumbers    = $number_type . '_' . $self->order->$number_type;
2130

  
2131
  SL::DB::History->new(
2132
    trans_id    => $self->order->id,
2133
    employee_id => SL::DB::Manager::Employee->current->id,
2134
    what_done   => $self->order->type,
2135
    snumbers    => $snumbers,
2136
    addition    => $addition,
2137
  )->save;
2138
}
2139

  
2109 2140
1;
2110 2141

  
2111 2142
__END__
......
2229 2260

  
2230 2261
=item * display weights
2231 2262

  
2232
=item * history
2233

  
2234 2263
=item * mtime check
2235 2264

  
2236 2265
=item * optional client/user behaviour

Auch abrufbar als: Unified diff