Bug 7360 Import Default framework into other deletes default Framework

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 <francois.charbonnier@biblibre.com>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
This commit is contained in:
Admin User Koha 2011-12-14 17:31:00 +01:00 committed by Paul Poulain
parent c9c6bbdea8
commit a830f46fc7
1 changed files with 2 additions and 2 deletions

View File

@ -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;