User Tools

Site Tools


en:wiki:2.-desarrollo-app:2.3.-codigo:c.-eventos:4.-before-edit:start

BEFORE-EDIT Node


Here you can put each and every one of the actions that have been explained in the share section.

Its scope is at the level of coll , like the rest of events.


This event is executed when someone edits an object, it must be edited by the user of the application, that is, if an object is edited by code, script, this node is not executed, it is a user event.


We give the value 0 to the flag “MAP_BANDERA” and we check if there are receipts, giving error message if there were.

<before-edit>
<action name="runscript">
	<include file="todo1_recibos.vbs"/>					
	<script language="VBScript">			
		This("MAP_BANDERA")=0
		CheckRecibosPendientes
		If This("MAP_NOPAGA")=1 Then
			AppData.FailWithMessage -8100,"El Cliente tiene recibos pendientes."
		End If													
	</script>				
</action>
</before-edit>



Script execution. In this example it is searched if there are calls for a client in a certain date.

<action name="runscript">
	<script language="VBScript">
		dim c
		set c=appdata.GetCollection("Llamadas")
		c.filter="IDCLIENTE=" + CSTR(this("ID")) + " AND FEMISION&gt;='" + cstr(This("FEMAIL")) + "'"
		c.Startbrowse
 
		//En caso de que haya, se rellenará la bandera "MAP_LLAMADAS"
		if not c.currentItem is nothing then
			this("MAP_LLAMADAS")=1
		end if
		c.EndBrowse
	</script>
</action>		


The “user is checked” to assign the corresponding permissions.

<action name="runscript">
	<script language="VBScript">
		if this("TRIDUSUARIO")&lt;&gt;AppData.CurrentUser("ROWID") then
			this("MAP_DISABLE")=1
		else
			if this("ESTADO")="3" then
				this("MAP_DISABLE")=0
			else
				if this("ACTUALIZADO")=1 then
					this("MAP_DISABLE")=1
				else
					this("MAP_DISABLE")=0
				end if
			end if
		end if
	</script>
</action>


Confirmation screen is launched.

<script language="VBScript">
	if This("IDSPGMCIERRE") =0 then
		ok=AppData.UserInterface.MsgBox ("¿Continuará con la resolución de la avería?","ATENCION!",4)
		If ok=6 Then
			' ha dicho si
			This("MAP_INDTERMINA")=0
		else
			' ha dicho no
		    	This("MAP_INDTERMINA")=1
		end if
	end if
</script>
en/wiki/2.-desarrollo-app/2.3.-codigo/c.-eventos/4.-before-edit/start.txt · Last modified: 2017/11/28 13:55 by patricia