• Write automaticly ID in to ODT file at upload

  • We tried to make OpenKM as intuitive as possible, but an advice is always welcome.
We tried to make OpenKM as intuitive as possible, but an advice is always welcome.
Forum rules: Please, before asking something see the documentation wiki or use the search feature of the forum. And remember we don't have a crystal ball or mental readers, so if you post about an issue tell us which OpenKM are you using and also the browser and operating system version. For more info read How to Report Bugs Effectively.
 #40300  by stefbort
 
Hi everybody.
I wold like OpenKM to write an unique ID in the ODT file when I upload it, but I don't understund how do that.

I traied the guide "Incremental autonumeric" to generate an easy numeric unique ID for each document. Aftrer I tested the template system + form to insert, by hand, the data in to document and it works fine.
Now I wold like complete the test updating the script to ID generate from the script it goes in the LibreOffice file at the upload time.
My LibreOffice files have an tag/field name (okp_tpl_uuid), I have alredy insert the property group name (okp:tpl.uuid), the script "incremental autonumeric" are running and I am used the the community OpenKM 6.3.0 bundle pack.

Thanks in advance.
 #40302  by jllort
 
Really your case is not exactly the "create from template" problem but it's similar. You should take a look at ou source code for replacing the tag, but you can not use directly the create from template methods.
Do you have JAVA skills ? You should take a look at com.openkm.servlet.frontend.DocumentServlet.java, take a look at the private method ( into the method you have what you need to update the odt file ) :
Code: Select all
private File tmpFromTemplate(Document docTpl, List<GWTFormElement> formProperties, Map<String, List<Map<String, String>>> tableProperties)
 #40308  by stefbort
 
Thanks jllort.
I will see your suggestion.
About "create from template" was an idea, for me, to understand how work OpenKM.
My java skill is near "0" :( but I now a bit about programming (bash, php, .net)

But about my case is it possible to do the replacement by script at upload?
I am thinking a script in the OpenKM -> Administration -> Automation.

TANKS again.
 #40313  by jllort
 
Yes could be done in a script, basically getting almost code in the classes I shared to you and doing a checkout and check-in of the document.

The idea will be:
1- upload document
2- automation executed
2.0 - verify document is version 1.0 otherwise do nothing.
2.1 - document chekcout ( on edition )
2.2 - download the document -> getContent() -> InputStream to tmp file
2.3 - with some code in the classes I shared to you, modify the tmp file ( odt ) replacing the tag with the number
2.4 - checkin new version of document ( 1.1 ) from tmp file
 #40333  by jllort
 
Here's the doxygen documentation http://doxygen.openkm.com/openkm_6.3.0/ you should have interest in com.openkm.api.* classes http://doxygen.openkm.com/openkm_6.3.0/ ... _1api.html ( actually are still not described in our documentation, but is something also we will do ).

About Us

OpenKM is part of the management software. A management software is a program that facilitates the accomplishment of administrative tasks. OpenKM is a document management system that allows you to manage business content and workflow in a more efficient way. Document managers guarantee data protection by establishing information security for business content.