Consultor Eletrônico



Kbase P13962: Behavior change in SDO between 9.0 and 9.1 to save a record when the CheckModified process occurs.
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   16/10/2008
Status: Unverified

FACT(s) (Environment):

Progress 9.1x

SYMPTOM(s):

More then one client is updating the same record at the same time

Table:
Field(s) have been changed by another user. Your change has been rejected.
Update cancelled.

Can press SmartPanel Save while the record is being modified by another user

After pressing Save again, the new record has been pushed

CAUSE:

Behavior change in SDO between 9.0 and 9.1 to save a record when the
CheckModified process occurs.

FIX:

The next files should be changed:

1. src\adm2\data.i
2. src\adm2\custom\viewercustom.i
3. src\adm2\custom\viewercustom.p

1. In data.i I after statement:
BUFFER-COPY RowObjUpd EXCEPT RowMod ChangedFields TO bRowObjUpd.
I add next code:
       IF lAutoCommit THEN
         DYNAMIC-FUNCTION('setUserProperty':U IN TARGET-PROCEDURE,                   'ADM-FIELDS-CHANGED':U, 'YES':U).

2. In src/adm2/custom/viewercustom.i:
   - uncomment the next statement:
   /* RUN start-super-proc ("adm2/custom/viewercustom.p":U).*/


3. IN src\adm2/custom/viewercustom.p: - I add the folowing new procedure:


/*-------------------------------------------------------------------------------------------------------------------------------*/
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE updateRecord Procedure
PROCEDURE updateRecord :
/*------------------------------------------------------------------------------
Purpose: Super Override
Parameters:
Notes:
------------------------------------------------------------------------------*/
DEFINE VARIABLE hDataSource AS HANDLE NO-UNDO.
DEFINE VARIABLE cObjects AS CHARACTER NO-UNDO.
DEFINE VARIABLE iObject AS INTEGER NO-UNDO.
DEFINE VARIABLE hObject AS HANDLE NO-UNDO.
DEFINE VARIABLE cObjectType AS CHARACTER NO-UNDO.
DEFINE VARIABLE hContainerSource AS HANDLE NO-UNDO.
DEFINE VARIABLE iCurrentPage AS INTEGER NO-UNDO.
DEFINE VARIABLE lChangePage AS LOGICAL NO-UNDO.


/* If a new record is created or deleted, the first Viewer should be shown.
When an update is started, the first viewer must only be shown when a
browser is on the current page
=> Copy of part of cancelRecord */
{get ContainerSource hContainerSource}.
IF VALID-HANDLE(hContainerSource) THEN DO:
{get currentPage iCurrentPage hContainerSource}.
IF iCurrentPage = 1 THEN DO:
{get PageNTarget cObjects hContainerSource}.

ObjFind:
DO iObject = 1 TO NUM-ENTRIES(cObjects):
ASSIGN hObject = WIDGET-HANDLE(ENTRY(1, ENTRY(iObject, cObjects), '|')).
{get ObjectType cObjectType hObject}.
IF cObjectType = "SmartDataViewer" THEN LEAVE ObjFind.
END.

IF INTEGER(ENTRY(2, ENTRY(iObject, cObjects), "|")) <> iCurrentPage THEN
RUN selectPage IN hContainerSource (INTEGER(ENTRY(2, ENTRY(iObject, cObjects), "|"))).
END.
END.
/* => End of copy of part of cancelRecord */

RUN SUPER.
{get DataSource hDataSource}.
IF RETURN-VALUE = 'ADM-ERROR':U THEN
DO:
IF DYNAMIC-FUNCTION('getUserProperty':U IN hDataSource,
'ADM-FIELDS-CHANGED':U) = 'YES':U THEN
DO:
DYNAMIC-FUNCTION('setUserProperty':U IN hDataSource,
'ADM-FIELDS-CHANGED':U, 'NO':U).
RUN displayRecord IN TARGET-PROCEDURE.
END.
END.
/* Code placed here will execute AFTER standard behavior. */

/* Force a disconnect of the AppServer */
/* Workaround for disappearing records */
IF VALID-HANDLE (hDataSource) THEN DO:
RUN destroyServerObject IN hDataSource.
END.

END PROCEDURE.

/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME
/*-------------------------------------------------------------------------------------------------------------------------------*/



The next files should be recompiled:
-  all SDOs
- all SDVs
- viewercustom.p


The procedure viewercustom.p -is running persistent, so if is running already, is better to delete it from the memory or to restart progress session to push progress to use the new version of it.