Problem:
Selected recordset checkboxes ~ if none selected and 'Remove Selected Records' is clicked you get a 'for each error on line 181'
Solution:
To stop this I put in an if statement on the function display() on thre RemoveRelatedRecordForm.php
as follows
function display(){
if ( $this->_toBeRemoved !='' ){ // Added to stop 'for each error on empty result
$this->_build();
$domainTable = $this->_relationship->getDomainTable();
if ( PEAR::isError($domainTable) ){
$domainTable = $this->_relationship->_schema['selected_tables'][0];
}
$domainTable = Dataface_Table::loadTable($domainTable);
$io =& new Dataface_IO($domainTable->tablename);
echo "
Are you sure you want to remove the following records from the relationship '".$this->_relationshipName."'?
";echo "
- ";
- ".$record->getTitle()." \n";
//print_r($this->_toBeRemoved);
foreach ($this->_toBeRemoved as $remKeys){
$keyvals = explode('-', $remKeys);
$query = array();
foreach (array_keys($domainTable->keys()) as $keyname){
$query[$keyname] = array_shift($keyvals);
}
$record = new Dataface_Record($domainTable->tablename, array());
//print_r($query);
$io->read($query, $record);
echo "
unset($record);
}
echo "
// Added to stop 'for each error on empty result
} else {
echo "
No records selected from the relationship '".$this->_relationshipName."'?
";}
parent::display();
}
I hope this helps and if some one could tell me where to go (politely!) I'll go.
Best Regards
Graeme Hird