Workflow fails when cron is running if using business hours to calculate WF actions #5212

Open
opened 2026-02-20 16:31:27 -05:00 by deekerman · 0 comments
Owner

Originally created by @JackBuchanan on GitHub (Jun 16, 2024).

Issue

When using business hours to calculate date in workflow a 500 error is thrown when running from cron:

[16-Jun-2024 15:12:15 UTC] PHP Fatal error: Uncaught TypeError: AOBH_BusinessHours::addBusinessHours(): Argument #2 ($date) must be of type ?DateTime, bool given, called in /var/www/SuiteCRMCorePR/modules/AOW_Actions/actions/actionCreateRecord.php on line 279 and defined in /var/www/SuiteCRMCorePR/modules/AOBH_BusinessHours/AOBH_BusinessHours.php:185
Stack trace:
#0 /var/www/SuiteCRMCorePR/modules/AOW_Actions/actions/actionCreateRecord.php(279): AOBH_BusinessHours->addBusinessHours()
#1 /var/www/SuiteCRMCorePR/modules/AOW_Actions/actions/actionCreateRecord.php(170): actionCreateRecord->set_record()
#2 /var/www/SuiteCRMCorePR/modules/AOW_WorkFlow/AOW_WorkFlow.php(1046): actionCreateRecord->run_action()
#3 /var/www/SuiteCRMCorePR/modules/AOW_WorkFlow/AOW_WorkFlow.php(214): AOW_WorkFlow->run_actions()
#4 /var/www/SuiteCRMCorePR/modules/AOW_WorkFlow/AOW_WorkFlow.php(198): AOW_WorkFlow->run_flow()
#5 /var/www/SuiteCRMCorePR/modules/Schedulers/_AddJobsHere.php(836): AOW_WorkFlow->run_flows()
#6 /var/www/SuiteCRMCorePR/modules/SchedulersJobs/SchedulersJob.php(529): processAOW_Workflow()
#7 /var/www/SuiteCRMCorePR/include/SugarQueue/SugarCronJobs.php(191): SchedulersJob->runJob()
#8 /var/www/SuiteCRMCorePR/include/SugarQueue/SugarCronJobs.php(233): SugarCronJobs->executeJob()
#9 /var/www/SuiteCRMCorePR/cron.php(100): SugarCronJobs->runCycle()
#10 {main}
thrown in /var/www/SuiteCRMCorePR/modules/AOBH_BusinessHours/AOBH_BusinessHours.php on line 185

Possible Fix

No response

Steps to Reproduce the Issue

1. Create Workflow
2. Create Action where the business hours is used to calculate date field e.g. Date Created -> Date -> Date Created -> + -> 5 Business Hours
3. Run WF via cron

Context

No response

Version

7.14.2

What browser are you currently using?

Chrome

Browser Version

No response

Environment Information

php 8.2

Operating System and Version

Ubuntu 22

Originally created by @JackBuchanan on GitHub (Jun 16, 2024). ### Issue When using business hours to calculate date in workflow a 500 error is thrown when running from cron: [16-Jun-2024 15:12:15 UTC] PHP Fatal error: Uncaught TypeError: AOBH_BusinessHours::addBusinessHours(): Argument #2 ($date) must be of type ?DateTime, bool given, called in /var/www/SuiteCRMCorePR/modules/AOW_Actions/actions/actionCreateRecord.php on line 279 and defined in /var/www/SuiteCRMCorePR/modules/AOBH_BusinessHours/AOBH_BusinessHours.php:185 Stack trace: #0 /var/www/SuiteCRMCorePR/modules/AOW_Actions/actions/actionCreateRecord.php(279): AOBH_BusinessHours->addBusinessHours() #1 /var/www/SuiteCRMCorePR/modules/AOW_Actions/actions/actionCreateRecord.php(170): actionCreateRecord->set_record() #2 /var/www/SuiteCRMCorePR/modules/AOW_WorkFlow/AOW_WorkFlow.php(1046): actionCreateRecord->run_action() #3 /var/www/SuiteCRMCorePR/modules/AOW_WorkFlow/AOW_WorkFlow.php(214): AOW_WorkFlow->run_actions() #4 /var/www/SuiteCRMCorePR/modules/AOW_WorkFlow/AOW_WorkFlow.php(198): AOW_WorkFlow->run_flow() #5 /var/www/SuiteCRMCorePR/modules/Schedulers/_AddJobsHere.php(836): AOW_WorkFlow->run_flows() #6 /var/www/SuiteCRMCorePR/modules/SchedulersJobs/SchedulersJob.php(529): processAOW_Workflow() #7 /var/www/SuiteCRMCorePR/include/SugarQueue/SugarCronJobs.php(191): SchedulersJob->runJob() #8 /var/www/SuiteCRMCorePR/include/SugarQueue/SugarCronJobs.php(233): SugarCronJobs->executeJob() #9 /var/www/SuiteCRMCorePR/cron.php(100): SugarCronJobs->runCycle() #10 {main} thrown in /var/www/SuiteCRMCorePR/modules/AOBH_BusinessHours/AOBH_BusinessHours.php on line 185 ### Possible Fix _No response_ ### Steps to Reproduce the Issue ```bash 1. Create Workflow 2. Create Action where the business hours is used to calculate date field e.g. Date Created -> Date -> Date Created -> + -> 5 Business Hours 3. Run WF via cron ``` ### Context _No response_ ### Version 7.14.2 ### What browser are you currently using? Chrome ### Browser Version _No response_ ### Environment Information php 8.2 ### Operating System and Version Ubuntu 22
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/SuiteCRM-SuiteCRM#5212
No description provided.