Questions and discussion about using ProcessMaker: user interface, running cases & functionality
By shailoz
#814127
Hi everyone,

Is there a way to export the documents in the document management system in the same format and structure in which they are set up?

For example if my files are stored in the following format:

Department —> case no. —> doc 1

Then I would like to access the files in the same way as they would appear in windows explorer?

If PM does not offer this functionality, then is there any plugin or 3rd party product that can do it?

Thanks
By shailoz
#814210
Dear Amos,

I tried to upload the tar file to PM but it fails due to 'invalid file' error. I have also tried to open it with winzip but I get the same error. Can you please check and provide a new file?

Thank you
By shailoz
#814257
Hi Amos,

Sorry to trouble you but I am a bit stuck with these .... this may be a dumb question but I cannot get this to work.

I thought I will try the wiki example caselister as I have never used REST API (I am not a developer) and got that to work. I then thought I can try the same on the folders and content points you provided.

It all works fine except that instead of the output data I get "undefined".

I am using the same code as caselister (with tokens updated for new). I suspect the issue may be in the variable assignment in the todo-list.html file (i.e. record.FOLDER_UID as below)

I tried using lower case and upper case but cannot get the data out. Is there something obvious that I am not doing right?

Thank you in advance.

Shailoz


extract from todo-list.html file (I renamed it to folder-list.html)
Code: Select all
    <script>
      $(document).ready( function() {
        $.get("app-data.json", function(appdata) {
          //Change the server name and the workspace
          var apiserver = 'http://206.189.xx.xx/api/1.0/workflow';
          var endpoint = '/extrarest/documents/root/folders';

          $.ajax({
             url: apiserver + endpoint,
             type: "GET",
             contentType: false,
             beforeSend: function(request) {
                request.setRequestHeader("Authorization", "Bearer " + appdata.access_token);
             },
             success: function (data) {
                console.log(data);
                $.each(data, function(index, record) {
                   $('#folder-list').append('<li><a href="#" class="ui-btn ui-btn-icon-right ui-icon-carat-r">Folder #' +
                     record.FOLDER_UID + '</b> - ' + [b]record.folder_name[/b] + '</a></li>');
                });
             }
          });
        },
        'json'
        );
      });
    </script>
By shailoz
#814290
Hi Amos,

Thank you again for your prompt response. However, when I implement the Dynaform and run it, it lists the folders but not the files (content). I have looked to see whether I can find the issue but unfortunately I cannot. I re-created the Dynaform as the one provided in GitHub is blank so I am wondering if it's the same issue with GitHub corrupting files?

Your assistance will be greatly appreciated (as usual).

Regards,

Shailoz
By shailoz
#814303
Hi Amos,

