Case Files Professional Error:

Post Reply
yaoying
Posts: 133
Joined: 10 Apr 2023, 23:23
Name: 耀影
Location: 深圳
Company Name: 深圳市耀影科技有限公司
Contact:

Case Files Professional Error:

Post by yaoying »

Case Files Professional
https://www.rukovoditel.net/database_templates.php?id=2

After importing the data template, there is a background error

Code: Select all

Database Error: 1305 - FUNCTION rukovoditel.rukovoditel_hours_diff does not exist
Query: select e.* ,rukovoditel_hours_diff(e.field_1272,e.field_1491,'','','') as field_1492 from app_entity_78 e where e.id>0 and ((FROM_UNIXTIME(field_1272,'%Y-%m-%d')=date_format(DATE_SUB(now(),INTERVAL 1 DAY),'%Y-%m-%d') or FROM_UNIXTIME(field_1272,'%Y-%m-%d')=date_format(DATE_SUB(now(),INTERVAL 2 DAY),'%Y-%m-%d')))
Page: /index.php?module=dashboard/
#0 includes/functions/database.php(87): mysqli_query()
#1 includes/classes/reports/reports_counter.php(195): db_query()
#2 includes/classes/reports/reports_counter.php(46): reports_counter->get_reports_details()
#3 modules/dashboard/views/dashboard.php(17): reports_counter->render()
#4 template/layout.php(155): require('...')
#5 index.php(32): require('...')
#6 {main}
Attachments
截图_选择区域_20230427181417.png
User avatar
support
Site Admin
Posts: 6215
Joined: 19 Oct 2014, 18:22
Name: Sergey Kharchishin
Location: Russia, Evpatoriya

Re: Case Files Professional Error:

Post by support »

Go to entities page/fields configuration and just Edit field with type hours_diff
The function rukovoditel_hours_diff will be created automatically.

FILEINFO extension should be enabled in php.ini
yaoying
Posts: 133
Joined: 10 Apr 2023, 23:23
Name: 耀影
Location: 深圳
Company Name: 深圳市耀影科技有限公司
Contact:

Re: Case Files Professional Error:

Post by yaoying »

Edit the field, but make a mistake

Code: Select all

Database Error: 1418 - This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)
Query: CREATE FUNCTION `rukovoditel_hours_diff`(`start_date` INT, `end_date` INT, `include_hours` VARCHAR(255), `exclude_days` VARCHAR(64), `exclude_holidays` TINYINT(1)) RETURNS FLOAT BEGIN DECLARE minutes_diff INT; DECLARE inc_minue TINYINT; DECLARE minutes_start TINYINT; DECLARE use_minutes_start TINYINT; DECLARE minutes_end TINYINT; IF start_date>0 and end_date>0 and end_date>start_date THEN #skip while if no restriction IF length(exclude_days)=0 and length(include_hours)=0 and exclude_holidays!=1 THEN RETURN (end_date-start_date)/3600; END IF; SET minutes_diff = 0; SET use_minutes_start = 0; SET minutes_start = MINUTE(FROM_UNIXTIME(start_date,'%Y-%m-%d %H:%i')); SET minutes_end = MINUTE(FROM_UNIXTIME(end_date,'%Y-%m-%d %H:%i')); SET start_date = start_date-(minutes_start*60); WHILE start_date<end_date DO SET inc_minue=1; #exclude day of week IF find_in_set(DAYOFWEEK(FROM_UNIXTIME(start_date,'%Y-%m-%d')),exclude_days) THEN SET inc_minue=0; END IF; #exclude not working hours IF find_in_set(HOUR(FROM_UNIXTIME(start_date,'%Y-%m-%d %H:%i')),include_hours)=0 and length(include_hours)>0 THEN SET inc_minue=0; END IF; #exclude holidays IF exclude_holidays=1 THEN SET @start_date_var = FROM_UNIXTIME(start_date,'%Y-%m-%d'); SET @is_holiday = (select count(*) from app_holidays h where h.start_date<= @start_date_var and h.end_date>=@start_date_var); if @is_holiday!=0 THEN SET inc_minue=0; END if; END IF; IF inc_minue=1 THEN SET minutes_diff =minutes_diff+60; END IF; #handle first hour minute IF inc_minue=1 and use_minutes_start=0 THEN SET use_minutes_start=1; ELSEIF use_minutes_start=0 THEN SET use_minutes_start=2; END IF; SET start_date = start_date+3600; END WHILE; #handle start minutes IF use_minutes_start=1 THEN SET minutes_diff =minutes_diff-minutes_start; END IF; #handle end minutes IF minutes_end>0 and inc_minue=1 THEN SET minutes_diff =(minutes_diff-60)+minutes_end; END IF; END IF; IF minutes_diff>0 THEN RETURN minutes_diff/60; ELSE RETURN 0; END IF; END;
Page: /index.php?module=entities/fields_configuration
#0 includes/functions/database.php(87): mysqli_query()
#1 includes/classes/fieldstypes/fieldtype_hours_difference.php(196): db_query()
#2 includes/classes/fieldstypes/fieldtype_hours_difference.php(48): fieldtype_hours_difference::prepare_procedure()
#3 modules/entities/actions/fields_configuration.php(25): fieldtype_hours_difference->get_configuration()
#4 index.php(20): require('...')
#5 {main}
But I solved the problem by here
viewtopic.php?p=3619&hilit=rukovoditel_hours_diff#p3619

Code: Select all

mysql> SET GLOBAL log_bin_trust_function_creators = 1;
Attachments
录屏_选择区域_20230428011146.gif
Post Reply