/**
* Method override to check-in a record or an array of record
*
* @param mixed $pks The ID of the primary key or an array of IDs
*
* @return integer|boolean Boolean false if there is an error, otherwise the count of records checked in.
*
* @since 1.6
*/
public function checkin($pks = array())
{
$pks = (array) $pks;
$table = $this->getTable();
$count = 0;
if (empty($pks)) {
$pks = array((int) $this->getState($this->getName() . '.id'));
}
$checkedOutField = $table->getColumnAlias('checked_out');
// Check in all items.
foreach ($pks as $pk) {
if ($table->load($pk)) {
if ($table->{$checkedOutField} > 0) {
if (!parent::checkin($pk)) {
return false;
}
$count++;
}
} else {
$this->setError($table->getError());
return false;
}
}
return $count;
}