diff --git a/Auditoria_checklist/forms/40213 - checklist/.metadata b/Auditoria_checklist/forms/40213 - checklist/.metadata index f6e09b6..06b0502 100644 Binary files a/Auditoria_checklist/forms/40213 - checklist/.metadata and b/Auditoria_checklist/forms/40213 - checklist/.metadata differ diff --git a/Auditoria_checklist/forms/40213 - checklist/assets/js/fluigFormAttachment.js b/Auditoria_checklist/forms/40213 - checklist/assets/js/fluigFormAttachment.js index a4763ce..d5cc6dc 100644 --- a/Auditoria_checklist/forms/40213 - checklist/assets/js/fluigFormAttachment.js +++ b/Auditoria_checklist/forms/40213 - checklist/assets/js/fluigFormAttachment.js @@ -195,11 +195,20 @@ #canDisplayActionButton() { const element = this.#input.get(0); + const hasEditPermission = parent.ECM.workflowView.userPermissions.indexOf("P") >= 0; + const isManagerMode = location.href.includes('ManagerMode'); + const isTokenView = location.href.includes('token'); + const hasMobileCameraBridge = ( + (window.JSInterface && typeof window.JSInterface.showCamera === "function") + || (parent && parent.JSInterface && typeof parent.JSInterface.showCamera === "function") + ); + const isMobileUA = /android|iphone|ipad|ipod|mobile/i.test(navigator.userAgent || ""); + const allowByContext = (isManagerMode && !isTokenView) || hasMobileCameraBridge || isMobileUA; + const allowByPermission = hasEditPermission || hasMobileCameraBridge || isMobileUA; return this.#settings.showActionButton - && parent.ECM.workflowView.userPermissions.indexOf("P") >= 0 - && location.href.includes('ManagerMode') - && !location.href.includes('token') + && allowByPermission + && allowByContext && element.nodeName.toLowerCase() === "input" && !element.disabled ; diff --git a/Lançamento de documentos/.gitignore b/Lançamento de documentos/.gitignore new file mode 100644 index 0000000..e10e727 --- /dev/null +++ b/Lançamento de documentos/.gitignore @@ -0,0 +1 @@ +/.metadata/ diff --git a/Lançamento de documentos/.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi b/Lançamento de documentos/.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi index c997dc3..1899e3e 100644 --- a/Lançamento de documentos/.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi +++ b/Lançamento de documentos/.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi @@ -1,16 +1,16 @@ - - + + activeSchemeId:org.eclipse.ui.defaultAcceleratorConfiguration ModelMigrationProcessor.001 - + topLevel - - - + + + persp.actionSet:org.eclipse.mylyn.doc.actionSet persp.actionSet:org.eclipse.mylyn.tasks.ui.navigation @@ -70,85 +70,85 @@ persp.showIn:org.eclipse.eclemma.ui.CoverageView persp.newWizSC:org.eclipse.jpt.jpa.ui.wizard.newJpaProject persp.perspSC:org.eclipse.jpt.ui.jpaPerspective - - - + + + View categoryTag:General - + View categoryTag:General - + View categoryTag:Java - + View categoryTag:Java Browsing - - - - - + + + + + View categoryTag:General - + View categoryTag:Mylyn - + View categoryTag:General - - + + View categoryTag:General - + View categoryTag:General - + View categoryTag:Server - + View categoryTag:Data Management - + View categoryTag:General - + View categoryTag:General - + View categoryTag:General - + View categoryTag:General - + View categoryTag:General - + View categoryTag:General - + View categoryTag:General @@ -156,7 +156,7 @@ - + persp.actionSet:org.eclipse.mylyn.doc.actionSet persp.actionSet:org.eclipse.mylyn.tasks.ui.navigation @@ -188,55 +188,55 @@ persp.newWizSC:com.fluig.wcm.eclipse.component.wizard.CreateLayoutWizardID persp.newWizSC:com.fluig.wcm.eclipse.component.wizard.CreateWidgetWizardID persp.showIn:org.eclipse.tm.terminal.view.ui.TerminalsView - - - - + + + + active + noFocus + View categoryTag:Java - + View categoryTag:General - + View categoryTag:Fluig - - + + View categoryTag:General - - - - active - noFocus - + + + + View categoryTag:General - + View categoryTag:General - + View categoryTag:General - + View categoryTag:Fluig - + View categoryTag:Fluig - + View categoryTag:Fluig @@ -245,3042 +245,3063 @@ - - + + View categoryTag:Help - + View categoryTag:General - + View categoryTag:Help - + View categoryTag:Help - + View categoryTag:General - + ViewMenu menuContribution:menu - + - + View categoryTag:Help - - + + org.eclipse.e4.primaryDataStack EditorStack - + Editor removeOnHide com.totvs.tds.ecm.designer.bpmneditor + + + Editor + removeOnHide + org.eclipse.wst.jsdt.ui.CompilationUnitEditor + + + + Editor + removeOnHide + org.eclipse.wst.jsdt.ui.CompilationUnitEditor + - + View categoryTag:General - + ViewMenu menuContribution:menu - + - + View categoryTag:General - + View categoryTag:Java - + View categoryTag:Java Browsing - + View categoryTag:General - + ViewMenu menuContribution:menu - + - + View categoryTag:General - active - + ViewMenu menuContribution:menu - + - + View categoryTag:Server - + View categoryTag:Data Management - + View categoryTag:General - + View categoryTag:General - + View categoryTag:General - + View categoryTag:General - + View categoryTag:General - + View categoryTag:General - + View categoryTag:General - + View categoryTag:General - + ViewMenu menuContribution:menu - + - + View categoryTag:Mylyn - + ViewMenu menuContribution:menu - + - + View categoryTag:General - + View categoryTag:Java - + active + ViewMenu menuContribution:menu - + - + View categoryTag:Fluig - + ViewMenu menuContribution:menu - + - + View categoryTag:General - + ViewMenu menuContribution:menu - + - + + View categoryTag:Fluig + + ViewMenu + menuContribution:menu + + - + View categoryTag:Fluig - + View categoryTag:Fluig - - + + toolbarSeparator - + - + Draggable - + - + toolbarSeparator - + - + Draggable - + toolbarSeparator - + - + Draggable - + Draggable - + Draggable - + Draggable - + Draggable - + Draggable - + toolbarSeparator - + - + Draggable - + - + Draggable - + + Draggable + + toolbarSeparator - + - + toolbarSeparator - + - + Draggable - + stretch SHOW_RESTORE_MENU - + Draggable HIDEABLE SHOW_RESTORE_MENU - - + + stretch - + Draggable - + Draggable - + Draggable - - + + TrimStack Draggable - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - + + + + + + + - - + + - - - - - - - + + + + + + + - - - - + + + + - - - + + + - - - - - + + + + + - - + + - - + + - - - + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - + + - - + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - + + + + - - - + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - + + + - - - - - - - - - - + + + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + - - + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + platform:win32 - - - - - - - - - + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + - - - - - - - + + + + + + + - - - - + + + + - - + + - - - - + + + + - - - - - - - - + + + + + + + + - - + + - - - - - - + + + + + + - - - + + + - - - + + + - - - - - - + + + + + + - - - - - - - - - + + + + + + + + + - - + + - - - - + + + + - - - - + + + + - - + + - - - - + + + + - - + + - - + + platform:win32 - - + + - - + + - - - - - - - + + + + + + + - - - + + + - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + - - + + - - - - - - - - - - - + + + + + + + + + + + - - - - - - + + + + + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Editor removeOnHide - + View categoryTag:Ant - + View categoryTag:Gradle - + View categoryTag:Gradle - + View categoryTag:Data Management - + View categoryTag:Data Management - + View categoryTag:Data Management - + View categoryTag:Debug - + View categoryTag:Debug - + View categoryTag:Debug - + View categoryTag:Debug - + View categoryTag:Debug - + View categoryTag:Debug - + View categoryTag:Debug - + View categoryTag:Java - + View categoryTag:Git - + View categoryTag:Git - + View categoryTag:Git - + View categoryTag:Git NoRestore - + View categoryTag:Git - + View categoryTag:General - + View categoryTag:Help - + View categoryTag:Debug - + View categoryTag:Java - + View categoryTag:Java - + View categoryTag:Java - + View categoryTag:Java Browsing - + View categoryTag:Java Browsing - + View categoryTag:Java Browsing - + View categoryTag:Java Browsing - + View categoryTag:Java - + View categoryTag:General - + View categoryTag:Java - + View categoryTag:Java - + View categoryTag:JPA - + View categoryTag:JPA - + View categoryTag:JavaServer Faces - + View categoryTag:JavaServer Faces - + View categoryTag:Web Services - + View categoryTag:Maven - + View categoryTag:Maven - + View categoryTag:Mylyn - + View categoryTag:Mylyn - + View categoryTag:Mylyn - + View categoryTag:Oomph - + View categoryTag:API Tools - + View categoryTag:Plug-in Development - + View categoryTag:Plug-in Development - + View categoryTag:Plug-in Development - + View categoryTag:Plug-in Development - + View categoryTag:Plug-in Development - + View categoryTag:Plug-in Development - + View categoryTag:Remote Systems - + View categoryTag:Remote Systems - + View categoryTag:Remote Systems - + View categoryTag:Remote Systems - + View categoryTag:Remote Systems - + View categoryTag:Remote Systems - + View categoryTag:General - + View categoryTag:General - + View categoryTag:Team - + View categoryTag:Team - + View categoryTag:Help - + View categoryTag:Terminal - + View categoryTag:Other - + View categoryTag:General - + View categoryTag:General - + View categoryTag:Help - + View categoryTag:General - + View categoryTag:General - + View categoryTag:General - + View categoryTag:General - + View categoryTag:General - + View categoryTag:General - + View categoryTag:General - + View categoryTag:General - + View categoryTag:General - + View categoryTag:General - + View categoryTag:General - + View categoryTag:General - + View categoryTag:General - + View categoryTag:Debug - + View categoryTag:JavaScript - + View categoryTag:JavaScript - + View categoryTag:JavaScript - + View categoryTag:JavaScript - + View categoryTag:JavaScript - + View categoryTag:Server - + View categoryTag:XML - + View categoryTag:XML - + View categoryTag:XML - + View categoryTag:XML - + View categoryTag:XML - + View categoryTag:Fluig - + View categoryTag:Fluig - + View categoryTag:Fluig - + View categoryTag:Fluig - + View categoryTag:Fluig - + View categoryTag:General - - + + glue move_after:PerspectiveSpacer SHOW_RESTORE_MENU - + move_after:Spacer Glue HIDEABLE SHOW_RESTORE_MENU - + glue move_after:SearchField SHOW_RESTORE_MENU - - - - - + + + + + - - - - - - - - - - + + + + + + + + + + - - - - - - + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - + + + + + + + + - - - - - - - + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + - - - - - - - + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + - - - + + + - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - + + + + + + + + - - - - - - + + + + + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - + + + + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Lançamento de documentos/.vscode/launch.json b/Lançamento de documentos/.vscode/launch.json new file mode 100644 index 0000000..104d190 --- /dev/null +++ b/Lançamento de documentos/.vscode/launch.json @@ -0,0 +1,18 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "type": "totvs_language_debug", + "request": "launch", + "name": "TOTVS Language Debug", + "program": "${command:AskForProgramName}", + "cwb": "${workspaceFolder}", + "smartclientBin": "../totvs/bin/smartclient/smartclient.exe", + "isMultiSession": true, + "enableTableSync": true, + "extendFeatures": { + "charDetails": false + } + } + ] +} \ No newline at end of file diff --git a/Lançamento de documentos/.vscode/servers.json b/Lançamento de documentos/.vscode/servers.json new file mode 100644 index 0000000..9854b91 --- /dev/null +++ b/Lançamento de documentos/.vscode/servers.json @@ -0,0 +1,17 @@ +{ + "version": "1.0.0", + "configurations": [ + { + "id": "cafi5jey9zammnjzp2n5z2h8lutld7", + "name": "Fluig produção", + "host": "comerciode188006.fluig.cloudtotvs.com.br", + "ssl": true, + "port": 443, + "username": "andrey.cunha", + "password": "eyJpdiI6ImQwNjBhYWU1NzM3ZjVhNzU0ZWExOWYwZGZiNDEzNWI3Iiwic2FsdCI6IjQ0NmVjYTQ4OTY3ZWViOTc3NmRjY2E4M2UyYzc2NGViIiwidGV4dCI6ImNmZWRiYzFlODFjY2EwOTUzOWZlMGVlMTMzZWIwNzA0In0=", + "userCode": "andrey.cunha", + "confirmExporting": false, + "companyId": 1 + } + ] +} \ No newline at end of file diff --git a/Lançamento de documentos/lançamentos/.project b/Lançamento de documentos/lançamentos/.project new file mode 100644 index 0000000..3046dc0 --- /dev/null +++ b/Lançamento de documentos/lançamentos/.project @@ -0,0 +1,18 @@ + + + lançamentos + + + + + + org.eclipse.wst.validation.validationbuilder + + + + + + org.eclipse.wst.jsdt.core.jsNature + com.totvs.tds.ecm.designer.nature + + diff --git a/Lançamento de documentos/lançamentos/.settings/org.eclipse.core.resources.prefs b/Lançamento de documentos/lançamentos/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..3a52e2d --- /dev/null +++ b/Lançamento de documentos/lançamentos/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,13 @@ +eclipse.preferences.version=1 +encoding//wcm/widget/portalfornecedor/src/main/resources/application.info=utf8 +encoding//wcm/widget/portalfornecedor/src/main/resources/edit.ftl=utf8 +encoding//wcm/widget/portalfornecedor/src/main/resources/portalfornecedor.properties=utf8 +encoding//wcm/widget/portalfornecedor/src/main/resources/portalfornecedor_en_US.properties=utf8 +encoding//wcm/widget/portalfornecedor/src/main/resources/portalfornecedor_es.properties=utf8 +encoding//wcm/widget/portalfornecedor/src/main/resources/portalfornecedor_pt_BR.properties=utf8 +encoding//wcm/widget/portalfornecedor/src/main/resources/view.ftl=utf8 +encoding//wcm/widget/portalfornecedor/src/main/webapp/WEB-INF/jboss-web.xml=utf8 +encoding//wcm/widget/portalfornecedor/src/main/webapp/WEB-INF/web.xml=utf8 +encoding//wcm/widget/portalfornecedor/src/main/webapp/resources/css/portalfornecedor.css=utf8 +encoding//wcm/widget/portalfornecedor/src/main/webapp/resources/images/icon.png=utf8 +encoding//wcm/widget/portalfornecedor/src/main/webapp/resources/js/portalfornecedor.js=utf8 diff --git a/Lançamento de documentos/lançamentos/datasets/dsPortalFornecedorNF.js b/Lançamento de documentos/lançamentos/datasets/dsPortalFornecedorNF.js new file mode 100644 index 0000000..407dd52 --- /dev/null +++ b/Lançamento de documentos/lançamentos/datasets/dsPortalFornecedorNF.js @@ -0,0 +1,42 @@ +function createDataset(fields, constraints, sortFields) { + var dataset = DatasetBuilder.newDataset(); + dataset.addColumn("STATUS"); + dataset.addColumn("CAMPO"); + dataset.addColumn("VALOR"); + + try { + dataset.addRow(["DEBUG", "__version__", "dsPortalFornecedorNF_debug_2026_03_12"]); + + if (!constraints || constraints.length === 0) { + dataset.addRow(["DEBUG", "__constraints__", "vazio"]); + return dataset; + } + + for (var i = 0; i < constraints.length; i++) { + var c = constraints[i]; + var fieldName = getFieldNameSafe(c); + var initialValue = getInitialValueSafe(c); + dataset.addRow(["DEBUG", fieldName, initialValue]); + } + + return dataset; + } catch (e) { + var erro = (e && e.message) ? e.message : ("" + e); + dataset.addRow(["ERRO", "__exception__", erro]); + return dataset; + } +} + +function getFieldNameSafe(c) { + if (!c) return ""; + if (typeof c.getFieldName === "function") return (c.getFieldName() || "") + ""; + if (c.fieldName !== undefined && c.fieldName !== null) return (c.fieldName || "") + ""; + return ""; +} + +function getInitialValueSafe(c) { + if (!c) return ""; + if (typeof c.getInitialValue === "function") return (c.getInitialValue() || "") + ""; + if (c.initialValue !== undefined && c.initialValue !== null) return (c.initialValue || "") + ""; + return ""; +} diff --git a/Lançamento de documentos/lançamentos/forms/41254 - totvsflow_lancamento_documento/.metadata b/Lançamento de documentos/lançamentos/forms/41254 - totvsflow_lancamento_documento/.metadata new file mode 100644 index 0000000..9eca6c2 Binary files /dev/null and b/Lançamento de documentos/lançamentos/forms/41254 - totvsflow_lancamento_documento/.metadata differ diff --git a/Lançamento de documentos/lançamentos/forms/41254 - totvsflow_lancamento_documento/totvsflow_lancamento_documento.html b/Lançamento de documentos/lançamentos/forms/41254 - totvsflow_lancamento_documento/totvsflow_lancamento_documento.html new file mode 100644 index 0000000..701035a --- /dev/null +++ b/Lançamento de documentos/lançamentos/forms/41254 - totvsflow_lancamento_documento/totvsflow_lancamento_documento.html @@ -0,0 +1,1271 @@ + + + + + + + + + + + + + + + + + + +
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
+ +

