From: Sven Schöling Date: Tue, 24 Apr 2007 11:16:49 +0000 (+0000) Subject: Substitute mit execute reimt sich. X-Git-Tag: release-2.4.3^2~464 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=b4b714341153b2d66d5095b3ae7dddbddb95f61d;p=kivitendo-erp.git Substitute mit execute reimt sich. --- 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 = ?|;