Questions and discussion about using ProcessMaker: user interface, running cases & functionality
#822529
Hi everybody
I want to change the default calendar of processmaker to Jalali calendar, I can set Jalali calendar with javascript but I don't know how to save and get current date time from the database. I think I must change core class but I can't find where is it.

Thanks in advance
#822550
Create a normal datetime field to save the results from your Jalali calendar. Then add this JavaScript to your Dynaform to hide the datetime field so the user doesn't see it and to copy the result from the Jalali calendar and insert it in the datetime field when the dynaform is submitted:
Code: Select all
$("#mydatetime").hide();

//copy date from mydatetime to Jalali calendar when Dynaform loads:
var jalali = $("#mydatetime").getValue(); //will be in "YYYY-MM-DD HH:MM:SS"  format
if (jalali != "") {
    //add your code to set your jalali calendar if mydatetime is not empty
}

var formId = $("form").prop("id");
getFormById(formId).setOnSubmit( function(){
   //copy date from Jalali calendar to mydatetime when the dynaform is submitted:
   var jalaliDate = //add your code here to get date in "YYYY-MM-DD HH:MM:SS" format
   $("#mydatetime").setValue(jalaliDate);
});
#822586
amosbatto wrote: Fri Jan 25, 2019 12:14 am Create a normal datetime field to save the results from your Jalali calendar. Then add this JavaScript to your Dynaform to hide the datetime field so the user doesn't see it and to copy the result from the Jalali calendar and insert it in the datetime field when the dynaform is submitted:
Code: Select all
$("#mydatetime").hide();

//copy date from mydatetime to Jalali calendar when Dynaform loads:
var jalali = $("#mydatetime").getValue(); //will be in "YYYY-MM-DD HH:MM:SS"  format
if (jalali != "") {
    //add your code to set your jalali calendar if mydatetime is not empty
}

var formId = $("form").prop("id");
getFormById(formId).setOnSubmit( function(){
   //copy date from Jalali calendar to mydatetime when the dynaform is submitted:
   var jalaliDate = //add your code here to get date in "YYYY-MM-DD HH:MM:SS" format
   $("#mydatetime").setValue(jalaliDate);
});
thank you, dear amosbatto but I want to write a plugin for it. read wiki of development but I dont know what i must to do exactly.
#822605
ProcessMaker's code to deal with dates is found at workflow/engine/classes/Dates.php, but that isn't going to help you. You would have to change the code for dealing with Dynaforms to add a new Jalali datetime field, which is very complicated.

Plugins aren't designed for changing the source code of the ProcessMaker core. If you already have JavaScript to display a Jalali calendar, then I recommend that you display it inside a Dynaform panel. Then, use JavaScript to save the value of the Jalali calendar in a string in a hidden field when the Dynaform is submitted. That way you don't have to touch the Processmaker source code.

These examples might help you:
viewtopic.php?f=41&t=713915#p796186
viewtopic.php?f=44&t=730764&p=815448#p815448
#823523
Dear Amosbatto,
I want to make the Jalali calendar in all of ProcessMaker's parts like process information, inbox,process map, and where ever.
At the moment, I can make Jalali calendar in dynaforms, How can I make it? Probably, I have to change various files in different paths to solve my problem. I would be appreciated if you help me so as to tackle my issue
Best Regards
#823539
mohamad wrote: Mon Mar 25, 2019 4:07 pm I want to make the Jalali calendar in all of ProcessMaker's parts like process information, inbox,process map, and where ever.
At the moment, I can make Jalali calendar in dynaforms, How can I make it? Probably, I have to change various files in different paths to solve my problem. I would be appreciated if you help me so as to tackle my issue
This is going to be difficult and it is probably better to not try to do this. However, if you are crazy enough to try, here are 4 possible ways to do this:
1. Maybe you could edit the file workflow/engine/src/ProcessMaker/Util/DateTime.php and change the functions convertTimeZone() and convertDataToTimeZone() to convert to a Jalali date.

2. Another option is to change the code of workflow/engine/classes/model/AppDelegation.php and workflow/engine/classes/model/Application.php files to write Jalali dates to the APP_DELEGATION and APPLICATION tables. For example, you could change $this->setDelDelegateDate(...) to code to insert a Jalali date, but MySQL expects the datetime fields to be written in the format "YYYY-MM-DD HH:MM:SS". (You might have to change these fields from datetime to string. I don't know how Jalali dates work, so I can't really tell you what is necessary.)

3. Create a plugin that displays your own case lists in place of the Home page or create an external web page to display the case lists using REST or web services. You can replace all the datetimes with Jalali dates.

4. Use the Custom Case List Builder to display the Jalali Dates in separate columns. This is probably the easiest solution and the only one that I can recommend. To get the datetimes for a case, you can use the Cases::LoadCase(@@APPLICATION, @%INDEX) function in a trigger to get information about the the current case. See: https://wiki.processmaker.com/3.0/Inter ... Case.28.29
#827115
amosbatto wrote: Mon Mar 25, 2019 10:40 pm
mohamad wrote: Mon Mar 25, 2019 4:07 pm I want to make the Jalali calendar in all of ProcessMaker's parts like process information, inbox,process map, and where ever.
At the moment, I can make Jalali calendar in dynaforms, How can I make it? Probably, I have to change various files in different paths to solve my problem. I would be appreciated if you help me so as to tackle my issue
This is going to be difficult and it is probably better to not try to do this. However, if you are crazy enough to try, here are 4 possible ways to do this:
1. Maybe you could edit the file workflow/engine/src/ProcessMaker/Util/DateTime.php and change the functions convertTimeZone() and convertDataToTimeZone() to convert to a Jalali date.

2. Another option is to change the code of workflow/engine/classes/model/AppDelegation.php and workflow/engine/classes/model/Application.php files to write Jalali dates to the APP_DELEGATION and APPLICATION tables. For example, you could change $this->setDelDelegateDate(...) to code to insert a Jalali date, but MySQL expects the datetime fields to be written in the format "YYYY-MM-DD HH:MM:SS". (You might have to change these fields from datetime to string. I don't know how Jalali dates work, so I can't really tell you what is necessary.)

3. Create a plugin that displays your own case lists in place of the Home page or create an external web page to display the case lists using REST or web services. You can replace all the datetimes with Jalali dates.

4. Use the Custom Case List Builder to display the Jalali Dates in separate columns. This is probably the easiest solution and the only one that I can recommend. To get the datetimes for a case, you can use the Cases::LoadCase(@@APPLICATION, @%INDEX) function in a trigger to get information about the the current case. See: https://wiki.processmaker.com/3.0/Inter ... Case.28.29
Thanks for great reply!

Hello. For rental housing, there are software solu[…]

Experience heightened pleasure with Cenforce 100 M[…]

Get an instant solution to move emails to MBOX for[…]

Most Demanding OST to PST Converter

The most demanding OST to PST Converter is TrijaT[…]