[Koha-bugs] [Bug 10900] Incorrect calling conventions accessing C4::Context

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Sat Oct 26 04:02:30 CEST 2013


http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10900

M. Tompsett <mtompset at hotmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|Failed QA                   |Needs Signoff

--- Comment #20 from M. Tompsett <mtompset at hotmail.com> ---
After reading your post, Kyle, I did a fresh git install on a fresh OS clone. I
could not replicate your failure.

mtompset at ubuntu:~/kohaclone$ git checkout -b bug_10900 origin/master
Branch bug_10900 set up to track remote branch master from origin.
Switched to a new branch 'bug_10900'
mtompset at ubuntu:~/kohaclone$ git diff origin/master
mtompset at ubuntu:~/kohaclone$ git bz apply 10900
Bug 10900 - Incorrect calling conventions accessing C4::Context

Bug 10900 - Incorrect calling conventions accessing C4::Context
Apply? [yn] y

Applying: Bug 10900 - Incorrect calling conventions accessing C4::Context
mtompset at ubuntu:~/kohaclone$ prove -v t/Circulation_barcodedecode.t
t/Circulation_barcodedecode.t ..
1..26
ok 1 - use C4::Circulation;
ok 2 -        EAN13:       '892685001928' => '0892685001928'
ok 3 -        EAN13:             '695152' => '0000000695152'
ok 4 -     T-prefix:           'T0031472' =>      'T0031472'
ok 5 -     T-prefix:                'T32' =>      'T0000002'
ok 6 -       cuecat:           '26002315' =>      '26002315'
ok 7 -       cuecat: '.C3nZC3nZC3nYD3b6ENnZCNnY.fHmc.C3D1Dxr2C3nZE3n7.' => 
'046675000808'
ok 8 -       cuecat: '.C3nZC3nZC3nYD3b6ENnZCNnY.fHmc.C3D1Dxr2C3nZE3n7.
# ' =>  '046675000808'
ok 9 -       cuecat: 'q.C3nZC3nZC3nWDNzYDxf2CNnY.fHmc.C3DWC3nZCNjXD3nW.' => 
'043000112403'
ok 10 -       cuecat:
'.C3nZC3nZC3nWCxjWE3D1C3nX.cGf2.ENr7C3v7D3T3ENj3C3zYDNnZ.' =>
'978068484914051500'
ok 11 -    libsuite8:            'b000126' =>     'IMS-b-126'
ok 12 -    libsuite8:                'b12' =>      'IMS-b-12'
ok 13 -    libsuite8:              'B0126' =>     'IMS-B-126'
ok 14 -    libsuite8:          'IMS-B-126' =>     'IMS-B-126'
ok 15 -    libsuite8:          'ims-b-126' =>     'ims-b-126'
ok 16 -    libsuite8:          'CD0000024' =>     'IMS-CD-24'
ok 17 -    libsuite8:              '00123' =>     'IMS-b-123'
ok 18 -    libsuite8:              '11998' =>   'IMS-b-11998'
ok 19 -        other:           '26002315' =>      '26002315'
ok 20 -        other:           'T0031472' =>      'T0031472'
ok 21 -        other:                'T32' =>           'T32'
ok 22 -        other:        'Alphanum123' =>   'Alphanum123'
ok 23 -        other:      'Alpha Num 345' => 'Alpha Num 345'
ok 24 -   whitespace:          ' 26002315' =>      '26002315'
ok 25 -   whitespace:          '26002315 ' =>      '26002315'
ok 26 -   whitespace:        '
#       26002315
# ' =>      '26002315'
ok
All tests successful.
Files=1, Tests=26,  0 wallclock secs ( 0.01 usr  0.01 sys +  0.30 cusr  0.02
csys =  0.34 CPU)
Result: PASS

So, I looked at your bad output line:
# Bad output: 'kale-b-126'

'kale' is the last name in the set_userenv call.
The line that changed in the test file is:
C4::Context->set_userenv(1,'kmkale' , 1, 'km', 'kale' , 'IMS', 'IMS Branch
DEscription', 0, 'kmkale at anantcorp.com');

This would be affected if the set_userenv function in C4::Context is missing
shift @_; or the call is :: in the test file.

>From C4::Context:
    shift @_;
    my ($usernum, $userid, $usercnum, $userfirstname, $usersurname,
$userbranch, $branchname, $userflags, $emailaddress, $branchprinter, $persona)=
@_;

The -> passes an object, which is shifted off, and
$usernum=1,$userid='kmkale',$usercnum=1,$userfirstname='km',$usersurname='kale',$userbranch='IMS'

The barcodedecode function uses the userbranch. So, if there is a missing shift
@_ and the Circulationbarcode.t file has ->set_userenv(...) as above, then that
$userbranch would be 'kale', which matches your failed output. The 'kale-'
portion is based on the branchcode.

>From C4/Circulation.pm
sub barcodedecode {
    my ($barcode, $filter) = @_;
    my $branch = C4::Branch::mybranch();
...
        } elsif ($filter eq 'libsuite8') {
                unless($barcode =~ m/^($branch)-/i){    #if barcode starts with
branch code its in Koha style. Skip it.
                        if($barcode =~ m/^(\d)/i){      #Some barcodes even
start with 0's & numbers and are assumed to have b as the item type in the
libsuite8 software
                                $barcode =~ s/^[0]*(\d+)$/$branch-b-$1/i;
                        }else{
                                $barcode =~ s/^(\D+)[0]*(\d+)$/$branch-$1-$2/i;
                        }
                }

>From C4/Branch.pm
# always returns a string for OK comparison via "eq" or "ne"
sub mybranch {
    C4::Context->userenv           or return '';
    return C4::Context->userenv->{branch} || '';
}

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list