Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision be0f02ee

Von Bernd Bleßmann vor mehr als 2 Jahren hinzugefügt

  • ID be0f02ee8008482ceece366f2327203850756ad4
  • Vorgänger 51e60701
  • Nachfolger 6e445d41

Wiedervorlage für mehrere Benutzer: Erstellen und Bearbeiten

Unterschiede anzeigen:

SL/FU.pm
35 35
  if (!$params{id}) {
36 36
    ($params{id}) = selectrow_query($form, $dbh, qq|SELECT nextval('follow_up_id')|);
37 37

  
38
    $query = qq|INSERT INTO follow_ups (created_by, done, note_id, follow_up_date, created_for_user, id)
39
                VALUES ((SELECT id FROM employee WHERE login = ?), ?, ?, ?, ?, ?)|;
38
    $query = qq|INSERT INTO follow_ups (created_by, done, note_id, follow_up_date, id)
39
                VALUES ((SELECT id FROM employee WHERE login = ?), ?, ?, ?, ?)|;
40 40

  
41 41
    push @values, $::myconfig{login};
42 42

  
43 43
  } else {
44
    $query = qq|UPDATE follow_ups SET done = ?, note_id = ?, follow_up_date = ?, created_for_user = ? WHERE id = ?|;
44
    $query = qq|UPDATE follow_ups SET done = ?, note_id = ?, follow_up_date = ? WHERE id = ?|;
45 45
  }
46 46

  
47 47
  $params{note_id} = Notes->save('id'           => $params{note_id},
......
53 53

  
54 54
  $params{done} = 1 if (!defined $params{done});
55 55

  
56
  do_query($form, $dbh, $query, @values, $params{done} ? 't' : 'f', conv_i($params{note_id}), $params{follow_up_date}, conv_i($params{created_for_user}), conv_i($params{id}));
56
  do_query($form, $dbh, $query, @values, $params{done} ? 't' : 'f', conv_i($params{note_id}), $params{follow_up_date}, conv_i($params{id}));
57 57

  
58 58
  do_query($form, $dbh, qq|DELETE FROM follow_up_links WHERE follow_up_id = ?|, conv_i($params{id}));
59 59

  
......
66 66

  
67 67
  $sth->finish();
68 68

  
69
  do_query($form, $dbh, qq|DELETE FROM follow_up_created_for_employees WHERE follow_up_id = ?|, conv_i($params{id}));
70

  
71
  $query = qq|INSERT INTO follow_up_created_for_employees (follow_up_id, employee_id) VALUES (?, ?)|;
72
  $sth   = prepare_query($form, $dbh, $query);
73

  
74
  foreach my $employee_id (@{ $params{created_for_employees} }) {
75
    do_statement($form, $sth, $query, conv_i($params{id}), $employee_id);
76
  }
77

  
69 78
  return 1;
70 79
}
71 80

  
......
131 140
  $query            = qq|SELECT fu.*, n.subject, n.body, n.created_by
132 141
                         FROM follow_ups fu
133 142
                         LEFT JOIN notes n ON (fu.note_id = n.id)
143
                         LEFT JOIN follow_up_created_for_employees ON (follow_up_created_for_employees.follow_up_id = fu.id)
134 144
                         WHERE (fu.id = ?)
135
                           AND (   (fu.created_by = ?) OR (fu.created_for_user = ?)
145
                           AND (   (fu.created_by = ?) OR (follow_up_created_for_employees.employee_id = ?)
136 146
                                OR (fu.created_by IN (SELECT DISTINCT what FROM follow_up_access WHERE who = ?)))|;
137 147
  my $ref           = selectfirst_hashref_query($form, $dbh, $query, conv_i($params{id}), $employee_id, $employee_id, $employee_id);
138 148

  

Auch abrufbar als: Unified diff