nulog format

Questions related to customising nuBuilder Forte with JavaScript or PHP.

nulog format

Unread postby vario » Wed May 05, 2021 9:39 pm

Hi,
Is there any reason why I should not change the logged user and time to a more user-friendly format?
I would choose #LOGIN_NAME# and date('Y-m-d H:i:s') for my purposes.

Neil.
vario
 
Posts: 72
Joined: Mon Dec 05, 2011 8:53 pm
Location: Newton Abbot, UK
nuBuilder Version: 4.5

Re: nulog format

Unread postby kev1n » Thu May 06, 2021 2:36 am

One of the primary benefits of using Unix time is that it can be represented as an integer making it easier to parse and use across different systems. And depending on the country and preference, different formats would be chosen.

To parse the unix date (and then also display it in your preferred format), check out:
https://github.com/nuBuilder/nuBuilder- ... g_activity
https://github.com/nuBuilder/nuBuilder- ... g_activity
kev1n
nuBuilder Team
 
Posts: 2012
Joined: Mon Oct 15, 2018 2:13 am
nuBuilder Version: 4.5

Re: nulog format

Unread postby vario » Sat May 08, 2021 3:11 pm

I have added the code but it shows zzzzsys_user_id rather than the readable sus_login_name or sus_name I want. Are there going to be any bugs if I change the stored user to LOGIN_NAME at line 172 of nudata.php?

Neil
vario
 
Posts: 72
Joined: Mon Dec 05, 2011 8:53 pm
Location: Newton Abbot, UK
nuBuilder Version: 4.5

Re: nulog format

Unread postby kev1n » Sat May 08, 2021 7:31 pm

I will try adding an additional format to the nulog column so you can use either of them
kev1n
nuBuilder Team
 
Posts: 2012
Joined: Mon Oct 15, 2018 2:13 am
nuBuilder Version: 4.5

Re: nulog format

Unread postby vario » Sat May 08, 2021 8:21 pm

OK thanks - I have modified nudata.php anyway to test and all working well. If anyone else is interested here is a bit of SQL to update existing data (presuming your SQL supports the regexp code).

Code: Select all
update yourtable
join zzzzsys_user on (zzzzsys_user_id = regexp_substr(yourtable_nulog,'"added":{"user":"\\K[0-9a-z]+'))
set yourtable_nulog = replace(yourtable_nulog,regexp_substr(yourtable_nulog,'"added":{"user":"\\K[0-9a-z]+'),sus_login_name)


Repeat as required for "edited" and so on.
vario
 
Posts: 72
Joined: Mon Dec 05, 2011 8:53 pm
Location: Newton Abbot, UK
nuBuilder Version: 4.5


Return to Custom Code

Who is online

Users browsing this forum: No registered users and 4 guests