<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" needAccessControl="false">
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
                SELECT t.file_name,t.file_path
                FROM (SELECT fa.file_name, fa.file_path
                FROM fnd_atm_attachment fa, fnd_atm_attachment_multi m
                WHERE m.attachment_id = fa.attachment_id
                AND fa.source_type_code = 'fnd_atm_attachment_multi'
                AND fa.source_pk_value = m.record_id
                AND m.table_name = 'ACR_INVOICE_HD'
                AND m.table_pk_value = ${@invoice_hd_id}) t
                WHERE rownum = 1
                ]]></bm:query-sql>
        </bm:operation>
        <bm:operation name="update">
            <bm:update-sql><![CDATA[
                begin
                acr_invoice_pkg.send_invoice_mail(
                p_file_name => ${@file_name},
                p_file_path => ${@file_path} ,
                p_file_size => ${@file_size},
                p_user_id   => ${/session/@user_id},
                p_bp_id     => ${@bp_id}
                );
                end;
                ]]></bm:update-sql>
        </bm:operation>
    </bm:operations>
    <bm:fields>
        <bm:field name="file_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="FILE_NAME"/>
        <bm:field name="file_path" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="FILE_PATH"/>
    </bm:fields>
</bm:model>