|
Lines 24-30
use Carp;
Link Here
|
| 24 |
|
24 |
|
| 25 |
use C4::Context; |
25 |
use C4::Context; |
| 26 |
use C4::Debug; |
26 |
use C4::Debug; |
| 27 |
use C4::Dates; |
|
|
| 28 |
|
27 |
|
| 29 |
use vars qw($VERSION @ISA); |
28 |
use vars qw($VERSION @ISA); |
| 30 |
use vars qw($debug $cgi_debug); # from C4::Debug, of course |
29 |
use vars qw($debug $cgi_debug); # from C4::Debug, of course |
|
Lines 44-56
sub db_max ($;$) {
Link Here
|
| 44 |
my ($iso); |
43 |
my ($iso); |
| 45 |
if (@_) { |
44 |
if (@_) { |
| 46 |
my $input = shift; |
45 |
my $input = shift; |
| 47 |
$iso = C4::Dates->new($input,'iso')->output('iso'); # try to set the date w/ 2nd arg |
46 |
$iso = output_pref({ dt => dt_from_string( $input, 'iso' ), dateformat => 'iso', dateonly => 1 }); # try to set the date w/ 2nd arg |
| 48 |
unless ($iso) { |
47 |
unless ($iso) { |
| 49 |
warn "Failed to create 'iso' Dates object with input '$input'. Reverting to today's date."; |
48 |
warn "Failed to create 'iso' Dates object with input '$input'. Reverting to today's date."; |
| 50 |
$iso = C4::Dates->new->output('iso'); # failover back to today |
49 |
$iso = output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }); # failover back to today |
| 51 |
} |
50 |
} |
| 52 |
} else { |
51 |
} else { |
| 53 |
$iso = C4::Dates->new->output('iso'); |
52 |
$iso = output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }); |
| 54 |
} |
53 |
} |
| 55 |
my $year = substr($iso,0,4); # YYYY |
54 |
my $year = substr($iso,0,4); # YYYY |
| 56 |
$sth->execute("$year-%"); |
55 |
$sth->execute("$year-%"); |
|
Lines 61-67
sub db_max ($;$) {
Link Here
|
| 61 |
|
60 |
|
| 62 |
sub initial () { |
61 |
sub initial () { |
| 63 |
my $self = shift; |
62 |
my $self = shift; |
| 64 |
return substr(C4::Dates->new->output('iso'),0,4) .'-'. sprintf('%'."$width.$width".'d', 1); |
63 |
return substr(output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }), 0, 4 ) .'-'. sprintf('%'."$width.$width".'d', 1); |
| 65 |
} |
64 |
} |
| 66 |
|
65 |
|
| 67 |
sub parse ($;$) { |
66 |
sub parse ($;$) { |
|
Lines 82-88
sub width ($;$) {
Link Here
|
| 82 |
sub process_head($$;$$) { # (self,head,whole,specific) |
81 |
sub process_head($$;$$) { # (self,head,whole,specific) |
| 83 |
my ($self,$head,$whole,$specific) = @_; |
82 |
my ($self,$head,$whole,$specific) = @_; |
| 84 |
$specific and return $head; # if this is built off an existing barcode, just return the head unchanged. |
83 |
$specific and return $head; # if this is built off an existing barcode, just return the head unchanged. |
| 85 |
return substr(C4::Dates->new->output('iso'),0,4) . '-'; # else get new YYYY- |
84 |
return substr(output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }), 0, 4 ) . '-'; # else get new YYYY- |
| 86 |
} |
85 |
} |
| 87 |
|
86 |
|
| 88 |
sub new_object { |
87 |
sub new_object { |
| 89 |
- |
|
|