tomolimo / processmaker-server

ProcessMaker Edition compatibles with GLPI via plugin
GNU Affero General Public License v3.0
10 stars 2 forks source link

file upload web control #11

Closed rohit-ambre-uno closed 6 years ago

rohit-ambre-uno commented 6 years ago

Dear @tomolimo , file upload web control is not available in processmaker-server which is very important for my use case. In processmaker 3.0 i have to use file web control for which i have to create input document which only allows me to upload only one document. if I set step as input document in designer it is not attaching documents in GLPI.

I want have multiple file upload in dynaform and which can be seen in further tasks of process.

tomolimo commented 6 years ago

Hello @rohit-ambre-uno Three questions/remarks:

  1. What is the "file upload web control"?
  2. please read this about input/output of documents: https://github.com/tomolimo/processmaker/wiki/Restrictions-of-use
  3. Do you run your process in Central or in Self-service interface?

What yo have to understand is that PM server is managing documents on its own, and of course not attaching uploaded document into GLPI.

We may imagine an enhancement to permit this, but as a workaround you may manage that asking your people to attach document into the Tickets (or Changes, or Problems).

Thank you Regards, Tomolimo

rohit-ambre-uno commented 6 years ago

To answer your questions

  1. processmaker introduced file upload web control in dynaform in PM 3.1 which enables to attach files in forms but as you are using processmaker 3.0 it does not have that plugin so by using 'file' web control available in PM3.0, i have to create input document. I followed documentation to use file web control and input document I am not able to use just input document as step in processmaker(it shows input document page in GLPI but it does not accepts file) and if i use file web control in dynaform then i can only upload single file(or else i have to use file web control multiple times in form)
  2. I understand this
  3. i ran my process in standard interface in GLPI

Yes, we can attach documents in GLPI but that's inconvenient for user

It would be much easier if PM server is upgraded to newer version

tomolimo commented 6 years ago

If you use the self-service interface then end-users can add documents to the ticket at the same time they are doing the first task of the chosen process.

Currently the input of document is not supported by the plug-in, even if the pm server is upgraded to latest version, I'm not sure that it will change something for the plug-in.

tomolimo commented 6 years ago

Hello @rohit-ambre-uno

I made a modification of the function that sends Dynaform data to PM server, so that the input document will be saved into the PM server. You may test it by adding the following code:

     // check if any files are in the $_FILES global array
      // and add them to the curl POST 
      if (isset($_FILES['form']['name'])) {
         foreach ($_FILES['form']['name'] as $key => $file) {
            $cfile = new CURLFile($_FILES['form']['tmp_name'][$key], $_FILES['form']['type'][$key],$_FILES['form']['name'][$key]);
            $data["form[$key]"] = $cfile;
         }
      }

This should be added into the function saveForm(...) in the processmaker.class.php source file, just before the line $ch = curl_init();

As example, here is the complete php file (beware that this file is for version 3.3.2) processmaker.class.php.zip

Could you do some tests, and give me feedback about these?

Thank you Regards, Tomolimo

tomolimo commented 6 years ago

This issue was moved to tomolimo/processmaker#78