Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 14c1b704

Von Moritz Bunkus vor mehr als 15 Jahren hinzugefügt

  • ID 14c1b704816c9dcfebca1d0bf9fd0e2fc2d253e4
  • Vorgänger dc6afb8c
  • Nachfolger 32147d43

Beim Speichern eines Benutzers aus dem Administrationsfrontend heraus seinen Eintrag in employee aktualisieren.

Fix für Bug 1031.

Unterschiede anzeigen:

SL/User.pm
955 955

  
956 956
  my $dbh = DBI->connect($self->{dbconnect}, $self->{dbuser}, $self->{dbpasswd});
957 957
  if ($dbh) {
958
    $self->create_employee_entry($form, $dbh, $self);
958
    $self->create_employee_entry($form, $dbh, $self, 1);
959 959
    $dbh->disconnect();
960 960
  }
961 961

  
......
965 965
sub create_employee_entry {
966 966
  $main::lxdebug->enter_sub();
967 967

  
968
  my $self     = shift;
969
  my $form     = shift;
970
  my $dbh      = shift;
971
  my $myconfig = shift;
968
  my $self            = shift;
969
  my $form            = shift;
970
  my $dbh             = shift;
971
  my $myconfig        = shift;
972
  my $update_existing = shift;
972 973

  
973 974
  # add login to employee table if it does not exist
974 975
  # no error check for employee table, ignore if it does not exist
975
  my ($login)  = selectrow_query($form, $dbh, qq|SELECT id FROM employee WHERE login = ?|, $self->{login});
976
  my ($id)  = selectrow_query($form, $dbh, qq|SELECT id FROM employee WHERE login = ?|, $self->{login});
976 977

  
977
  if (!$login) {
978
  if (!$id) {
978 979
    my $query = qq|INSERT INTO employee (login, name, workphone, role) VALUES (?, ?, ?, ?)|;
979 980
    do_query($form, $dbh, $query, ($self->{login}, $myconfig->{name}, $myconfig->{tel}, "user"));
981

  
982
  } elsif ($update_existing) {
983
    my $query = qq|UPDATE employee SET name = ?, workphone = ?, role = 'user' WHERE id = ?|;
984
    do_query($form, $dbh, $query, $myconfig->{name}, $myconfig->{tel}, $id);
980 985
  }
981 986

  
982 987
  $main::lxdebug->leave_sub();

Auch abrufbar als: Unified diff