Bugzilla – Attachment 71818 Details for
Bug 20176
Set biblio.datecreated to NOW if not defined
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20176: [sql_modes] Set biblio.datecreated to NOW if not defined
Bug-20176-sqlmodes-Set-bibliodatecreated-to-NOW-if.patch (text/plain), 2.13 KB, created by
Nick Clemens (kidclamp)
on 2018-02-16 15:25:54 UTC
(
hide
)
Description:
Bug 20176: [sql_modes] Set biblio.datecreated to NOW if not defined
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2018-02-16 15:25:54 UTC
Size:
2.13 KB
patch
obsolete
>From 40b766d5968e685c3b8c4e8dc5c976c860e2661e Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 5 Feb 2018 15:59:09 -0300 >Subject: [PATCH] Bug 20176: [sql_modes] Set biblio.datecreated to NOW if not > defined > >Fix at ->store level, this issue appears in lot of places. > >Fix for: >Field 'datecreated' doesn't have a default value > >Signed-off-by: Julian Maurice <julian.maurice@biblibre.com> > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > Koha/Biblio.pm | 14 ++++++++++++++ > t/db_dependent/Koha/Biblios.t | 15 +++++++++++++-- > 2 files changed, 27 insertions(+), 2 deletions(-) > >diff --git a/Koha/Biblio.pm b/Koha/Biblio.pm >index a35048d..d226304 100644 >--- a/Koha/Biblio.pm >+++ b/Koha/Biblio.pm >@@ -45,6 +45,20 @@ Koha::Biblio - Koha Biblio Object class > > =cut > >+=head3 store >+ >+Overloaded I<store> method to set default values >+ >+=cut >+ >+sub store { >+ my ( $self ) = @_; >+ >+ $self->datecreated( dt_from_string ) unless $self->datecreated; >+ >+ return $self->SUPER::store; >+} >+ > =head3 subtitles > > my @subtitles = $biblio->subtitles(); >diff --git a/t/db_dependent/Koha/Biblios.t b/t/db_dependent/Koha/Biblios.t >index 2f807b1..5cc286e 100644 >--- a/t/db_dependent/Koha/Biblios.t >+++ b/t/db_dependent/Koha/Biblios.t >@@ -19,11 +19,11 @@ > > use Modern::Perl; > >-use Test::More tests => 3; >+use Test::More tests => 4; > > use C4::Reserves; > >-use Koha::DateUtils qw( dt_from_string ); >+use Koha::DateUtils qw( dt_from_string output_pref ); > use Koha::Biblios; > use Koha::Patrons; > use Koha::Subscriptions; >@@ -45,6 +45,17 @@ my $biblioitem = $schema->resultset('Biblioitem')->new( > } > )->insert(); > >+subtest 'store' => sub { >+ plan tests => 1; >+ is( >+ Koha::Biblios->find( $biblio->biblionumber )->datecreated, >+ output_pref( >+ { dt => dt_from_string, dateformat => 'iso', dateonly => 1 } >+ ), >+ "datecreated must be set to today if not passed to the constructor" >+ ); >+}; >+ > subtest 'holds + current_holds' => sub { > plan tests => 5; > C4::Reserves::AddReserve( $patron->branchcode, $patron->borrowernumber, $biblio->biblionumber ); >-- >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 20176
:
71466
|
71778
|
71814
| 71818