Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision ca5de571

Von Moritz Bunkus vor mehr als 17 Jahren hinzugefügt

  • ID ca5de5712845a874f8abe976d92aef945d513ca7
  • Vorgänger c8ab196a
  • Nachfolger 8c667be6

Speichern der Historie in einer eigenen Tabelle. Auch ein Fix für Bugzilla-ID 558.

Unterschiede anzeigen:

SL/Form.pm
2248 2248
		&get_employee($self, $dbh);
2249 2249
	}
2250 2250
	
2251
	my $query = qq|INSERT INTO status (trans_id, employee_id, addition, what_done) 
2252
				   VALUES ($self->{id}, $self->{employee_id}, '$self->{addition}', '$self->{what_done}')|;
2253
	$dbh->do($query) || $self->dberror($query);
2251
	my $query =
2252
    qq|INSERT INTO history_erp (trans_id, employee_id, addition, what_done) | .
2253
    qq|VALUES (?, ?, ?, ?)|;
2254
  my @values = (conv_i($self->{id}), conv_i($self->{employee_id}),
2255
                $self->{addition}, $self->{what_done});
2256
  do_query($self, $dbh, $query, @values);
2254 2257
	
2255 2258
	$main::lxdebug->leave_sub();
2256 2259
}
......
2264 2267
	my $restriction = shift();
2265 2268
	my @tempArray;
2266 2269
	my $i = 0;
2267
	if($trans_id ne ""){
2268
		my $query = qq|SELECT st.employee_id, st.itime, st.addition, st.what_done, emp.name 
2269
				   FROM status st 
2270
				   LEFT JOIN employee emp 
2271
				   ON emp.id = st.employee_id
2272
				   WHERE trans_id = $trans_id|
2273
				   . $restriction;
2270
	if ($trans_id ne "") {
2271
		my $query =
2272
      qq|SELECT h.employee_id, h.itime, h.addition, h.what_done, emp.name | .
2273
      qq|FROM history_erp h | .
2274
      qq|LEFT JOIN employee emp | .
2275
      qq|ON emp.id = st.employee_id | .
2276
      qq|WHERE trans_id = ? |
2277
      . $restriction;
2274 2278
	
2275 2279
		my $sth = $dbh->prepare($query) || $self->dberror($query);
2276 2280
	
2277
		$sth->execute() || $self->dberror($query);
2281
		$sth->execute($trans_id) || $self->dberror("$query ($trans_id)");
2278 2282

  
2279 2283
		while(my $hash_ref = $sth->fetchrow_hashref()) {
2280 2284
			$hash_ref->{addition} = $main::locale->text($hash_ref->{addition});
2281 2285
			$hash_ref->{what_done} = $main::locale->text($hash_ref->{what_done});
2282 2286
			$tempArray[$i++] = $hash_ref; 
2283 2287
		}
2284
		return \@tempArray if ($i > 0 && $tempArray[0] ne "");
2288
    $main::lxdebug->leave_sub() and return \@tempArray
2289
      if ($i > 0 && $tempArray[0] ne "");
2285 2290
	}
2286
	return 0;
2287 2291
	$main::lxdebug->leave_sub();
2292
	return 0;
2288 2293
}
2289 2294

  
2290 2295
sub save_status {

Auch abrufbar als: Unified diff