EAC Implementation

0 downloads 181 Views 2MB Size Report
Jan 27, 2016 - Static: this email contain only a static UI described in VDOM XML, the EAC ...... the content by clicking
EAC Implementation How to use EAC technology

Document version: V 1.0.0 Edition Date : Langue : Origine : Rédigé : Réf : Etat :

27/01/16 EN Création NKY EAC IMP. Applicable

SUBJECT: The goal of this document is to help developer to implement EAC application in ProMail or other VDOM Plateform based.

TABLE: General description .......................................................................................................................................... 3 The User Interface description ...................................................................................................................... 3 The Event system description ....................................................................................................................... 5 Building an EAC Email with its UI .................................................................................................................. 8 EAC Communication from the UI to the BL in the server ..............................................................................11 Build EAC Application in ProShare .................................................................................................................. 22 Build EAC Application in ProShare thanks to Automation Plug-In................................................................... 30 Set the rules on the income folder ...........................................................................................................31 Answer to EAC GET/POST request.......................................................................................................... 34

General description EAC technology is a new paradigm to develop Email based application, the description of its principal is described in the patent: US 14/838,364. EAC means Email Active Content the main idea is to be able to encapsulate in an email a user interface that interact possibly with some business logic provided by the sender. The technology used to run EAC technology are basically the VDOM Plateform Stack as it’s the most adapted one for this purpose now. But any technology that fulfil the requirement of EAC Technology could possibly use. The need is a serializable UI define by any metalanguage, the most obvious is nowadays XML, it also needs to describe the event model of the user interface with an association paradigm like event>actions and finally a transportation communication system that allow to encapsulate the message and provide the necessary information to contact, authenticate, GET and POST height="600" width="600" left="0"> ") else WHOLE_"+"http://"+hosts(0)+""" appID="""+appID+""">") end if WHOLE_"+logincontainer+""" action="""+loginmethod+"""/>") WHOLE_"+getcontainer+""" action="""+getmethod+""">") WHOLE_"+postcontainer+""" action="""+postmethod+""">") WHOLE_ then WHOLE_"+sessionToken+""">") if typename(Events then EAC for i=1 to len(str) v = mid(str,i,1) a = asc(v) if (a>=48 and a=65 and a=95 and a {=c height="650" width="807" left="0">

8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87

{=c top="138" height="2" width="599" color="055475" left="13"> {=c top="7" value="Liste des factures" fontweight="bold" width="166" align="center" left="628"> {Affect("cpt",0)} {EACEvt("FACTURES")} {=csv("FACTURES","map",vdomxml_list,"factureGUID","factureName","societe","numfacture","tva_intra","datefacture", "montantht","montantttc","commentaires","docok")} {=c zindex="10" left="197" top="190" label="OK" type="2"> {=c zindex="0" width="0" left="0"> {=c zindex="2" width="347" left="0"> {=c zindex="0" top="0" left="0" width="0"> {=c visible="0" zindex="10" top="43" height="100" width="416" left="34"> {=c visible="0" zindex="10" top="43" height="100" width="416" left="34"> {=c hint="{factureName}" value="ed9fcbbd-3649-416f-ac73-1f7a14a86f0a" height="96" width="96" left="29" top="{=10+cpt*130}"> {EACEvt("FACTURES","invoicemain.invoicelist.s_img_"+cpt,"click",EACAction("invoicemain.pdfinvoice","setHTML", ""), EACAction("invoicemain.form1.f_datefacture","setValue",datefacture),EACAction("invoicemain.form1.f_numfacture","setValue",numfacture), EACAction("invoicemain.form1.f_montantht","setValue",montantht),EACAction("invoicemain.form1.f_montantttc","setValue",montantttc), EACAction("invoicemain.form1.f_fournisseur","setValue",societe),EACAction("invoicemain.form1.fileGUID","setValue",factureGUID), EACAction("invoicemain.msgintro","hide","0"), EACAction("invoicemain.cmsg",if(commentaires="","hide","show"),"10"))} {EACEvt ("FACTURES","invoicemain.invoicelist.s_img_"+cpt,"click",EACAction("invoicemain.cmsg.boxmsg","setHTML",commentaires))} {Affect("cpt",cpt+1)}

Code 18 : code of the variable vdomxml_list

To handle events on each pictures we generate a name based on the counter cpt, the counter is incremented on line 7 this procedure is the same for all VDOM component of the list. Then we have the Events definition by using the command EACEvt(), this function accepts the following parameters :

   

NAME of EVENT Storage (String) NAME of the VDOM Component (String) NAME of the EVENT to listen (String) LIST of actions to perform (List) : each item are the return of the command EACAction.

The EACAction allows to build the specific string to execute an action, it accepts this parameters :   

NAME of the VDOM Component (String) NAME of the ACTION to do (String) LIST of values for each parameters of the action (List of Value) : The function guess the type of the value & build the appropriate syntax.

The result can be seen on figure 26, the list of invoices is built and when a click is done on one of them all fields are feed with the appropriate value.

Figure 26 : UI after clicking on an Invoice.

Return to the main variable vdomxml_facture the line 77 to 88 build the rest of the events needed for this UI. It’s important to consider the order of the commands, here for example the submit action must be at the end, if not the form submit action will be performed before the other action will be done & the value set in the hidden field will not be set. Finally the line 85 set the name of this event on submit stored in the variable eacaction used in the filter section of the EAC Event here processinvoice.

EAC POST Request As we have already define the initial UI with the GET Request, let’s now process some user interaction with the POST request.

Figure 27 : Sending document As mentioned upper to select the fact it’s a POST Request we need to check the variable “eacaction”. 1 'EAC GET/POST filer 2 Affect("filter",if(eacaction="processinvoice",oui,non)) Code 19 : Select EAC Call

This value is processinvoice as we have seen upper, then if this value is set in the variable eacaction it means it’s a POST request for this specific set of ,"goto ERR","goto PROCESS") :ERR Affect("errcommentv","1") Affect("errmsg","Vous devez sélectionner une facture !") goto("RETURN_XML") :PROCESS if(commentaires"","goto STORE_HISTORY","goto OPERATION") :STORE_HISTORY EcrireDansHistorique(commentaires) :OPERATION if(operation="return","goto NOT_OK","goto NEXT") :NOT_OK CSV("FACTURES","update",fileGUID,"commentaires",commentaires,"docok","N") goto("RETURN_XML") end :NEXT CSV("FACTURES","supprimer",fileGUID) DeplacerVers("../Archive") if(CompterFichiers()=0,"goto DEL_EMAIL","goto RETURN_XML") :DEL_EMAIL SendEACMail("[email protected]","Gestion des factures","delete") EACAnswer(message_fin_traitement) end

35 36 37

:RETURN_XML EACAnswer(vdomxml_facture,"FACTURES") Code 20 : Processing POST Request

All data sent when the form is post are converted into variable in the context of the execution of this commands, so if an invoice is clicked then its GUID is set in the field fileGUID then the test line 6 check if the user clicked on an invoice, if not it goes to line 8 and set the variable to show an error message, to do it we just make the container cmsg visible thanks to the variable errcommentv and display a message stored in the variable errmsg. If the user correctly selects an invoice we then detect line 14 if he let a comment and write it to the history record of the file line 15 that will be seen in ProShare.

Figure 28 : One invoice set at wrong

Figure 29 : Comment shown on a returned invoice

Line 19 we check on what button the user clicked [Valid] or [Return], if he clicked on return we store in the DB the comment and this fact either we delete the record in the DB and mover physically the file form the current folder to the Archive folder. Finally, if there is no more file we send the email to delete this one to delete it.

Figure 30 : Message shown after all invoices processed