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);
}
Index: trunk/kernel/include/parseditem.php
===================================================================
diff -u -r446 -r470
--- trunk/kernel/include/parseditem.php (.../parseditem.php) (revision 446)
+++ trunk/kernel/include/parseditem.php (.../parseditem.php) (revision 470)
@@ -1508,7 +1508,6 @@
function Query_Item($sql,$limit = null, $fix_method = 'set_first')
{
- //echo "two_method
";
// query itemlist (module items) using $sql specified
// apply direct limit clause ($limit) or calculate it if not specified
// fix invalid page in case if needed by method specified in $fix_method
@@ -1522,7 +1521,14 @@
//echo "page fix pre (class: ".get_class($this).")
";
$this->QueryItemCount = QueryCount($sql); // must get total item count before fixing
$this->FixInvalidPage($fix_method);
- return parent::Query_Item($sql,$this->GetPageOffset(),$this->GetPageRowCount());
+
+ // specially made for cats delete
+ if ($_GET['action'] != 'm_cat_delete') {
+ return parent::Query_Item($sql,$this->GetPageOffset(),$this->GetPageRowCount());
+ }
+ else {
+ return parent::Query_Item($sql);
+ }
}
}
Index: trunk/kernel/include/category.php
===================================================================
diff -u -r271 -r470
--- trunk/kernel/include/category.php (.../category.php) (revision 271)
+++ trunk/kernel/include/category.php (.../category.php) (revision 470)
@@ -48,7 +48,7 @@
function Delete()
{
global $CatDeleteList;
-
+
if(!is_array($CatDeleteList))
$CatDeleteList = array();
if($this->UsingTempTable()==FALSE)
@@ -2232,7 +2232,7 @@
{
if($Param == NULL)
{
- $d->$function();
+ $d->$function();
}
else
{
@@ -2241,7 +2241,7 @@
}
else
{
- RunUp($ParentId, $function, $Param);
+ RunUp($ParentId, $function, $Param);
if($Param == NULL)
{
$d->$function();
@@ -2262,7 +2262,6 @@
$adodbConnection = GetADODBConnection();
$sql = "select CategoryId from ".GetTablePrefix()."Category where ParentId='$Id'";
$rs = $adodbConnection->Execute($sql);
- //echo $sql."
\n";
while($rs && !$rs->EOF)
{
Index: trunk/kernel/include/itemdb.php
===================================================================
diff -u -r398 -r470
--- trunk/kernel/include/itemdb.php (.../itemdb.php) (revision 398)
+++ trunk/kernel/include/itemdb.php (.../itemdb.php) (revision 470)
@@ -236,7 +236,7 @@
}
function Delete()
- {
+ {
global $Errors;
if($this->Get($this->IdField())==0)
@@ -245,7 +245,6 @@
return false;
}
-
$sql = sprintf('DELETE FROM %s WHERE %s = %s', $this->tablename, $this->IdField(),
$this->UniqueId());
if($this->debuglevel>0)