<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: linjinxiao  
    $Date: 2012-7-4 下午1:29:48  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:s="leaf.plugin.script" xmlns:bm="http://www.leaf-framework.org/schema/bm" alias="t1" defaultOrderBy="report_id desc" extend="psr.PSR1030.psr_task_reports" extendMode="reference">
    <bm:fields>
        <bm:field name="report_id"/>
        <bm:field name="task_id"/>
        <bm:field name="session_id"/>
        <bm:field name="user_id"/>
        <bm:field name="role_id"/>
        <bm:field name="company_id"/>
        <bm:field name="lang"/>
        <bm:field name="file_name"/>
        <bm:field name="file_path"/>
        <bm:field name="request_url"/>
        <bm:field name="creation_date_view" expression="to_char(t1.creation_date, &apos;yyyy-mm-dd hh24:mi:ss&apos;)"/>
    </bm:fields>
    <bm:features>
        <s:bm-script><![CDATA[
            var cx = Packages.leaf.javascript.Context.getCurrentContext();
            Packages.leaf.plugin.script.engine.ScriptImportor.defineExternScript(cx, this, $ctx.getData(), "aut_authority_bm_validate.js");
        ]]></s:bm-script>
    </bm:features>
    <bm:ref-fields>
        <bm:ref-field name="company_short_name" relationName="r_cpy" sourceField="company_code"/>
        <bm:ref-field name="user_description" relationName="r_user" sourceField="description"/>
        <bm:ref-field name="role_name" relationName="r_role" sourceField="role_name"/>
        <bm:ref-field name="task_description" relationName="r_task" sourceField="task_description"/>
        <bm:ref-field name="lang_description" relationName="r_lang" sourceField="description"/>
    </bm:ref-fields>
    <bm:relations>
        <bm:relation name="r_cpy" joinType="LEFT OUTER" refAlias="cpy" refModel="fnd.fnd_companies_vl">
            <bm:reference foreignField="company_id" localField="company_id"/>
        </bm:relation>
        <bm:relation name="r_user" joinType="LEFT OUTER" refAlias="u" refModel="sys.sys_user">
            <bm:reference foreignField="user_id" localField="user_id"/>
        </bm:relation>
        <bm:relation name="r_role" joinType="LEFT OUTER" refAlias="ro" refModel="sys.sys_role_vl">
            <bm:reference foreignField="role_id" localField="role_id"/>
        </bm:relation>
        <bm:relation name="r_task" joinType="LEFT OUTER" refAlias="task" refModel="sys.SYS1070.sys_tasks">
            <bm:reference foreignField="task_id" localField="task_id"/>
        </bm:relation>
        <bm:relation name="r_lang" joinType="LEFT OUTER" refAlias="lang" refModel="sys.sys_languages">
            <bm:reference foreignField="language_code" localField="lang"/>
        </bm:relation>
    </bm:relations>
    <bm:query-fields>
        <bm:query-field name="creation_date_from" queryExpression="t1.creation_date &gt; to_date(${@creation_date_from},&apos;YYYY-MM-DD&apos;)"/>
        <bm:query-field name="creation_date_to" queryExpression="t1.creation_date &lt; to_date(${@creation_date_to},&apos;YYYY-MM-DD&apos;)"/>
        <bm:query-field field="report_id" queryExpression="t1.report_id=${@report_id}"/>
    </bm:query-fields>
</bm:model>
