Fix list of resource not visible
This commit is contained in:
parent
84d4cbdbcc
commit
2abb90713e
@ -3277,12 +3277,12 @@ abstract class CommonObject
|
||||
* Need $this->element & $this->id
|
||||
*
|
||||
* @param int $resource_id Resource id
|
||||
* @param string $resource_element Resource element
|
||||
* @param string $resource_type 'resource'
|
||||
* @param int $busy Busy or not
|
||||
* @param int $mandatory Mandatory or not
|
||||
* @return int <=0 if KO, >0 if OK
|
||||
*/
|
||||
function add_element_resource($resource_id,$resource_element,$busy=0,$mandatory=0)
|
||||
function add_element_resource($resource_id, $resource_type, $busy=0, $mandatory=0)
|
||||
{
|
||||
$this->db->begin();
|
||||
|
||||
@ -3295,7 +3295,7 @@ abstract class CommonObject
|
||||
$sql.= ", mandatory";
|
||||
$sql.= ") VALUES (";
|
||||
$sql.= $resource_id;
|
||||
$sql.= ", '".$resource_element."'";
|
||||
$sql.= ", '".$resource_type."'";
|
||||
$sql.= ", '".$this->id."'";
|
||||
$sql.= ", '".$this->element."'";
|
||||
$sql.= ", '".$busy."'";
|
||||
|
||||
@ -1791,10 +1791,10 @@ function cleanCorruptedTree($db, $tabletocleantree, $fieldfkparent)
|
||||
|
||||
/**
|
||||
* Get an array with properties of an element
|
||||
*
|
||||
* @param string $element_type Element type. ex : project_task or object@modulext or object_under@module
|
||||
* @return array (module, classpath, element, subelement, classfile, classname)
|
||||
*/
|
||||
*
|
||||
* @param string $element_type Element type: 'action', 'facture', 'project_task' or 'object@modulext'...
|
||||
* @return array (module, classpath, element, subelement, classfile, classname)
|
||||
*/
|
||||
function getElementProperties($element_type)
|
||||
{
|
||||
// Parse element/subelement (ex: project_task)
|
||||
@ -1887,15 +1887,15 @@ function getElementProperties($element_type)
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch an object with element_type and its id
|
||||
* Fetch an object from its id and element_type
|
||||
* Inclusion classes is automatic
|
||||
*
|
||||
* @param int $element_id Element id
|
||||
* @param string $element_type Element type
|
||||
* @return object || 0 || -1 if error
|
||||
* @param int $element_id Element id
|
||||
* @param string $element_type Element type
|
||||
* @return int|object object || 0 || -1 if error
|
||||
*/
|
||||
function fetchObjectByElement($element_id,$element_type) {
|
||||
|
||||
function fetchObjectByElement($element_id, $element_type)
|
||||
{
|
||||
global $conf;
|
||||
global $db,$conf;
|
||||
|
||||
|
||||
@ -14,7 +14,7 @@ $out .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$out .= '<input type="hidden" name="action" value="add_element_resource">';
|
||||
$out .= '<input type="hidden" name="element" value="'.$element.'">';
|
||||
$out .= '<input type="hidden" name="element_id" value="'.$element_id.'">';
|
||||
$out .= '<input type="hidden" name="resource_type" value="'.$resource_type.'">';
|
||||
$out .= '<input type="hidden" name="resource_type" value="'.($resource_type?$resource_type:'resource').'">';
|
||||
|
||||
|
||||
// Place
|
||||
@ -37,4 +37,4 @@ $out .= '<br />';
|
||||
|
||||
print $out;
|
||||
|
||||
// FIN DU TPL
|
||||
// END BEGIN TPL RESOURCE_ADD.TPL.PHP
|
||||
|
||||
@ -63,23 +63,23 @@ $id = GETPOST('id','int');
|
||||
$action = GETPOST('action','alpha');
|
||||
$mode = GETPOST('mode','alpha');
|
||||
$lineid = GETPOST('lineid','int');
|
||||
$element = GETPOST('element','alpha');
|
||||
$element = GETPOST('element','alpha'); // element_type
|
||||
$element_id = GETPOST('element_id','int');
|
||||
$resource_id = GETPOST('fk_resource','int');
|
||||
$resource_type = GETPOST('resource_type','alpha');
|
||||
$busy = GETPOST('busy','int');
|
||||
$mandatory = GETPOST('mandatory','int');
|
||||
$cancel = GETPOST('cancel','alpha');
|
||||
$confirm = GETPOST('confirm','alpha');
|
||||
$confirm = GETPOST('confirm','alpha');
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if($action == 'add_element_resource' && ! $cancel)
|
||||
if ($action == 'add_element_resource' && ! $cancel)
|
||||
{
|
||||
$objstat = fetchObjectByElement($element_id,$element);
|
||||
$objstat = fetchObjectByElement($element_id, $element);
|
||||
$res = $objstat->add_element_resource($resource_id,$resource_type,$busy,$mandatory);
|
||||
if($res > 0)
|
||||
{
|
||||
@ -261,9 +261,6 @@ else
|
||||
{
|
||||
$element_prop = getElementProperties($resource_obj);
|
||||
|
||||
|
||||
|
||||
|
||||
//print '/'.$modresources.'/class/'.$resource_obj.'.class.php<br />';
|
||||
|
||||
$path = '';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user