Fix für Bug 1025.
# check for duplicates
if (!$form->{edit}) {
my %members = $auth->read_all_users();
-
if ($members{$form->{login}}) {
- $form->error("$form->{login} " . $locale->text('is already a member!'));
+ $form->show_generic_error($locale->text('Another user with the login #1 does already exist.', $form->{login}), 'back_button' => 1);
}
}
}
}
+ # Add new user to his groups.
+ if (ref $form->{new_user_group_ids} eq 'ARRAY') {
+ my $all_groups = $auth->read_groups();
+ my %user = $auth->read_user($form->{login});
+
+ foreach my $group_id (@{ $form->{new_user_group_ids} }) {
+ my $group = $all_groups->{$group_id};
+
+ next if !$group;
+
+ push @{ $group->{members} }, $user{id};
+ $auth->save_group($group);
+ }
+ }
+
$form->redirect($locale->text('User saved!'));
}
+sub save_user_as_new {
+ $form->{login} = $form->{new_user_login};
+ delete @{$form}{qw(edit new_user_login)};
+
+ save_user();
+}
+
sub delete_user {
my %members = $auth->read_all_users();
my $templates = $members{$form->{login}}->{templates};
}
sub dispatcher {
- foreach my $action (qw(create_standard_group dont_create_standard_group)) {
+ foreach my $action (qw(create_standard_group dont_create_standard_group
+ save_user delete_user save_user_as_new)) {
if ($form->{"action_${action}"}) {
call_sub($action);
return;
'Administration' => 'Administration',
'Advance turnover tax return' => 'Umsatzsteuervoranmeldung',
'All reports' => 'Alle Berichte (Kontenübersicht, Summen- u. Saldenliste, GuV, BWA, Bilanz, Projektbuchungen)',
+ 'Another user with the login #1 does already exist.' => 'Es existiert bereits ein anderer Benutzer mit diesem Login.',
'Attempt to call an undefined sub named \'%s\'' => 'Es wurde versucht, eine nicht definierte Unterfunktion namens \'%s\' aufzurufen.',
'Authentification database creation' => 'Anlegen der Datenbank zur Benutzerauthentifizierung',
'Authentification tables creation' => 'Anlegen der Tabellen zur Benutzerauthentifizierung',
'config/authentication.pl: Missing parameters in "LDAP_config". Required parameters are "host", "attribute" and "base_dn".' => 'config/authentication.pl: Fehlende Parameter in "LDAP_config". Benötigt werden "host", "attribute" und "base_dn".',
'customer' => 'Kunde',
'invoice' => 'Rechnung',
- 'is already a member!' => 'ist bereits ein Mitglied!',
'no' => 'nein',
'packing_list' => 'Versandliste',
'pick_list' => 'Entnahmeliste',
'save_group' => 'save_group',
'save_group_membership' => 'save_group_membership',
'save_user' => 'save_user',
+ 'save_user_as_new' => 'save_user_as_new',
'select_part' => 'select_part',
'select_part_internal' => 'select_part_internal',
'set_longdescription' => 'set_longdescription',
'Amount' => 'Betrag',
'Amount Due' => 'Betrag fällig',
'Annotations' => 'Anmerkungen',
+ 'Another user with the login #1 does already exist.' => 'Es existiert bereits ein anderer Benutzer mit diesem Login.',
'Ansprechpartner' => 'Ansprechpartner',
'Ap aging on %s' => 'Offene Verbindlichkeiten zum %s',
'Application Error. No Format given' => 'Fehler in der Anwendung. Das Ausgabeformat fehlt.',
'Please ask your administrator to create warehouses and bins.' => 'Bitten Sie Ihren Administrator, dass er Lager und Lagerplätze anlegt.',
'Please enter a license key.' => 'Bitte geben Sie einen Lizenzschlüssel an.',
'Please enter a number of licenses.' => 'Bitte geben Sie die Anzahl Lizenzschlüssel an.',
+ 'Please enter the login for the new user.' => 'Bitte geben Sie das Login für den neuen Benutzer ein.',
'Please enter the name of the database that will be used as the template for the new database:' => 'Bitte geben Sie den Namen der Datenbank an, die als Vorlage für die neue Datenbank benutzt wird:',
'Please enter the name of the dataset you want to restore the backup in.' => 'Bitte geben Sie den Namen der Datenbank ein, in der Sie die Sicherung wiederherstellen wollen.',
'Please enter the taxnumber in the administration menu userpreferences' => 'Bitte bei den Einstellungen des aktuellen Benutzers im Administrationsmodul
'history search engine' => 'Historien Suchmaschine',
'invoice' => 'Rechnung',
'invoice_list' => 'debitorenbuchungsliste',
- 'is already a member!' => 'ist bereits ein Mitglied!',
'lead deleted!' => 'Kundenquelle gelöscht',
'lead saved!' => 'Kundenquelle geichert',
'list' => 'auflisten',
[% USE HTML %]<body class="admin">
<script type="text/javascript" src="js/common.js"></script>
+ <script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript">
<!--
function open_connection_test_window() {
-->
</script>
- <form name="Form" method="post" action="admin.pl">
+ <form name="Form" id="Form" method="post" action="admin.pl">
<div class="listtop" width="100%">[% title %]</div>
<table>
<tr>
<th align="right">Anmeldung</th>
- <td>[% IF edit %]<input type="hidden" name="login" value="[% HTML.escape(myc_login) %]">[% HTML.escape(myc_login) %][% ELSE %]<input name="login" value="[% HTML.escape(myc_login) %]">[% END %]</td>
+ <td>
+ [%- IF edit %]
+ <input type="hidden" name="login" value="[% HTML.escape(myc_login) %]">[% HTML.escape(myc_login) %]
+ [%- ELSE %]
+ <input name="login" value="[% HTML.escape(myc_login) %]">
+ [%- END %]
+ </td>
</tr>
<tr>
<input name="callback" type="hidden" value="admin.pl?action=list_users">
- <input type="submit" class="submit" name="action" value="Speichern">
+ <input type="hidden" name="action" value="dispatcher">
+ <input type="submit" class="submit" name="action_save_user" value="Speichern">
[% IF edit %]
- <input type="submit" class="submit" name="action" value="Löschen">
+ [% FOREACH row = GROUPS %]
+ <input type="hidden" name="new_user_group_ids[]" value="[% HTML.escape(row.id) %]">
+ [% END %]
+ <input type="hidden" name="new_user_login" id="new_user_login" value="">
+ <input type="hidden" name="action_save_user_as_new" id="action_save_user_as_new" value="">
+ <input type="button" class="submit" id="save_as_new_button" value="als neu speichern">
+ <input type="submit" class="submit" name="action_delete_user" value="Löschen">
<input type="hidden" name="edit" value="1">
[% END %]
</form>
+ <script type="text/javascript">
+ <!--
+ $(document).ready(function() {
+ $("#save_as_new_button").click(function() {
+ var new_user_login = prompt('Bitte geben Sie das Login für den neuen Benutzer ein.', '');
+ if (!new_user_login || (new_user_login == ''))
+ return;
+
+ $("#action_save_user_as_new").attr('value', '1');
+ $("#new_user_login").attr('value', new_user_login);
+ $("#Form").submit();
+ });
+ });
+ -->
+ </script>
+
</body>
</html>
[% USE HTML %]<body class="admin">
<script type="text/javascript" src="js/common.js"></script>
+ <script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript">
<!--
function open_connection_test_window() {
-->
</script>
- <form name="Form" method="post" action="admin.pl">
+ <form name="Form" id="Form" method="post" action="admin.pl">
<div class="listtop" width="100%">[% title %]</div>
<table>
<tr>
<th align="right"><translate>Login</translate></th>
- <td>[% IF edit %]<input type="hidden" name="login" value="[% HTML.escape(myc_login) %]">[% HTML.escape(myc_login) %][% ELSE %]<input name="login" value="[% HTML.escape(myc_login) %]">[% END %]</td>
+ <td>
+ [%- IF edit %]
+ <input type="hidden" name="login" value="[% HTML.escape(myc_login) %]">[% HTML.escape(myc_login) %]
+ [%- ELSE %]
+ <input name="login" value="[% HTML.escape(myc_login) %]">
+ [%- END %]
+ </td>
</tr>
<tr>
<input name="callback" type="hidden" value="admin.pl?action=list_users">
- <input type="submit" class="submit" name="action" value="<translate>Save</translate>">
+ <input type="hidden" name="action" value="dispatcher">
+ <input type="submit" class="submit" name="action_save_user" value="<translate>Save</translate>">
[% IF edit %]
- <input type="submit" class="submit" name="action" value="<translate>Delete</translate>">
+ [% FOREACH row = GROUPS %]
+ <input type="hidden" name="new_user_group_ids[]" value="[% HTML.escape(row.id) %]">
+ [% END %]
+ <input type="hidden" name="new_user_login" id="new_user_login" value="">
+ <input type="hidden" name="action_save_user_as_new" id="action_save_user_as_new" value="">
+ <input type="button" class="submit" id="save_as_new_button" value="<translate>Save as new</translate>">
+ <input type="submit" class="submit" name="action_delete_user" value="<translate>Delete</translate>">
<input type="hidden" name="edit" value="1">
[% END %]
</form>
+ <script type="text/javascript">
+ <!--
+ $(document).ready(function() {
+ $("#save_as_new_button").click(function() {
+ var new_user_login = prompt('<translate>Please enter the login for the new user.</translate>', '');
+ if (!new_user_login || (new_user_login == ''))
+ return;
+
+ $("#action_save_user_as_new").attr('value', '1');
+ $("#new_user_login").attr('value', new_user_login);
+ $("#Form").submit();
+ });
+ });
+ -->
+ </script>
+
</body>
</html>