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

(-)a/C4/SIP/ILS.pm (-18 / +22 lines)
Lines 172-205 sub checkout { Link Here
172
}
172
}
173
173
174
sub checkin {
174
sub checkin {
175
    my ($self, $item_id, $trans_date, $return_date,
175
    my ( $self, $item_id, $trans_date, $return_date, $current_loc, $item_props, $cancel, $checked_in_ok ) = @_;
176
	$current_loc, $item_props, $cancel) = @_;
176
    my ( $patron, $item, $circ );
177
    my ($patron, $item, $circ);
178
177
179
    $circ = C4::SIP::ILS::Transaction::Checkin->new();
178
    $circ = C4::SIP::ILS::Transaction::Checkin->new();
180
    # BEGIN TRANSACTION
179
    # BEGIN TRANSACTION
181
    $circ->item($item = C4::SIP::ILS::Item->new( $item_id));
180
    $circ->item($item = C4::SIP::ILS::Item->new( $item_id));
182
181
183
    if ($item) {
182
    if ($item) {
184
        $circ->do_checkin($current_loc, $return_date);
183
        $circ->do_checkin( $current_loc, $return_date );
185
    } else {
184
    }
185
    else {
186
        $circ->alert(1);
186
        $circ->alert(1);
187
        $circ->alert_type(99);
187
        $circ->alert_type(99);
188
        $circ->screen_msg('Invalid Item');
188
        $circ->screen_msg('Invalid Item');
189
    }
189
    }
190
	# It's ok to check it in if it exists, and if it was checked out
190
191
	$circ->ok($item && $item->{patron});
191
    # It's ok to check it in if it exists, and if it was checked out
192
192
    # or it was not checked out but the checked_in_ok flag was set
193
	if (!defined($item->{patron})) {
193
    $circ->ok( ( $checked_in_ok && $item ) || ( $item && $item->{patron} ) );
194
		$circ->screen_msg("Item not checked out");
194
195
	} else {
195
    if ( !defined( $item->{patron} ) ) {
196
		if ($circ->ok) {
196
        $circ->screen_msg("Item not checked out") unless $checked_in_ok;
197
			$circ->patron($patron = C4::SIP::ILS::Patron->new( $item->{patron}));
197
    }
198
			delete $item->{patron};
198
    else {
199
			delete $item->{due_date};
199
        if ( $circ->ok ) {
200
			$patron->{items} = [ grep {$_ ne $item_id} @{$patron->{items}} ];
200
            $circ->patron( $patron = new ILS::Patron $item->{patron} );
201
		}
201
            delete $item->{patron};
202
	}
202
            delete $item->{due_date};
203
            $patron->{items} = [ grep { $_ ne $item_id } @{ $patron->{items} } ];
204
        }
205
    }
206
203
    # END TRANSACTION
207
    # END TRANSACTION
204
208
205
    return $circ;
209
    return $circ;
(-)a/C4/SIP/Sip/MsgType.pm (-1 / +1 lines)
Lines 639-645 sub handle_checkin { Link Here
639
        syslog("LOG_WARNING", "received no-block checkin from terminal '%s'", $account->{id});
639
        syslog("LOG_WARNING", "received no-block checkin from terminal '%s'", $account->{id});
640
        $status = $ils->checkin_no_block($item_id, $trans_date, $return_date, $item_props, $cancel);
640
        $status = $ils->checkin_no_block($item_id, $trans_date, $return_date, $item_props, $cancel);
641
    } else {
641
    } else {
642
        $status = $ils->checkin($item_id, $trans_date, $return_date, $my_branch, $item_props, $cancel);
642
        $status = $ils->checkin($item_id, $trans_date, $return_date, $my_branch, $item_props, $cancel, $account->{checked_in_ok});
643
    }
643
    }
644
644
645
    $patron = $status->patron;
645
    $patron = $status->patron;
(-)a/etc/SIPconfig.xml (-2 / +1 lines)
Lines 36-42 Link Here
36
  </listeners>
36
  </listeners>
37
37
38
  <accounts>
38
  <accounts>
39
      <login id="term1"  password="term1" delimiter="|" error-detect="enabled" institution="CPL" encoding="ascii" />
39
      <login id="term1"  password="term1" delimiter="|" error-detect="enabled" institution="CPL" encoding="ascii" checked_in_ok="1" />
40
      <login id="koha"   password="koha"  delimiter="|" error-detect="enabled" institution="kohalibrary" encoding="utf8" />
40
      <login id="koha"   password="koha"  delimiter="|" error-detect="enabled" institution="kohalibrary" encoding="utf8" />
41
      <login id="koha2"  password="koha" institution="kohalibrary2" terminator="CR" />
41
      <login id="koha2"  password="koha" institution="kohalibrary2" terminator="CR" />
42
      <login id="lpl-sc" password="1234" institution="LPL" />
42
      <login id="lpl-sc" password="1234" institution="LPL" />
43
- 

Return to bug 13411