-#!/usr/bin/perl
-
package C4::Barcodes::hbyymmincr;
# Copyright 2008 LibLime
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
-# You should have received a copy of the GNU General Public License along with
-# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
-# Suite 330, Boston, MA 02111-1307 USA
+# You should have received a copy of the GNU General Public License along
+# with Koha; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
use strict;
use warnings;
use vars qw($branch $width);
BEGIN {
- $VERSION = 0.01;
+ $VERSION = 3.07.00.049;
@ISA = qw(C4::Barcodes);
}
# Generates barcode where hb = home branch Code, yymm = year/month catalogued, incr = incremental number,
# increment resets yearly -fbcit
-sub db_max ($;$) {
+sub db_max {
my $self = shift;
my $query = "SELECT MAX(SUBSTRING(barcode,-$width)), barcode FROM items WHERE barcode REGEXP ? GROUP BY barcode";
$debug and print STDERR "(hbyymmincr) db_max query: $query\n";
return ($max || 0);
}
-sub initial () {
+sub initial {
my $self = shift;
# FIXME: populated branch?
my $iso = C4::Dates->new->output('iso'); # like "2008-07-02"
return $self->branch . substr($iso,2,2) . substr($iso,5,2) . sprintf('%' . "$width.$width" . 'd',1);
}
-sub parse ($;$) { # return 3 parts of barcode: non-incrementing, incrementing, non-incrementing
+sub parse { # return 3 parts of barcode: non-incrementing, incrementing, non-incrementing
my $self = shift;
my $barcode = (@_) ? shift : $self->value;
my $branch = $self->branch;
return ($1,$2,''); # the third part is in anticipation of barcodes that include checkdigits
}
-sub branch ($;$) {
+sub branch {
my $self = shift;
(@_) and $self->{branch} = shift;
return $self->{branch};
}
-sub width ($;$) {
+sub width {
my $self = shift;
(@_) and $width = shift; # hitting the class variable.
return $width;
}
-sub process_head($$;$$) { # (self,head,whole,specific)
+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.
$head =~ s/\d{4}$//; # else strip the old yymm