--- /dev/null
+package SL::Controller::Employee;
+
+use strict;
+use parent qw(SL::Controller::Base);
+
+use SL::DB::Employee;
+use SL::Helper::Flash;
+
+__PACKAGE__->run_before('check_auth');
+__PACKAGE__->run_before('load_all');
+__PACKAGE__->run_before('load_from_form');
+__PACKAGE__->run_before('assign_from_form');
+
+our @updatable_columns = qw(deleted);
+
+sub action_list {
+ my ($self, %params) = @_;
+
+ $self->render('employee/list', title => $::locale->text('Employees'));
+}
+
+sub action_edit {
+ my ($self, %params) = @_;
+
+ if ($self->{employee}) {
+ $self->render('employee/edit', title => $::locale->text('Edit Employee #1', $self->{employee}->safe_name));
+ } else {
+ flash('error', $::locale->text('Could not load employee'));
+ $self->redirect_to(action => 'list');
+ }
+}
+
+sub action_save {
+ my ($self, %params) = @_;
+
+ $self->{employee}->save;
+
+ flash('info', $::locale->text('Employee #1 saved!'));
+
+ $self->redirect_to(action => 'edit', 'employee.id' => $self->{employee}->id);
+}
+
+#################### private stuff ##########################
+
+sub check_auth {
+ $::auth->assert('admin');
+}
+
+sub load_all {
+ $_[0]{employees} = SL::DB::Manager::Employee->get_all;
+}
+
+sub load_from_form {
+ $_[0]{employee} = SL::DB::Manager::Employee->find_by(id => delete $::form->{employee}{id});
+}
+
+sub assign_from_form {
+ my %data = %{ $::form->{employee} || {} };
+
+ return 1 unless keys %data;
+
+ $_[0]{employee}->assign_attributes(map { $_ => $data{$_} } @updatable_columns);
+ return 1;
+}
+
+
+######################## behaviour ##########################
+
+sub delay_flash_on_redirect { 1 }
+
+1;
'Corrections' => 'Korrekturen',
'Costs' => 'Kosten',
'Could not copy %s to %s. Reason: %s' => 'Die Datei "%s" konnte nicht nach "%s" kopiert werden. Grund: %s',
+ 'Could not load employee' => 'Konnte Benutzer nicht laden',
'Could not open the file users/members.' => 'Die Datei "users/members" konnte nicht geöffnet werden.',
'Could not open the old memberfile.' => 'Die Datei mit den Benutzerdaten konnte nicht geöffnet werden.',
'Could not print dunning.' => 'Die Mahnungen konnten nicht gedruckt werden.',
'Delete group' => 'Gruppe löschen',
'Delete profile' => 'Profil löschen',
'Delete transaction' => 'Buchung löschen',
+ 'Deleted' => 'Gelöscht',
'Delivered' => 'Geliefert',
'Delivery Date' => 'Lieferdatum',
'Delivery Order' => 'Lieferschein',
'Edit Customer' => 'Kunde editieren',
'Edit Dunning' => 'Mahnungen konfigurieren',
'Edit Dunning Process Config' => 'Mahnwesenkonfiguration bearbeiten',
+ 'Edit Employee #1' => 'Benutzer #1 bearbeiten',
'Edit Follow-Up' => 'Wiedervorlage bearbeiten',
'Edit Follow-Up for #1' => 'Wiedervorlage für #1 bearbeiten',
'Edit General Ledger Transaction' => 'Buchung im Hauptbuch bearbeiten',
'Either there are no open invoices, or you have already initiated bank transfers with the open amounts for those that are still open.' => 'Entweder gibt es keine offenen Rechnungen, oder es wurden bereits Überweisungen über die offenen Beträge aller offenen Rechnungen erstellt.',
'Element disabled' => 'Element deaktiviert',
'Employee' => 'Bearbeiter',
+ 'Employee #1 saved!' => 'Benutzer #1 gespeichert!',
+ 'Employees' => 'Benutzer',
'Empty transaction!' => 'Buchung ist leer!',
'End date' => 'Enddatum',
'Enter a description for this new draft.' => 'Geben Sie eine Beschreibung für diesen Entwurf ein.',
'Login' => 'Anmelden',
'Login Name' => 'Benutzer',
'Login name missing!' => 'Benutzer - Feld darf nicht leer sein!',
+ 'Login of User' => 'Login',
'Logout' => 'Abmelden',
'Logout now' => 'Lx-Office jetzt verlassen',
'Long Dates' => 'Lange Monatsnamen',
module=am.pl
action=show_history_search
+[System--Employees]
+ACCESS=admin
+module=controller.pl
+action=Employee/list
+
[Program]
--- /dev/null
+[%- USE HTML %]
+[%- USE LxERP %]
+[%- USE T8 %]
+[%- USE L %]
+
+<form action='controller.pl' method='POST'>
+
+<table>
+<tr>
+ <td align='right' class=''>[% 'Login of User' | $T8 %]:</td>
+ <td>[% employee.login | html %]</td>
+</tr>
+<tr>
+ <td align='right'>[% 'Name' | $T8 %]:</td>
+ <td>[% employee.name | html %]</td>
+</tr>
+<tr>
+ <td align='right'>[% 'Deleted' | $T8 %]:</td>
+ <td> [% L.radio_button_tag('employee.deleted', value=1, checked=employee.deleted, label=LxERP.t8('Yes')) %]
+ [% L.radio_button_tag('employee.deleted', value=0, checked=!employee.deleted, label=LxERP.t8('No')) %]
+ </td>
+</tr>
+</table>
+
+[%- L.hidden_tag('employee.id', employee.id) %]
+[%- L.hidden_tag('action', 'Employee/dispatch') %]
+[%- L.submit_tag('action_save', LxERP.t8('Save')) %]
+</form>
+
--- /dev/null
+[%- USE T8 %]
+<table>
+ <tr class='listheading'>
+ <th>[% 'Login of User' | $T8 %]</th>
+ <th>[% 'Name' | $T8 %]</th>
+ <th>[% 'Deleted' | $T8 %]</th>
+ </tr>
+[%- FOREACH row IN SELF.employees %]
+ <tr class='listrow[% loop.count % 2 %]'>
+ <td><a href='[% SELF.url_for(action="edit", "employee.id"=row.id) %]'>[% row.login | html %]</a></td>
+ <td>[% row.name | html %]</td>
+ <td>[% row.deleted_as_bool_yn | html %]</td>
+ </tr>
+[%- END %]
+ </table>
--- /dev/null
+<h1>[% title | html %]</h1>
+
+[% PROCESS 'common/flash.html' %]
+
+[% PROCESS 'employee/_form.html' employee=SELF.employee %]
+
+<hr>
+
+[% PROCESS 'employee/_list.html' %]
--- /dev/null
+<h1>[% title | html %]</h1>
+
+[% PROCESS 'common/flash.html' %]
+
+[% PROCESS 'employee/_list.html' %]