diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 05005b8b5bb..ada86667f44 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -716,7 +716,7 @@ class Categorie extends CommonObject } - + // Call trigger $this->linkto=$obj; // Deprecated. Save object we want to link category to into category instance to provide information to trigger $this->context=array('linkto'=>$obj); // Save object we want to link category to into category instance to provide information to trigger diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 922980f62dd..67497b4881b 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -984,9 +984,10 @@ class FormMail extends Form * @param Translate $outputlangs Output lang object * @param int $id Id of template to find, or -1 for first found with lower position, or 0 for first found whatever is position * @param int $active 1=Only active template, 0=Only disabled, -1=All + * @param string $label Label of template * @return array array('topic'=>,'content'=>,..) */ - public function getEMailTemplate($db, $type_template, $user, $outputlangs, $id=0, $active=1) + public function getEMailTemplate($db, $type_template, $user, $outputlangs, $id=0, $active=1, $label='') { $ret=array(); @@ -996,6 +997,7 @@ class FormMail extends Form $sql.= " AND entity IN (".getEntity('c_email_templates').")"; $sql.= " AND (private = 0 OR fk_user = ".$user->id.")"; // Get all public or private owned if ($active >= 0) $sql.=" AND active = ".$active; + if ($label) $sql.=" AND label ='".$this->db->escape($label)."'"; if (is_object($outputlangs)) $sql.= " AND (lang = '".$outputlangs->defaultlang."' OR lang IS NULL OR lang = '')"; if ($id > 0) $sql.= " AND rowid=".$id; if ($id == -1) $sql.= " AND position=0";