@@ -, +, @@
details)
---
C4/Items.pm | 4 +--
admin/columns_settings.yml | 3 +-
.../bug17672_add_damaged_on_column_to_items.perl | 9 ++++++
installer/data/mysql/kohastructure.sql | 2 ++
koha-tmpl/intranet-tmpl/prog/en/columns.def | 1 +
.../prog/en/modules/catalogue/moredetail.tt | 3 ++
t/db_dependent/Items.t | 37 ++++++++++++++++++++++
7 files changed, 56 insertions(+), 3 deletions(-)
create mode 100644 installer/data/mysql/atomicupdate/bug17672_add_damaged_on_column_to_items.perl
--- a/C4/Items.pm
+++ a/C4/Items.pm
@@ -562,10 +562,10 @@ sub ModItem {
$item->{'itemnumber'} = $itemnumber or return;
- my @fields = qw( itemlost withdrawn );
+ my @fields = qw( itemlost withdrawn damaged );
# Only call GetItem if we need to set an "on" date field
- if ( $item->{itemlost} || $item->{withdrawn} ) {
+ if ( $item->{itemlost} || $item->{withdrawn} || $item->{damaged} ) {
my $pre_mod_item = GetItem( $item->{'itemnumber'} );
for my $field (@fields) {
if ( defined( $item->{$field} )
--- a/admin/columns_settings.yml
+++ a/admin/columns_settings.yml
@@ -88,7 +88,8 @@ modules:
itemst:
# NOTE: These columns are in the same order as kohastructure.sql, and contain all items
# columns except for the following internal/obsolete fields: stack, more_subfields_xml,
- # cn_sort, permanent_location, itemlost_on, withdrawn_on, issues, renewals and reserves.
+ # cn_sort, permanent_location, damaged_on itemlost_on, withdrawn_on, issues, renewals and
+ # reserves.
-
columnname: barcode
-
--- a/installer/data/mysql/atomicupdate/bug17672_add_damaged_on_column_to_items.perl
+++ a/installer/data/mysql/atomicupdate/bug17672_add_damaged_on_column_to_items.perl
@@ -0,0 +1,9 @@
+$DBversion = 'XXX'; # will be replaced by the RM
+if( CheckVersion( $DBversion ) ) {
+ $dbh->do( "ALTER TABLE items ADD COLUMN damaged_on DATETIME NULL AFTER damaged");
+ $dbh->do( "ALTER TABLE deleteditems ADD COLUMN damaged_on DATETIME NULL AFTER damaged");
+
+ # Always end with this (adjust the bug info)
+ SetVersion( $DBversion );
+ print "Upgrade to $DBversion done (Bug 17672 - Items table should have a damaged_on column)\n";
+}
--- a/installer/data/mysql/kohastructure.sql
+++ a/installer/data/mysql/kohastructure.sql
@@ -667,6 +667,7 @@ CREATE TABLE `deleteditems` (
`stack` tinyint(1) default NULL,
`notforloan` tinyint(1) NOT NULL default 0, -- authorized value defining why this item is not for loan (MARC21 952$7)
`damaged` tinyint(1) NOT NULL default 0, -- authorized value defining this item as damaged (MARC21 952$4)
+ `damaged_on` datetime DEFAULT NULL, -- the date and time an item was last marked as damaged, NULL if not damaged
`itemlost` tinyint(1) NOT NULL default 0, -- authorized value defining this item as lost (MARC21 952$1)
`itemlost_on` datetime DEFAULT NULL, -- the date and time an item was last marked as lost, NULL if not lost
`withdrawn` tinyint(1) NOT NULL default 0, -- authorized value defining this item as withdrawn (MARC21 952$0)
@@ -927,6 +928,7 @@ CREATE TABLE `items` ( -- holdings/item information
`stack` tinyint(1) default NULL,
`notforloan` tinyint(1) NOT NULL default 0, -- authorized value defining why this item is not for loan (MARC21 952$7)
`damaged` tinyint(1) NOT NULL default 0, -- authorized value defining this item as damaged (MARC21 952$4)
+ `damaged_on` datetime DEFAULT NULL, -- the date and time an item was last marked as damaged, NULL if not damaged
`itemlost` tinyint(1) NOT NULL default 0, -- authorized value defining this item as lost (MARC21 952$1)
`itemlost_on` datetime DEFAULT NULL, -- the date and time an item was last marked as lost, NULL if not lost
`withdrawn` tinyint(1) NOT NULL default 0, -- authorized value defining this item as withdrawn (MARC21 952$0)
--- a/koha-tmpl/intranet-tmpl/prog/en/columns.def
+++ a/koha-tmpl/intranet-tmpl/prog/en/columns.def
@@ -100,6 +100,7 @@