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

(-)a/C4/SIP/ILS.pm (-19 / +24 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 = new ILS::Transaction::Checkin;
178
    $circ = new ILS::Transaction::Checkin;
179
180
    # BEGIN TRANSACTION
180
    # BEGIN TRANSACTION
181
    $circ->item($item = new ILS::Item $item_id);
181
    $circ->item( $item = new ILS::Item $item_id);
182
182
183
    if ($item) {
183
    if ($item) {
184
        $circ->do_checkin($current_loc, $return_date);
184
        $circ->do_checkin( $current_loc, $return_date );
185
    } else {
185
    }
186
    else {
186
        $circ->alert(1);
187
        $circ->alert(1);
187
        $circ->alert_type(99);
188
        $circ->alert_type(99);
188
        $circ->screen_msg('Invalid Item');
189
        $circ->screen_msg('Invalid Item');
189
    }
190
    }
190
	# It's ok to check it in if it exists, and if it was checked out
191
191
	$circ->ok($item && $item->{patron});
192
    # It's ok to check it in if it exists, and if it was checked out
192
193
    # or it was not checked out but the checked_in_ok flag was set
193
	if (!defined($item->{patron})) {
194
    $circ->ok( ( $checked_in_ok && $item ) || ( $item && $item->{patron} ) );
194
		$circ->screen_msg("Item not checked out");
195
195
	} else {
196
    if ( !defined( $item->{patron} ) ) {
196
		if ($circ->ok) {
197
        $circ->screen_msg("Item not checked out") unless $checked_in_ok;
197
			$circ->patron($patron = new ILS::Patron $item->{patron});
198
    }
198
			delete $item->{patron};
199
    else {
199
			delete $item->{due_date};
200
        if ( $circ->ok ) {
200
			$patron->{items} = [ grep {$_ ne $item_id} @{$patron->{items}} ];
201
            $circ->patron( $patron = new ILS::Patron $item->{patron} );
201
		}
202
            delete $item->{patron};
202
	}
203
            delete $item->{due_date};
204
            $patron->{items} = [ grep { $_ ne $item_id } @{ $patron->{items} } ];
205
        }
206
    }
207
203
    # END TRANSACTION
208
    # END TRANSACTION
204
209
205
    return $circ;
210
    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