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}