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

(-)a/C4/SIP/ILS.pm (-1 / +4 lines)
Lines 126-138 sub offline_ok { Link Here
126
# the response.
126
# the response.
127
#
127
#
128
sub checkout {
128
sub checkout {
129
    my ($self, $patron_id, $item_id, $sc_renew) = @_;
129
    my ($self, $patron_id, $item_id, $sc_renew, $fee_ack) = @_;
130
    my ($patron, $item, $circ);
130
    my ($patron, $item, $circ);
131
131
132
    $circ = C4::SIP::ILS::Transaction::Checkout->new();
132
    $circ = C4::SIP::ILS::Transaction::Checkout->new();
133
    # BEGIN TRANSACTION
133
    # BEGIN TRANSACTION
134
    $circ->patron($patron = C4::SIP::ILS::Patron->new( $patron_id));
134
    $circ->patron($patron = C4::SIP::ILS::Patron->new( $patron_id));
135
    $circ->item($item = C4::SIP::ILS::Item->new( $item_id));
135
    $circ->item($item = C4::SIP::ILS::Item->new( $item_id));
136
    if ($fee_ack) {
137
        $circ->fee_ack($fee_ack);
138
    }
136
139
137
    if (!$patron) {
140
    if (!$patron) {
138
		$circ->screen_msg("Invalid Patron");
141
		$circ->screen_msg("Invalid Patron");
(-)a/C4/SIP/ILS/Transaction.pm (+1 lines)
Lines 21-26 my %fields = ( Link Here
21
	sip_currency  => 'USD', # FIXME: why hardcoded?
21
	sip_currency  => 'USD', # FIXME: why hardcoded?
22
	screen_msg    => '',
22
	screen_msg    => '',
23
	print_line    => '',
23
	print_line    => '',
24
    fee_ack       => 'N',
24
);
25
);
25
26
26
our $AUTOLOAD;
27
our $AUTOLOAD;
(-)a/C4/SIP/ILS/Transaction/Checkout.pm (+13 lines)
Lines 90-98 sub do_checkout { Link Here
90
            } elsif ($confirmation eq 'HIGHHOLDS') {
90
            } elsif ($confirmation eq 'HIGHHOLDS') {
91
                $overridden_duedate = $needsconfirmation->{$confirmation}->{returndate};
91
                $overridden_duedate = $needsconfirmation->{$confirmation}->{returndate};
92
                $self->screen_msg('Loan period reduced for high-demand item');
92
                $self->screen_msg('Loan period reduced for high-demand item');
93
            } elsif ($confirmation eq 'RENTALCHARGE') {
94
                if ($self->{fee_ack} ne 'Y') {
95
                    $noerror = 0;
96
                }
93
            } else {
97
            } else {
94
                $self->screen_msg($needsconfirmation->{$confirmation});
98
                $self->screen_msg($needsconfirmation->{$confirmation});
95
                $noerror = 0;
99
                $noerror = 0;
100
                syslog('LOG_DEBUG', "Blocking checkout Reason:$confirmation");
96
            }
101
            }
97
        }
102
        }
98
    }
103
    }
Lines 106-111 sub do_checkout { Link Here
106
        $self->screen_msg("Item is on hold shelf for another patron.");
111
        $self->screen_msg("Item is on hold shelf for another patron.");
107
        $noerror = 0;
112
        $noerror = 0;
108
    }
113
    }
114
    my ($fee, undef) = GetIssuingCharges($itemnumber, $self->{patron}->{borrowernumber});
115
    if ( $fee > 0 ) {
116
        $self->{sip_fee_type} = '06';
117
        $self->{fee_amount} = sprintf '%.2f', $fee;
118
        if ($self->{fee_ack} eq 'N' ) {
119
            $noerror = 0;
120
        }
121
    }
