Bugzilla – Attachment 76504 Details for
Bug 20271
Merge deleted biblio, biblioitems, biblio_metadata, and items tables
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20271: (QA follow-up): rename to deleted_on and various fixes
Bug-20271-QA-follow-up-rename-to-deletedon-and-var.patch (text/plain), 40.63 KB, created by
Josef Moravec
on 2018-06-27 13:38:32 UTC
(
hide
)
Description:
Bug 20271: (QA follow-up): rename to deleted_on and various fixes
Filename:
MIME Type:
Creator:
Josef Moravec
Created:
2018-06-27 13:38:32 UTC
Size:
40.63 KB
patch
obsolete
>From ba6997c79ac4cd5003cefb979e85bebaec973c5b Mon Sep 17 00:00:00 2001 >From: Benjamin Rokseth <benjamin.rokseth@deichman.no> >Date: Tue, 15 May 2018 23:10:03 +0200 >Subject: [PATCH] Bug 20271: (QA follow-up): rename to deleted_on and various > fixes > >- renamed deleted_at => deleted_on >- removed failing sql in t/db_dependent/OAI/Server.t >- removed deprecated autoincrement checks in about.pl >- fixed errors in catalogue_stats.tt and catalogue_stats.pl > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Removed the DBIx schema changes. Please keep them separated. >We missed changes for Biblioitem btw. Adding them in follow-up. >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> > >Signed-off-by: Josef Moravec <josef.moravec@gmail.com> >--- > C4/Biblio.pm | 16 +++++++-------- > C4/Circulation.pm | 2 +- > C4/Items.pm | 20 +++++++++--------- > C4/Reserves.pm | 4 ++-- > Koha/Biblio.pm | 2 +- > Koha/Filter/MARC/EmbedItemsAvailability.pm | 2 +- > Koha/OAI/Server/GetRecord.pm | 6 +++--- > Koha/OAI/Server/ListBase.pm | 8 ++++---- > Koha/Patron.pm | 2 +- > about.pl | 10 --------- > admin/branches.pl | 2 +- > cataloguing/merge.pl | 2 +- > ...eleteitems_tables_with_their_alive_cousins.perl | 18 ++++++++-------- > installer/data/mysql/kohastructure.sql | 8 ++++---- > .../en/modules/admin/preferences/web_services.pref | 4 ++-- > .../prog/en/modules/reports/catalogue_stats.tt | 8 ++++---- > labels/label-item-search.pl | 2 +- > misc/export_records.pl | 4 ++-- > opac/opac-reserve.pl | 4 ++-- > reports/catalogue_stats.pl | 24 +++++++++++----------- > reports/itemslost.pl | 2 +- > t/db_dependent/Acquisition.t | 4 ++-- > t/db_dependent/Biblio.t | 2 +- > t/db_dependent/Items.t | 2 +- > t/db_dependent/Items/DelItem.t | 4 ++-- > t/db_dependent/OAI/Server.t | 3 --- > t/lib/TestBuilder.pm | 8 ++++---- > 27 files changed, 80 insertions(+), 93 deletions(-) > >diff --git a/C4/Biblio.pm b/C4/Biblio.pm >index e392850..5a10fbd 100644 >--- a/C4/Biblio.pm >+++ b/C4/Biblio.pm >@@ -315,7 +315,7 @@ sub ModBiblio { > # update biblionumber and biblioitemnumber in MARC > # FIXME - this is assuming a 1 to 1 relationship between > # biblios and biblioitems >- my $sth = $dbh->prepare("select biblioitemnumber from biblioitems where biblionumber=? AND deleted_at IS NULL"); >+ my $sth = $dbh->prepare("select biblioitemnumber from biblioitems where biblionumber=? AND deleted_on IS NULL"); > $sth->execute($biblionumber); > my ($biblioitemnumber) = $sth->fetchrow; > $sth->finish(); >@@ -384,7 +384,7 @@ sub DelBiblio { > my $error; # for error handling > > # First make sure this biblio has no items attached >- my $sth = $dbh->prepare("SELECT itemnumber FROM items WHERE biblionumber=? AND deleted_at IS NULL"); >+ my $sth = $dbh->prepare("SELECT itemnumber FROM items WHERE biblionumber=? AND deleted_on IS NULL"); > $sth->execute($biblionumber); > if ( my $itemnumber = $sth->fetchrow ) { > >@@ -415,7 +415,7 @@ sub DelBiblio { > ModZebra( $biblionumber, "recordDelete", "biblioserver" ); > > # mark biblioitems and items as deleted >- $sth = $dbh->prepare("SELECT biblioitemnumber FROM biblioitems WHERE biblionumber=? AND deleted_at IS NULL"); >+ $sth = $dbh->prepare("SELECT biblioitemnumber FROM biblioitems WHERE biblionumber=? AND deleted_on IS NULL"); > $sth->execute($biblionumber); > while ( my $biblioitemnumber = $sth->fetchrow ) { > >@@ -1169,7 +1169,7 @@ sub GetMarcBiblio { > } > > my $dbh = C4::Context->dbh; >- my $sth = $dbh->prepare("SELECT biblioitemnumber FROM biblioitems WHERE biblionumber=? AND deleted_at IS NULL"); >+ my $sth = $dbh->prepare("SELECT biblioitemnumber FROM biblioitems WHERE biblionumber=? AND deleted_on IS NULL"); > $sth->execute($biblionumber); > my $row = $sth->fetchrow_hashref; > my $biblioitemnumber = $row->{'biblioitemnumber'}; >@@ -2792,7 +2792,7 @@ sub EmbedItemsInMarcBiblio { > > # ... and embed the current items > my $dbh = C4::Context->dbh; >- my $sth = $dbh->prepare("SELECT itemnumber FROM items WHERE biblionumber = ? and deleted_at IS NULL"); >+ my $sth = $dbh->prepare("SELECT itemnumber FROM items WHERE biblionumber = ? and deleted_on IS NULL"); > $sth->execute($biblionumber); > my @item_fields; > my ( $itemtag, $itemsubfield ) = GetMarcFromKohaField( "items.itemnumber", $frameworkcode ); >@@ -3122,7 +3122,7 @@ C<$biblionumber> - the biblionumber of the biblio (and metadata) to be marked as > sub _koha_delete_biblio { > my ( $dbh, $biblionumber ) = @_; > _koha_delete_biblio_metadata( $biblionumber ); >- my $sth = $dbh->prepare("UPDATE biblio SET deleted_at = NOW() WHERE biblionumber=?"); >+ my $sth = $dbh->prepare("UPDATE biblio SET deleted_on = NOW() WHERE biblionumber=?"); > return $sth->execute($biblionumber) ? undef : ($DBI::errstr || "unknown error"); > } > >@@ -3141,7 +3141,7 @@ C<$biblionumber> - the biblioitemnumber of the biblioitem to be marked as delet > > sub _koha_delete_biblioitems { > my ( $dbh, $biblioitemnumber ) = @_; >- my $sth = $dbh->prepare("UPDATE biblioitems SET deleted_at = NOW() WHERE biblioitemnumber=?"); >+ my $sth = $dbh->prepare("UPDATE biblioitems SET deleted_on = NOW() WHERE biblioitemnumber=?"); > return $sth->execute($biblioitemnumber) ? undef : ($DBI::errstr || 'unknown error'); > } > >@@ -3156,7 +3156,7 @@ C<$biblionumber> - the biblionumber of the biblio metadata to be marked as dele > sub _koha_delete_biblio_metadata { > my ($biblionumber) = @_; > my $dbh = C4::Context->dbh; >- my $sth = $dbh->prepare("UPDATE biblio_metadata SET deleted_at = NOW() WHERE biblionumber=?"); >+ my $sth = $dbh->prepare("UPDATE biblio_metadata SET deleted_on = NOW() WHERE biblionumber=?"); > return $sth->execute($biblionumber); > } > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 5c4b6ae..ec2bd7d 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -1806,7 +1806,7 @@ sub AddReturn { > unless ($item) { > return ( 0, { BadBarcode => $barcode } ); # no barcode means no item or borrower. bail out. > } >- if ($item->{deleted_at}) { >+ if ($item->{deleted_on}) { > return ( 0, { BadBarcode => $barcode } ); > } > >diff --git a/C4/Items.pm b/C4/Items.pm >index c1f0a6f..f82191c 100644 >--- a/C4/Items.pm >+++ b/C4/Items.pm >@@ -838,7 +838,7 @@ sub GetItemsForInventory { > FROM items > LEFT JOIN biblio ON items.biblionumber = biblio.biblionumber > LEFT JOIN biblioitems on items.biblionumber = biblioitems.biblionumber >- WHERE (items.deleted_at IS NULL AND biblio.deleted_at IS NULL AND biblioitems.deleted_at IS NULL) >+ WHERE (items.deleted_on IS NULL AND biblio.deleted_on IS NULL AND biblioitems.deleted_on IS NULL) > }; > if ($statushash){ > for my $authvfield (keys %$statushash){ >@@ -945,7 +945,7 @@ Called by C<C4::XISBN> > sub GetItemsByBiblioitemnumber { > my ( $bibitem ) = @_; > my $dbh = C4::Context->dbh; >- my $sth = $dbh->prepare("SELECT * FROM items WHERE items.biblioitemnumber = ? AND items.deleted_at IS NULL") || die $dbh->errstr; >+ my $sth = $dbh->prepare("SELECT * FROM items WHERE items.biblioitemnumber = ? AND items.deleted_on IS NULL") || die $dbh->errstr; > # Get all items attached to a biblioitem > my $i = 0; > my @results; >@@ -1069,7 +1069,7 @@ sub GetItemsInfo { > FROM items > LEFT JOIN branches AS holding ON items.holdingbranch = holding.branchcode > LEFT JOIN branches AS home ON items.homebranch=home.branchcode >- LEFT JOIN biblio ON biblio.biblionumber = items.biblionumber AND biblio.deleted_at IS NULL >+ LEFT JOIN biblio ON biblio.biblionumber = items.biblionumber AND biblio.deleted_on IS NULL > LEFT JOIN biblioitems ON biblioitems.biblioitemnumber = items.biblioitemnumber > LEFT JOIN issues USING (itemnumber) > LEFT JOIN borrowers USING (borrowernumber) >@@ -1083,7 +1083,7 @@ sub GetItemsInfo { > AND localization.lang = ? > |; > >- $query .= " WHERE items.biblionumber = ? AND items.deleted_at IS NULL ORDER BY home.branchname, items.enumchron, LPAD( items.copynumber, 8, '0' ), items.dateaccessioned DESC" ; >+ $query .= " WHERE items.biblionumber = ? AND items.deleted_on IS NULL ORDER BY home.branchname, items.enumchron, LPAD( items.copynumber, 8, '0' ), items.dateaccessioned DESC" ; > my $sth = $dbh->prepare($query); > $sth->execute($language, $biblionumber); > my $i = 0; >@@ -1190,7 +1190,7 @@ sub GetItemsLocationInfo { > location, itemcallnumber, cn_sort > FROM items, branches as a, branches as b > WHERE homebranch = a.branchcode AND holdingbranch = b.branchcode >- AND biblionumber = ? AND deleted_at IS NULL >+ AND biblionumber = ? AND deleted_on IS NULL > ORDER BY cn_sort ASC"; > my $sth = $dbh->prepare($query); > $sth->execute($biblionumber); >@@ -1257,7 +1257,7 @@ sub GetLastAcquisitions { > my $number_of_branches = @{$data->{branches}}; > my $number_of_itemtypes = @{$data->{itemtypes}}; > >- my @where = ('WHERE (items.deleted_at IS NULL AND biblio.deleted_at IS NULL AND biblioitems.deleted_at IS NULL)'); >+ my @where = ('WHERE (items.deleted_on IS NULL AND biblio.deleted_on IS NULL AND biblioitems.deleted_on IS NULL)'); > $number_of_branches and push @where > , 'AND holdingbranch IN (' > , join(',', ('?') x $number_of_branches ) >@@ -1304,7 +1304,7 @@ sub GetItemnumbersForBiblio { > my $biblionumber = shift; > my @items; > my $dbh = C4::Context->dbh; >- my $sth = $dbh->prepare("SELECT itemnumber FROM items WHERE biblionumber = ? AND deleted_at IS NULL"); >+ my $sth = $dbh->prepare("SELECT itemnumber FROM items WHERE biblionumber = ? AND deleted_on IS NULL"); > $sth->execute($biblionumber); > while (my $result = $sth->fetchrow_hashref) { > push @items, $result->{'itemnumber'}; >@@ -2080,7 +2080,7 @@ sub _koha_delete_item { > > my $dbh = C4::Context->dbh; > >- my $sth = $dbh->prepare("UPDATE items SET deleted_at = NOW() WHERE itemnumber = ?"); >+ my $sth = $dbh->prepare("UPDATE items SET deleted_on = NOW() WHERE itemnumber = ?"); > my $deleted = $sth->execute($itemnum); > return ( $deleted == 1 ) ? 1 : 0; > } >@@ -2445,7 +2445,7 @@ sub SearchItems { > LEFT JOIN biblio ON biblio.biblionumber = items.biblionumber > LEFT JOIN biblioitems ON biblioitems.biblioitemnumber = items.biblioitemnumber > LEFT JOIN biblio_metadata ON biblio_metadata.biblionumber = biblio.biblionumber >- WHERE items.deleted_at IS NULL >+ WHERE items.deleted_on IS NULL > }; > if (defined $where_str and $where_str ne '') { > $query .= qq{ AND $where_str }; >@@ -2796,7 +2796,7 @@ sub ToggleNewStatus { > SELECT items.biblionumber, items.itemnumber > FROM items > LEFT JOIN biblioitems ON biblioitems.biblionumber = items.biblionumber >- WHERE items.deleted_at IS NULL >+ WHERE items.deleted_on IS NULL > |; > for my $condition ( @$conditions ) { > if ( >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index 9451788..d2a2ef7 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -1132,7 +1132,7 @@ sub IsAvailableForItemLevelRequest { > return 1; > } elsif ( $on_shelf_holds == 2 ) { > my @items = >- Koha::Items->search( { biblionumber => $item->{biblionumber}, deleted_at => undef } ); >+ Koha::Items->search( { biblionumber => $item->{biblionumber}, deleted_on => undef } ); > > my $any_available = 0; > >@@ -2054,7 +2054,7 @@ sub GetMaxPatronHoldsForRecord { > my ( $borrowernumber, $biblionumber ) = @_; > > my $patron = Koha::Patrons->find($borrowernumber); >- my @items = Koha::Items->search( { biblionumber => $biblionumber, deleted_at => undef } ); >+ my @items = Koha::Items->search( { biblionumber => $biblionumber, deleted_on => undef } ); > > my $controlbranch = C4::Context->preference('ReservesControlBranch'); > >diff --git a/Koha/Biblio.pm b/Koha/Biblio.pm >index ccec4ae..3859c60 100644 >--- a/Koha/Biblio.pm >+++ b/Koha/Biblio.pm >@@ -250,7 +250,7 @@ or list of Koha::Item objects in list context. > sub items { > my ($self) = @_; > >- $self->{_items} ||= Koha::Items->search( { biblionumber => $self->biblionumber(), deleted_at => undef } ); >+ $self->{_items} ||= Koha::Items->search( { biblionumber => $self->biblionumber(), deleted_on => undef } ); > > return wantarray ? $self->{_items}->as_list : $self->{_items}; > } >diff --git a/Koha/Filter/MARC/EmbedItemsAvailability.pm b/Koha/Filter/MARC/EmbedItemsAvailability.pm >index e41d04b..18e1785 100644 >--- a/Koha/Filter/MARC/EmbedItemsAvailability.pm >+++ b/Koha/Filter/MARC/EmbedItemsAvailability.pm >@@ -79,7 +79,7 @@ sub _processrecord { > my $not_onloan_items = Koha::Items->search({ > biblionumber => $biblionumber, > onloan => undef, >- deleted_at => undef, >+ deleted_on => undef, > })->count; > > # check for field 999 >diff --git a/Koha/OAI/Server/GetRecord.pm b/Koha/OAI/Server/GetRecord.pm >index 244479c..dbaa2ab 100644 >--- a/Koha/OAI/Server/GetRecord.pm >+++ b/Koha/OAI/Server/GetRecord.pm >@@ -39,7 +39,7 @@ sub new { > my $sql = " > SELECT timestamp > FROM biblioitems >- WHERE biblionumber=? AND deleted_at IS NULL >+ WHERE biblionumber=? AND deleted_on IS NULL > "; > my @bind_params = ($biblionumber); > if ( $items_included ) { >@@ -63,7 +63,7 @@ sub new { > $sql = " > SELECT timestamp > FROM biblio >- WHERE biblionumber=? AND deleted_at IS NOT NULL >+ WHERE biblionumber=? AND deleted_on IS NOT NULL > "; > @bind_params = ($biblionumber); > >@@ -72,7 +72,7 @@ sub new { > $sql .= " > UNION > SELECT timestamp from items >- WHERE biblionumber=? AND deleted_at IS NULL >+ WHERE biblionumber=? AND deleted_on IS NULL > "; > push @bind_params, $biblionumber; > $sql = " >diff --git a/Koha/OAI/Server/ListBase.pm b/Koha/OAI/Server/ListBase.pm >index da03014..9383e1e 100644 >--- a/Koha/OAI/Server/ListBase.pm >+++ b/Koha/OAI/Server/ListBase.pm >@@ -52,7 +52,7 @@ sub GetRecords { > my $include_items = $repository->items_included( $format ); > > my $sql = " >- SELECT biblionumber, deleted_at >+ SELECT biblionumber, deleted_on > FROM biblio_metadata > WHERE (timestamp >= ? AND timestamp <= ?) > "; >@@ -96,7 +96,7 @@ sub GetRecords { > my $record_sth = $dbh->prepare( $sql ) || die( 'Could not prepare statement: ' . $dbh->errstr ); > > $sth->execute( @bind_params ) || die( 'Could not execute statement: ' . $sth->errstr ); >- while ( my ($biblionumber, $deleted_at) = $sth->fetchrow ) { >+ while ( my ($biblionumber, $deleted_on) = $sth->fetchrow ) { > $count++; > if ( $count > $max ) { > $self->resumptionToken( >@@ -120,7 +120,7 @@ sub GetRecords { > push @setSpecs, $_->{spec}; > } > if ( $metadata ) { >- my $marcxml = !$deleted_at ? $repository->get_biblio_marcxml($biblionumber, $format) : undef; >+ my $marcxml = !$deleted_on ? $repository->get_biblio_marcxml($biblionumber, $format) : undef; > if ( $marcxml ) { > $self->record( Koha::OAI::Server::Record->new( > $repository, $marcxml, $timestamp, \@setSpecs, >@@ -138,7 +138,7 @@ sub GetRecords { > $self->identifier( new HTTP::OAI::Header( > identifier => $repository->{ koha_identifier} . ':' . $biblionumber, > datestamp => $timestamp, >- status => $deleted_at ? 'deleted' : undef >+ status => $deleted_on ? 'deleted' : undef > ) ); > } > } >diff --git a/Koha/Patron.pm b/Koha/Patron.pm >index 1da1636..87234d6 100644 >--- a/Koha/Patron.pm >+++ b/Koha/Patron.pm >@@ -326,7 +326,7 @@ sub do_check_for_previous_checkout { > my ( $self, $item ) = @_; > > # Find all items for bib and extract item numbers. >- my @items = Koha::Items->search({biblionumber => $item->{biblionumber}, deleted_at => undef }); >+ my @items = Koha::Items->search({biblionumber => $item->{biblionumber}, deleted_on => undef }); > my @item_nos; > foreach my $item (@items) { > push @item_nos, $item->itemnumber; >diff --git a/about.pl b/about.pl >index a79fc2c..1643e81 100755 >--- a/about.pl >+++ b/about.pl >@@ -440,14 +440,6 @@ if ( C4::Context->preference('WebBasedSelfCheck') > q|select b.borrowernumber from borrowers b join deletedborrowers db on b.borrowernumber=db.borrowernumber|, > { Slice => {} } > ); >- my $biblios = $dbh->selectall_arrayref( >- q|select b.biblionumber from biblio b join deletedbiblio db on b.biblionumber=db.biblionumber|, >- { Slice => {} } >- ); >- my $items = $dbh->selectall_arrayref( >- q|select i.itemnumber from items i join deleteditems di on i.itemnumber=di.itemnumber|, >- { Slice => {} } >- ); > my $checkouts = $dbh->selectall_arrayref( > q|select i.issue_id from issues i join old_issues oi on i.issue_id=oi.issue_id|, > { Slice => {} } >@@ -460,8 +452,6 @@ if ( C4::Context->preference('WebBasedSelfCheck') > $template->param( > has_ai_issues => 1, > ai_patrons => $patrons, >- ai_biblios => $biblios, >- ai_items => $items, > ai_checkouts => $checkouts, > ai_holds => $holds, > ); >diff --git a/admin/branches.pl b/admin/branches.pl >index 4ff237d..2100430 100755 >--- a/admin/branches.pl >+++ b/admin/branches.pl >@@ -109,7 +109,7 @@ if ( $op eq 'add_form' ) { > { -or => { > holdingbranch => $branchcode, > homebranch => $branchcode, >- deleted_at => undef, >+ deleted_on => undef, > }, > } > )->count; >diff --git a/cataloguing/merge.pl b/cataloguing/merge.pl >index 0633a39..c2e0867 100755 >--- a/cataloguing/merge.pl >+++ b/cataloguing/merge.pl >@@ -88,7 +88,7 @@ if ($merge) { > > # Moving items from the other record to the reference record > foreach my $biblionumber (@biblionumbers) { >- my $items = Koha::Items->search({ biblionumber => $biblionumber, deleted_at => undef }); >+ my $items = Koha::Items->search({ biblionumber => $biblionumber, deleted_on => undef }); > while ( my $item = $items->next) { > my $res = MoveItemFromBiblio( $item->itemnumber, $biblionumber, $ref_biblionumber ); > if ( not defined $res ) { >diff --git a/installer/data/mysql/atomicupdate/bug_20271_-_merge_deletedbiblio_and_deleteitems_tables_with_their_alive_cousins.perl b/installer/data/mysql/atomicupdate/bug_20271_-_merge_deletedbiblio_and_deleteitems_tables_with_their_alive_cousins.perl >index 4098ff6..792d051 100644 >--- a/installer/data/mysql/atomicupdate/bug_20271_-_merge_deletedbiblio_and_deleteitems_tables_with_their_alive_cousins.perl >+++ b/installer/data/mysql/atomicupdate/bug_20271_-_merge_deletedbiblio_and_deleteitems_tables_with_their_alive_cousins.perl >@@ -1,26 +1,26 @@ > $DBversion = 'XXX'; # will be replaced by the RM > if( CheckVersion( $DBversion ) ) { >- $dbh->do( "ALTER TABLE biblio ADD COLUMN deleted_at datetime DEFAULT NULL" ) or warn $DBI::errstr; >- $dbh->do( "ALTER TABLE biblioitems ADD COLUMN deleted_at datetime DEFAULT NULL" ) or warn $DBI::errstr; >- $dbh->do( "ALTER TABLE biblio_metadata ADD COLUMN deleted_at datetime DEFAULT NULL" ) or warn $DBI::errstr; >- $dbh->do( "ALTER TABLE items ADD COLUMN deleted_at datetime DEFAULT NULL" ) or warn $DBI::errstr; >+ $dbh->do( "ALTER TABLE biblio ADD COLUMN deleted_on datetime DEFAULT NULL" ) or warn $DBI::errstr; >+ $dbh->do( "ALTER TABLE biblioitems ADD COLUMN deleted_on datetime DEFAULT NULL" ) or warn $DBI::errstr; >+ $dbh->do( "ALTER TABLE biblio_metadata ADD COLUMN deleted_on datetime DEFAULT NULL" ) or warn $DBI::errstr; >+ $dbh->do( "ALTER TABLE items ADD COLUMN deleted_on datetime DEFAULT NULL" ) or warn $DBI::errstr; > > # Need to disable foreign keys on deletedbiblio_metadata to avoid cascading deletes from deletedbiblio > # Bug 17196 introduced a mismatch in foreign keys of deletedbiblio_metadata, so any key must be dropped > DropAllForeignKeys('deletedbiblio_metadata'); >- $dbh->do( "INSERT IGNORE INTO biblio SELECT *, timestamp AS deleted_at FROM deletedbiblio" ) or warn $DBI::errstr; >+ $dbh->do( "INSERT IGNORE INTO biblio SELECT *, timestamp AS deleted_on FROM deletedbiblio" ) or warn $DBI::errstr; > # We also need to make sure foreign keys references are in place, as Mysql < 5.7 aborts on foreign key errors > $dbh->do( "INSERT IGNORE INTO biblioitems ( >- SELECT *, timestamp AS deleted_at FROM deletedbiblioitems >+ SELECT *, timestamp AS deleted_on FROM deletedbiblioitems > WHERE biblionumber IN (SELECT biblionumber FROM biblio) > )" ) or warn $DBI::errstr; > # biblio_metadata needs special handling since there is an extra autoincrement id that cannot be moved >- $dbh->do( "INSERT IGNORE INTO biblio_metadata (biblionumber, format, marcflavour, metadata, timestamp, deleted_at) ( >- SELECT biblionumber, format, marcflavour, metadata, timestamp, timestamp AS deleted_at FROM deletedbiblio_metadata >+ $dbh->do( "INSERT IGNORE INTO biblio_metadata (biblionumber, format, marcflavour, metadata, timestamp, deleted_on) ( >+ SELECT biblionumber, format, marcflavour, metadata, timestamp, timestamp AS deleted_on FROM deletedbiblio_metadata > WHERE biblionumber IN (SELECT biblionumber FROM biblio) > )" ) or warn $DBI::errstr; > $dbh->do( "INSERT IGNORE INTO items ( >- SELECT *, timestamp AS deleted_at FROM deleteditems >+ SELECT *, timestamp AS deleted_on FROM deleteditems > WHERE biblioitemnumber IN (SELECT biblioitemnumber FROM biblioitems) > AND homebranch IN (SELECT homebranch FROM branches) > AND holdingbranch IN (SELECT holdingbranch FROM branches) >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index ad27ea9..b11ddfb 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -140,7 +140,7 @@ CREATE TABLE `biblio` ( -- table that stores bibliographic information > `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- date and time this record was last touched > `datecreated` DATE NOT NULL, -- the date this record was added to Koha > `abstract` LONGTEXT, -- summary from the MARC record (520$a in MARC21) >- `deleted_at` datetime DEFAULT NULL, -- timestamp of deletion >+ `deleted_on` datetime DEFAULT NULL, -- timestamp of deletion > PRIMARY KEY (`biblionumber`), > KEY `blbnoidx` (`biblionumber`) > ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; >@@ -194,7 +194,7 @@ CREATE TABLE `biblioitems` ( -- information related to bibliographic records in > `cn_sort` varchar(255) default NULL, -- normalized version of the call number used for sorting > `agerestriction` varchar(255) default NULL, -- target audience/age restriction from the bib record (MARC21 521$a) > `totalissues` int(10), >- `deleted_at` datetime DEFAULT NULL, -- timestamp of deletion >+ `deleted_on` datetime DEFAULT NULL, -- timestamp of deletion > PRIMARY KEY (`biblioitemnumber`), > KEY `bibinoidx` (`biblioitemnumber`), > KEY `bibnoidx` (`biblionumber`), >@@ -800,7 +800,7 @@ CREATE TABLE `items` ( -- holdings/item information > `copynumber` varchar(32) default NULL, -- copy number (MARC21 952$t) > `stocknumber` varchar(32) default NULL, -- inventory number (MARC21 952$i) > `new_status` VARCHAR(32) DEFAULT NULL, -- 'new' value, you can put whatever free-text information. This field is intented to be managed by the automatic_item_modification_by_age cronjob. >- `deleted_at` datetime DEFAULT NULL, -- timestamp of deletion >+ `deleted_on` datetime DEFAULT NULL, -- timestamp of deletion > PRIMARY KEY (`itemnumber`), > UNIQUE KEY `itembarcodeidx` (`barcode`), > KEY `itemstocknumberidx` (`stocknumber`), >@@ -3833,7 +3833,7 @@ CREATE TABLE biblio_metadata ( > `marcflavour` VARCHAR(16) NOT NULL, > `metadata` LONGTEXT NOT NULL, > `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, >- `deleted_at` datetime DEFAULT NULL, -- timestamp of deletion >+ `deleted_on` datetime DEFAULT NULL, -- timestamp of deletion > PRIMARY KEY(id), > UNIQUE KEY `biblio_metadata_uniq_key` (`biblionumber`,`format`,`marcflavour`), > CONSTRAINT `record_metadata_fk_1` FOREIGN KEY (biblionumber) REFERENCES biblio (biblionumber) ON DELETE CASCADE ON UPDATE CASCADE, >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/web_services.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/web_services.pref >index 6b415f2..f40eaf2 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/web_services.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/web_services.pref >@@ -40,12 +40,12 @@ Web services: > no: Disable > - automatic update of OAI-PMH sets when a bibliographic record is created or updated > - >- - Koha's deletedbiblio table >+ - Koha deleted records > - pref: "OAI-PMH:DeletedRecord" > choices: > persistent: will never be emptied or truncated (persistent) > transient: might be emptied or truncated at some point (transient) >- no: will never have any data in it (no) >+ no: will not be persisted (no) > - "." > ILS-DI: > - >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/catalogue_stats.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/catalogue_stats.tt >index f47b00e..0347e72 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/catalogue_stats.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/catalogue_stats.tt >@@ -229,8 +229,8 @@ > </tr> > <tr id="removeddatetr"> > <td>Date deleted (item)</td> >- <td><input type="radio" name="Line" value="deleteditems.timestamp" /></td> >- <td><input type="radio" name="Column" value="deleteditems.timestamp" /></td> >+ <td><input type="radio" name="Line" value="items.deleted_on" /></td> >+ <td><input type="radio" name="Column" value="items.deleted_on" /></td> > <td> > <label for="deldateFrom">From</label> > <input type="text" name="Filter" id="deldateFrom" class="datepicker" /> >@@ -305,12 +305,12 @@ > var Cellvalue = $("input[name='Cellvalue']:checked").val(); > if(Cellvalue == "deleteditems") { > $("#removeddatetr").show(); >- $("input[value='deleteditems.timestamp']").prop('disabled', false); >+ $("input[value='items.deleted_on']").prop('disabled', false); > $("#deldateFrom").prop('disabled', false); > $("#deldateTo").prop('disabled', false); > } else { > $("#removeddatetr").hide(); >- $("input[value='deleteditems.timestamp']").prop('disabled', true).prop('checked', false); >+ $("input[value='items.deleted_on']").prop('disabled', true).prop('checked', false); > $("#deldateFrom").prop('disabled', true).val(''); > $("#deldateTo").prop('disabled', true).val(''); > } >diff --git a/labels/label-item-search.pl b/labels/label-item-search.pl >index c915ffc..df412d7 100755 >--- a/labels/label-item-search.pl >+++ b/labels/label-item-search.pl >@@ -137,7 +137,7 @@ if ($show_results) { > push (@results_set, $biblio); > my $biblionumber = $biblio->{'biblionumber'}; > #DEBUG Notes: Grab the item numbers associated with this MARC record... >- my $items = Koha::Items->search({ biblionumber => $biblionumber, deleted_at => undef }, { order_by => { -desc => 'itemnumber' }}); >+ my $items = Koha::Items->search({ biblionumber => $biblionumber, deleted_on => undef }, { order_by => { -desc => 'itemnumber' }}); > #DEBUG Notes: Retrieve the item data for each number... > while ( my $item = $items->next ) { > #DEBUG Notes: Build an array element 'item' of the correct bib (results) hash which contains item-specific data... >diff --git a/misc/export_records.pl b/misc/export_records.pl >index 061700f..bcb6985 100755 >--- a/misc/export_records.pl >+++ b/misc/export_records.pl >@@ -110,7 +110,7 @@ if ( $record_type eq 'bibs' ) { > }; > } else { > my $conditions = { >- deleted_at => undef, >+ deleted_on => undef, > ( $starting_biblionumber or $ending_biblionumber ) > ? ( > "me.biblionumber" => { >@@ -182,7 +182,7 @@ if ($deleted_barcodes) { > my $barcode = $dbh->selectall_arrayref(q| > SELECT DISTINCT barcode > FROM items >- WHERE deleteditems.biblionumber = ? AND deleted_at IS NOT NULL >+ WHERE biblionumber = ? AND deleted_on IS NOT NULL > |, { Slice => {} }, $record_id ); > say $_->{barcode} for @$barcode; > } >diff --git a/opac/opac-reserve.pl b/opac/opac-reserve.pl >index c3fd1a2..ec63c28 100755 >--- a/opac/opac-reserve.pl >+++ b/opac/opac-reserve.pl >@@ -286,7 +286,7 @@ if ( $query->param('place_reserve') ) { > } > > unless ( $can_place_hold_if_available_at_pickup ) { >- my $items_in_this_library = Koha::Items->search({ biblionumber => $biblioNum, holdingbranch => $branch, deleted_at => undef }); >+ my $items_in_this_library = Koha::Items->search({ biblionumber => $biblioNum, holdingbranch => $branch, deleted_on => undef }); > my $nb_of_items_issued = $items_in_this_library->search({ 'issue.itemnumber' => { not => undef }}, { join => 'issue' })->count; > my $nb_of_items_unavailable = $items_in_this_library->search({ -or => { lost => { '!=' => 0 }, damaged => { '!=' => 0 }, } }); > if ( $items_in_this_library->count > $nb_of_items_issued + $nb_of_items_unavailable ) { >@@ -537,7 +537,7 @@ foreach my $biblioNum (@biblionumbers) { > $numCopiesAvailable++; > > unless ( $can_place_hold_if_available_at_pickup ) { >- my $items_in_this_library = Koha::Items->search({ biblionumber => $itemInfo->{biblionumber}, holdingbranch => $itemInfo->{holdingbranch}, deleted_at => undef }); >+ my $items_in_this_library = Koha::Items->search({ biblionumber => $itemInfo->{biblionumber}, holdingbranch => $itemInfo->{holdingbranch}, deleted_on => undef }); > my $nb_of_items_issued = $items_in_this_library->search({ 'issue.itemnumber' => { not => undef }}, { join => 'issue' })->count; > if ( $items_in_this_library->count > $nb_of_items_issued ) { > push @not_available_at, $itemInfo->{holdingbranch}; >diff --git a/reports/catalogue_stats.pl b/reports/catalogue_stats.pl >index e92a4c3..54f63a8 100755 >--- a/reports/catalogue_stats.pl >+++ b/reports/catalogue_stats.pl >@@ -46,7 +46,7 @@ my $fullreportname = "reports/catalogue_stats.tt"; > my $do_it = $input->param('do_it'); > my $line = $input->param("Line"); > my $column = $input->param("Column"); >-my $cellvalue = $input->param("Cellvalue"); # one of 'items', 'biblios', 'deleteditems' >+my $cellvalue = $input->param("Cellvalue"); # one of 'items', 'biblios' > my @filters = $input->multi_param("Filter"); > my $cotedigits = $input->param("cotedigits"); > my $output = $input->param("output"); >@@ -173,9 +173,9 @@ sub calculate { > my $barcodefilter = @$filters[17]; > my $not; > my $itemstable = 'items'; >- my $deleted_where = "items.deleted_at IS NULL"; >+ my $deleted_where = "items.deleted_on IS NULL"; > $deleted_where = "1" if $cellvalue eq 'allitems'; >- $deleted_where = "items.deleted_at IS NOT NULL" if $cellvalue eq 'deleteditems'; >+ $deleted_where = "items.deleted_on IS NOT NULL" if $cellvalue eq 'items'; > > my $dbh = C4::Context->dbh; > >@@ -250,8 +250,8 @@ sub calculate { > $linefilter[0] = @$filters[10] if ( $line =~ /items\.materials/ ); > $linefilter[0] = @$filters[13] if ( $line =~ /items\.dateaccessioned/ ); > $linefilter[1] = @$filters[14] if ( $line =~ /items\.dateaccessioned/ ); >- $linefilter[0] = @$filters[15] if ( $line =~ /deleteditems\.timestamp/ ); >- $linefilter[1] = @$filters[16] if ( $line =~ /deleteditems\.timestamp/ ); >+ $linefilter[0] = @$filters[15] if ( $line =~ /items\.deleted_on/ ); >+ $linefilter[1] = @$filters[16] if ( $line =~ /items\.deleted_on/ ); > > my @colfilter; > $colfilter[0] = @$filters[0] if ( $column =~ /items\.itemcallnumber/ ); >@@ -271,8 +271,8 @@ sub calculate { > $colfilter[0] = @$filters[10] if ( $column =~ /items\.materials/ ); > $colfilter[0] = @$filters[13] if ( $column =~ /items.dateaccessioned/ ); > $colfilter[1] = @$filters[14] if ( $column =~ /items\.dateaccessioned/ ); >- $colfilter[0] = @$filters[15] if ( $column =~ /deleteditems\.timestamp/ ); >- $colfilter[1] = @$filters[16] if ( $column =~ /deleteditems\.timestamp/ ); >+ $colfilter[0] = @$filters[15] if ( $column =~ /items\.deleted_on/ ); >+ $colfilter[1] = @$filters[16] if ( $column =~ /items\.deleted_on/ ); > > # 1st, loop rows. > my $origline = $line; >@@ -338,7 +338,7 @@ sub calculate { > my $colfield; > if ( ( $column =~ /itemcallnumber/ ) and ($cotedigits) ) { > $colfield = "left($column,$cotedigits)"; >- } elsif ( $column =~ /^deleteditems\.timestamp$/ ) { >+ } elsif ( $column =~ /^items\.deleted_on$/ ) { > $colfield = "DATE($column)"; > } else { > $colfield = $column; >@@ -499,14 +499,14 @@ sub calculate { > @$filters[14] =~ s/\*/%/g; > push @sqlargs, @$filters[14]; > } >- if ( $cellvalue eq 'deleteditems' and @$filters[15] ) { >- $strcalc .= " AND DATE(deleted_at) >= ? "; >+ if ( $cellvalue eq 'items' and @$filters[15] ) { >+ $strcalc .= " AND DATE(deleted_on) >= ? "; > @$filters[15] =~ s/\*/%/g; > push @sqlargs, @$filters[15]; > } >- if ( $cellvalue eq 'deleteditems' and @$filters[16] ) { >+ if ( $cellvalue eq 'items' and @$filters[16] ) { > @$filters[16] =~ s/\*/%/g; >- $strcalc .= " AND DATE(deleted_at) <= ?"; >+ $strcalc .= " AND DATE(deleted_on) <= ?"; > push @sqlargs, @$filters[16]; > } > $strcalc .= " group by $linefield, $colfield order by $linefield,$colfield"; >diff --git a/reports/itemslost.pl b/reports/itemslost.pl >index 3bb5a1e..7eb1419 100755 >--- a/reports/itemslost.pl >+++ b/reports/itemslost.pl >@@ -115,7 +115,7 @@ if ( $op eq 'export' ) { > my $notforloanfilter = $params->{'notforloanfilter'} || undef; > > my $params = { >- deleted_at => undef, >+ deleted_on => undef, > ( $branchfilter ? ( homebranch => $branchfilter ) : () ), > ( > $loststatusfilter >diff --git a/t/db_dependent/Acquisition.t b/t/db_dependent/Acquisition.t >index c5a36e9..7db30d7 100755 >--- a/t/db_dependent/Acquisition.t >+++ b/t/db_dependent/Acquisition.t >@@ -513,7 +513,7 @@ ok((not defined $error), "DelOrder does not fail"); > $order2 = GetOrder($order2->{ordernumber}); > ok((defined $order2->{datecancellationprinted}), "order is cancelled"); > ok((not defined $order2->{cancellationreason}), "order has no cancellation reason"); >-ok(Koha::Biblios->find($order2->{biblionumber})->deleted_at , "biblio does not exist anymore"); >+ok(Koha::Biblios->find($order2->{biblionumber})->deleted_on , "biblio does not exist anymore"); > > my $order4 = GetOrder($ordernumbers[3]); > $error = DelOrder($order4->{biblionumber}, $order4->{ordernumber}, 1, "foobar"); >@@ -521,7 +521,7 @@ ok((not defined $error), "DelOrder does not fail"); > $order4 = GetOrder($order4->{ordernumber}); > ok((defined $order4->{datecancellationprinted}), "order is cancelled"); > ok(($order4->{cancellationreason} eq "foobar"), "order has cancellation reason \"foobar\""); >-ok(Koha::Biblios->find($order4->{biblionumber})->deleted_at, "biblio does not exist anymore"); >+ok(Koha::Biblios->find($order4->{biblionumber})->deleted_on, "biblio does not exist anymore"); > > my $order5 = GetOrder($ordernumbers[4]); > C4::Items::AddItem( { barcode => '0102030405' }, $order5->{biblionumber} ); >diff --git a/t/db_dependent/Biblio.t b/t/db_dependent/Biblio.t >index e53c695..ffcbabb 100755 >--- a/t/db_dependent/Biblio.t >+++ b/t/db_dependent/Biblio.t >@@ -451,7 +451,7 @@ subtest 'delete biblio' => sub { > my $err = C4::Biblio::DelBiblio( $biblionumber ); > is($err, undef, 'Biblio deleted without error'); > my $data = GetBiblioData( $biblionumber ); >- isnt( $data->{deleted_at}, undef, 'Biblio deleted with timestamp' ); >+ isnt( $data->{deleted_on}, undef, 'Biblio deleted with timestamp' ); > }; > > # Cleanup >diff --git a/t/db_dependent/Items.t b/t/db_dependent/Items.t >index 0a02666..c1d74c5 100755 >--- a/t/db_dependent/Items.t >+++ b/t/db_dependent/Items.t >@@ -81,7 +81,7 @@ subtest 'General Add, Get and Del tests' => sub { > # Delete item. > DelItem({ biblionumber => $bibnum, itemnumber => $itemnumber }); > my $getdeleted = GetItem($itemnumber); >- isnt($getdeleted->{'deleted_at'}, undef, "Item deleted as expected."); >+ isnt($getdeleted->{'deleted_on'}, undef, "Item deleted as expected."); > > ($item_bibnum, $item_bibitemnum, $itemnumber) = AddItem({ homebranch => $library->{branchcode}, holdingbranch => $library->{branchcode}, location => $location, permanent_location => 'my permanent location', itype => $itemtype->{itemtype} } , $bibnum); > $getitem = GetItem($itemnumber); >diff --git a/t/db_dependent/Items/DelItem.t b/t/db_dependent/Items/DelItem.t >index 49e3da1..d8d14cf 100644 >--- a/t/db_dependent/Items/DelItem.t >+++ b/t/db_dependent/Items/DelItem.t >@@ -28,14 +28,14 @@ my ( $item_bibnum, $item_bibitemnum, $itemnumber ); > my $deleted = DelItem( { biblionumber => $biblionumber, itemnumber => $itemnumber } ); > is( $deleted, 1, "DelItem should return 1 if the item has been deleted" ); > my $deleted_item = GetItem($itemnumber); >-isnt( $deleted_item->{deleted_at}, undef, "DelItem with biblionumber parameter - the item should be deleted." ); >+isnt( $deleted_item->{deleted_on}, undef, "DelItem with biblionumber parameter - the item should be deleted." ); > > ( $item_bibnum, $item_bibitemnum, $itemnumber ) = > AddItem( { homebranch => $library->{branchcode}, holdingbranch => $library->{branchcode} }, $biblionumber ); > $deleted = DelItem( { biblionumber => $biblionumber, itemnumber => $itemnumber } ); > is( $deleted, 1, "DelItem should return 1 if the item has been deleted" ); > $deleted_item = GetItem($itemnumber); >-isnt( $deleted_item->{deleted_at}, undef, "DelItem without biblionumber parameter - the item should be deleted." ); >+isnt( $deleted_item->{deleted_on}, undef, "DelItem without biblionumber parameter - the item should be deleted." ); > > $deleted = DelItem( { itemnumber => $itemnumber + 1} ); > is( $deleted, 0, "DelItem should return 0 if no item has been deleted" ); >diff --git a/t/db_dependent/OAI/Server.t b/t/db_dependent/OAI/Server.t >index 6f69548..6676816 100644 >--- a/t/db_dependent/OAI/Server.t >+++ b/t/db_dependent/OAI/Server.t >@@ -65,9 +65,6 @@ my $dbh = C4::Context->dbh; > $dbh->do("SET time_zone='+00:00'"); > $dbh->do('DELETE FROM issues'); > $dbh->do('DELETE FROM biblio'); >-$dbh->do('DELETE FROM deletedbiblio'); >-$dbh->do('DELETE FROM deletedbiblioitems'); >-$dbh->do('DELETE FROM deleteditems'); > $dbh->do('DELETE FROM oai_sets'); > > set_fixed_time(CORE::time()); >diff --git a/t/lib/TestBuilder.pm b/t/lib/TestBuilder.pm >index 5fde9f2..2a94055 100644 >--- a/t/lib/TestBuilder.pm >+++ b/t/lib/TestBuilder.pm >@@ -471,13 +471,13 @@ sub _gen_default_values { > borrowernotes => '', > }, > Biblio => { >- deleted_at => undef, >+ deleted_on => undef, > }, > Biblioitems => { >- deleted_at => undef, >+ deleted_on => undef, > }, > BiblioMetadata => { >- deleted_at => undef, >+ deleted_on => undef, > }, > Item => { > notforloan => 0, >@@ -485,7 +485,7 @@ sub _gen_default_values { > withdrawn => 0, > restricted => 0, > more_subfields_xml => undef, >- deleted_at => undef, >+ deleted_on => undef, > }, > Category => { > enrolmentfee => 0, >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 20271
:
72300
|
72799
|
72800
|
73091
|
73092
|
73093
|
73535
|
73536
|
73537
|
73538
|
73539
|
73540
|
73597
|
73759
|
73760
|
73761
|
73762
|
73763
|
73764
|
73765
|
74127
|
74128
|
74129
|
74130
|
74131
|
74132
|
74133
|
74134
|
74135
|
74136
|
74137
|
74138
|
74139
|
74140
|
74141
|
74142
|
74182
|
74183
|
74184
|
74185
|
74186
|
74187
|
74188
|
74189
|
74190
|
74223
|
74407
|
74408
|
74409
|
74410
|
74411
|
74412
|
74413
|
74414
|
74415
|
74416
|
75265
|
75347
|
75894
|
75897
|
75898
|
75899
|
75910
|
75977
|
75978
|
75979
|
75980
|
75981
|
75982
|
75983
|
75984
|
75985
|
75986
|
75987
|
75988
|
75989
|
75990
|
75991
|
75992
|
75993
|
76047
|
76048
|
76255
|
76256
|
76257
|
76258
|
76259
|
76260
|
76261
|
76262
|
76263
|
76264
|
76265
|
76266
|
76267
|
76268
|
76269
|
76270
|
76271
|
76272
|
76273
|
76274
|
76275
|
76276
|
76277
|
76493
|
76494
|
76495
|
76496
|
76497
|
76498
|
76499
|
76500
|
76501
|
76502
|
76503
|
76504
|
76505
|
76506
|
76507
|
76508
|
76509
|
76510
|
76511
|
76512
|
76513
|
76514