Questions and discussion about developing processes and programming in PHP, JavaScript, web services & REST API.
Forum rules: Please search to see if a question has already asked before creating a new topic. Please don't post the same question in multiple forums.
By naapak
#814033
Hello we need to enter the companies employee number in the user registration form. So is it possible to create custom USR_ID for the users? If so where is the user form being called in the code to alter it? and how do I set it in the MySql?

This way we can use the employee number in the dynaforms. Any help here will be appreciated.
#814056
I don't have time to test this, but the basic steps would be:
1. Edit the file processmaker/gulliver/bin/tasks/templates/schema.xml.tpl. In <table name="USERS">, add extra columns to the USERS table.

2. Then, edit workflow/engine/classes/model/om/BaseUsersPeer.php and add your fields.

3. Then, enter these commands in the terminal of your PM server:
su or sudo su -
cd /opt/processmaker
php processmaker database-upgrade

This will add extra fields to the USERS table in the database.

4. Then, edit workflow/engine/templates/users/users.js and add your fields.

5. If you need any special processing when the user form is submitted, then also edit workflow/engine/methods/users/usersAjax.php and add code to the section under:
case 'userData':

I might be forgetting something, but start there and let me know if it works.
By naapak
#814071
Thank you Amosbatto. This will be a great first steps for me to start. I will let you know how it goes.

amosbatto wrote:I don't have time to test this, but the basic steps would be:
1. Edit the file processmaker/gulliver/bin/tasks/templates/schema.xml.tpl. In <table name="USERS">, add extra columns to the USERS table.

2. Then, edit workflow/engine/classes/model/om/BaseUsersPeer.php and add your fields.

3. Then, enter these commands in the terminal of your PM server:
su or sudo su -
cd /opt/processmaker
php processmaker database-upgrade

This will add extra fields to the USERS table in the database.

4. Then, edit workflow/engine/templates/users/users.js and add your fields.

5. If you need any special processing when the user form is submitted, then also edit workflow/engine/methods/users/usersAjax.php and add code to the section under:
case 'userData':

I might be forgetting something, but start there and let me know if it works.
By naapak
#814083
Hello Amosbatto,

I tried this your way but I Coudnt go past the field after creating it in the users.js. Thinking where I was wrong and All I wanted was to enter the employee number to the field. Since we already have to access of USR_ID from the database in
Code: Select all
var data = Ext.util.JSON.decode(r.responseText);
            usertmp = data.user;
in workflow/engine/templates/users/users.js and that I need to alter this number. So here is all that I changed in the users.js file to get the results.
Code: Select all
{
          id         : 'USR_ID',
          fieldLabel : '<span style=\"color:red;\" ext:qtip="'+ _('ID_FIELD_REQUIRED', _('Employee #')) +'"> * </span>' + _('Employee #'),
          xtype      : 'textfield',
          width      : 260,
          allowBlank : false
        },
in the var informationFields

Code: Select all
Ext.getCmp("frmDetails").getForm().setValues({
                USR_FIRSTNAME: data.user.USR_FIRSTNAME,
                USR_LASTNAME: data.user.USR_LASTNAME,
                USR_USERNAME: data.user.USR_USERNAME,
                USR_EMAIL: data.user.USR_EMAIL,
                USR_ADDRESS: data.user.USR_ADDRESS,
                USR_ZIP_CODE: data.user.USR_ZIP_CODE,
                USR_ID:data.user.USR_ID,
                USR_PHONE: data.user.USR_PHONE,
                USR_POSITION: data.user.USR_POSITION,
                USR_DUE_DATE: data.user.USR_DUE_DATE,
                USR_STATUS: data.user.USR_STATUS,
                /*----------------------------------********---------------------------------*/
                USR_LOGGED_NEXT_TIME: data.user.USR_LOGGED_NEXT_TIME
            });
in the loadUserData function
Code: Select all
Ext.getCmp("USR_ID2").setText(data.user.USR_ID);
in if (infoMode) in the loadUserData function.

End result is we have a new field Employee # in the user form. Where we can see the USR_ID and change this number. The only issue I see is that when we try to save new user with an existing USR_ID number, it does not save as there is error but the client does not see it.

Please let me know if you think there is a major issues you find with this method. Thank you so much for your help.
Attachments
Screen Shot 2018-04-17 at 5.02.43 PM.png
Screen Shot 2018-04-17 at 5.02.43 PM.png (60.51 KiB) Viewed 2954 times

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[…]

Betvisa clone scripts are pre-built software solut[…]