Skip to content

Commit

Permalink
Merge pull request #1786 from atm-maxime/develop
Browse files Browse the repository at this point in the history
Fix on class not extending commonobject
  • Loading branch information
eldy committed Aug 4, 2014
2 parents 7d3c266 + 94fee7a commit 3024d82
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 4 deletions.
2 changes: 1 addition & 1 deletion htdocs/categories/class/categorie.class.php
Expand Up @@ -87,7 +87,7 @@ function fetch($id,$label='')

else
{
if ($label) $sql.= " WHERE label = '".$this->db->escape($label)."' AND entity=".$conf->entity;;
if ($label) $sql.= " WHERE label = '".$this->db->escape($label)."' AND entity IN (".getEntity('category',1).")";
}

dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
Expand Down
28 changes: 28 additions & 0 deletions htdocs/core/class/commonobjectline.class.php
Expand Up @@ -28,6 +28,34 @@
*/
abstract class CommonObjectLine
{
/**
* Call trigger based on this instance
* NB: Error from trigger are stacked in interface->errors
* NB2: If return code of triggers are < 0, action calling trigger should cancel all transaction.
*
* @param string $trigger_name trigger's name to execute
* @param User $user Object user
* @return int Result of run_triggers
*/
function call_trigger($trigger_name, $user)
{
global $langs,$conf;

include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($this->db);
$result=$interface->run_triggers($trigger_name,$this,$user,$langs,$conf);
if ($result < 0)
{
if (!empty($this->errors))
{
$this->errors=array_merge($this->errors,$interface->errors);
}
else
{
$this->errors=$interface->errors;
}
}
return $result;
}
}

3 changes: 2 additions & 1 deletion htdocs/fichinter/class/fichinter.class.php
Expand Up @@ -24,6 +24,7 @@
* \brief Fichier de la classe des gestion des fiches interventions
*/
require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php';
require_once DOL_DOCUMENT_ROOT .'/core/class/commonobjectline.class.php';


/**
Expand Down Expand Up @@ -998,7 +999,7 @@ function fetch_lines()
/**
* Classe permettant la gestion des lignes d'intervention
*/
class FichinterLigne
class FichinterLigne extends CommonObjectLine
{
var $db;
var $error;
Expand Down
2 changes: 1 addition & 1 deletion htdocs/product/stock/class/mouvementstock.class.php
Expand Up @@ -28,7 +28,7 @@
/**
* Class to manage stock movements
*/
class MouvementStock
class MouvementStock extends CommonObject
{
var $error;
var $db;
Expand Down
2 changes: 1 addition & 1 deletion htdocs/projet/tasks/task.php
Expand Up @@ -116,7 +116,7 @@

if ($object->delete($user) > 0)
{
header("Location: index.php");
header('Location: '.DOL_URL_ROOT.'/projet/tasks.php?id='.$projectstatic->id);
exit;
}
else
Expand Down

0 comments on commit 3024d82

Please sign in to comment.