From b4b714341153b2d66d5095b3ae7dddbddb95f61d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Tue, 24 Apr 2007 11:16:49 +0000 Subject: [PATCH] Substitute mit execute reimt sich. --- SL/Form.pm | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/SL/Form.pm b/SL/Form.pm index 45fd48ed2..8275807d2 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -2357,12 +2357,8 @@ sub update_defaults { my ($var) = $sth->fetchrow_array; $sth->finish; - if ($var =~ /^(.*?)(\d+)$/) { - my $new_num = sprintf '%0*d', length($2), $2 + 1; - $var = "${1}${new_num}"; - } else { - $var++; - } + $var =~ s/\d+$/ sprintf '%0*d', length($&), $&+1 /e; + $var ||= 1; $query = qq|UPDATE defaults SET $fld = ?|; do_query($self, $dbh, $query, $var); @@ -2393,14 +2389,8 @@ sub update_business { WHERE id = ? FOR UPDATE|; my ($var) = selectrow_query($self, $dbh, $query, $business_id); - if ($var ne "") { - if ($var =~ /^(.*?)(\d+)$/) { - my $new_num = sprintf '%0*d', length($2), $2 + 1; - $var = "${1}${new_num}"; - } else { - $var++; - } - } + $var =~ s/\d+$/ sprintf '%0*d', length($&), $&+1 /e; + $query = qq|UPDATE business SET customernumberinit = ? WHERE id = ?|; -- 2.20.1