Thank you again, however, I am still not getting the content of the folders. I only get the folders but no files and now there is an error message (pop up says: This site says ... [object Object]

I am not sure if I am doing something wrong, but I don't know how to make it work. I have increased max_execution_time and tried changing some of the code but still it does not display folders.

Can you please check?

Thanks
User avatar
By amosbatto
#814338
Oh, I see that alert(error) isn't displaying the error message correctly.

To display the error message, change your JavaScript code to this:
Code: Select all
var host = PMDynaform.getHostName();              // get the hostname
var ws = PMDynaform.getWorkspaceName();           // get the current workspace
var token = PMDynaform.getAccessToken();          // get the access Token
var listTree = '';

function getSubfolders(folderId, indent, startingFolder) {
    if (folderId == "root") {
        listTree = "<ul><li>\/</li>\n";
        indent += '  ';
    }
    else if (startingFolder == true) {
        listTree = '';
    }
  
    $.ajax({
        url: host+"/api/1.0/"+ws+"/extrarest/documents/"+folderId+"/folders",                
        type: "GET",
        async: false, 
        beforeSend: function(xhr){
          xhr.setRequestHeader('Authorization', 'Bearer '+token);
        },       
        success: function(oFolders) {
          //console.log(oFolders); //for debug
          listTree += "<ul>\n";
          
          for (var idx = 0; idx < oFolders.folders.length; idx++) {
            console.log(idx + ":"+ oFolders.folders[idx].FOLDER_NAME);
            
            listTree += indent + "<li><strong>" + oFolders.folders[idx].FOLDER_NAME + "</strong></li>\n";
            getSubfolders(oFolders.folders[idx].FOLDER_UID, indent+"  ", false);
          }
          
          getFolderContents(folderId, indent);
          listTree += "</ul>\n";
          
          if (folderId == "root") {
            listTree += "</ul>\n";
          }
          
          if (folderId == "root" || startingFolder == true) {
            $("#docListPanel").find("div.panel-body").html(listTree);
          }
        },
        contentType: "application/json; charset=utf-8",
          error:function(jqXHR, textStatus, errorThrown) {
          alert(textStatus+": "+errorThrown);
          }
    });
}

function getFolderContents(folderId, indent) {
  $.ajax({
        url: host+"/api/1.0/"+ws+"/extrarest/documents/"+folderId+"/contents?limit=50",                 
        type: "GET",
        async: false,
        beforeSend: function(xhr){
          xhr.setRequestHeader('Authorization', 'Bearer '+token);
        },       
        success: function(oDocList) {
          console.log(oDocList);                        
          for (i = 0; i < oDocList.documents.length; i++) { 
            if (oDocList.documents[i].APP_DOC_TYPE == 'OUTPUT') {  
              listTree += indent + '<li><a href="' + oDocList.documents[i].DOWNLOAD_LINK +
                  '">' + oDocList.documents[i].APP_DOC_FILENAME + 
                oDocList.documents[i].DOWNLOAD_LABEL + "</a></li>\n";
              
              if (oDocList.documents[i].DOWNLOAD_LINK1 != '') {
                  listTree += indent + '<li><a href="' + oDocList.documents[i].DOWNLOAD_LINK1 +
                      '">' + oDocList.documents[i].APP_DOC_FILENAME + 
                    oDocList.documents[i].DOWNLOAD_LABEL1 + "</a></li>\n";
              }
            }
            else { // if an Input Document or attached file:
              listTree += indent + '<li><a href="' + oDocList.documents[i].DOWNLOAD_LINK +
                  '">' + oDocList.documents[i].APP_DOC_FILENAME + "</a></li>\n";
            }
          }  
        },
        contentType: "application/json; charset=utf-8",
        error:function(jqXHR, textStatus, errorThrown) {
          alert(textStatus+": "+errorThrown);
          }
    });
}

function getDocList() {
  getSubfolders("root", "");  
}

$("#docListBtn").find('button').click(getDocList); 
What error message do you see?
By shailoz
#814354
Hi Amos,

the error I am getting is:

parsererror SyntaxError JSON.parse Invalid character at position:1

If I select to not show any errors then it provides the folder list but does not show any of the files in the folders.

I am not sure why not? Appreciate if you can provide any help

Thanks
User avatar
By amosbatto
#814378
Maybe it is timing out. Try changing from:
Code: Select all
url: host+"/api/1.0/"+ws+"/extrarest/documents/"+folderId+"/contents?limit=50",
To:
Code: Select all
url: host+"/api/1.0/"+ws+"/extrarest/documents/"+folderId+"/contents?limit=10",
If that doesn't work, try displaying the files in the root folder. Try changing from:
Code: Select all
function getDocList() {
  getSubfolders("root", "");  
}
To:
Code: Select all
function getDocList() {
  getFolderContents("root", ""); 
  $("#docListPanel").find("div.panel-body").html(listTree); 
}
By shailoz
#814397
Hi Amos,

Still no luck but I think I made some progress using the debugger.

I noticed that it appears that the script does not find any files in the folders and therefore the oDocList.documents.length parameter is zero.
However, using the Network logs I see that it retrieves the contents but also notices and warnings which makes me think that that this is an invalid JSON response. Not sure if I am right as this is still new to me. I also notice that I get a 200/OK message when looking at headers

Is there some setting I need to be aware of?

Below is a copy of the logs ...

<br />
<b>Notice</b>: Undefined index: USER_LOGGED in <b>/opt/processmaker/workflow/engine/classes/model/AppFolder.php</b> on line <b>804</b><br />
<br />
<b>Notice</b>: Undefined index: USER_LOGGED in <b>/opt/processmaker/workflow/engine/classes/model/AppFolder.php</b> on line <b>568</b><br />
<br />
<b>Notice</b>: Undefined index: USER_LOGGED in <b>/opt/processmaker/workflow/engine/classes/model/AppFolder.php</b> on line <b>804</b><br />
<br />
<b>Notice</b>: Undefined index: USER_LOGGED in <b>/opt/processmaker/workflow/engine/classes/model/AppFolder.php</b> on line <b>568</b><br />
<br />
<b>Notice</b>: Undefined index: USER_LOGGED in <b>/opt/processmaker/workflow/engine/classes/model/AppFolder.php</b> on line <b>804</b><br />
<br />
<b>Notice</b>: Undefined index: USER_LOGGED in <b>/opt/processmaker/workflow/engine/classes/model/AppFolder.php</b> on line <b>568</b><br />
<br />
<b>Notice</b>: Undefined index: USER_LOGGED in <b>/opt/processmaker/workflow/engine/classes/model/AppFolder.php</b> on line <b>804</b><br />
<br />
<b>Notice</b>: Undefined index: USER_LOGGED in <b>/opt/processmaker/workflow/engine/classes/model/AppFolder.php</b> on line <b>568</b><br />
<br />
<b>Notice</b>: Undefined index: USER_LOGGED in <b>/opt/processmaker/workflow/engine/classes/model/AppFolder.php</b> on line <b>804</b><br />
<br />
<b>Notice</b>: Undefined index: USER_LOGGED in <b>/opt/processmaker/workflow/engine/classes/model/AppFolder.php</b> on line <b>568</b><br />
<br />
<b>Notice</b>: Undefined offset: 5 in <b>/opt/processmaker/workflow/engine/plugins/extraRest/src/Services/Api/ExtraRest/Extra.php</b> on line <b>1175</b><br />
<br />
<b>Warning</b>: Invalid argument supplied for foreach() in <b>/opt/processmaker/workflow/engine/plugins/extraRest/src/Services/Api/ExtraRest/Extra.php</b> on line <b>1175</b><br />
<br />
<b>Notice</b>: Undefined offset: 6 in <b>/opt/processmaker/workflow/engine/plugins/extraRest/src/Services/Api/ExtraRest/Extra.php</b> on line <b>1175</b><br />
<br />
<b>Warning</b>: Invalid argument supplied for foreach() in <b>/opt/processmaker/workflow/engine/plugins/extraRest/src/Services/Api/ExtraRest/Extra.php</b> on line <b>1175</b><br />
<br />
<b>Notice</b>: Undefined offset: 7 in <b>/opt/processmaker/workflow/engine/plugins/extraRest/src/Services/Api/ExtraRest/Extra.php</b> on line <b>1175</b><br />
<br />
<b>Warning</b>: Invalid argument supplied for foreach() in <b>/opt/processmaker/workflow/engine/plugins/extraRest/src/Services/Api/ExtraRest/Extra.php</b> on line <b>1175</b><br />
<br />
<b>Notice</b>: Undefined offset: 8 in <b>/opt/processmaker/workflow/engine/plugins/extraRest/src/Services/Api/ExtraRest/Extra.php</b> on line <b>1175</b><br />
<br />
<b>Warning</b>: Invalid argument supplied for foreach() in <b>/opt/processmaker/workflow/engine/plugins/extraRest/src/Services/Api/ExtraRest/Extra.php</b> on line <b>1175</b><br />
<br />
<b>Notice</b>: Undefined offset: 9 in <b>/opt/processmaker/workflow/engine/plugins/extraRest/src/Services/Api/ExtraRest/Extra.php</b> on line <b>1175</b><br />
<br />
<b>Warning</b>: Invalid argument supplied for foreach() in <b>/opt/processmaker/workflow/engine/plugins/extraRest/src/Services/Api/ExtraRest/Extra.php</b> on line <b>1175</b><br />
<br />
<b>Notice</b>: Undefined offset: 10 in <b>/opt/processmaker/workflow/engine/plugins/extraRest/src/Services/Api/ExtraRest/Extra.php</b> on line <b>1175</b><br />
<br />
<b>Warning</b>: Invalid argument supplied for foreach() in <b>/opt/processmaker/workflow/engine/plugins/extraRest/src/Services/Api/ExtraRest/Extra.php</b> on line <b>1175</b><br />
<br />
<b>Notice</b>: Undefined offset: 11 in <b>/opt/processmaker/workflow/engine/plugins/extraRest/src/Services/Api/ExtraRest/Extra.php</b> on line <b>1175</b><br />
<br />
<b>Warning</b>: Invalid argument supplied for foreach() in <b>/opt/processmaker/workflow/engine/plugins/extraRest/src/Services/Api/ExtraRest/Extra.php</b> on line <b>1175</b><br />
{"documents":[{"APP_DOC_UID":"9671774915adff817ead924079902240","APP_DOC_FILENAME":"getPhoto (8).jpg","APP_DOC_COMMENT":"","DOC_VERSION":1,"APP_UID":"6774663585adff765660e94094684721","DEL_INDEX":3,"DOC_UID":"-1","USR_UID":"4791085325ad407ad3d9997099613661","APP_DOC_TYPE":"ATTACHED","APP_DOC_CREATE_DATE":"2018-04-25 11:37:59","APP_DOC_INDEX":4,"FOLDER_UID":"","APP_DOC_PLUGIN":"","APP_DOC_TAGS":null,"APP_DOC_STATUS":"ACTIVE","APP_DOC_STATUS_DATE":null,"APP_DOC_FIELDNAME":"varNoticeOfVariationDocumentsOther","APP_DOC_DRIVE_DOWNLOAD":null,"SYNC_WITH_DRIVE":"UNSYNCHRONIZED",
By shailoz
#814485
Hi Amos,

I have installed the latest .tar (v1.4) and I can see that it sees more files. However, whatever I try I still cannot get the files listed. I am still getting html errors when looking at the developer tools (F12) and the files are not listed. However, I can see that the information is returned in the JSON response.

I tried switching off errors in the php.ini files but I still get the html errors. I am not sure what to do and I cannot figure out what is causing the html errors.

If I understand correctly, the JSON response is rejected as it is not "clean" and that is why I cannot see the files?

Any suggestions?

Shailoz
User avatar
By amosbatto
#814490
shailoz wrote:I have installed the latest .tar (v1.4) and I can see that it sees more files. However, whatever I try I still cannot get the files listed. I am still getting html errors when looking at the developer tools (F12) and the files are not listed. However, I can see that the information is returned in the JSON response.
Can you post the errors that you see? It's really hard to debug without that information.
By shailoz
#814494
See my response above and also below:

<br />
<b>Notice</b>: Undefined index: USER_LOGGED in <b>/opt/processmaker/workflow/engine/classes/model/AppFolder.php</b> on line <b>804</b><br />
<br />
<b>Notice</b>: Undefined index: USER_LOGGED in <b>/opt/processmaker/workflow/engine/classes/model/AppFolder.php</b> on line <b>568</b><br />
{"documents":[{"APP_DOC_UID":"6960030245ae960fb4dcad6008821267","APP_DOC_FILENAME":"getPhoto (5).jpg","APP_DOC_COMMENT":"","DOC_VERSION":1,"APP_UID":"5334995345ae960ab63cad0056006366","DEL_INDEX":1,"DOC_UID":"5233296395adeaa1d040e80012224808","USR_UID":"5670316545ad4085383dce6041092145","APP_DOC_TYPE":"INPUT","APP_DOC_CREATE_DATE":"2018-05-02 14:55:55","APP_DOC_INDEX":1,"FOLDER_UID":"1758731895ae960fb4c9f96066263473","APP_DOC_PLUGIN":"","APP_DOC_TAGS":null,"APP_DOC_STATUS":"ACTIVE","APP_DOC_STATUS_DATE":null,"APP_DOC_FIELDNAME":"varDirectionDocuments","APP_DOC_DRIVE_DOWNLOAD":null,"SYNC_WITH_DRIVE":"UNSYNCHRONIZED","SYNC_PERMISSIONS":null,"APP_TITLE":"8","APP_DESCRIPTION":"","APP_NUMBER":118,"APP_PARENT":"","APP_STATUS":"TO_DO","PRO_UID":"5889086015ad8329791eed8067207574","APP_PROC_CODE":"","STATUS":"To do","CREATOR":"Sha Liu","CREATE_DATE":"2018-05-02 14:54:35","UPDATE_DATE":"2018-05-02 15:02:53","PRO_TITLE":"Directions","INP_DOC_UID":"5233296395adeaa1d040e80012224808","INP_DOC_TITLE":"Direction Documents","INP_DOC_DESCRIPTION":"","INP_DOC_FORM_NEEDED":"VIRTUAL","INP_DOC_ORIGINAL":"ORIGINAL","INP_DOC_PUBLISHED":"PRIVATE","INP_DOC_VERSIONING":1,"INP_DOC_DESTINATION_PATH":"@#varProjectTitle\/@#varProcessTitle\/@#varID\/Direction\/","INP_DOC_TAGS":"INPUT","INP_DOC_TYPE_FILE":".*","INP_DOC_MAX_FILESIZE":0,"INP_DOC_MAX_FILESIZE_UNIT":"MB","USR_USERNAME":"sha.liu","USR_FIRSTNAME":"Sha","USR_LASTNAME":"Liu","DELETE_LABEL":"Delete","DOWNLOAD_LABEL":"Download","DOWNLOAD_LINK":"..\/cases\/cases_ShowDocument?a=6960030245ae960fb4dcad6008821267&v=1","DOWNLOAD_LABEL1":"","DOWNLOAD_LINK1":"","APP_DOC_UID_VERSION":"6960030245ae960fb4dcad6008821267_1"}],"totalDocumentsCount":1}
By shailoz
#814520
Hi Amos,

Thank you for your help again.

Yes it works. I can now see the documents in the folders so that is a major step forward. The documents are shown as links. However, when I try clicking on them to view the documents I get a 403 Access denied error. I am logged in a Admin and should have all permissions enabled.

I am not sure what the exact functionality should be. Should I be able to click the files to open them?

Kind regards,

Shailoz
User avatar
By amosbatto
#814527
shailoz wrote:However, when I try clicking on them to view the documents I get a 403 Access denied error. I am logged in a Admin and should have all permissions enabled.
There are restrictions to downloading files when you don't have an open login session inside ProcessMaker. Read this post for an explanation how to get around them:
viewtopic.php?f=44&t=730371&p=813761#p813761
User avatar
By amosbatto
#819311
william191 wrote: Mon Nov 26, 2018 8:31 am Hello Guys,

My company the big document management services provide for any company but problem is my company document service all of the world provide for someone else please company provide export service suggest me.

Thanks!
Is this a question about ProcessMaker? If you want to export your documents from ProcessMaker, then see:
viewtopic.php?f=44&t=730621&p=814744#p814744
viewtopic.php?f=7&t=708801&p=784350#p784350


If you just need a document management service, see this list:
https://www.capterra.com/document-management-software/
By adam1109
#823827
I also want to know if there is any third party application or any plug-in to get the document in the same format . I had also faced the problems when i had moved my document form one system to other . But i had found some of the document management services which has helped me to move ahead but now i need much more better service then before which can complete my all the required needs regarding my document management.
User avatar
By EvilKiller
#829587
Document management software / system assists with putting away, access, oversee, control, and track computerized archives and electronic pictures of paper-based data that has been caught through report examining innovation, or ingested as an advanced record.

A 1xbet clone script is a pre-designed software so[…]

4rabet clone script is enabling entrepreneurs to e[…]

Parimatch clone script is enabling entrepreneurs t[…]

In the world of cryptocurrency, a wallet is an app[…]