View | Details | Raw Unified | Return to bug 15757
Collapse All | Expand All

(-)a/C4/Circulation.pm (-11 / +11 lines)
Lines 1484-1530 sub GetLoanLength { Link Here
1484
    my $loanlength = $sth->fetchrow_hashref;
1484
    my $loanlength = $sth->fetchrow_hashref;
1485
1485
1486
    return $loanlength
1486
    return $loanlength
1487
      if defined($loanlength) && $loanlength->{issuelength};
1487
      if defined($loanlength) && defined $loanlength->{issuelength};
1488
1488
1489
    $sth->execute( $borrowertype, '*', $branchcode );
1489
    $sth->execute( $borrowertype, '*', $branchcode );
1490
    $loanlength = $sth->fetchrow_hashref;
1490
    $loanlength = $sth->fetchrow_hashref;
1491
    return $loanlength
1491
    return $loanlength
1492
      if defined($loanlength) && $loanlength->{issuelength};
1492
      if defined($loanlength) && defined $loanlength->{issuelength};
1493
1493
1494
    $sth->execute( '*', $itemtype, $branchcode );
1494
    $sth->execute( '*', $itemtype, $branchcode );
1495
    $loanlength = $sth->fetchrow_hashref;
1495
    $loanlength = $sth->fetchrow_hashref;
1496
    return $loanlength
1496
    return $loanlength
1497
      if defined($loanlength) && $loanlength->{issuelength};
1497
      if defined($loanlength) && defined $loanlength->{issuelength};
1498
1498
1499
    $sth->execute( '*', '*', $branchcode );
1499
    $sth->execute( '*', '*', $branchcode );
1500
    $loanlength = $sth->fetchrow_hashref;
1500
    $loanlength = $sth->fetchrow_hashref;
1501
    return $loanlength
1501
    return $loanlength
1502
      if defined($loanlength) && $loanlength->{issuelength};
1502
      if defined($loanlength) && defined $loanlength->{issuelength};
1503
1503
1504
    $sth->execute( $borrowertype, $itemtype, '*' );
1504
    $sth->execute( $borrowertype, $itemtype, '*' );
1505
    $loanlength = $sth->fetchrow_hashref;
1505
    $loanlength = $sth->fetchrow_hashref;
1506
    return $loanlength
1506
    return $loanlength
1507
      if defined($loanlength) && $loanlength->{issuelength};
1507
      if defined($loanlength) && defined $loanlength->{issuelength};
1508
1508
1509
    $sth->execute( $borrowertype, '*', '*' );
1509
    $sth->execute( $borrowertype, '*', '*' );
1510
    $loanlength = $sth->fetchrow_hashref;
1510
    $loanlength = $sth->fetchrow_hashref;
1511
    return $loanlength
1511
    return $loanlength
1512
      if defined($loanlength) && $loanlength->{issuelength};
1512
      if defined($loanlength) && defined $loanlength->{issuelength};
1513
1513
1514
    $sth->execute( '*', $itemtype, '*' );
1514
    $sth->execute( '*', $itemtype, '*' );
1515
    $loanlength = $sth->fetchrow_hashref;
1515
    $loanlength = $sth->fetchrow_hashref;
1516
    return $loanlength
1516
    return $loanlength
1517
      if defined($loanlength) && $loanlength->{issuelength};
1517
      if defined($loanlength) && defined $loanlength->{issuelength};
1518
1518
1519
    $sth->execute( '*', '*', '*' );
1519
    $sth->execute( '*', '*', '*' );
1520
    $loanlength = $sth->fetchrow_hashref;
1520
    $loanlength = $sth->fetchrow_hashref;
1521
    return $loanlength
1521
    return $loanlength
1522
      if defined($loanlength) && $loanlength->{issuelength};
1522
      if defined($loanlength) && defined $loanlength->{issuelength};
1523
1523
1524
    # if no rule is set => 21 days (hardcoded)
1524
    # if no rule is set => 0 day (hardcoded)
1525
    return {
1525
    return {
1526
        issuelength => 21,
1526
        issuelength => 0,
1527
        renewalperiod => 21,
1527
        renewalperiod => 0,
1528
        lengthunit => 'days',
1528
        lengthunit => 'days',
1529
    };
1529
    };
1530
1530
(-)a/t/db_dependent/Circulation_Issuingrule.t (-20 / +11 lines)
Lines 104-109 $dbh->do( Link Here
104
104
105
#Begin Tests
105
#Begin Tests
106
106
107
my $default = {
108
    issuelength => 0,
109
    renewalperiod => 0,
110
    lengthunit => 'days'
111
};
112
107
#Test GetIssuingRule
113
#Test GetIssuingRule
108
my $sampleissuingrule1 = {
114
my $sampleissuingrule1 = {
109
    reservecharge      => '0.000000',
115
    reservecharge      => '0.000000',
Lines 343-382 is_deeply( Link Here
343
    { issuelength => 5, lengthunit => 'days', renewalperiod => 5 },
349
    { issuelength => 5, lengthunit => 'days', renewalperiod => 5 },
344
    "GetLoanLength"
350
    "GetLoanLength"
345
);
351
);
352
346
is_deeply(
353
is_deeply(
347
    C4::Circulation::GetLoanLength(),
354
    C4::Circulation::GetLoanLength(),
348
    {
355
    $default,
349
        issuelength   => 21,
350
        renewalperiod => 21,
351
        lengthunit    => 'days',
352
    },
353
    "Without parameters, GetLoanLength returns hardcoded values"
356
    "Without parameters, GetLoanLength returns hardcoded values"
354
);
357
);
355
is_deeply(
358
is_deeply(
356
    C4::Circulation::GetLoanLength( -1, -1 ),
359
    C4::Circulation::GetLoanLength( -1, -1 ),
357
    {
360
    $default,
358
        issuelength   => 21,
359
        renewalperiod => 21,
360
        lengthunit    => 'days',
361
    },
362
    "With wrong parameters, GetLoanLength returns hardcoded values"
361
    "With wrong parameters, GetLoanLength returns hardcoded values"
363
);
362
);
364
is_deeply(
363
is_deeply(
365
    C4::Circulation::GetLoanLength( $samplecat->{categorycode} ),
364
    C4::Circulation::GetLoanLength( $samplecat->{categorycode} ),
366
    {
365
    $default,
367
        issuelength   => 21,
368
        renewalperiod => 21,
369
        lengthunit    => 'days',
370
    },
371
    "With only one parameter, GetLoanLength returns hardcoded values"
366
    "With only one parameter, GetLoanLength returns hardcoded values"
372
);    #NOTE : is that really what is expected?
367
);    #NOTE : is that really what is expected?
373
is_deeply(
368
is_deeply(
374
    C4::Circulation::GetLoanLength( $samplecat->{categorycode}, 'BOOK' ),
369
    C4::Circulation::GetLoanLength( $samplecat->{categorycode}, 'BOOK' ),
375
    {
370
    $default,
376
        issuelength   => 21,
377
        renewalperiod => 21,
378
        lengthunit    => 'days',
379
    },
380
    "With only two parameters, GetLoanLength returns hardcoded values"
371
    "With only two parameters, GetLoanLength returns hardcoded values"
381
);    #NOTE : is that really what is expected?
372
);    #NOTE : is that really what is expected?
382
is_deeply(
373
is_deeply(
(-)a/t/db_dependent/Circulation_issuingrules.t (-3 / +2 lines)
Lines 27-34 my $expected = { Link Here
27
};
27
};
28
28
29
my $default = {
29
my $default = {
30
    issuelength => 21,
30
    issuelength => 0,
31
    renewalperiod => 21,
31
    renewalperiod => 0,
32
    lengthunit => 'days'
32
    lengthunit => 'days'
33
};
33
};
34
34
35
- 

Return to bug 15757