diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 69f1c6df145..58597862f8c 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -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."'"; diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index de3b112e37f..9c77729ac5a 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -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; diff --git a/htdocs/core/tpl/resource_add.tpl.php b/htdocs/core/tpl/resource_add.tpl.php index d16b8b629f8..38733726b85 100644 --- a/htdocs/core/tpl/resource_add.tpl.php +++ b/htdocs/core/tpl/resource_add.tpl.php @@ -14,7 +14,7 @@ $out .= ''; $out .= ''; $out .= ''; $out .= ''; -$out .= ''; +$out .= ''; // Place @@ -37,4 +37,4 @@ $out .= '
'; print $out; -// FIN DU TPL +// END BEGIN TPL RESOURCE_ADD.TPL.PHP diff --git a/htdocs/resource/element_resource.php b/htdocs/resource/element_resource.php index 123673654c9..c7acae78333 100644 --- a/htdocs/resource/element_resource.php +++ b/htdocs/resource/element_resource.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
'; $path = '';