Fix : update linked resource

This commit is contained in:
jfefe 2014-05-11 10:19:38 +02:00
parent 872b2c229e
commit 12aafd219d
3 changed files with 8 additions and 8 deletions

View File

@ -49,7 +49,7 @@ if( (array) $linked_resources && count($linked_resources) > 0)
print '<form class="tagtr '.($var==true?'pair':'impair').'" action="'.$_SERVER["PHP_SELF"].'?element='.$element.'&element_id='.$element_id.'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'" />';
print '<input type="hidden" name="id" value="'.$object->id.'" />';
print '<input type="hidden" name="action" value="update_resource" />';
print '<input type="hidden" name="action" value="update_linked_resource" />';
print '<input type="hidden" name="resource_type" value="'.$resource_type.'" />';
print '<input type="hidden" name="lineid" value="'.$linked_resource['rowid'].'" />';

View File

@ -112,16 +112,16 @@ class ActionsResource
}
// Update ressource
if ($action == 'update_resource' && $user->rights->resource->write && !GETPOST('cancel') )
if ($action == 'update_linked_resource' && $user->rights->resource->write && !GETPOST('cancel') )
{
$res = $object->fetch(GETPOST('lineid'));
$res = $object->fetch_element_resource(GETPOST('lineid'));
if($res)
{
$object->id = GETPOST('lineid');
$object->busy = GETPOST('busy');
$object->mandatory = GETPOST('mandatory');
$result = $object->update();
$result = $object->update_element_resource($user);
if ($result >= 0)
{

View File

@ -303,9 +303,9 @@ class Resource extends CommonObject
$this->fk_user_create = $obj->fk_user_create;
if($obj->resource_id && $obj->resource_type)
$this->objresource = $this->fetchObjectByElement($obj->resource_id,$obj->resource_type);
$this->objresource = fetchObjectByElement($obj->resource_id,$obj->resource_type);
if($obj->element_id && $obj->element_type)
$this->objelement = $this->fetchObjectByElement($obj->element_id,$obj->element_type);
$this->objelement = fetchObjectByElement($obj->element_id,$obj->element_type);
}
$this->db->free($resql);