109
	unless ($noerror) {
122
	unless ($noerror) {
110
		$debug and warn "cannot issue: " . Dumper($issuingimpossible) . "\n" . Dumper($needsconfirmation);
123
		$debug and warn "cannot issue: " . Dumper($issuingimpossible) . "\n" . Dumper($needsconfirmation);
111
		$self->ok(0);
124
		$self->ok(0);
(-)a/C4/SIP/ILS/Transaction/Renew.pm (+11 lines)
Lines 32-37 sub do_renew_for { Link Here
32
    my $self = shift;
32
    my $self = shift;
33
    my $borrower = shift;
33
    my $borrower = shift;
34
    my ($renewokay,$renewerror) = CanBookBeRenewed($borrower->{borrowernumber},$self->{item}->{itemnumber});
34
    my ($renewokay,$renewerror) = CanBookBeRenewed($borrower->{borrowernumber},$self->{item}->{itemnumber});
35
    if ($renewokay) { # ok so far check charges
36
        my ($fee, undef) = GetIssuingCharges($self->{item}->{itemnumber}, $self->{patron}->{borrowernumber});
37
        if ($fee > 0) {
38
            $self->{sip_fee_type} = '06';
39
            $self->{fee_amount} = sprintf '%.2f',$fee;
40
            if ($self->{fee_ack} eq 'N') {
41
                $renewokay = 0;
42
            }
43
        }
44
45
    }
35
    if ($renewokay){
46
    if ($renewokay){
36
        $self->{due} = undef;
47
        $self->{due} = undef;
37
        my $due_date = AddIssue( $borrower, $self->{item}->id, undef, 0 );
48
        my $due_date = AddIssue( $borrower, $self->{item}->id, undef, 0 );
(-)a/C4/SIP/Sip/MsgType.pm (-10 / +13 lines)
Lines 511-516 sub handle_checkout { Link Here
511
511
512
    $patron_id = $fields->{(FID_PATRON_ID)};
512
    $patron_id = $fields->{(FID_PATRON_ID)};
513
    $item_id   = $fields->{(FID_ITEM_ID)};
513
    $item_id   = $fields->{(FID_ITEM_ID)};
514
    my $fee_ack = $fields->{(FID_FEE_ACK)};
514
515
515
516
516
    if ($no_block eq 'Y') {
517
    if ($no_block eq 'Y') {
Lines 525-531 sub handle_checkout { Link Here
525
    } else {
526
    } else {
526
	# Does the transaction date really matter for items that are
527
	# Does the transaction date really matter for items that are
527
	# checkout out while the terminal is online?  I'm guessing 'no'
528
	# checkout out while the terminal is online?  I'm guessing 'no'
528
		$status = $ils->checkout($patron_id, $item_id, $sc_renewal_policy);
529
		$status = $ils->checkout($patron_id, $item_id, $sc_renewal_policy, $fee_ack);
529
    }
530
    }
530
531
531
    $item = $status->item;
532
    $item = $status->item;
Lines 567-583 sub handle_checkout { Link Here
567
	    $resp .= maybe_add(FID_MEDIA_TYPE, $item->sip_media_type);
568
	    $resp .= maybe_add(FID_MEDIA_TYPE, $item->sip_media_type);
568
	    $resp .= maybe_add(FID_ITEM_PROPS, $item->sip_item_properties);
569
	    $resp .= maybe_add(FID_ITEM_PROPS, $item->sip_item_properties);
569
570
570
	    # Financials
571
	    if ($status->fee_amount) {
572
		$resp .= add_field(FID_FEE_AMT, $status->fee_amount);
573
		$resp .= maybe_add(FID_CURRENCY, $status->sip_currency);
574
		$resp .= maybe_add(FID_FEE_TYPE, $status->sip_fee_type);
575
		$resp .= maybe_add(FID_TRANSACTION_ID,
576
				   $status->transaction_id);
577
	    }
571
	    }
578
	}
572
	}
579
573
580
    } else {
574
    else {
581
	# Checkout failed
575
	# Checkout failed
582
	# Checkout Response: not ok, no renewal, don't know mag. media,
576
	# Checkout Response: not ok, no renewal, don't know mag. media,
583
	# no desensitize
577
	# no desensitize
Lines 607-612 sub handle_checkout { Link Here
607
	    }
601
	    }
608
	}
602
	}
609
    }
603
    }
604
	if ($protocol_version >= 2) {
605
	    # Financials : return irrespective of ok status
606
        if ($status->fee_amount) {
607
            $resp .= add_field(FID_FEE_AMT, $status->fee_amount);
608
            $resp .= maybe_add(FID_CURRENCY, $status->sip_currency);
609
            $resp .= maybe_add(FID_FEE_TYPE, $status->sip_fee_type);
610
            $resp .= maybe_add(FID_TRANSACTION_ID,
611
                $status->transaction_id);
612
        }
613
    }
610
614
611
    $self->write_msg($resp,undef,$server->{account}->{terminator},$server->{account}->{encoding});
615
    $self->write_msg($resp,undef,$server->{account}->{terminator},$server->{account}->{encoding});
612
    return(CHECKOUT);
616
    return(CHECKOUT);
613
- 

Return to bug 12820