Bug 13264: Follow up: in opac_utf8.t insert also delete of biblio
authorZeno Tajoli <z.tajoli@cineca.it>
Fri, 21 Nov 2014 12:27:34 +0000 (13:27 +0100)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Tue, 13 Jan 2015 15:43:26 +0000 (12:43 -0300)
In previous version of the test opac_utf8.t clears import from resevoir
but it doesn't delete record from biblio table in MySQL.
This the standard work of the feature, see:
http://manual.koha-community.org/3.18/en/catalogtools.html#managestaged

Now the script deletes also record on MySQL level.
No necessary on Zebra level because it uses a temporaney Zebra index that it is
clenaned at the end of the script.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
t/db_dependent/www/opac_utf8.t

index aad38de..fc20908 100644 (file)
@@ -189,10 +189,13 @@ my $webpage = $agent->{content};
 
 $webpage =~ /(.*<title>.*?)(\d{1,})(.*<\/title>)/sx;
 my $id_batch = $2;
+my $id_bib_number = GetBiblionumberFromImport($id_batch);
 
 # wait enough time for the indexer
 sleep 10;
 
+
+
 # -------------------------------------------------- TEST ON OPAC
 
 
@@ -218,6 +221,8 @@ ok ($text =~  m/学協会. μμ/, 'UTF-8 chars are correctly present. Good');
 $agent->get_ok( "$intranet/cgi-bin/koha/tools/manage-marc-import.pl", 'view and clean batch' );
 $agent->form_name('clean_batch_'.$id_batch);
 $agent->click();
+$agent->get_ok( "$intranet/cgi-bin/koha/catalogue/detail.pl?biblionumber=$id_bib_number", 'biblio on intranet' );
+$agent->get_ok( "$intranet/cgi-bin/koha/cataloguing/addbiblio.pl?op=delete&biblionumber=$id_bib_number", 'biblio deleted' );
 
 # clean
 cleanup();
@@ -260,6 +265,13 @@ sub cleanup {
 
 }
 
+sub GetBiblionumberFromImport{
+    my ( $batch_id) = @_;
+    use C4::ImportBatch;
+    my $data = C4::ImportBatch::GetImportRecordsRange($batch_id, '', '', undef,
+                    { order_by => 'import_record_id', order_by_direction => 'DESC' });
+    my $biblionumber = $data->[0]->{'matched_biblionumber'};
 
-
+    return $biblionumber;
+}
 1;