From f8fee1da5ff3193c89408f08226e90d4bad54969 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20V=C3=A9ron?= Date: Fri, 13 Mar 2015 14:59:49 +0100 Subject: [PATCH] Bug 13813 - Remove C4::Dates from C4/Barcodes/annual.pm To test: Set syspref autoBarcode to -001, -002 Edit items or add item, click in empty barcode field, verify that barcodes are filled in as appropriate. Amended following comment #58 --- C4/Barcodes/annual.pm | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/C4/Barcodes/annual.pm b/C4/Barcodes/annual.pm index ae03274..7b7e8ca 100644 --- a/C4/Barcodes/annual.pm +++ b/C4/Barcodes/annual.pm @@ -24,7 +24,6 @@ use Carp; use C4::Context; use C4::Debug; -use C4::Dates; use vars qw($VERSION @ISA); use vars qw($debug $cgi_debug); # from C4::Debug, of course @@ -44,13 +43,13 @@ sub db_max ($;$) { my ($iso); if (@_) { my $input = shift; - $iso = C4::Dates->new($input,'iso')->output('iso'); # try to set the date w/ 2nd arg + $iso = output_pref({ dt => dt_from_string( $input, 'iso' ), dateformat => 'iso', dateonly => 1 }); # try to set the date w/ 2nd arg unless ($iso) { warn "Failed to create 'iso' Dates object with input '$input'. Reverting to today's date."; - $iso = C4::Dates->new->output('iso'); # failover back to today + $iso = output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }); # failover back to today } } else { - $iso = C4::Dates->new->output('iso'); + $iso = output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }); } my $year = substr($iso,0,4); # YYYY $sth->execute("$year-%"); @@ -61,7 +60,7 @@ sub db_max ($;$) { sub initial () { my $self = shift; - return substr(C4::Dates->new->output('iso'),0,4) .'-'. sprintf('%'."$width.$width".'d', 1); + return substr(output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }), 0, 4 ) .'-'. sprintf('%'."$width.$width".'d', 1); } sub parse ($;$) { @@ -82,7 +81,7 @@ sub width ($;$) { sub process_head($$;$$) { # (self,head,whole,specific) my ($self,$head,$whole,$specific) = @_; $specific and return $head; # if this is built off an existing barcode, just return the head unchanged. - return substr(C4::Dates->new->output('iso'),0,4) . '-'; # else get new YYYY- + return substr(output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }), 0, 4 ) . '-'; # else get new YYYY- } sub new_object { -- 1.7.10.4