[Friday, 09 December 2011], Jaroslaw Dziubek napisał(a):
To jeszcze jedna mała poprawka - numer domu może być w formacie: aa-bb (np. "Krótka 1-4/3"). Patch poniżej:
A może być tez: Krótka 1-4/3A ;)
Index: lms-teryt =================================================================== RCS file: /cvsroot/lms/bin/lms-teryt,v retrieving revision 1.10 diff -u -r1.10 lms-teryt --- lms-teryt 9 Dec 2011 19:52:22 -0000 1.10 +++ lms-teryt 9 Dec 2011 23:00:30 -0000 @@ -620,11 +620,11 @@ printf("%s (%04d) %s: ", $row->{'name'}, $row->{'id'}, $addr) if not $quiet;
# get house/flat - if ($addr =~ /\s([0-9]+\s*[a-z]*)$/i) { + if ($addr =~ /\s([0-9]+(?:-[0-9]+)?\s*[a-z]*)$/i) { $addr = substr($addr, 0, -1 * length($1)); $house = $1; } - elsif ($addr =~ /\s(([0-9]+\s*[a-z]*)/([0-9]+))$/i) { + elsif ($addr =~ /\s(([0-9]+(?:-[0-9]+)?\s*[a-z]*)/([0-9]+[a-z]?))$/i) { $addr = substr($addr, 0, -1 * length($1)); $house = $2; $flat = $3; @@ -651,6 +651,13 @@ if (my $srow = $street_get->fetchrow_hashref()) { $street_id = $srow->{'id'}; $city_id = $srow->{'cityid'}; + } + else { + $city_get->execute($street); + if (my $srow = $city_get->fetchrow_hashref()) { + $city_id = $srow->{'id'}; + $orig_location=~s/$city, //; + } } } elsif ($city) {