Index: trunk/kernel/include/item.php
===================================================================
diff -u -r450 -r470
--- trunk/kernel/include/item.php (.../item.php) (revision 450)
+++ trunk/kernel/include/item.php (.../item.php) (revision 470)
@@ -106,11 +106,11 @@
}
function DeleteReviews()
- {
+ {
$res_id = $this->Get("ResourceId");
if($res_id)
{
- $sql = "DELETE FROM ".GetTablePrefix()."ItemReview WHERE ResourceId=$res_id";
+ $sql = "DELETE FROM ".GetTablePrefix()."ItemReview WHERE ItemId=$res_id";
$this->adodbConnection->Execute($sql);
unset($this->Reviews);
$this->Reviews = new clsItemReviewList($res_id);
@@ -185,7 +185,7 @@
function Delete($RecordOnly=FALSE)
{
global $objFavorites;
-
+
if($RecordOnly==FALSE)
{
$this->DeleteReviews();
@@ -224,7 +224,7 @@
}
function DeleteRelations()
- {
+ {
$res_id = $this->Get("ResourceId");
if($res_id)
{
@@ -655,7 +655,7 @@
}
function Delete($RecordOnly=FALSE)
- {
+ {
global $objFavorites;
parent::Delete($RecordOnly);
@@ -800,7 +800,7 @@
global $objSession, $objCatList;
if(strlen($SourceTable)==0)
- $SourceTable = GetTablePrefix()."CategoryItems";
+ $SourceTable = GetTablePrefix()."CategoryItems";
if($this->type>0)
{
@@ -825,49 +825,49 @@
$sql = "UPDATE $SourceTable SET CategoryId=$NewCatId WHERE CategoryId=$OldCatId AND ItemResourceId=".$this->Get("ResourceId");
if($this->debuglevel)
- echo $sql."
\n";
+ echo $sql."
\n";
$this->adodbConnection->Execute($sql);
}
function DeleteCategoryItems($CatId,$SourceTable = "")
- {
+ {
if(strlen($SourceTable)==0)
- $SourceTable = GetTablePrefix()."CategoryItems";
+ $SourceTable = GetTablePrefix()."CategoryItems";
$CatCount = $this->CategoryMemberCount($SourceTable);
if($CatCount>1)
- {
+ {
$this->RemoveFromCategory($CatId,$SourceTable);
$this->ClearCacheData();
}
else
- {
+ {
$this->Delete();
$sql = "DELETE FROM $SourceTable WHERE CategoryId=$CatId AND ItemResourceId=".$this->Get("ResourceId");
if($this->debuglevel)
- echo $sql."
\n";
+ echo $sql."
\n";
$this->adodbConnection->Execute($sql);
}
}
function RemoveFromAllCategories($SourceTable = "")
- {
+ {
if(strlen($SourceTable)==0)
$SourceTable = GetTablePrefix()."CategoryItems";
if($this->type>0)
{
- $sql = "SELECT * FROM $SourceTable WHERE ResourceId=".$this->Get("ResourceId");
+ $sql = "SELECT * FROM $SourceTable WHERE ItemResourceId=".$this->Get("ResourceId");
$rs = $this->adodbConnection->Execute($sql);
while ($rs && !$rs->EOF)
{
$CategoryId = $rs->fields["CategoryId"];
$rs->MoveNext();
}
- $sql = "DELETE FROM $SourceTable WHERE ResourceId=".$this->Get("ResourceId");
+ $sql = "DELETE FROM $SourceTable WHERE ItemResourceId=".$this->Get("ResourceId");
if($this->debuglevel)
- echo $sql."
\n";
+ echo $sql."
\n";
$this->adodbConnection->Execute($sql);
}