X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=C4%2FBarcodes%2Fhbyymmincr.pm;h=258a1a50ece2acfdc04bfd1f4017d22f9a0b7061;hb=14def333db6a6533f0756878e75a87531d25a3d3;hp=5f2f029e569174d29cc53af0cb715ac5ce9e48ea;hpb=4313afb977cf6c6cfcc1144565809d698a0e5d9e;p=koha_fer diff --git a/C4/Barcodes/hbyymmincr.pm b/C4/Barcodes/hbyymmincr.pm old mode 100755 new mode 100644 index 5f2f029e56..258a1a50ec --- a/C4/Barcodes/hbyymmincr.pm +++ b/C4/Barcodes/hbyymmincr.pm @@ -1,5 +1,3 @@ -#!/usr/bin/perl - package C4::Barcodes::hbyymmincr; # Copyright 2008 LibLime @@ -15,9 +13,9 @@ package C4::Barcodes::hbyymmincr; # 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; @@ -33,7 +31,7 @@ use vars qw($debug $cgi_debug); # from C4::Debug, of course use vars qw($branch $width); BEGIN { - $VERSION = 0.01; + $VERSION = 3.07.00.049; @ISA = qw(C4::Barcodes); } @@ -44,7 +42,7 @@ INIT { # 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"; @@ -73,14 +71,14 @@ sub db_max ($;$) { 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; @@ -92,17 +90,17 @@ sub parse ($;$) { # return 3 parts of barcode: non-incrementing, incrementing, 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