if( ($found_item_id != $this->GetID()) || $has_page ) // other category has same filename as ours OR we have filename, that ends with _number
{
$append = $found_item_id ? 'a' : '';
if($has_page)
{
$filename = $rets[1].'_'.$rets[2];
$append = $rets[3] ? $rets[3] : 'a';
}
- $sql = 'SELECT '.$this->IDField.' FROM '.$this->TableName.' WHERE (Filename = %s) AND ('.$this->IDField.' != '.$this->GetID().')';
- while ( $this->Conn->GetOne( sprintf($sql, $this->Conn->qstr($filename.$append)) ) > 0 )
+ // check live & temp table
+ $sql_temp = 'SELECT '.$this->IDField.' FROM '.$this->TableName.' WHERE (Filename = %s) AND ('.$this->IDField.' != '.$this->GetID().')';
+ $sql_live = 'SELECT '.$this->IDField.' FROM '.kTempTablesHandler::GetLiveName($this->TableName).' WHERE (Filename = %s) AND ('.$this->IDField.' != '.$this->GetID().')';
+ while ( $this->Conn->GetOne( sprintf($sql_temp, $this->Conn->qstr($filename.$append)) ) > 0 ||
if( ($found_item_id != $this->GetID()) || $has_page ) // other category has same filename as ours OR we have filename, that ends with _number
{
$append = $found_item_id ? 'a' : '';
if($has_page)
{
$filename = $rets[1].'_'.$rets[2];
$append = $rets[3] ? $rets[3] : 'a';
}
- $sql = 'SELECT '.$this->IDField.' FROM '.$this->TableName.' WHERE (Filename = %s) AND ('.$this->IDField.' != '.$this->GetID().')';
- while ( $this->Conn->GetOne( sprintf($sql, $this->Conn->qstr($filename.$append)) ) > 0 )
+ // check live & temp table
+ $sql_temp = 'SELECT '.$this->IDField.' FROM '.$this->TableName.' WHERE (Filename = %s) AND ('.$this->IDField.' != '.$this->GetID().')';
+ $sql_live = 'SELECT '.$this->IDField.' FROM '.kTempTablesHandler::GetLiveName($this->TableName).' WHERE (Filename = %s) AND ('.$this->IDField.' != '.$this->GetID().')';
+ while ( $this->Conn->GetOne( sprintf($sql_temp, $this->Conn->qstr($filename.$append)) ) > 0 ||