/**
  * @see parent::store
  */
 function store()
 {
     if (!$this->_id) {
         $transf_rule = new CEAITransformationRule();
         $transf_rule->eai_transformation_ruleset_id = $this->eai_transformation_ruleset_id;
         $this->rank = $transf_rule->countMatchingList() + 1;
     }
     return parent::store();
 }
/**
 * Edit transformaiton rule EAI
 *
 * @category EAI
 * @package  Mediboard
 * @author   SARL OpenXtrem <*****@*****.**>
 * @license  GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version  SVN: $Id:$
 * @link     http://www.mediboard.org
 */
CCanDo::checkAdmin();
$transformation_ruleset_id = CValue::getOrSession("transformation_ruleset_id");
$transformation_rule_id = CValue::getOrSession("transformation_rule_id");
$mode_duplication = CValue::getOrSession("mode_duplication", false);
$transf_rule = new CEAITransformationRule();
$transf_rule->load($transformation_rule_id);
if (!$transf_rule->_id) {
    $transf_rule->eai_transformation_ruleset_id = $transformation_ruleset_id;
}
$standards = CInteropNorm::getObjects();
$standards_flat = array();
foreach ($standards as $_standard_name => $_standards) {
    foreach ($_standards as $_domain_name => $_domains) {
        foreach ($_domains as $_profil_name => $_profils) {
            foreach ($_profils as $_transaction_name => $_transactions) {
                foreach ($_transactions as $_event_name => $_event) {
                    $standards_flat[] = array("standard" => $_standard_name, "domain" => $_domain_name, "profil" => $_profil_name, "transaction" => $_transaction_name, "message" => $_event);
                }
            }
        }
<?php

/**
 * View stats transformations for transformation rule
 *
 * @category EAI
 * @package  Mediboard
 * @author   SARL OpenXtrem <*****@*****.**>
 * @license  GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version  SVN: $Id:$
 * @link     http://www.mediboard.org
 */
CCanDo::checkAdmin();
$transformation_rule_id = CValue::getOrSession("transformation_rule_id");
$transf_rule = new CEAITransformationRule();
$transf_rule->load($transformation_rule_id);
foreach ($transf_rule->loadRefsEAITransformation("actor_class ASC, actor_id ASC") as $_transformation) {
    $_transformation->loadRefActor();
}
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("transf_rule", $transf_rule);
$smarty->display("inc_show_stats_transformations.tpl");
 * Link transformations
 *
 * @category EAI
 * @package  Mediboard
 * @author   SARL OpenXtrem <*****@*****.**>
 * @license  GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version  SVN: $Id:$
 * @link     http://www.mediboard.org
 */
CCanDo::checkAdmin();
$actor_guid = CValue::post("actor_guid");
$event_name = CValue::post("event_name");
$transformation_rules = CValue::post("transformation_rules", array());
/** @var CInteropActor $actor */
$actor = CMbObject::loadFromGuid($actor_guid);
$event = new $event_name();
// Ajout des transformations à l'acteur
foreach ($transformation_rules as $_transf_rule_id) {
    $transformation_rule = new CEAITransformationRule();
    $transformation_rule->load($_transf_rule_id);
    $transformation = new CEAITransformation();
    $transformation->bindTransformationRule($transformation_rule, $actor);
    $transformation->message = $event_name;
    if ($msg = $transformation->store()) {
        CAppUI::setMsg($msg, UI_MSG_ERROR);
    } else {
        CAppUI::setMsg("CEAITransformation-msg-modify");
    }
}
echo CAppUI::getMsg();
CApp::rip();
 * @author   SARL OpenXtrem <*****@*****.**>
 * @license  GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version  SVN: $Id:$
 * @link     http://www.mediboard.org
 */
CCanDo::checkAdmin();
$actor_guid = CValue::getOrSession("actor_guid");
$event_class = CValue::getOrSession("event_class");
$message_class = CValue::getOrSession("message_class");
/** @var CInteropActor $actor */
$actor = CMbObject::loadFromGuid($actor_guid);
$event = new $event_class();
/** @var CInteropNorm $message */
$message = new $message_class();
$transformation = new CEAITransformation();
$transformation->actor_id = $actor->_id;
$transformation->actor_class = $actor->_class;
$transformations = $transformation->loadMatchingList();
// On charge la liste des règles possibles en fonction des propriétés de l'évènement
$transf_rule = new CEAITransformationRule();
$transf_rules = array();
if ($where = $transf_rule->bindObject($message, $event)) {
    $transf_rules = $transf_rule->loadList($where, "rank");
}
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("actor", $actor);
$smarty->assign("event", $event);
$smarty->assign("transf_rules", $transf_rules);
$smarty->assign("transformation", $transformation);
$smarty->display("inc_link_transformation_rules.tpl");
/**
 * Duplicate an transformation to another (or the same) category
 *  
 * @category EAI
 * @package  Mediboard
 * @author   SARL OpenXtrem <*****@*****.**>
 * @license  OXOL, see http://www.mediboard.org/public/OXOL
 * @version  SVN: $Id:\$ 
 * @link     http://www.mediboard.org
 */
CCanDo::checkAdmin();
$eai_transformation_rule_id = CValue::post("eai_transformation_rule_id");
$eai_transformation_ruleset_id = CValue::post("eai_transformation_ruleset_id");
$transformation_ruleset_dest_id = CValue::post("transformation_ruleset_dest_id");
$transf_rule = new CEAITransformationRule();
// On duplique toutes les règles de la catégorie
if ($eai_transformation_ruleset_id) {
    $transf_rule->eai_transformation_ruleset_id = $eai_transformation_ruleset_id;
    /** @var $transf_rules CEAITransformationRule[] */
    $transf_rules = $transf_rule->loadMatchingList();
    foreach ($transf_rules as $_transf_rule) {
        $msg = $_transf_rule->duplicate($transformation_ruleset_dest_id);
        CAppUI::displayMsg($msg, "CEAITransformationRule-msg-create");
    }
} else {
    $transf_rule->load($eai_transformation_rule_id);
    $msg = $transf_rule->duplicate($transformation_ruleset_dest_id);
    CAppUI::displayMsg($msg, "CEAITransformationRule-msg-create");
}
CAppUI::js(CValue::post("callback") . "()");
 */
CCanDo::checkAdmin();
$transformation_rule_id_move = CValue::post("transformation_rule_id_move");
$direction = CValue::post("direction");
$transf_rule = new CEAITransformationRule();
$transf_rule->load($transformation_rule_id_move);
switch ($direction) {
    case "up":
        $transf_rule->rank--;
        break;
    case "down":
        $transf_rule->rank++;
        break;
    default:
}
$transf_rule_to_move = new CEAITransformationRule();
$transf_rule_to_move->eai_transformation_ruleset_id = $transf_rule->eai_transformation_ruleset_id;
$transf_rule_to_move->rank = $transf_rule->rank;
$transf_rule_to_move->loadMatchingObject();
if ($transf_rule_to_move->_id) {
    $direction == "up" ? $transf_rule_to_move->rank++ : $transf_rule_to_move->rank--;
    $transf_rule_to_move->store();
}
$transf_rule->store();
/** @var CEAITransformationRuleSet $actor */
$transf_ruleset = new CEAITransformationRuleSet();
$transf_ruleset->load($transf_rule->eai_transformation_ruleset_id);
/** @var CEAITransformationRule[] $transformation_rules */
$transformation_rules = $transf_ruleset->loadBackRefs("eai_transformation_rules", "rank");
$i = 1;
foreach ($transformation_rules as $_trans_rule) {