Lançamento de documento

+ +
+ +
+ +
+
+

+  Dados do documento  +

+
Dados referentes ao documento que será lançado.
+
+
+ + +
+
+
+
+ + +
+
+ + + +
+ +
+ + * + + +
+
+ + +
+
+
+

+
+
+
+
+ * + + +
+
+ * + + + +

+ +
+ +
+ + +
+
+
+

+ +
+
+
+
+ * + + + +
+
+ +
+ R$ + +
+
+

+
+
+
+
+
+
+ + * + +

Utilize a aba anexos para anexar o documento ou o botão + abaixo. Anexo obrigatório.

+ +
+
+
+

+ +
+ +

 Descrição dos serviços +   +

+
Descrição detalhada dos serviços prestados e as possíveis informações complementares.
+
+
+
+
+
+ * + + +
+
+
+
+ + + + + + +
+ + + + +
+
+ +
Todos os campos com * são de preenchimento obrigatório.
+ + +
+
+
+ + + + + + diff --git a/Lançamento de documentos/lançamentos/wcm/widget/portalfornecedor/src/main/resources/application.info b/Lançamento de documentos/lançamentos/wcm/widget/portalfornecedor/src/main/resources/application.info new file mode 100644 index 0000000..5259ff2 --- /dev/null +++ b/Lançamento de documentos/lançamentos/wcm/widget/portalfornecedor/src/main/resources/application.info @@ -0,0 +1,19 @@ +application.type=widget +application.code=portalfornecedor +application.title=portalfornecedor +application.description=portalfornecedor +application.fluig.version=null +application.category=SYSTEM +application.renderer=freemarker +developer.code=DESKTOP-0E2LAA6 +developer.name=Home +developer.url=http://www.fluig.com +application.uiwidget=true +application.mobileapp=false +application.version=${build.version}-${build.revision} +view.file=view.ftl +edit.file=edit.ftl +locale.file.base.name=portalfornecedor +application.resource.js.1=/resources/js/portalfornecedor.js +application.resource.css.2=/resources/css/portalfornecedor.css +hash=4a16315e9e66fa7d797b3f6b1fb365b69f9a4ce2 diff --git a/Lançamento de documentos/lançamentos/wcm/widget/portalfornecedor/src/main/resources/edit.ftl b/Lançamento de documentos/lançamentos/wcm/widget/portalfornecedor/src/main/resources/edit.ftl new file mode 100644 index 0000000..986d9b5 --- /dev/null +++ b/Lançamento de documentos/lançamentos/wcm/widget/portalfornecedor/src/main/resources/edit.ftl @@ -0,0 +1,5 @@ +
+ +
+ + diff --git a/Lançamento de documentos/lançamentos/wcm/widget/portalfornecedor/src/main/resources/portalfornecedor.properties b/Lançamento de documentos/lançamentos/wcm/widget/portalfornecedor/src/main/resources/portalfornecedor.properties new file mode 100644 index 0000000..139597f --- /dev/null +++ b/Lançamento de documentos/lançamentos/wcm/widget/portalfornecedor/src/main/resources/portalfornecedor.properties @@ -0,0 +1,2 @@ + + diff --git a/Lançamento de documentos/lançamentos/wcm/widget/portalfornecedor/src/main/resources/portalfornecedor_en_US.properties b/Lançamento de documentos/lançamentos/wcm/widget/portalfornecedor/src/main/resources/portalfornecedor_en_US.properties new file mode 100644 index 0000000..139597f --- /dev/null +++ b/Lançamento de documentos/lançamentos/wcm/widget/portalfornecedor/src/main/resources/portalfornecedor_en_US.properties @@ -0,0 +1,2 @@ + + diff --git a/Lançamento de documentos/lançamentos/wcm/widget/portalfornecedor/src/main/resources/portalfornecedor_es.properties b/Lançamento de documentos/lançamentos/wcm/widget/portalfornecedor/src/main/resources/portalfornecedor_es.properties new file mode 100644 index 0000000..139597f --- /dev/null +++ b/Lançamento de documentos/lançamentos/wcm/widget/portalfornecedor/src/main/resources/portalfornecedor_es.properties @@ -0,0 +1,2 @@ + + diff --git a/Lançamento de documentos/lançamentos/wcm/widget/portalfornecedor/src/main/resources/portalfornecedor_pt_BR.properties b/Lançamento de documentos/lançamentos/wcm/widget/portalfornecedor/src/main/resources/portalfornecedor_pt_BR.properties new file mode 100644 index 0000000..139597f --- /dev/null +++ b/Lançamento de documentos/lançamentos/wcm/widget/portalfornecedor/src/main/resources/portalfornecedor_pt_BR.properties @@ -0,0 +1,2 @@ + + diff --git a/Lançamento de documentos/lançamentos/wcm/widget/portalfornecedor/src/main/resources/view.ftl b/Lançamento de documentos/lançamentos/wcm/widget/portalfornecedor/src/main/resources/view.ftl new file mode 100644 index 0000000..2aaf5fe --- /dev/null +++ b/Lançamento de documentos/lançamentos/wcm/widget/portalfornecedor/src/main/resources/view.ftl @@ -0,0 +1,184 @@ +
+ + + +
+ + + +
+

