* [bug #56744] fix restore related object now work on expected on delete doc.
This commit is contained in:
@@ -1448,8 +1448,9 @@ class actionModel extends model
|
||||
$action = $this->getById($actionID);
|
||||
if(!$action || $action->action != 'deleted') return false;
|
||||
|
||||
list($table, $orderby, $field) = $this->actionTao->getUndeleteParamsByObjectType($action->objectType);
|
||||
$object = $this->actionTao->getObjectBaseInfo($table, array('id' => $action->objectID), $field, $orderby);
|
||||
list($table, $orderby, $field, $queryKey) = $this->actionTao->getUndeleteParamsByObjectType($action->objectType);
|
||||
if(empty($queryKey)) $queryKey = 'id';
|
||||
$object = $this->actionTao->getObjectBaseInfo($table, array($queryKey => $action->objectID), $field, $orderby);
|
||||
if(empty($object)) return false;
|
||||
|
||||
$result = $this->checkActionCanUndelete($action, $object);
|
||||
|
||||
@@ -983,9 +983,10 @@ class actionTao extends actionModel
|
||||
*/
|
||||
public function getUndeleteParamsByObjectType(string $objectType): array
|
||||
{
|
||||
$table = $this->config->objectTables[$objectType];
|
||||
$orderby = '';
|
||||
$field = '*';
|
||||
$table = $this->config->objectTables[$objectType];
|
||||
$orderby = '';
|
||||
$field = '*';
|
||||
$queryKey = 'id';
|
||||
switch($objectType)
|
||||
{
|
||||
case 'product':
|
||||
@@ -996,11 +997,12 @@ class actionTao extends actionModel
|
||||
$field = 'id, acl, name, hasProduct';
|
||||
break;
|
||||
case 'doc':
|
||||
$table = TABLE_DOCCONTENT;
|
||||
$orderby = 'version desc';
|
||||
$table = TABLE_DOCCONTENT;
|
||||
$orderby = 'version desc';
|
||||
$queryKey = 'doc';
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return array($table, $orderby, $field);
|
||||
}
|
||||
return array($table, $orderby, $field, $queryKey);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user