{"id":24937,"date":"2017-11-16T22:46:15","date_gmt":"2017-11-16T21:46:15","guid":{"rendered":"http:\/\/help.qualiware.it\/qw-help\/?p=24937"},"modified":"2017-11-16T23:19:05","modified_gmt":"2017-11-16T22:19:05","slug":"audit-trail-registrazione-automatica-ad-ogni-salvataggio-di-un-form","status":"publish","type":"post","link":"https:\/\/help.qualiware.it\/qw-help\/audit-trail-registrazione-automatica-ad-ogni-salvataggio-di-un-form\/","title":{"rendered":"Audit Trail: registrazione automatica ad ogni salvataggio di un form"},"content":{"rendered":"<p>&nbsp;<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\">' Il seguente snippet pu\u00f2 essere utilizzato per forzare la registrazione di una entry nell'Audit Trail ad ogni salvataggio di un form. Ci\u00f2 pu\u00f2 essere utile per creare automaticamente una copia di backup dei dati.\r\n' NOTA: lo snippet \u00e8 applicabile dalla release 2015.17.2e in poi, e dalla versione 2015.17.2p il pulsante \u201cAUDIT TRAIL\u201d comparire nella toolbar anche per le categorie documentali NON-GMP dove \u00e8 stato fatto uso dell\u2019Audit Trail. \r\n\r\n' **** EVENTOSALVA\r\n' La seguente istruzione va inserita nell'EventoSalva e serve per richiedere la registrazione nell'AuditTrail effettuata all'interno dell'EventoRender\r\nform.findcontrol(\"SALVA\").tag=\"saved\"\r\n'&nbsp;****&nbsp;FINE EVENTOSALVA\r\n\r\n' **** EVENTORENDER\r\n'&nbsp;La&nbsp;seguente&nbsp;istruzione&nbsp;va&nbsp;inserita&nbsp;nell'EventoRender&nbsp;e&nbsp;serve&nbsp;per&nbsp;effettuare la&nbsp;registrazione&nbsp;nell'AuditTrail&nbsp;nel caso sia stato effettuato il salvataggio e questo sia andato a buon fine\r\nif form.findcontrol(\"SALVA\").tag=\"saved\" \r\n   if not form.IsNew()\r\n      dim msg as string\r\n\t  msg=AuditTrail_Save(form.GetSession(),form.form_state.dmd_ref.DOCUMENT.rowset.fields(\"_IDDOC\").value,form.form_state.dmd_ref.DOCUMENT.rowset.fields(\"_CODDOC\").value, Get_Document_Descr(form.GetSession(),form.form_state.dmd_ref.DOCUMENT.rowset.fields(\"_IDDOC\").value,form.form_state.dmd_ref.DOCUMENT.rowset.fields(\"_CODDOC\").value),\"Salvataggio\",form.GetUserCode(),form.GetUserName())\r\n\r\n\t  if msg&lt;&gt;\"\"\r\n\t     form.alert(\"Errore nel salvataggio dei dati nell'Audit Trail: \"+msg)\r\n\t  end if \r\n    end if    \r\n\r\n    form.findcontrol(\"SALVA\").tag=nothing\r\nend if\t\r\n'&nbsp;****&nbsp;EVENTORENDER&nbsp;\r\n\r\n\r\n' Per creare una registrazione iniziale nell'audit trail di tutti i documenti di una categoria utilizzare la query scaricabile da qui: http:\/\/help.qualiware.it\/qw-help\/wp-content\/uploads\/SALVATAGGIO-AUDIT-TRAIL-CATEGORIA-DOCUMENTALE.zip\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; &#8216; Il seguente snippet pu\u00f2 essere utilizzato per forzare la registrazione di una entry nell&#8217;Audit Trail ad ogni salvataggio di un form. Ci\u00f2 pu\u00f2 essere utile per creare automaticamente una copia di backup dei dati. &#8216; NOTA: lo snippet \u00e8 applicabile dalla release 2015.17.2e in poi, e dalla versione 2015.17.2p il pulsante \u201cAUDIT TRAIL\u201d&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"ngg_post_thumbnail":0,"footnotes":""},"categories":[65],"tags":[71],"acf":[],"_links":{"self":[{"href":"https:\/\/help.qualiware.it\/qw-help\/wp-json\/wp\/v2\/posts\/24937"}],"collection":[{"href":"https:\/\/help.qualiware.it\/qw-help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/help.qualiware.it\/qw-help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/help.qualiware.it\/qw-help\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/help.qualiware.it\/qw-help\/wp-json\/wp\/v2\/comments?post=24937"}],"version-history":[{"count":0,"href":"https:\/\/help.qualiware.it\/qw-help\/wp-json\/wp\/v2\/posts\/24937\/revisions"}],"wp:attachment":[{"href":"https:\/\/help.qualiware.it\/qw-help\/wp-json\/wp\/v2\/media?parent=24937"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/help.qualiware.it\/qw-help\/wp-json\/wp\/v2\/categories?post=24937"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/help.qualiware.it\/qw-help\/wp-json\/wp\/v2\/tags?post=24937"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}