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

(-)a/C4/SIP/ILS.pm (-19 / +24 lines)
Lines 175-208 sub checkout { Link Here
175
}
175
}
176
176
177
sub checkin {
177
sub checkin {
178
    my ($self, $item_id, $trans_date, $return_date,
178
    my ( $self, $item_id, $trans_date, $return_date, $current_loc, $item_props, $cancel, $checked_in_ok ) = @_;
179
	$current_loc, $item_props, $cancel) = @_;
179
    my ( $patron, $item, $circ );
180
    my ($patron, $item, $circ);
181
180
182
    $circ = C4::SIP::ILS::Transaction::Checkin->new();
181
    $circ = C4::SIP::ILS::Transaction::Checkin->new();
182
183
    # BEGIN TRANSACTION
183
    # BEGIN TRANSACTION
184
    $circ->item($item = C4::SIP::ILS::Item->new( $item_id));
184
    $circ->item( $item = C4::SIP::ILS::Item->new($item_id) );
185
185
186
    if ($item) {
186
    if ($item) {
187
        $circ->do_checkin($current_loc, $return_date);
187
        $circ->do_checkin( $current_loc, $return_date );
188
    } else {
188
    }
189
    else {
189
        $circ->alert(1);
190
        $circ->alert(1);
190
        $circ->alert_type(99);
191
        $circ->alert_type(99);
191
        $circ->screen_msg('Invalid Item');
192
        $circ->screen_msg('Invalid Item');
192
    }
193
    }
193
	# It's ok to check it in if it exists, and if it was checked out
194
194
	$circ->ok($item && $item->{patron});
195
    # It's ok to check it in if it exists, and if it was checked out
195
196
    # or it was not checked out but the checked_in_ok flag was set
196
	if (!defined($item->{patron})) {
197
    $circ->ok( ( $checked_in_ok && $item ) || ( $item && $item->{patron} ) );
197
		$circ->screen_msg("Item not checked out");
198
198
	} else {
199
    if ( !defined( $item->{patron} ) ) {
199
		if ($circ->ok) {
200
        $circ->screen_msg("Item not checked out") unless $checked_in_ok;
200
			$circ->patron($patron = C4::SIP::ILS::Patron->new( $item->{patron}));
201
    }
201
			delete $item->{patron};
202
    else {
202
			delete $item->{due_date};
203
        if ( $circ->ok ) {
203
			$patron->{items} = [ grep {$_ ne $item_id} @{$patron->{items}} ];
204
            $circ->patron( $patron = C4::SIP::ILS::Patron->new( $item->{patron} ) );
204
		}
205
            delete $item->{patron};
205
	}
206
            delete $item->{due_date};
207
            $patron->{items} = [ grep { $_ ne $item_id } @{ $patron->{items} } ];
208
        }
209
    }
210
206
    # END TRANSACTION
211
    # END TRANSACTION
207
212
208
    return $circ;
213
    return $circ;
(-)a/C4/SIP/Sip/MsgType.pm (-1 / +1 lines)
Lines 643-649 sub handle_checkin { Link Here
643
        syslog("LOG_WARNING", "received no-block checkin from terminal '%s'", $account->{id});
643
        syslog("LOG_WARNING", "received no-block checkin from terminal '%s'", $account->{id});
644
        $status = $ils->checkin_no_block($item_id, $trans_date, $return_date, $item_props, $cancel);
644
        $status = $ils->checkin_no_block($item_id, $trans_date, $return_date, $item_props, $cancel);
645
    } else {
645
    } else {
646
        $status = $ils->checkin($item_id, $trans_date, $return_date, $my_branch, $item_props, $cancel);
646
        $status = $ils->checkin($item_id, $trans_date, $return_date, $my_branch, $item_props, $cancel, $account->{checked_in_ok});
647
    }
647
    }
648
648
649
    $patron = $status->patron;
649
    $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