[Koha-patches] [PATCH] Bug 6931 : Only update frameworks for the correct marcflavour

Marc Balmer marc at msys.ch
Fri Apr 20 00:04:04 CEST 2012





Am 19.04.2012 um 23:55 schrieb Chris Cormack <chrisc at catalyst.net.nz>:

> ---
> installer/data/mysql/updatedatabase.pl |   31 ++++++++++++++++++-------------
> 1 files changed, 18 insertions(+), 13 deletions(-)
> 
> diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl
> index e140ff3..40819c6 100755
> --- a/installer/data/mysql/updatedatabase.pl
> +++ b/installer/data/mysql/updatedatabase.pl
> @@ -3974,20 +3974,25 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
> }
> 
> $DBversion = "3.03.00.015";
> -if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
> -    my $sth = $dbh->prepare("INSERT INTO `marc_subfield_structure` (`tagfield`, `tagsubfield`, `liblibrarian`, `libopac`, `repeatable`, `mandatory`, `kohafield`, 
> +if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
> +    if ( C4::Context->preference("marcflavour") eq "MARC21" ) {
> +        my $sth = $dbh->prepare(
> +"INSERT INTO `marc_subfield_structure` (`tagfield`, `tagsubfield`, `liblibrarian`, `libopac`, `repeatable`, `mandatory`, `kohafield`, 
>                              `tab`, `authorised_value`, `authtypecode`, `value_builder`, `isurl`, `hidden`, `frameworkcode`, `seealso`, `link`, `defaultvalue`)


this patch looks nice, but please remove the unnecessary MySQLisms. It is really not needed to use backticks here.

> -                             VALUES ( ?, '9', '9 (RLIN)', '9 (RLIN)', 0, 0, '', 6, '', '', '', 0, -5, '', '', '', NULL)");
> -    $sth->execute('648');
> -    $sth->execute('654');
> -    $sth->execute('655');
> -    $sth->execute('656');
> -    $sth->execute('657');
> -    $sth->execute('658');
> -    $sth->execute('662');
> -    $sth->finish;
> -    print "Upgrade to $DBversion done (Bug 5619: Add subfield 9 to marc21 648,654,655,656,657,658,662)\n";
> -    SetVersion ($DBversion);
> +                             VALUES ( ?, '9', '9 (RLIN)', '9 (RLIN)', 0, 0, '', 6, '', '', '', 0, -5, '', '', '', NULL)"
> +        );
> +        $sth->execute('648');
> +        $sth->execute('654');
> +        $sth->execute('655');
> +        $sth->execute('656');
> +        $sth->execute('657');
> +        $sth->execute('658');
> +        $sth->execute('662');
> +        $sth->finish;
> +        print
> +"Upgrade to $DBversion done (Bug 5619: Add subfield 9 to marc21 648,654,655,656,657,658,662)\n";
> +    }
> +    SetVersion($DBversion);
> }
> 
> $DBversion = '3.03.00.016';
> -- 
> 1.7.5.4
> 
> _______________________________________________
> Koha-patches mailing list
> Koha-patches at lists.koha-community.org
> http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-patches
> website : http://www.koha-community.org/
> git : http://git.koha-community.org/
> bugs : http://bugs.koha-community.org/


More information about the Koha-patches mailing list