thiagojoseoliveira, this can be done in two ways:
1- Creating a new OP and call it as the orderwf_aprove_console form (need a new spel)
2- Creating a javascript to make the dirty work on the form.
I made this change as follows (can be improved):
Inside the head tag (I put in the end, before </head>) on the detail_cr_wf.htmpl
function z_salvaStatusSolesp()
{
if("$args.KEEP.status_code" =="APR")
{
document.main_form.elements['SET.status'].value='APR';
//if you want just click at the button to approve and save automatically, uncomment the line below and create a new line to put some default comment.
//document.main_form.submit();
}
else if("$args.KEEP.status_code" =="REJ")
document.main_form.elements['SET.status'].value='REJ';
document.main_form.elements['SET.description'].focus();
}
//This define the status on the temporary form
function z_defineStatus(status)
{
var frm = document.forms["zSolespForm"];
frm.elements["KEEP.status_code"].value = status;
document.zSolespForm.submit();
}
Below the line <PDM_INCLUDE FILE=std_body.htmpl [...], create a new form to host temporary values.
<!-- Customizado -->
<PDM_IF "$prop.form_name_3" != "edit">
<FORM NAME="zSolespForm">
<INPUT TYPE=HIDDEN NAME=OP VALUE=UPDATE>
<INPUT TYPE=HIDDEN NAME=FACTORY VALUE=cr_wf>
<INPUT TYPE=HIDDEN NAME=PERSID VALUE="$args.persistent_id">
<INPUT TYPE=HIDDEN NAME=KEEP.aprovado VALUE="1">
<input TYPE=HIDDEN NAME=DESCRIPTION>
<input TYPE=HIDDEN NAME=KEEP.status_code> <!-- This is the most important value -->
<INPUT TYPE=HIDDEN NAME=NEXT_PERSID VALUE="$args.persistent_id">
<INPUT TYPE=HIDDEN NAME=SET.id VALUE="$args.id">
<SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript">
docWriteln('<INPUT TYPE=HIDDEN NAME=SID VALUE='+cfgSID+'>');
docWriteln('<INPUT TYPE=HIDDEN NAME=FID VALUE='+cfgFID+'>');
//document.write("<INPUT TYPE=HIDDEN NAME=KEEP.aprovado VALUE=\"0\">");
</SCRIPT>
</FORM>
</PDM_IF>
Above the line <PDM_FORM NAME="frmDTLRO">, put:
<script type="text/javascript">
<PDM_MACRO name=btnStartRow>
//Customizado - Cria botões
if (allow_wf_edit() && "$args.status.code" != "WAIT" && "$args.status.code" != "REOPWAIT" && cfgMOPreviewMode == 0)
{
var fieldset = "<td>";
if ( _browser.isIe )
fieldset += "<fieldset>";
else
fieldset += "<fieldset class=firefox_fieldset>";
var legend = "Ações";
docWriteln(fieldset + "<legend class=button_legend>" + legend + "</legend>");
<PDM_MACRO name=btnStartRow>
<PDM_MACRO name=button Caption="Aprovar" Func="z_defineStatus('APR');" hotkey_name="APR" ID="APRSOLESP" Tooltip="Aprovar SOLESP">
<PDM_MACRO name=button Caption="Rejeitar" Func="z_defineStatus('REJ');" hotkey_name="REJ" ID="REJSOLESP" Tooltip="Rejeitar SOLESP">
docWriteln("</fieldset></td></tr></table>");
}
</script>
Now, change the body as below
<!-- Customizado -->
<PDM_IF "$args.KEEP.aprovado" == "1" && "$prop.form_name_3" == "edit">
<body class="detailro" onload="z_salvaStatusSolesp()" onunload="unloadActions()">
<PDM_ELSE>
<body class="detailro" onunload="unloadActions()">
</PDM_IF>
The first function define a value to KEEP.status and KEEP.aprovado variables and submit the form, refreshing the form and calling the onload event on body tag which call the another function in which saves the value at the right form.
Good luck!