From feeab4e185593d1dbb727a1f647cebe40de86e14 Mon Sep 17 00:00:00 2001 From: Julian Maurice Date: Thu, 21 Mar 2013 14:47:37 +0000 Subject: [PATCH] Bug 9117: Add imageurl to the list of parameters of AddAuthorisedValue and add unit test in t/db_dependant/Koha.t --- C4/Koha.pm | 10 +++++----- t/db_dependent/Koha.t | 8 +++----- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/C4/Koha.pm b/C4/Koha.pm index 13ab94a..6869ab0 100644 --- a/C4/Koha.pm +++ b/C4/Koha.pm @@ -1229,22 +1229,22 @@ sub GetKohaAuthorisedValueLib { =head2 AddAuthorisedValue - AddAuthorisedValue($category, $authorised_value, $lib, $lib_opac); + AddAuthorisedValue($category, $authorised_value, $lib, $lib_opac, $imageurl); Create a new authorised value. =cut sub AddAuthorisedValue { - my ($category, $authorised_value, $lib, $lib_opac) = @_; + my ($category, $authorised_value, $lib, $lib_opac, $imageurl) = @_; my $dbh = C4::Context->dbh; my $query = qq{ - INSERT INTO authorised_values (category, authorised_value, lib, lib_opac) - VALUES (?,?,?,?) + INSERT INTO authorised_values (category, authorised_value, lib, lib_opac, imageurl) + VALUES (?,?,?,?,?) }; my $sth = $dbh->prepare($query); - $sth->execute($category, $authorised_value, $lib, $lib_opac); + $sth->execute($category, $authorised_value, $lib, $lib_opac, $imageurl); } =head2 display_marc_indicators diff --git a/t/db_dependent/Koha.t b/t/db_dependent/Koha.t index aea5245..1a68c7d 100644 --- a/t/db_dependent/Koha.t +++ b/t/db_dependent/Koha.t @@ -32,9 +32,7 @@ subtest 'Authorized Values Tests' => sub { # Insert an entry into authorised_value table - my $query = "INSERT INTO authorised_values (category, authorised_value, lib, lib_opac, imageurl) VALUES (?,?,?,?,?);"; - my $sth = $dbh->prepare($query); - my $insert_success = $sth->execute($data->{category}, $data->{authorised_value}, $data->{lib}, $data->{lib_opac}, $data->{imageurl}); + my $insert_success = AddAuthorisedValue($data->{category}, $data->{authorised_value}, $data->{lib}, $data->{lib_opac}, $data->{imageurl}); ok($insert_success, "Insert data in database"); @@ -57,8 +55,8 @@ subtest 'Authorized Values Tests' => sub { # Clean up if($insert_success){ - $query = "DELETE FROM authorised_values WHERE category=? AND authorised_value=? AND lib=? AND lib_opac=? AND imageurl=?;"; - $sth = $dbh->prepare($query); + my $query = "DELETE FROM authorised_values WHERE category=? AND authorised_value=? AND lib=? AND lib_opac=? AND imageurl=?;"; + my $sth = $dbh->prepare($query); $sth->execute($data->{category}, $data->{authorised_value}, $data->{lib}, $data->{lib_opac}, $data->{imageurl}); } }; -- 1.7.2.5