[Koha-patches] [PATCH] Bug 5418: Revised patch new itemBarcodeInputFilter for libsuite8 style barcodes

Mike Hafen mdhafen at tech.washk12.org
Thu Nov 18 19:27:38 CET 2010


Ah, I see you already got the second suggestion.  One comment about that
though, my libraries all have branch codes that are numbers.  So this filter
would be broken in that case.

On Thu, Nov 18, 2010 at 7:12 AM, Koustubha Kale <kmkale at anantcorp.com>wrote:
...

> diff --git a/C4/Circulation.pm b/C4/Circulation.pm
> index 10c3c11..219991e 100644
> --- a/C4/Circulation.pm
> +++ b/C4/Circulation.pm
> @@ -136,7 +136,7 @@ System Pref options.
>  # FIXME -- these plugins should be moved out of Circulation.pm
>  #
>  sub barcodedecode {
> -    my ($barcode, $filter) = @_;
> +    my ($barcode, $filter, $branch) = @_;
>     $filter = C4::Context->preference('itemBarcodeInputFilter') unless
> $filter;
>     $filter or return $barcode;     # ensure filter is defined, else return
> untouched barcode
>        if ($filter eq 'whitespace') {
> @@ -155,6 +155,10 @@ sub barcodedecode {
>         # FIXME: $barcode could be "T1", causing warning: substr outside of
> string
>         # Why drop the nonzero digit after the T?
>         # Why pass non-digits (or empty string) to "T%07d"?
> +       } elsif ($filter eq 'libsuite8') {
> +               unless($barcode =~ m/^($branch)-/i){
> +               $barcode =~ s/^(\D+)[0]*(\d+)$/$branch-$1-$2/i
> +               }
>        }
>     return $barcode;    # return barcode, modified or not
>  }
>
...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/koha-patches/attachments/20101118/c10e6237/attachment-0001.htm>


More information about the Koha-patches mailing list