Dados do documento

+

Preencha os campos obrigatórios para iniciar a solicitação.

+ +
+ +
+ + +
+ +
+ + + +
+ +
+ + + +
+ +
+ + + +
+ +
+ +
+ +
+ + + +
+ +
+ + + +
+ + + +
+ + + +
+ +
+ +
+ +
+ + + +
+ +
+ + +
+ R$ + + +
+
+ +
+ +
+ +
+ + + +

+ Utilize o botão abaixo para anexar o documento. +

+ + + + + +
+ +
+ +
+ +
+ +
+ +

Descrição dos serviços

+

Inclua detalhes para facilitar a análise.

+ + + +
+ + + +
+ + + +
+ +
+ +
diff --git a/Lançamento de documentos/lançamentos/wcm/widget/portalfornecedor/src/main/webapp/WEB-INF/jboss-web.xml b/Lançamento de documentos/lançamentos/wcm/widget/portalfornecedor/src/main/webapp/WEB-INF/jboss-web.xml new file mode 100644 index 0000000..7aded4b --- /dev/null +++ b/Lançamento de documentos/lançamentos/wcm/widget/portalfornecedor/src/main/webapp/WEB-INF/jboss-web.xml @@ -0,0 +1,5 @@ + + + /portalfornecedor + false + diff --git a/Lançamento de documentos/lançamentos/wcm/widget/portalfornecedor/src/main/webapp/WEB-INF/web.xml b/Lançamento de documentos/lançamentos/wcm/widget/portalfornecedor/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000..3cea5b4 --- /dev/null +++ b/Lançamento de documentos/lançamentos/wcm/widget/portalfornecedor/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,7 @@ + + + + diff --git a/Lançamento de documentos/lançamentos/wcm/widget/portalfornecedor/src/main/webapp/resources/css/portalfornecedor.css b/Lançamento de documentos/lançamentos/wcm/widget/portalfornecedor/src/main/webapp/resources/css/portalfornecedor.css new file mode 100644 index 0000000..4f902ff --- /dev/null +++ b/Lançamento de documentos/lançamentos/wcm/widget/portalfornecedor/src/main/webapp/resources/css/portalfornecedor.css @@ -0,0 +1,346 @@ +.wcm-widget-class { + background: + radial-gradient(circle at 2px 2px, rgba(13, 109, 141, 0.06) 1px, transparent 0) 0 0 / 18px 18px, + linear-gradient(180deg, #f8fbfd 0%, #eef3f7 100%); +} + +.portal-shell { + --pf-bg: #f2f5f8; + --pf-card: #ffffff; + --pf-border: #d9e2ec; + --pf-ink: #133045; + --pf-muted: #5f7282; + --pf-primary: #0a6d8d; + --pf-primary-strong: #085a74; + --pf-success: #0f766e; + --pf-success-bg: #ecfdf5; + --pf-danger: #b42318; + + max-width: 980px; + margin: 28px auto; + padding: 0 12px 32px; + color: var(--pf-ink); +} + +.page-header { + position: relative; + margin: 0 0 20px; + padding: 18px 16px 14px; + border: 1px solid #0b4a5f; + border-radius: 12px; + background: #0b556b; + box-shadow: 0 8px 20px rgba(11, 85, 107, 0.24); +} + +.page-header::before { + content: ""; + position: absolute; + top: 0; + left: 0; + width: 180px; + height: 4px; + border-radius: 99px; + background: rgba(255, 255, 255, 0.75); +} + +.page-brand { + position: absolute; + right: 0; + top: 6px; + width: 188px; + height: 64px; + display: flex; + align-items: center; + justify-content: center; + border-radius: 0; + border: none; + background: transparent; + box-shadow: none; + padding: 0; +} + +.page-brand img { + max-width: 94%; + max-height: 82%; + object-fit: contain; +} + +.brand-fallback-text { + display: none; + font-size: 14px; + font-weight: 700; + color: #ffffff; +} + +.page-brand.brand-fallback .brand-fallback-text { + display: inline-block; +} + +.page-eyebrow { + display: inline-block; + font-size: 11px; + font-weight: 700; + letter-spacing: 0.08em; + text-transform: uppercase; + color: #d7f0f7; + margin-bottom: 6px; +} + +.page-title { + margin: 0; + font-size: 34px; + line-height: 1.15; + font-weight: 800; + color: #ffffff; +} + +.page-title i { + margin-right: 8px; + color: #d7f0f7; +} + +.page-subtitle { + margin: 8px 0 0; + color: #d5e8ef; + font-size: 15px; + max-width: 70%; +} + +.form-card { + background: var(--pf-card); + border: 1px solid var(--pf-border); + border-radius: 14px; + padding: 22px 20px 16px; + margin-bottom: 16px; + box-shadow: 0 8px 24px rgba(16, 24, 40, 0.06); + transition: transform 0.2s ease, box-shadow 0.2s ease; +} + +.portal-shell .page-header .page-title, +.portal-shell .page-header .page-title i { + color: #ffffff !important; +} + +.portal-shell .page-header .page-subtitle { + color: #e6f2f6 !important; +} + +.portal-shell .page-header .page-eyebrow { + color: #dff6ff !important; +} + +.portal-shell .form-card { + background: #ffffff !important; + border-color: #cfdce8 !important; +} + +.portal-shell .arquivo-nome:empty { + display: none; +} + +.form-card:hover { + transform: translateY(-2px); + box-shadow: 0 12px 30px rgba(16, 24, 40, 0.08); +} + +.titulo-secao { + margin: 0; + font-size: 22px; + line-height: 1.2; + font-weight: 800; + color: #0b3f55; +} + +.sub-secao { + margin: 6px 0 18px; + color: var(--pf-muted); + font-size: 13px; +} + +.form-group { + margin-bottom: 16px; +} + +.form-group > label { + display: block; + margin-bottom: 6px; + font-size: 13px; + font-weight: 700; + color: #324b5d; +} + +.portal-shell .form-control, +.portal-shell .input-group-addon, +.portal-shell select.form-control { + border-radius: 8px; +} + +.portal-shell .form-control { + height: 40px; + border: 1px solid #c9d5e2; + transition: border-color 0.15s ease, box-shadow 0.15s ease; +} + +.portal-shell textarea.form-control { + min-height: 120px; + resize: vertical; +} + +.portal-shell .form-control:hover { + border-color: #8fb5c3; +} + +.portal-shell .form-control:focus { + border-color: #0a6d8d; + box-shadow: 0 0 0 3px rgba(10, 109, 141, 0.12); +} + +.portal-shell .has-error .form-control, +.portal-shell .alertaCampo.has-error .form-control { + border-color: var(--pf-danger); +} + +.btn-anexo { + background: #eef4f7; + border: 1px dashed #9db7c5; + color: #133045; + border-radius: 8px; + padding: 10px 14px; + font-weight: 700; + transition: background 0.15s ease; +} + +.btn-anexo:hover { + background: #e4eef3; +} + +.arquivo-nome { + margin-top: 10px; + padding: 8px 10px; + border-radius: 8px; + background: #f4f8fb; + border: 1px solid #d7e5ef; + color: #365266; + font-size: 13px; +} + +.btn-enviar { + margin-top: 10px; + min-width: 220px; + border-radius: 10px; + background: linear-gradient(135deg, #0a6d8d 0%, #0f8f98 100%); + border: none; + padding: 12px 28px; + font-size: 16px; + font-weight: 700; + color: white; + transition: transform 0.15s ease, box-shadow 0.15s ease; +} + +.btn-enviar:hover { + transform: translateY(-1px); + box-shadow: 0 10px 22px rgba(10, 109, 141, 0.25); +} + +.envio-status { + margin: 0 0 14px; + padding: 12px 14px; + border-radius: 10px; + border: 1px solid transparent; + font-size: 14px; + font-weight: 600; +} + +.envio-status.hidden { + display: none; +} + +.envio-status.success { + color: #065f46; + background: var(--pf-success-bg); + border-color: #a7f3d0; +} + +.envio-status.error { + color: #7a271a; + background: #fef3f2; + border-color: #fecdca; +} + +.portal-success-state { + max-width: 760px; + margin: 32px auto; + padding: 26px 24px; + border: 1px solid #b7ebd8; + border-radius: 12px; + background: linear-gradient(180deg, #f4fffb 0%, #ecfdf5 100%); + animation: fadeIn 0.4s ease; +} + +.portal-success-title { + margin: 0 0 8px; + color: #0f5132; + font-weight: 800; +} + +.portal-success-desc { + margin: 0; + color: #1f5f46; +} + +@keyframes fadeIn { + from { + opacity: 0; + transform: translateY(10px); + } + to { + opacity: 1; + transform: translateY(0); + } +} + +@media (max-width: 991px) { + .portal-shell { + padding: 0 10px 24px; + } + + .page-title { + font-size: 28px; + } + + .page-subtitle { + max-width: 100%; + padding-right: 184px; + } +} + +@media (max-width: 767px) { + .page-title { + font-size: 24px; + } + + .page-header { + padding-top: 76px; + } + + .page-brand { + left: 0; + right: auto; + top: 8px; + width: 164px; + height: 58px; + } + + .page-subtitle { + padding-right: 0; + } + + .form-card { + padding: 16px 14px 10px; + border-radius: 12px; + } + + .btn-enviar { + width: 100%; + } +} diff --git a/Lançamento de documentos/lançamentos/wcm/widget/portalfornecedor/src/main/webapp/resources/images/icon.png b/Lançamento de documentos/lançamentos/wcm/widget/portalfornecedor/src/main/webapp/resources/images/icon.png new file mode 100644 index 0000000..102160c Binary files /dev/null and b/Lançamento de documentos/lançamentos/wcm/widget/portalfornecedor/src/main/webapp/resources/images/icon.png differ diff --git a/Lançamento de documentos/lançamentos/wcm/widget/portalfornecedor/src/main/webapp/resources/images/logo.ginseng.branca.png b/Lançamento de documentos/lançamentos/wcm/widget/portalfornecedor/src/main/webapp/resources/images/logo.ginseng.branca.png new file mode 100644 index 0000000..6b66c74 Binary files /dev/null and b/Lançamento de documentos/lançamentos/wcm/widget/portalfornecedor/src/main/webapp/resources/images/logo.ginseng.branca.png differ diff --git a/Lançamento de documentos/lançamentos/wcm/widget/portalfornecedor/src/main/webapp/resources/js/portalfornecedor.js b/Lançamento de documentos/lançamentos/wcm/widget/portalfornecedor/src/main/webapp/resources/js/portalfornecedor.js new file mode 100644 index 0000000..79fddb5 --- /dev/null +++ b/Lançamento de documentos/lançamentos/wcm/widget/portalfornecedor/src/main/webapp/resources/js/portalfornecedor.js @@ -0,0 +1,460 @@ +if (typeof window !== "undefined") { + window.WCMAPI = window.WCMAPI || {}; + if (typeof window.WCMAPI.isMobileAppMode !== "function") { + window.WCMAPI.isMobileAppMode = function () { return false; }; + } +} +function showCamera(param) { + if (typeof JSInterface !== "undefined" && JSInterface && typeof JSInterface.showCamera === "function") { + JSInterface.showCamera(param); + return true; + } + return false; +} + +var MyWidget = SuperWidget.extend({ + init: function () { + this.root = $("#MyWidget_" + this.instanceId); + this.anexoInfo = null; + this.gedParentFolderId = 10; + this.isSending = false; + this.bindEvents(); + this.setupInitialValues(); + }, + + bindEvents: function () { + var self = this; + + this.root.find("#btnEnviarNota_" + this.instanceId + ", #btnEnviarNota").off("click").on("click", function () { + self.enviarDocumento(); + }); + + this.root.find("#anexaDocumento").off("click").on("click", function () { + self.handleAnexo(); + }); + + this.root.find("#arquivoLocal").off("change").on("change", function () { + self.onArquivoSelecionado(this); + }); + + this.root.find("#tipo_cadastro").off("change").on("change", function () { + self.toggleTipoCadastro(this.value); + self.clearFieldError("#cpf"); + self.clearFieldError("#cnpj"); + }); + + this.root.find("#cpf").off("input").on("input", function () { + this.value = self.mascaraCPF(this.value); + }); + + this.root.find("#cnpj").off("input").on("input", function () { + this.value = self.mascaraCNPJ(this.value); + }); + }, + + setupInitialValues: function () { + this.root.find("#data_abertura").val(this.getCurrentDate()); + this.root.find("#tipo_cadastro").val("cpf").trigger("change"); + this.root.find("#emitido_por").val("fornecedor"); + this.root.find("#tipo_documento").val("danfe"); + this.clearStatus(); + }, + + onArquivoSelecionado: function (inputEl) { + var file = inputEl && inputEl.files && inputEl.files[0] ? inputEl.files[0] : null; + + if (!file) { + this.anexoInfo = null; + this.root.find("#arquivoLocalNome").text(""); + return; + } + + this.anexoInfo = { + fileName: file.name, + mimeType: file.type || "application/octet-stream", + fileSize: file.size || 0, + file: file + }; + + this.root.find("#arquivoLocalNome").text("Arquivo selecionado: " + file.name + " (" + this.formatFileSize(file.size || 0) + ")"); + this.clearStatus(); + + console.log("[portalfornecedor] anexo preparado para envio:", { + fileName: this.anexoInfo.fileName, + mimeType: this.anexoInfo.mimeType, + fileSize: this.anexoInfo.fileSize + }); + }, + + handleAnexo: function () { + if (showCamera("anexo_documento")) { + return; + } + + if (this.openAttachmentTab()) { + return; + } + + this.root.find("#arquivoLocal").trigger("click"); + }, + + openAttachmentTab: function () { + try { + var parentDoc = window.parent && window.parent.document ? window.parent.document : document; + var selectors = [ + "#tab-attachments", + "a[href*='attachments']", + "a[aria-controls*='attachments']", + "[data-tab*='attachments']" + ]; + + for (var i = 0; i < selectors.length; i++) { + var el = parentDoc.querySelector(selectors[i]); + if (el) { + el.click(); + return true; + } + } + } catch (e) { + // ignore + } + + return false; + }, + + toggleTipoCadastro: function (tipo) { + tipo = this.normalizeTipoCadastro(tipo); + var divCpf = this.root.find(".divCpf"); + var divCnpj = this.root.find(".divCnpj"); + var cpf = this.root.find("#cpf"); + var cnpj = this.root.find("#cnpj"); + + if (tipo === "cpf") { + divCpf.show(); + divCnpj.hide(); + cpf.prop("readonly", false); + cnpj.prop("readonly", true).val(""); + return; + } + + if (tipo === "cnpj") { + divCpf.hide(); + divCnpj.show(); + cnpj.prop("readonly", false); + cpf.prop("readonly", true).val(""); + return; + } + + divCpf.hide(); + divCnpj.show(); + cpf.prop("readonly", true).val(""); + cnpj.prop("readonly", true).val(""); + }, + + enviarDocumento: function () { + var self = this; + + if (this.isSending) { + return; + } + + if (!this.validateRequiredFields()) { + this.setStatus("error", "Revise os campos obrigatorios destacados para continuar."); + FLUIGC.toast({ + title: "Aviso", + message: "Preencha os campos obrigatorios antes de enviar.", + type: "warning" + }); + return; + } + + if (!this.anexoInfo || !this.anexoInfo.file) { + this.setStatus("error", "Selecione um anexo antes de enviar o documento."); + FLUIGC.toast({ + title: "Aviso", + message: "Selecione um anexo antes de enviar o documento.", + type: "warning" + }); + return; + } + + var tipoCadastro = this.normalizeTipoCadastro(this.value("#tipo_cadastro")); + var cpf = this.onlyDigits(this.value("#cpf")); + var cnpj = this.onlyDigits(this.value("#cnpj")); + var numeroDocumento = this.value("#numero_documento"); + var valor = this.normalizeMoney(this.value("#valor")); + var documentoPessoa = tipoCadastro === "cpf" ? cpf : cnpj; + var cpfField = tipoCadastro === "cpf" ? cpf : ""; + + this.setLoading(true, "Enviando documento, aguarde..."); + + this.uploadAnexoToECM(this.anexoInfo.file) + .done(function (docData) { + var payloadProcesso = { + targetState: 0, + subProcessTargetState: 0, + comment: "Solicitacao criada via widget", + formFields: { + data_abertura: self.value("#data_abertura"), + emitido_por: self.value("#emitido_por"), + entidade_responsavel: self.value("#entidade_responsavel"), + tipo_cadastro: tipoCadastro, + emailSolicitante: self.value("#emailSolicitante"), + cpf: cpfField || documentoPessoa, + tipo_documento: self.value("#tipo_documento"), + numero_documento: numeroDocumento, + valor: valor, + justificativa: self.value("#justificativa"), + anexo_documento_id: String(docData.documentId || ""), + anexo_documento_nome: self.anexoInfo.fileName, + anexo_documento_mime: self.anexoInfo.mimeType + } + }; + + window.__portalfornecedor_lastProcessPayload = payloadProcesso; + console.log("[portalfornecedor] payload direto processo:", payloadProcesso); + + self.enviarDiretoProcesso(payloadProcesso) + .done(function (response) { + console.log("[portalfornecedor] response processo direto:", response); + self.setLoading(false); + self.renderSuccessState(response); + }) + .fail(function (xhrDireto) { + self.setLoading(false); + console.warn("[portalfornecedor] falha no envio direto:", xhrDireto); + console.error("[portalfornecedor] detalhe erro processo direto:", { + status: xhrDireto.status, + statusText: xhrDireto.statusText, + responseText: xhrDireto.responseText + }); + self.setStatus("error", "Falha ao iniciar processo. Veja o console para detalhes."); + FLUIGC.toast({ + title: "Erro", + message: "Falha ao iniciar processo. Veja o console para detalhes.", + type: "danger" + }); + }); + }) + .fail(function (uploadErr) { + self.setLoading(false); + console.error("[portalfornecedor] falha upload documento ECM:", uploadErr); + self.setStatus("error", "Falha ao enviar anexo para o GED."); + FLUIGC.toast({ + title: "Erro", + message: "Falha ao enviar anexo para o GED.", + type: "danger" + }); + }); + }, + + renderSuccessState: function (response) { + var processInstanceId = this.extractProcessInstanceId(response); + var idText = processInstanceId ? ("Solicitação " + processInstanceId) : "Solicitação"; + var html = "" + + "
" + + "

" + idText + " enviada com sucesso.

" + + "

Sua Solicitação foi encaminhada para o Grupo Ginseng para análise.

" + + "
"; + + this.root.html(html); + console.log("[portalfornecedor] success state renderizado."); + }, + + extractProcessInstanceId: function (response) { + if (!response) return ""; + if (response.processInstanceId) return response.processInstanceId; + if (response.content && response.content.processInstanceId) return response.content.processInstanceId; + if (response.content && response.content.processInstanceid) return response.content.processInstanceid; + if (response.content && response.content.requestNumber) return response.content.requestNumber; + return ""; + }, + + enviarDiretoProcesso: function (payloadProcesso) { + return $.ajax({ + url: "/process-management/api/v2/processes/FlowEssentials_LancamentodeDocumento/start", + type: "POST", + contentType: "application/json", + data: JSON.stringify(payloadProcesso) + }); + }, + + uploadAnexoToECM: function (file) { + var self = this; + var dfd = $.Deferred(); + var fileName = file.name; + var uploadUrl = "/api/public/2.0/contentfiles/upload/?fileName=" + encodeURIComponent(fileName); + + fetch(uploadUrl, { + method: "POST", + headers: { + "Content-Type": "application/octet-stream" + }, + body: file + }) + .then(function (resp) { + if (!resp.ok) throw new Error("Falha no upload binario"); + return resp.text(); + }) + .then(function () { + var companyId = (window.WCMAPI && WCMAPI.organizationId) ? String(WCMAPI.organizationId) : "1"; + var createPayload = { + companyId: companyId, + description: fileName, + parentId: self.gedParentFolderId, + immutable: true, + isPrivate: false, + downloadEnabled: true, + attachments: [{ fileName: fileName }] + }; + + return fetch("/api/public/ecm/document/createDocument", { + method: "POST", + headers: { + "Content-Type": "application/json;charset=utf-8" + }, + body: JSON.stringify(createPayload) + }); + }) + .then(function (resp) { + if (!resp.ok) throw new Error("Falha ao criar documento no GED"); + return resp.json(); + }) + .then(function (data) { + var content = data && data.content ? data.content : {}; + var documentId = content.id || content.documentId; + if (!documentId) throw new Error("GED nao retornou documentId"); + dfd.resolve({ documentId: documentId, raw: data }); + }) + .catch(function (err) { + dfd.reject(err); + }); + + return dfd.promise(); + }, + + setLoading: function (isLoading, message) { + this.isSending = !!isLoading; + var btn = this.root.find("#btnEnviarNota"); + + if (isLoading) { + btn.prop("disabled", true).text("Enviando..."); + this.setStatus("success", message || "Processando..."); + return; + } + + btn.prop("disabled", false).text("Enviar documento"); + }, + + setStatus: function (type, message) { + var box = this.root.find("#envioStatus"); + if (!box.length) return; + + box.removeClass("hidden success error"); + box.addClass(type === "error" ? "error" : "success"); + box.text(message || ""); + }, + + clearStatus: function () { + var box = this.root.find("#envioStatus"); + if (!box.length) return; + box.removeClass("success error").addClass("hidden").text(""); + }, + + validateRequiredFields: function () { + var ok = true; + var tipoCadastro = this.normalizeTipoCadastro(this.value("#tipo_cadastro")); + + if (!this.value("#emitido_por")) ok = this.markRequired("#emitido_por") && ok; + if (!this.value("#entidade_responsavel")) ok = this.markRequired("#entidade_responsavel") && ok; + if (!this.value("#tipo_cadastro")) ok = this.markRequired("#tipo_cadastro") && ok; + if (!this.value("#numero_documento")) ok = this.markRequired("#numero_documento") && ok; + if (!this.value("#justificativa")) ok = this.markRequired("#justificativa") && ok; + + if (tipoCadastro === "cpf") { + if (!this.onlyDigits(this.value("#cpf"))) ok = this.markRequired("#cpf") && ok; + this.clearFieldError("#cnpj"); + } else if (tipoCadastro === "cnpj") { + if (!this.onlyDigits(this.value("#cnpj"))) ok = this.markRequired("#cnpj") && ok; + this.clearFieldError("#cpf"); + } + + return ok; + }, + + markRequired: function (selector) { + var input = this.root.find(selector); + if (!input.length) return false; + + var container = input.closest(".alertaCampo, .form-group"); + if (container.length) container.addClass("has-error"); + + input.one("input change", function () { + if ($.trim($(this).val())) { + $(this).closest(".alertaCampo, .form-group").removeClass("has-error"); + } + }); + + return false; + }, + + clearFieldError: function (selector) { + var input = this.root.find(selector); + if (!input.length) return; + input.closest(".alertaCampo, .form-group").removeClass("has-error"); + }, + + value: function (selector) { + return (this.root.find(selector).val() || "").toString().trim(); + }, + + getCurrentDate: function () { + var now = new Date(); + var yyyy = now.getFullYear(); + var mm = ("0" + (now.getMonth() + 1)).slice(-2); + var dd = ("0" + now.getDate()).slice(-2); + return yyyy + "-" + mm + "-" + dd; + }, + + mascaraCPF: function (value) { + var v = (value || "").replace(/\D/g, "").slice(0, 11); + v = v.replace(/(\d{3})(\d)/, "$1.$2"); + v = v.replace(/(\d{3})(\d)/, "$1.$2"); + v = v.replace(/(\d{3})(\d{1,2})$/, "$1-$2"); + return v; + }, + + mascaraCNPJ: function (value) { + var v = (value || "").replace(/\D/g, "").slice(0, 14); + v = v.replace(/^(\d{2})(\d)/, "$1.$2"); + v = v.replace(/^(\d{2})\.(\d{3})(\d)/, "$1.$2.$3"); + v = v.replace(/\.(\d{3})(\d)/, ".$1/$2"); + v = v.replace(/(\d{4})(\d)/, "$1-$2"); + return v; + }, + + onlyDigits: function (value) { + return (value || "").replace(/\D/g, ""); + }, + + normalizeMoney: function (value) { + var raw = (value || "").toString().trim(); + if (!raw) return "0,00"; + if (raw.indexOf(",") >= 0) return raw; + if (raw.indexOf(".") >= 0) return raw.replace(".", ","); + return raw + ",00"; + }, + + normalizeTipoCadastro: function (value) { + return (value || "").toString().trim().toLowerCase(); + }, + + formatFileSize: function (bytes) { + var b = Number(bytes || 0); + if (b <= 0) return "0 KB"; + if (b < 1024) return b + " B"; + if (b < 1048576) return (b / 1024).toFixed(1) + " KB"; + return (b / 1048576).toFixed(2) + " MB"; + } +}); + diff --git a/Lançamento de documentos/lançamentos/wcm/widget/portalfornecedor/target/portalfornecedor.war b/Lançamento de documentos/lançamentos/wcm/widget/portalfornecedor/target/portalfornecedor.war new file mode 100644 index 0000000..09757e9 Binary files /dev/null and b/Lançamento de documentos/lançamentos/wcm/widget/portalfornecedor/target/portalfornecedor.war differ diff --git a/Lançamento de documentos/lançamentos/workflow/.resources/FlowEssentials_LancamentodeDocumento.ecm30.xml b/Lançamento de documentos/lançamentos/workflow/.resources/FlowEssentials_LancamentodeDocumento.ecm30.xml new file mode 100644 index 0000000..912e3ad --- /dev/null +++ b/Lançamento de documentos/lançamentos/workflow/.resources/FlowEssentials_LancamentodeDocumento.ecm30.xml @@ -0,0 +1,722 @@ + + + + 1 + FlowEssentials_LancamentodeDocumento + + Lançamento de documento + Este Flow permite ao colaborador lançar dados referentes a um documento, seja uma nota, recibo, boleto ou outro que a empresa possua, com a obrigatoriedade de anexar o documento citado. Quando aprovada a etapa de Análise do documento, o mesmo será publicado no ECM e herdará as propriedades de validade e notificação. + true + true + Default + Documentos + + 0 + 0 + 0 + Default + false + + 1 + true + false + 86400 + 43200 + true + + + + 1 + Lançamento de documento + 9 + + + 41254 + true + false + false + true + false + false + 0 + 2 + + false + false + true + + + + + 1 + FlowEssentials_LancamentodeDocumento + 1 + 4 + + Lançar documento + Lançar documento + + 0 + false + 0 + + + 1 + true + true + false + 3600 + 3600 + 0 + 0 + false + + 0 + true + true + false + 120 + 100 + 0 + 0 + false + false + 0 + 0 + false + + 0 + 10 + 0 + false + 0 + 0 + 0 + 0 + + false + + + + 1 + FlowEssentials_LancamentodeDocumento + 1 + 5 + + Analisar documento + Analisar documento + + 86400 + + false + 0 + Pool Grupo + <AssignmentController><Group>Fiscal</Group></AssignmentController> + 1 + false + true + false + 3600 + 3600 + 0 + 0 + false + + 0 + true + false + false + 280 + 300 + 0 + 0 + false + false + 0 + 0 + false + Default + 0 + 80 + 0 + false + 0 + 0 + 0 + 0 + + false + 0 + + + + 1 + FlowEssentials_LancamentodeDocumento + 1 + 9 + + Ajustar dados do documento + Ajustar dados do documento + + 86400 + + false + 0 + Executor Atividade + <AssignmentController><BaseActivity>4</BaseActivity><Returns>Last</Returns></AssignmentController> + 1 + false + true + false + 3600 + 3600 + 0 + 0 + false + + 0 + true + false + false + 500 + 77 + 0 + 0 + false + false + 0 + 0 + false + + 0 + 80 + 0 + false + 0 + 0 + 0 + 0 + + false + 0 + + + + 1 + FlowEssentials_LancamentodeDocumento + 1 + 7 + + Finalizar e aprovar solicitação + Finalizar e aprovar solicitação + Atividade final do processo + 0 + false + 0 + + + 0 + false + true + false + 0 + 1 + 0 + 0 + false + + 0 + false + false + false + 800 + 430 + 0 + 0 + false + false + 0 + 0 + false + + 6 + 60 + 0 + false + 0 + + false + + + + 1 + FlowEssentials_LancamentodeDocumento + 1 + 14 + + Cancelar + Cancelar + Atividade final do processo + 0 + false + 0 + + + 0 + false + true + false + 0 + 1 + 0 + 0 + false + + 0 + false + false + false + 800 + 320 + 0 + 0 + false + false + 0 + 0 + false + + 6 + 65 + 0 + false + 0 + + false + + + + + + + 1 + FlowEssentials_LancamentodeDocumento + 1 + 6 + + + false + 4 + 5 + + + false + false + 0 + + + + 1 + FlowEssentials_LancamentodeDocumento + 1 + 8 + + Finalizar e aprovar solicitação + false + 5 + 7 + + Aprovar + false + false + 0 + + + + 1 + FlowEssentials_LancamentodeDocumento + 1 + 10 + + + false + 5 + 9 + + Ajustar + false + false + 0 + + + + 1 + FlowEssentials_LancamentodeDocumento + 1 + 11 + + + false + 9 + 5 + + + false + false + 0 + + + + 1 + FlowEssentials_LancamentodeDocumento + 1 + 13 + + + false + 5 + 14 + + Cancelar + false + false + 0 + + + + + + + 1 + beforeStateEntry + FlowEssentials_LancamentodeDocumento + 1 + + function beforeStateEntry(sequenceId) { + appendDebugPublicacao("beforeStateEntry sequenceId=" + sequenceId); + + if (sequenceId == 7) { + anexarDocumentoDoCardSeNecessario(); + publicarDocumento(); + } + + if (sequenceId == 7) { + var attachments = hAPI.listAttachments(); + var hasAttachment = attachments && attachments.size() > 0; + appendDebugPublicacao("validacao anexos: total=" + (attachments ? attachments.size() : 0)); + + if (!hasAttachment) { + appendDebugPublicacao("validacao anexos: nenhum anexo encontrado apos processamento."); + throw "\n\nNao identificamos nenhum documento anexado, volte ao formulario e anexe pelo menos um documento para avancar a solicitacao.\n\n"; + } + } +} + +function anexarDocumentoDoCardSeNecessario() { + try { + var attachments = hAPI.listAttachments(); + if (attachments && attachments.size() > 0) { + appendDebugPublicacao("anexarDocumentoDoCardSeNecessario: solicitacao ja possui " + attachments.size() + " anexo(s)."); + return; + } + + var anexoIdStr = (hAPI.getCardValue("anexo_documento_id") || "") + ""; + anexoIdStr = anexoIdStr.replace(/^\s+|\s+$/g, ""); + if (!anexoIdStr) { + appendDebugPublicacao("anexarDocumentoDoCardSeNecessario: campo anexo_documento_id vazio."); + return; + } + + var anexoId = parseInt(anexoIdStr, 10); + if (isNaN(anexoId) || anexoId <= 0) { + appendDebugPublicacao("anexarDocumentoDoCardSeNecessario: anexo_documento_id invalido: " + anexoIdStr); + return; + } + + hAPI.attachDocument(anexoId); + appendDebugPublicacao("anexarDocumentoDoCardSeNecessario: hAPI.attachDocument OK documentId=" + anexoId); + + var attachmentsDepois = hAPI.listAttachments(); + appendDebugPublicacao("anexarDocumentoDoCardSeNecessario: total anexos apos attachDocument = " + (attachmentsDepois ? attachmentsDepois.size() : 0)); + } catch (e) { + appendDebugPublicacao("anexarDocumentoDoCardSeNecessario: ERRO " + e); + } +} + +function appendDebugPublicacao(msg) { + try { + var atual = (hAPI.getCardValue("debug_publicacao") || "") + ""; + var prefix = atual ? atual + "\n" : ""; + hAPI.setCardValue("debug_publicacao", prefix + msg); + } catch (e) { + log.warn("appendDebugPublicacao falhou: " + e); + } +} + + + + + 1 + publicarDocumento + FlowEssentials_LancamentodeDocumento + 1 + + function publicarDocumento() { + var radioGed = (hAPI.getCardValue("radio_ged") || "") + ""; + var idPastaSelecionadaRaw = (hAPI.getCardValue("idPastaSelecionada") || "") + ""; + log.info("PUBLICAR_DOCUMENTO LANCAMENTO_DOCUMENTO ########## radio_ged=" + radioGed + " idPastaSelecionada=" + idPastaSelecionadaRaw); + appendDebugPublicacao("publicarDocumento: radio_ged=" + radioGed + " idPastaSelecionada=" + idPastaSelecionadaRaw); + + if (radioGed != "publica_ged") { + log.info("PUBLICAR_DOCUMENTO LANCAMENTO_DOCUMENTO ########## Nao publicar no ECM (radio_ged diferente de publica_ged)."); + appendDebugPublicacao("publicarDocumento: radio_ged diferente de publica_ged."); + return; + } + + var attachments = hAPI.listAttachments(); + log.info("PUBLICAR_DOCUMENTO LANCAMENTO_DOCUMENTO ########## attachments.size=" + (attachments ? attachments.size() : 0)); + appendDebugPublicacao("publicarDocumento: attachments.size=" + (attachments ? attachments.size() : 0)); + + for (var i = 0; i < attachments.size(); i++) { + var docDto = attachments.get(i); + log.info("PUBLICAR_DOCUMENTO LANCAMENTO_DOCUMENTO ########## analisando anexo documentId=" + docDto.getDocumentId() + " version=" + docDto.getVersion() + " documentType=" + docDto.getDocumentType()); + appendDebugPublicacao("publicarDocumento: analisando documentId=" + docDto.getDocumentId() + " version=" + docDto.getVersion() + " type=" + docDto.getDocumentType()); + + try { + docAPI.copyDocumentToUploadArea(docDto.getDocumentId(), docDto.getVersion()); + + docDto.setDocumentId(0); + + var idPastaSelecionada = parseInt((hAPI.getCardValue("idPastaSelecionada") || "") + "", 10); + if (isNaN(idPastaSelecionada) || idPastaSelecionada <= 0) { + log.warn("PUBLICAR_DOCUMENTO LANCAMENTO_DOCUMENTO ########## idPastaSelecionada invalido. Documento nao sera publicado no ECM."); + appendDebugPublicacao("publicarDocumento: idPastaSelecionada invalido."); + continue; + } + + docDto.setParentDocumentId(idPastaSelecionada); + + var attachArray = new java.util.ArrayList(); + var mainAttach = docAPI.newAttachment(); + mainAttach.setFileName(docDto.getPhisicalFile()); + mainAttach.setPrincipal(true); + mainAttach.setAttach(false); + attachArray.add(mainAttach); + + docDto.setActiveVersion(true); + docDto.setColleagueId(getValue("WKUser")); + docDto.setPublisherId(getValue("WKUser")); + + if (hAPI.getCardValue("radio_data_validade") == "com_data_validade") { + docDto.setExpires(true); + + if (hAPI.getCardValue("inicio_validade") != "") { + var inicioValidade = (hAPI.getCardValue("inicio_validade") || "") + ""; + var dataInicioSplit = inicioValidade.split("-"); + var anoInicio = dataInicioSplit[0]; + var mesInicio = parseFloat(dataInicioSplit[1]) - 1; + var diaInicio = dataInicioSplit[2]; + var dInicio = new Date(anoInicio, mesInicio, diaInicio); + docDto.setValidationStartDate(dInicio); + } + + if (hAPI.getCardValue("expiracao_validade") != "") { + var dataVencimento = (hAPI.getCardValue("expiracao_validade") || "") + ""; + var dataSplit = dataVencimento.split("-"); + var ano = dataSplit[0]; + var mes = parseFloat(dataSplit[1]) - 1; + var dia = dataSplit[2]; + var d = new Date(ano, mes, dia); + docDto.setExpirationDate(d); + } + + if (hAPI.getCardValue("dias_antes_expiracao") != "") { + var diasAntesExpiracao = parseInt(hAPI.getCardValue("dias_antes_expiracao"), 10); + docDto.setNotificationDays(diasAntesExpiracao); + } + } else { + docDto.setExpires(false); + } + + log.info("PUBLICAR_DOCUMENTO LANCAMENTO_DOCUMENTO ########## before create document"); + var doc = docAPI.createDocument(docDto, attachArray, null, null, null); + log.info("PUBLICAR_DOCUMENTO LANCAMENTO_DOCUMENTO ########## DOCUMENTO CRIADO COM O ID: " + doc.getDocumentId()); + appendDebugPublicacao("publicarDocumento: documento publicado no ECM com id=" + doc.getDocumentId()); + } catch (e) { + log.error("PUBLICAR_DOCUMENTO LANCAMENTO_DOCUMENTO ########## falha ao publicar anexo documentId=" + docDto.getDocumentId() + " erro=" + e); + appendDebugPublicacao("publicarDocumento: ERRO ao publicar documentId=" + docDto.getDocumentId() + " erro=" + e); + } + } +} + +function appendDebugPublicacao(msg) { + try { + var atual = (hAPI.getCardValue("debug_publicacao") || "") + ""; + var prefix = atual ? atual + "\n" : ""; + hAPI.setCardValue("debug_publicacao", prefix + msg); + } catch (e) { + log.warn("appendDebugPublicacao falhou: " + e); + } +} + + + + + + + FFFFFF + 511 + 1031 + 10 + 10 + Lançamento de documento + 1 + 0 + + 1 + FlowEssentials_LancamentodeDocumento + 1 + 1 + + + + DBE8FF + 255 + 1001 + 40 + 10 + Solicitante + 2 + 1 + + 1 + FlowEssentials_LancamentodeDocumento + 1 + 2 + + + + E2E2E2 + 256 + 1001 + 40 + 265 + Responsável por documentos + 2 + 1 + + 1 + FlowEssentials_LancamentodeDocumento + 1 + 3 + + + + + + + + + 1 + FlowEssentials_LancamentodeDocumento + 9 + 6 + 1 + + 137 + 335 + + + + 1 + FlowEssentials_LancamentodeDocumento + 9 + 8 + 1 + + 333 + 447 + + + + 1 + FlowEssentials_LancamentodeDocumento + 9 + 10 + 1 + + 552 + 335 + + + + 1 + FlowEssentials_LancamentodeDocumento + 9 + 11 + 1 + + 333 + 112 + + + + + + + + + + 0 + 0 + FlowEssentials_LancamentodeDocumento + 9 + 5 + approval + title + Analisar documento + + + 0 + 0 + FlowEssentials_LancamentodeDocumento + 9 + 5 + approval + description + + + + 0 + 0 + FlowEssentials_LancamentodeDocumento + 9 + 5 + approval + highlight + Documento aprovado? + + + 0 + 0 + FlowEssentials_LancamentodeDocumento + 9 + 5 + approval + approve + 7 + + + 0 + 0 + FlowEssentials_LancamentodeDocumento + 9 + 5 + approval + reject + 9 + + + + + \ No newline at end of file diff --git a/Lançamento de documentos/lançamentos/workflow/.resources/FlowEssentials_LancamentodeDocumento.png b/Lançamento de documentos/lançamentos/workflow/.resources/FlowEssentials_LancamentodeDocumento.png new file mode 100644 index 0000000..5cb9992 Binary files /dev/null and b/Lançamento de documentos/lançamentos/workflow/.resources/FlowEssentials_LancamentodeDocumento.png differ diff --git a/Lançamento de documentos/lançamentos/workflow/.resources/FlowEssentials_LancamentodeDocumento.processimage.svg b/Lançamento de documentos/lançamentos/workflow/.resources/FlowEssentials_LancamentodeDocumento.processimage.svg new file mode 100644 index 0000000..5561a3b --- /dev/null +++ b/Lançamento de documentos/lançamentos/workflow/.resources/FlowEssentials_LancamentodeDocumento.processimage.svg @@ -0,0 +1,2 @@ + +Responsável por documentosSolicitanteLançamento de documentoAnalisardocumentoAjustar dadosdo documentoAprovarAjustarCancelar diff --git a/Lançamento de documentos/lançamentos/workflow/.resources/Fluig prod.ws.cache b/Lançamento de documentos/lançamentos/workflow/.resources/Fluig prod.ws.cache new file mode 100644 index 0000000..9da72e7 --- /dev/null +++ b/Lançamento de documentos/lançamentos/workflow/.resources/Fluig prod.ws.cache @@ -0,0 +1,724 @@ + + + + + volume + + + Default + + + + + camposFormulario, documentoId = 41254 + + + activity + + + cnpj + + + cpf + + + currentUserId + + + currentUsermail + + + currentUserName + + + data_abertura + + + data_validacao_gestor + + + dias_antes_expiracao + + + emailSolicitante + + + emitido_por + + + empresa + + + entidade_responsavel + + + expiracao_validade + + + formMode + + + gestor_cc + + + idPasta + + + idPastaSelecionada + + + inicio_validade + + + justificativa + + + justi_decisao_gestor + + + moreInfo + + + numero_documento + + + pasta_ged + + + radio_data_validade + + + radio_ged + + + requesterId + + + requesterMail + + + tipo_cadastro + + + tipo_documento + + + user_validacao_gestor + + + valor + + + WKNumProces + + + + + mecanismoGrupo + + + + + Tecnologia e Comunicação + + + TIC + + + + + + + Compras Indiretos + + + ComprasIndiretos + + + + + + + Obras e manutenção + + + Manutencao + + + + + + + Aprovadores Compras Nvl 3 + + + AprovadoresComprasNvl3 + + + + + + + Motoristas + + + Motoristas + + + + + + + Requisitantes de Vaga + + + Requisitantesdevaga + + + + + + + Recrutamento + + + Recrutamento + + + + + + + TODOS-TODOS-DIADMISSAO + + + TODOS-TODOS-DIADMISSAO + + + + + + + ResponsavelDesligamento + + + ResponsavelDesligamento + + + + + + + GENTE & CULTURA + + + GENTE_CULTURA + + + + + + + LOJA AL + + + LOJA_AL + + + + + + + CD + + + CD + + + + + + + ESPAÇO DO REVENDEDOR AL + + + ESPACO_DO_REVENDEDOR_AL + + + + + + + FINANCEIRO + + + FINANCEIRO + + + + + + + OPERAÇÕES + + + OPERACOES + + + + + + + AMG AL + + + AMG_AL + + + + + + + REGIONAL ALAGOAS + + + REGIONAL_ALAGOAS + + + + + + + PREVENÇÃO DE PERDA + + + PREVENCAO_DE_PERDA + + + + + + + MARKETING, TREINAMENTO + + + MARKETING_TREINAMENTO + + + + + + + SECRETARIA EXECUTIVA + + + SECRETARIA_EXECUTIVA + + + + + + + DIRETORIA EXECUTIVA + + + DIRETORIA_EXECUTIVA + + + + + + + INFRAESTRUTURA + + + INFRAESTRUTURA + + + + + + + ESPAÇO DO REVENDEDOR BA + + + ESPACO_DO_REVENDEDOR_BA + + + + + + + BUSINESS INTELLIGENCE + + + BUSINESS_INTELLIGENCE + + + + + + + DEPARTAMENTO PESSOAL + + + DEPARTAMENTO_PESSOAL + + + + + + + LOJA BA + + + LOJA_BA + + + + + + + TREINAMENTO + + + TREINAMENTO + + + + + + + AMG BA + + + AMG_BA + + + + + + + MARKETING + + + MARKETING + + + + + + + COMPRAS + + + COMPRAS + + + + + + + AMG SE + + + AMG_SE + + + + + + + LOJA SE + + + LOJA_SE + + + + + + + ESPAÇO DO REVENDEDOR SE + + + ESPACO_DO_REVENDEDOR_SE + + + + + + + VENDAS IN COMPANY + + + VENDAS_IN_COMPANY + + + + + + + REGIONAL BAHIA + + + REGIONAL_BAHIA + + + + + + + CANAL LOJA 01 + + + CANAL_LOJA_01 + + + + + + + AUDITORIA + + + AUDITORIA + + + + + + + CANAL LOJA 02 + + + CANAL_LOJA_02 + + + + + + + PLANEJAMENTO DE DEMANDAS + + + PLANEJAMENTO_DE_DEMANDAS + + + + + + + PROJETOS + + + PROJETOS + + + + + + + COMPLIANCE + + + COMPLIANCE + + + + + + + ESCRITÓRIO - MATRIZ + + + ESCRITORIO_MATRIZ + + + + + + + ESCRITÓRIO - CONQUISTA + + + ESCRITORIO_CONQUISTA + + + + + + + REGIONAL SERGIPE + + + REGIONAL_SERGIPE + + + + + + + Transferencia + + + Transferencia + + + + + + + Fiscal + + + Fiscal + + + + + + + expediente + + + Default + + + Expediente BackOffice, Logística e Motorista + + + Expediente Escritório Matriz + + + Expediente Lojas + + + + + mecanismo + + + + + Atribuição por Associação + + + Associado + + + + + + + Atribuição por Campo de Formulário + + + Campo Formulário + + + + + + + dpf_di_emp_filial_filtro + + + dpf_di_emp_filial_filtro + + + + + + + dpf_di_inicio_diadmissao + + + dpf_di_inicio_diadmissao + + + + + + + Atribuição por Executor de Atividade + + + Executor Atividade + + + + + + + Atribuição por Grupo + + + Grupo + + + + + + + Atribuição por Grupos do Colaborador + + + Grupos Colaborador + + + + + + + mecCustomAprov + + + mecCustomAprov + + + + + + + Atribuição por Papel + + + Papel + + + + + + + Atribuição para um Grupo + + + Pool Grupo + + + + + + + Atribuição para um Papel + + + Pool Papel + + + + + + + Atribuição por Usuário + + + Usuário + + + + + + + diff --git a/Lançamento de documentos/lançamentos/workflow/.resources/Fluig prod.ws.cache.bkp b/Lançamento de documentos/lançamentos/workflow/.resources/Fluig prod.ws.cache.bkp new file mode 100644 index 0000000..40d1d6e --- /dev/null +++ b/Lançamento de documentos/lançamentos/workflow/.resources/Fluig prod.ws.cache.bkp @@ -0,0 +1,726 @@ + + + + + volume + + + Default + + + + + camposFormulario, documentoId = 41254 + + + activity + + + centro_custo + + + cnpj + + + cpf + + + currentUserId + + + currentUsermail + + + currentUserName + + + data_abertura + + + data_validacao_gestor + + + dias_antes_expiracao + + + emailSolicitante + + + emitido_por + + + empresa + + + entidade_responsavel + + + estabelecimento_filial + + + expiracao_validade + + + formMode + + + gestor_cc + + + idPasta + + + idPastaSelecionada + + + inicio_validade + + + justi_decisao_gestor + + + justificativa + + + moreInfo + + + numero_documento + + + pasta_ged + + + radio_data_validade + + + radio_ged + + + requesterId + + + requesterMail + + + tipo_cadastro + + + tipo_documento + + + user_validacao_gestor + + + usuario_abertura + + + usuarioSolicitante + + + valor + + + WKNumProces + + + + + mecanismoGrupo + + + + + Tecnologia e Comunicação + + + TIC + + + + + + + Compras Indiretos + + + ComprasIndiretos + + + + + + + Obras e manutenção + + + Manutencao + + + + + + + Aprovadores Compras Nvl 3 + + + AprovadoresComprasNvl3 + + + + + + + Motoristas + + + Motoristas + + + + + + + Requisitantes de Vaga + + + Requisitantesdevaga + + + + + + + Recrutamento + + + Recrutamento + + + + + + + TODOS-TODOS-DIADMISSAO + + + TODOS-TODOS-DIADMISSAO + + + + + + + ResponsavelDesligamento + + + ResponsavelDesligamento + + + + + + + GENTE & CULTURA + + + GENTE_CULTURA + + + + + + + LOJA AL + + + LOJA_AL + + + + + + + CD + + + CD + + + + + + + ESPAÇO DO REVENDEDOR AL + + + ESPACO_DO_REVENDEDOR_AL + + + + + + + FINANCEIRO + + + FINANCEIRO + + + + + + + OPERAÇÕES + + + OPERACOES + + + + + + + AMG AL + + + AMG_AL + + + + + + + REGIONAL ALAGOAS + + + REGIONAL_ALAGOAS + + + + + + + PREVENÇÃO DE PERDA + + + PREVENCAO_DE_PERDA + + + + + + + MARKETING, TREINAMENTO + + + MARKETING_TREINAMENTO + + + + + + + SECRETARIA EXECUTIVA + + + SECRETARIA_EXECUTIVA + + + + + + + DIRETORIA EXECUTIVA + + + DIRETORIA_EXECUTIVA + + + + + + + INFRAESTRUTURA + + + INFRAESTRUTURA + + + + + + + ESPAÇO DO REVENDEDOR BA + + + ESPACO_DO_REVENDEDOR_BA + + + + + + + BUSINESS INTELLIGENCE + + + BUSINESS_INTELLIGENCE + + + + + + + DEPARTAMENTO PESSOAL + + + DEPARTAMENTO_PESSOAL + + + + + + + LOJA BA + + + LOJA_BA + + + + + + + TREINAMENTO + + + TREINAMENTO + + + + + + + AMG BA + + + AMG_BA + + + + + + + MARKETING + + + MARKETING + + + + + + + COMPRAS + + + COMPRAS + + + + + + + AMG SE + + + AMG_SE + + + + + + + LOJA SE + + + LOJA_SE + + + + + + + ESPAÇO DO REVENDEDOR SE + + + ESPACO_DO_REVENDEDOR_SE + + + + + + + VENDAS IN COMPANY + + + VENDAS_IN_COMPANY + + + + + + + REGIONAL BAHIA + + + REGIONAL_BAHIA + + + + + + + CANAL LOJA 01 + + + CANAL_LOJA_01 + + + + + + + AUDITORIA + + + AUDITORIA + + + + + + + CANAL LOJA 02 + + + CANAL_LOJA_02 + + + + + + + PLANEJAMENTO DE DEMANDAS + + + PLANEJAMENTO_DE_DEMANDAS + + + + + + + PROJETOS + + + PROJETOS + + + + + + + COMPLIANCE + + + COMPLIANCE + + + + + + + ESCRITÓRIO - MATRIZ + + + ESCRITORIO_MATRIZ + + + + + + + ESCRITÓRIO - CONQUISTA + + + ESCRITORIO_CONQUISTA + + + + + + + REGIONAL SERGIPE + + + REGIONAL_SERGIPE + + + + + + + Transferencia + + + Transferencia + + + + + + + expediente + + + Default + + + Expediente BackOffice, Logística e Motorista + + + Expediente Escritório Matriz + + + Expediente Lojas + + + + + mecanismo + + + + + Atribuição por Associação + + + Associado + + + + + + + Atribuição por Campo de Formulário + + + Campo Formulário + + + + + + + dpf_di_emp_filial_filtro + + + dpf_di_emp_filial_filtro + + + + + + + dpf_di_inicio_diadmissao + + + dpf_di_inicio_diadmissao + + + + + + + Atribuição por Executor de Atividade + + + Executor Atividade + + + + + + + Atribuição por Grupo + + + Grupo + + + + + + + Atribuição por Grupos do Colaborador + + + Grupos Colaborador + + + + + + + mecCustomAprov + + + mecCustomAprov + + + + + + + Atribuição por Papel + + + Papel + + + + + + + Atribuição para um Grupo + + + Pool Grupo + + + + + + + Atribuição para um Papel + + + Pool Papel + + + + + + + Atribuição por Usuário + + + Usuário + + + + + + + diff --git a/Lançamento de documentos/lançamentos/workflow/diagrams/FlowEssentials_LancamentodeDocumento.process b/Lançamento de documentos/lançamentos/workflow/diagrams/FlowEssentials_LancamentodeDocumento.process new file mode 100644 index 0000000..4241570 --- /dev/null +++ b/Lançamento de documentos/lançamentos/workflow/diagrams/FlowEssentials_LancamentodeDocumento.process @@ -0,0 +1,939 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Lançamento de documentos/lançamentos/workflow/scripts/FlowEssentials_LancamentodeDocumento.beforeStateEntry.js b/Lançamento de documentos/lançamentos/workflow/scripts/FlowEssentials_LancamentodeDocumento.beforeStateEntry.js new file mode 100644 index 0000000..3243ece --- /dev/null +++ b/Lançamento de documentos/lançamentos/workflow/scripts/FlowEssentials_LancamentodeDocumento.beforeStateEntry.js @@ -0,0 +1,60 @@ +function beforeStateEntry(sequenceId) { + appendDebugPublicacao("beforeStateEntry sequenceId=" + sequenceId); + + if (sequenceId == 7) { + anexarDocumentoDoCardSeNecessario(); + publicarDocumento(); + } + + if (sequenceId == 7) { + var attachments = hAPI.listAttachments(); + var hasAttachment = attachments && attachments.size() > 0; + appendDebugPublicacao("validacao anexos: total=" + (attachments ? attachments.size() : 0)); + + if (!hasAttachment) { + appendDebugPublicacao("validacao anexos: nenhum anexo encontrado apos processamento."); + throw "\n\nNao identificamos nenhum documento anexado, volte ao formulario e anexe pelo menos um documento para avancar a solicitacao.\n\n"; + } + } +} + +function anexarDocumentoDoCardSeNecessario() { + try { + var attachments = hAPI.listAttachments(); + if (attachments && attachments.size() > 0) { + appendDebugPublicacao("anexarDocumentoDoCardSeNecessario: solicitacao ja possui " + attachments.size() + " anexo(s)."); + return; + } + + var anexoIdStr = (hAPI.getCardValue("anexo_documento_id") || "") + ""; + anexoIdStr = anexoIdStr.replace(/^\s+|\s+$/g, ""); + if (!anexoIdStr) { + appendDebugPublicacao("anexarDocumentoDoCardSeNecessario: campo anexo_documento_id vazio."); + return; + } + + var anexoId = parseInt(anexoIdStr, 10); + if (isNaN(anexoId) || anexoId <= 0) { + appendDebugPublicacao("anexarDocumentoDoCardSeNecessario: anexo_documento_id invalido: " + anexoIdStr); + return; + } + + hAPI.attachDocument(anexoId); + appendDebugPublicacao("anexarDocumentoDoCardSeNecessario: hAPI.attachDocument OK documentId=" + anexoId); + + var attachmentsDepois = hAPI.listAttachments(); + appendDebugPublicacao("anexarDocumentoDoCardSeNecessario: total anexos apos attachDocument = " + (attachmentsDepois ? attachmentsDepois.size() : 0)); + } catch (e) { + appendDebugPublicacao("anexarDocumentoDoCardSeNecessario: ERRO " + e); + } +} + +function appendDebugPublicacao(msg) { + try { + var atual = (hAPI.getCardValue("debug_publicacao") || "") + ""; + var prefix = atual ? atual + "\n" : ""; + hAPI.setCardValue("debug_publicacao", prefix + msg); + } catch (e) { + log.warn("appendDebugPublicacao falhou: " + e); + } +} diff --git a/Lançamento de documentos/lançamentos/workflow/scripts/FlowEssentials_LancamentodeDocumento.publicarDocumento.js b/Lançamento de documentos/lançamentos/workflow/scripts/FlowEssentials_LancamentodeDocumento.publicarDocumento.js new file mode 100644 index 0000000..3ff165b --- /dev/null +++ b/Lançamento de documentos/lançamentos/workflow/scripts/FlowEssentials_LancamentodeDocumento.publicarDocumento.js @@ -0,0 +1,97 @@ +function publicarDocumento() { + var radioGed = (hAPI.getCardValue("radio_ged") || "") + ""; + var idPastaSelecionadaRaw = (hAPI.getCardValue("idPastaSelecionada") || "") + ""; + log.info("PUBLICAR_DOCUMENTO LANCAMENTO_DOCUMENTO ########## radio_ged=" + radioGed + " idPastaSelecionada=" + idPastaSelecionadaRaw); + appendDebugPublicacao("publicarDocumento: radio_ged=" + radioGed + " idPastaSelecionada=" + idPastaSelecionadaRaw); + + if (radioGed != "publica_ged") { + log.info("PUBLICAR_DOCUMENTO LANCAMENTO_DOCUMENTO ########## Nao publicar no ECM (radio_ged diferente de publica_ged)."); + appendDebugPublicacao("publicarDocumento: radio_ged diferente de publica_ged."); + return; + } + + var attachments = hAPI.listAttachments(); + log.info("PUBLICAR_DOCUMENTO LANCAMENTO_DOCUMENTO ########## attachments.size=" + (attachments ? attachments.size() : 0)); + appendDebugPublicacao("publicarDocumento: attachments.size=" + (attachments ? attachments.size() : 0)); + + for (var i = 0; i < attachments.size(); i++) { + var docDto = attachments.get(i); + log.info("PUBLICAR_DOCUMENTO LANCAMENTO_DOCUMENTO ########## analisando anexo documentId=" + docDto.getDocumentId() + " version=" + docDto.getVersion() + " documentType=" + docDto.getDocumentType()); + appendDebugPublicacao("publicarDocumento: analisando documentId=" + docDto.getDocumentId() + " version=" + docDto.getVersion() + " type=" + docDto.getDocumentType()); + + try { + docAPI.copyDocumentToUploadArea(docDto.getDocumentId(), docDto.getVersion()); + + docDto.setDocumentId(0); + + var idPastaSelecionada = parseInt((hAPI.getCardValue("idPastaSelecionada") || "") + "", 10); + if (isNaN(idPastaSelecionada) || idPastaSelecionada <= 0) { + log.warn("PUBLICAR_DOCUMENTO LANCAMENTO_DOCUMENTO ########## idPastaSelecionada invalido. Documento nao sera publicado no ECM."); + appendDebugPublicacao("publicarDocumento: idPastaSelecionada invalido."); + continue; + } + + docDto.setParentDocumentId(idPastaSelecionada); + + var attachArray = new java.util.ArrayList(); + var mainAttach = docAPI.newAttachment(); + mainAttach.setFileName(docDto.getPhisicalFile()); + mainAttach.setPrincipal(true); + mainAttach.setAttach(false); + attachArray.add(mainAttach); + + docDto.setActiveVersion(true); + docDto.setColleagueId(getValue("WKUser")); + docDto.setPublisherId(getValue("WKUser")); + + if (hAPI.getCardValue("radio_data_validade") == "com_data_validade") { + docDto.setExpires(true); + + if (hAPI.getCardValue("inicio_validade") != "") { + var inicioValidade = (hAPI.getCardValue("inicio_validade") || "") + ""; + var dataInicioSplit = inicioValidade.split("-"); + var anoInicio = dataInicioSplit[0]; + var mesInicio = parseFloat(dataInicioSplit[1]) - 1; + var diaInicio = dataInicioSplit[2]; + var dInicio = new Date(anoInicio, mesInicio, diaInicio); + docDto.setValidationStartDate(dInicio); + } + + if (hAPI.getCardValue("expiracao_validade") != "") { + var dataVencimento = (hAPI.getCardValue("expiracao_validade") || "") + ""; + var dataSplit = dataVencimento.split("-"); + var ano = dataSplit[0]; + var mes = parseFloat(dataSplit[1]) - 1; + var dia = dataSplit[2]; + var d = new Date(ano, mes, dia); + docDto.setExpirationDate(d); + } + + if (hAPI.getCardValue("dias_antes_expiracao") != "") { + var diasAntesExpiracao = parseInt(hAPI.getCardValue("dias_antes_expiracao"), 10); + docDto.setNotificationDays(diasAntesExpiracao); + } + } else { + docDto.setExpires(false); + } + + log.info("PUBLICAR_DOCUMENTO LANCAMENTO_DOCUMENTO ########## before create document"); + var doc = docAPI.createDocument(docDto, attachArray, null, null, null); + log.info("PUBLICAR_DOCUMENTO LANCAMENTO_DOCUMENTO ########## DOCUMENTO CRIADO COM O ID: " + doc.getDocumentId()); + appendDebugPublicacao("publicarDocumento: documento publicado no ECM com id=" + doc.getDocumentId()); + } catch (e) { + log.error("PUBLICAR_DOCUMENTO LANCAMENTO_DOCUMENTO ########## falha ao publicar anexo documentId=" + docDto.getDocumentId() + " erro=" + e); + appendDebugPublicacao("publicarDocumento: ERRO ao publicar documentId=" + docDto.getDocumentId() + " erro=" + e); + } + } +} + +function appendDebugPublicacao(msg) { + try { + var atual = (hAPI.getCardValue("debug_publicacao") || "") + ""; + var prefix = atual ? atual + "\n" : ""; + hAPI.setCardValue("debug_publicacao", prefix + msg); + } catch (e) { + log.warn("appendDebugPublicacao falhou: " + e); + } +}