Bug 19821: Use database_test entry if exists
[koha-ffzg.git] / Koha / Quotes.pm
index c315b32..d9fc43f 100644 (file)
@@ -16,11 +16,9 @@ package Koha::Quotes;
 # along with Koha; if not, see <http://www.gnu.org/licenses>.
 
 use Modern::Perl;
-use Carp;
-use DateTime::Format::MySQL;
 
 use Koha::Database;
-use Koha::DateUtils qw(dt_from_string);
+use Koha::DateUtils qw( dt_from_string );
 use Koha::Quote;
 
 use base qw(Koha::Objects);
@@ -93,15 +91,13 @@ sub get_daily_quote {
                 offset => $offset,
             }
         )->single;
+    }
 
-        unless($quote){
-            return;
-        }
+    return unless $quote;
+
+    # update the timestamp for that quote
+    $quote->update({timestamp => dt_from_string})->discard_changes;
 
-        # update the timestamp for that quote
-        my $dt = $dtf->format_datetime(dt_from_string);
-        $quote->update({ timestamp => $dt });
-    }
     return $quote;
 }
 
@@ -121,4 +117,4 @@ sub object_class {
     return 'Koha::Quote';
 }
 
-1;
\ No newline at end of file
+1;