From a830f46fc73af2281926e4fc83967674f4025ad3 Mon Sep 17 00:00:00 2001 From: Admin User Koha Date: Wed, 14 Dec 2011 17:31:00 +0100 Subject: [PATCH] Bug 7360 Import Default framework into other deletes default Framework MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Step to reproduce : - export default framework as SQL - create new framework - Import the exported SQL file into this new framework. Go to default framework : It disappeared. If some libraries want to share default frameworks, then it is a major bug. This patch fixes the test in order to cope with 0 character framework name. Signed-off-by: François Charbonnier Signed-off-by: Paul Poulain --- C4/ImportExportFramework.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/C4/ImportExportFramework.pm b/C4/ImportExportFramework.pm index a2b650b8eb..d85e64faeb 100755 --- a/C4/ImportExportFramework.pm +++ b/C4/ImportExportFramework.pm @@ -776,7 +776,7 @@ sub _parseSQLLine my $stmt = SQL::Statement->new($line, $parser); my $where = $stmt->where(); if ($where && $where->op() eq '=' && $line =~ /^\s*DELETE/) { - $line =~ s/frameworkcode='.+?'/frameworkcode='$frameworkcode';/ unless ($_ =~ /frameworkcode='$frameworkcode'/); + $line =~ s/frameworkcode='.*?'/frameworkcode='$frameworkcode';/ unless ($_ =~ /frameworkcode='$frameworkcode'/); } else { my @arrFields; my @arrValues; @@ -817,7 +817,7 @@ sub _parseSQLLine if ($error) { $line .= ';' unless ($line =~ /;$/); if ($line =~ /^\s*DELETE/) { - $line =~ s/frameworkcode='.+?'/frameworkcode='$frameworkcode'/ unless ($_ =~ /frameworkcode='$frameworkcode'/); + $line =~ s/frameworkcode='.*?'/frameworkcode='$frameworkcode'/ unless ($_ =~ /frameworkcode='$frameworkcode'/); } elsif ($line =~ /^\s*INSERT\s+INTO\s+(.*?)\s+\((.*?frameworkcode.*?)\)\s+VALUES\s+\((.+)\)\s*;\s*$/) { my $table = $1; my $fields = $2; -- 2.20.1