Skip to content
This repository was archived by the owner on Sep 10, 2021. It is now read-only.

Commit e82bb22

Browse files
committed
BUG: refs #0355. Fix error when directly deleting an item
We could do it when we were removing the item from the folder, or if we were deleting its parent folder altogether, but simply calling the item's deleteAction was throwing an exception.
1 parent 1fc0272 commit e82bb22

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

core/models/base/ItemModelBase.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ public function __construct()
2121
$this->_key = 'item_id';
2222

2323
$this->_mainData = array(
24-
'item_id' => array('type' => MIDAS_DATA),
25-
'name' => array('type' => MIDAS_DATA),
26-
'description' => array('type' => MIDAS_DATA),
24+
'item_id' => array('type' => MIDAS_DATA),
25+
'name' => array('type' => MIDAS_DATA),
26+
'description' => array('type' => MIDAS_DATA),
2727
'type' => array('type' => MIDAS_DATA),
2828
'sizebytes' => array('type' => MIDAS_DATA),
2929
'date_creation' => array('type' => MIDAS_DATA),
@@ -33,10 +33,10 @@ public function __construct()
3333
'download' => array('type' => MIDAS_DATA),
3434
'privacy_status' => array('type' => MIDAS_DATA),
3535
'uuid' => array('type' => MIDAS_DATA),
36-
'folders' => array('type' => MIDAS_MANY_TO_MANY, 'model' => 'Folder', 'table' => 'item2folder', 'parent_column' => 'item_id', 'child_column' => 'folder_id'),
37-
'revisions' => array('type' => MIDAS_ONE_TO_MANY, 'model' => 'ItemRevision', 'parent_column' => 'item_id', 'child_column' => 'item_id'),
38-
'itempolicygroup' => array('type' => MIDAS_ONE_TO_MANY, 'model' => 'Itempolicygroup', 'parent_column' => 'item_id', 'child_column' => 'item_id'),
39-
'itempolicyuser' => array('type' => MIDAS_ONE_TO_MANY, 'model' => 'Itempolicyuser', 'parent_column' => 'item_id', 'child_column' => 'item_id'),
36+
'folders' => array('type' => MIDAS_MANY_TO_MANY, 'model' => 'Folder', 'table' => 'item2folder', 'parent_column' => 'item_id', 'child_column' => 'folder_id'),
37+
'revisions' => array('type' => MIDAS_ONE_TO_MANY, 'model' => 'ItemRevision', 'parent_column' => 'item_id', 'child_column' => 'item_id'),
38+
'itempolicygroup' => array('type' => MIDAS_ONE_TO_MANY, 'model' => 'Itempolicygroup', 'parent_column' => 'item_id', 'child_column' => 'item_id'),
39+
'itempolicyuser' => array('type' => MIDAS_ONE_TO_MANY, 'model' => 'Itempolicyuser', 'parent_column' => 'item_id', 'child_column' => 'item_id'),
4040
);
4141
$this->initialize(); // required
4242
} // end __construct()

core/models/pdo/ItemModel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ function delete($itemdao)
329329
$folders = $itemdao->getFolders();
330330
foreach($folders as $folder)
331331
{
332-
$folder_model->removeItem($folder, $itemdao);
332+
$this->database->removeLink('folders', $itemdao, $folder);
333333
}
334334

335335
$revisions = $itemdao->getRevisions();

0 commit comments

Comments
 (0)