Revision 93a4e424
Von Moritz Bunkus vor mehr als 17 Jahren hinzugefügt
SL/Form.pm | ||
---|---|---|
2521 | 2521 |
sub update_business { |
2522 | 2522 |
$main::lxdebug->enter_sub(); |
2523 | 2523 |
|
2524 |
my ($self, $myconfig, $business_id) = @_; |
|
2524 |
my ($self, $myconfig, $business_id, $provided_dbh) = @_;
|
|
2525 | 2525 |
|
2526 |
my $dbh = $self->dbconnect_noauto($myconfig); |
|
2526 |
my $dbh; |
|
2527 |
if ($provided_dbh) { |
|
2528 |
$dbh = $provided_dbh; |
|
2529 |
} else { |
|
2530 |
$dbh = $self->dbconnect_noauto($myconfig); |
|
2531 |
} |
|
2527 | 2532 |
my $query = |
2528 | 2533 |
qq|SELECT customernumberinit FROM business WHERE id=$business_id FOR UPDATE|; |
2529 | 2534 |
my $sth = $dbh->prepare($query); |
... | ... | |
2538 | 2543 |
SET customernumberinit = '$var' WHERE id=$business_id|; |
2539 | 2544 |
$dbh->do($query) || $self->dberror($query); |
2540 | 2545 |
|
2541 |
$dbh->commit; |
|
2542 |
$dbh->disconnect; |
|
2546 |
if (!$provided_dbh) { |
|
2547 |
$dbh->commit; |
|
2548 |
$dbh->disconnect; |
|
2549 |
} |
|
2543 | 2550 |
|
2544 | 2551 |
$main::lxdebug->leave_sub(); |
2545 | 2552 |
|
Auch abrufbar als: Unified diff
CT.pm auf die Verwendung von parametrisierten Queries zur Vermeidung von SQL injection umgestellt. Dabei Restfunktionalität von customertax und vendortax entfernt. Mehr Datenbankhilfsfunktionen hinzugefügt.