[Koha-patches] [PATCH] Creates a syspref & modifies template to show checked out username in OPAC

Galen Charlton galen.charlton at liblime.com
Mon Apr 20 18:34:23 CEST 2009


Hi,

On Sat, Apr 18, 2009 at 4:34 PM, Jane Wagner <jwagner at ptfs.com> wrote:
> +    if (C4::Context->preference("opaclanguages") eq "fr") {
> +        $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OPACShowCheckoutName','0','Displays in the OPAC the name of patron who has checked out the material. WARNING: Most sites should leave this off. It's intended for corporate or special sites which need to track who has the item.','','YesNo')");
> +    } else {
> +        $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OPACShowCheckoutName','0','Displays in the OPAC the name of patron who has checked out the material. WARNING: Most sites should leave this off. It's intended for corporate or special sites which need to track who has the item.','','YesNo')");
> +    }

The rest of the patch is OK, but the change to updatedatabase.pl
doesn't successfully add the system preference.  If you try running
the web installer to update the database, you get the following error
message:

[Mon Apr 20 11:14:40 2009] updatedatabase.pl: DBD::mysql::db do
failed: You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use
near 's intended for corporate or special sites which need to track
who has the item.'' at line 1 at
/home/gmc/koha/dev/installer/data/mysql/updatedatabase.pl line 2310.

This is due to a syntax error in the SQL statement - because the
syspef description contains a quote ("It's"), it needs to be escaped
so that it doesn't get confused for the single quotes delimiting
strings in the SQL.  It should be

$dbh->do("INSERT INTO `systempreferences`
(variable,value,explanation,options,type)
VALUES('OPACShowCheckoutName','0','Displays in the OPAC the name of
patron who has checked out the material. WARNING: Most sites should
leave this off. It\\\'s intended for corporate or special sites which
need to track who has the item.','','YesNo')");

Also, I suggest taking out the test on opaclanguage - only one other
database update does this, and once Jesse's new systempreference
project is complete, we'll have a better way to translate system
preference regardless of whether they're added during a new
installation or during a database update.

Please fix the patch and resubmit.

Regards,

Galen
-- 
Galen Charlton
VP, Research & Development, LibLime
galen.charlton at liblime.com
p: 1-888-564-2457 x709
skype: gmcharlt



More information about the Koha-patches mailing list