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

(-)a/C4/SIP/ILS.pm (-1 / +5 lines)
Lines 126-132 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, $sc_fee_acknowledged ) = @_;
130
    my ($patron, $item, $circ);
130
    my ($patron, $item, $circ);
131
131
132
    $circ = new ILS::Transaction::Checkout;
132
    $circ = new ILS::Transaction::Checkout;
Lines 134-139 sub checkout { Link Here
134
    $circ->patron($patron = new ILS::Patron $patron_id);
134
    $circ->patron($patron = new ILS::Patron $patron_id);
135
    $circ->item($item = new ILS::Item $item_id);
135
    $circ->item($item = new ILS::Item $item_id);
136
136
137
    my $charge = $circ->fee();
138
137
    if (!$patron) {
139
    if (!$patron) {
138
		$circ->screen_msg("Invalid Patron");
140
		$circ->screen_msg("Invalid Patron");
139
    } elsif (!$patron->charge_ok) {
141
    } elsif (!$patron->charge_ok) {
Lines 146-151 sub checkout { Link Here
146
    } elsif ($item->{patron} && ($item->{patron} ne $patron_id)) {
148
    } elsif ($item->{patron} && ($item->{patron} ne $patron_id)) {
147
	# I can't deal with this right now
149
	# I can't deal with this right now
148
		$circ->screen_msg("Item checked out to another patron");
150
		$circ->screen_msg("Item checked out to another patron");
151
    } elsif ( !$sc_fee_acknowledged && $charge ) {
152
        $circ->screen_msg( sprintf("There is a charge of %.2f to check out this item. Please confirm.", $charge ) );
149
    } else {
153
    } else {
150
		$circ->do_checkout();
154
		$circ->do_checkout();
151
		if ($circ->ok){
155
		if ($circ->ok){
(-)a/C4/SIP/ILS/Item.pm (-1 / +4 lines)
Lines 92-98 sub new { Link Here
92
92
93
    my $it = C4::Context->preference('item-level_itypes') ? $item->{itype} : $item->{itemtype};
93
    my $it = C4::Context->preference('item-level_itypes') ? $item->{itype} : $item->{itemtype};
94
    my $itemtype = Koha::Database->new()->schema()->resultset('Itemtype')->find( $it );
94
    my $itemtype = Koha::Database->new()->schema()->resultset('Itemtype')->find( $it );
95
    $item->{sip_media_type} = $itemtype->sip_media_type() if $itemtype;
95
    if ($itemtype) {
96
        $item->{sip_media_type} = $itemtype->sip_media_type();
97
        $item->{fee}            = $itemtype->rentalcharge();
98
    }
96
99
97
	# check if its on issue and if so get the borrower
100
	# check if its on issue and if so get the borrower
98
	my $issue = GetItemIssue($item->{'itemnumber'});
101
	my $issue = GetItemIssue($item->{'itemnumber'});
(-)a/C4/SIP/ILS/Patron.pm (+2 lines)
Lines 68-73 sub new { Link Here
68
    %ilspatron = (
68
    %ilspatron = (
69
        getmemberdetails_object => $kp,
69
        getmemberdetails_object => $kp,
70
        name => $kp->{firstname} . " " . $kp->{surname},
70
        name => $kp->{firstname} . " " . $kp->{surname},
71
        ils_id => $kp->{borrowernumber},
71
        id   => $kp->{cardnumber},    # to SIP, the id is the BARCODE, not userid
72
        id   => $kp->{cardnumber},    # to SIP, the id is the BARCODE, not userid
72
        password        => $pw,
73
        password        => $pw,
73
        ptype           => $kp->{categorycode},     # 'A'dult.  Whatever.
74
        ptype           => $kp->{categorycode},     # 'A'dult.  Whatever.
Lines 132-137 sub new { Link Here
132
# 1 means read/write
133
# 1 means read/write
133
134
134
my %fields = (
135
my %fields = (
136
    ils_id                  => 0,
135
    id                      => 0,
137
    id                      => 0,
136
    name                    => 0,
138
    name                    => 0,
137
    address                 => 0,
139
    address                 => 0,
(-)a/C4/SIP/ILS/Transaction/Checkout.pm (+13 lines)
Lines 20-25 use C4::Circulation; Link Here
20
use C4::Members;
20
use C4::Members;
21
use C4::Reserves qw(ModReserveFill);
21
use C4::Reserves qw(ModReserveFill);
22
use C4::Debug;
22
use C4::Debug;
23
use C4::Circulation qw( GetIssuingCharges );
24
23
use parent qw(ILS::Transaction);
25
use parent qw(ILS::Transaction);
24
26
25
our $debug;
27
our $debug;
Lines 125-130 sub do_checkout { Link Here
125
	$debug and warn "do_checkout: calling AddIssue(\$borrower,$barcode, $overridden_duedate, 0)\n"
127
	$debug and warn "do_checkout: calling AddIssue(\$borrower,$barcode, $overridden_duedate, 0)\n"
126
		# . "w/ \$borrower: " . Dumper($borrower)
128
		# . "w/ \$borrower: " . Dumper($borrower)
127
		. "w/ C4::Context->userenv: " . Dumper(C4::Context->userenv);
129
		. "w/ C4::Context->userenv: " . Dumper(C4::Context->userenv);
130
    $self->{fee_amount} = GetIssuingCharges($itemnumber, $borrower);
128
	my $due_dt  = AddIssue($borrower, $barcode, $overridden_duedate, 0);
131
	my $due_dt  = AddIssue($borrower, $barcode, $overridden_duedate, 0);
129
    if ($due_dt) {
132
    if ($due_dt) {
130
        $self->{due} = $due_dt->clone();
133
        $self->{due} = $due_dt->clone();
Lines 137-141 sub do_checkout { Link Here
137
	return $self;
140
	return $self;
138
}
141
}
139
142
143
sub fee {
144
    my ($self) = @_;
145
146
    my ($charge) = GetIssuingCharges( $self->{item}->{itemnumber}, $self->{patron}->{ils_id} );
147
148
    if ($charge > 0 ) {
149
        return sprintf( "%.2f", $charge );
150
    }
151
}
152
140
1;
153
1;
141
__END__
154
__END__
(-)a/C4/SIP/Sip/MsgType.pm (-3 / +3 lines)
Lines 511-517 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
514
    my $sc_fee_acknowledged = $fields->{ (FID_FEE_ACK) } eq 'Y';
515
515
516
    if ($no_block eq 'Y') {
516
    if ($no_block eq 'Y') {
517
	# Off-line transactions need to be recorded, but there's
517
	# Off-line transactions need to be recorded, but there's
Lines 525-531 sub handle_checkout { Link Here
525
    } else {
525
    } else {
526
	# Does the transaction date really matter for items that are
526
	# Does the transaction date really matter for items that are
527
	# checkout out while the terminal is online?  I'm guessing 'no'
527
	# checkout out while the terminal is online?  I'm guessing 'no'
528
		$status = $ils->checkout($patron_id, $item_id, $sc_renewal_policy);
528
    $status = $ils->checkout( $patron_id, $item_id, $sc_renewal_policy, $sc_fee_acknowledged );
529
    }
529
    }
530
530
531
    $item = $status->item;
531
    $item = $status->item;
Lines 585-590 sub handle_checkout { Link Here
585
	$resp .= add_field(FID_INST_ID, $inst);
585
	$resp .= add_field(FID_INST_ID, $inst);
586
	$resp .= add_field(FID_PATRON_ID, $patron_id);
586
	$resp .= add_field(FID_PATRON_ID, $patron_id);
587
	$resp .= add_field(FID_ITEM_ID, $item_id);
587
	$resp .= add_field(FID_ITEM_ID, $item_id);
588
  $resp .= maybe_add( FID_FEE_AMT, $status->fee() );
588
589
589
	# If the item is valid, provide the title, otherwise
590
	# If the item is valid, provide the title, otherwise
590
	# leave it blank
591
	# leave it blank
591
- 

Return to bug 12820