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

(-)a/C4/Circulation.pm (-22 / +8 lines)
Lines 1470-1483 sub AddIssue { Link Here
1470
                $auto_renew = $rule->rule_value if $rule;
1470
                $auto_renew = $rule->rule_value if $rule;
1471
            }
1471
            }
1472
1472
1473
            # Record in the database the fact that the book was issued.
1473
            # Create the issue in the database
1474
            unless ($datedue) {
1475
                my $itype = $item_object->effective_itemtype;
1476
                $datedue = CalcDateDue( $issuedate, $itype, $branchcode, $borrower );
1477
1478
            }
1479
            $datedue->truncate( to => 'minute' );
1480
1481
            my $issue_attributes = {
1474
            my $issue_attributes = {
1482
                borrowernumber  => $borrower->{'borrowernumber'},
1475
                borrowernumber  => $borrower->{'borrowernumber'},
1483
                issuedate       => $issuedate->strftime('%Y-%m-%d %H:%M:%S'),
1476
                issuedate       => $issuedate->strftime('%Y-%m-%d %H:%M:%S'),
Lines 1486-1504 sub AddIssue { Link Here
1486
                onsite_checkout => $onsite_checkout,
1479
                onsite_checkout => $onsite_checkout,
1487
                auto_renew      => $auto_renew ? 1 : 0,
1480
                auto_renew      => $auto_renew ? 1 : 0,
1488
            };
1481
            };
1482
            $issue = Koha::Checkout->new(
1483
                {
1484
                    itemnumber => $item_object->itemnumber,
1485
                    %$issue_attributes,
1486
                }
1487
            )->store;
1489
1488
1490
            $issue = Koha::Checkouts->find( { itemnumber => $item_object->itemnumber } );
1491
            if ($issue) {
1492
                $issue->set($issue_attributes)->store;
1493
            }
1494
            else {
1495
                $issue = Koha::Checkout->new(
1496
                    {
1497
                        itemnumber => $item_object->itemnumber,
1498
                        %$issue_attributes,
1499
                    }
1500
                )->store;
1501
            }
1502
            if ( $item_object->location && $item_object->location eq 'CART'
1489
            if ( $item_object->location && $item_object->location eq 'CART'
1503
                && ( !$item_object->permanent_location || $item_object->permanent_location ne 'CART' ) ) {
1490
                && ( !$item_object->permanent_location || $item_object->permanent_location ne 'CART' ) ) {
1504
            ## Item was moved to cart via UpdateItemLocationOnCheckin, anything issued should be taken off the cart.
1491
            ## Item was moved to cart via UpdateItemLocationOnCheckin, anything issued should be taken off the cart.
Lines 1514-1521 sub AddIssue { Link Here
1514
            $item_object->itemlost(0);
1501
            $item_object->itemlost(0);
1515
            $item_object->onloan($datedue->ymd());
1502
            $item_object->onloan($datedue->ymd());
1516
            $item_object->datelastborrowed( dt_from_string()->ymd() );
1503
            $item_object->datelastborrowed( dt_from_string()->ymd() );
1504
            $item_object->datelastseen( dt_from_string()->ymd() );
1517
            $item_object->store({log_action => 0});
1505
            $item_object->store({log_action => 0});
1518
            ModDateLastSeen( $item_object->itemnumber );
1519
1506
1520
            # If it costs to borrow this book, charge it to the patron's account.
1507
            # If it costs to borrow this book, charge it to the patron's account.
1521
            my ( $charge, $itemtype ) = GetIssuingCharges( $item_object->itemnumber, $borrower->{'borrowernumber'} );
1508
            my ( $charge, $itemtype ) = GetIssuingCharges( $item_object->itemnumber, $borrower->{'borrowernumber'} );
1522
- 

Return to bug 26583