Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creation of Project with Template Causes 500 Error #10321

Closed
pstevens71 opened this issue Jan 19, 2024 · 1 comment
Closed

Creation of Project with Template Causes 500 Error #10321

pstevens71 opened this issue Jan 19, 2024 · 1 comment
Labels
Area:Projects Issues & PRs related to all things regarding to the Projects Module Priority:Important Issues & PRs that are important; broken functions, errors - there are workarounds Status:Fix Proposed A issue that has a PR related to it that provides a possible resolution Type: Bug Bugs within the core SuiteCRM codebase

Comments

@pstevens71
Copy link
Contributor

pstevens71 commented Jan 19, 2024

Issue

When a project is created with a template a 500 error is generated:

[18-Jan-2024 21:30:25 UTC] PHP Fatal error:  Uncaught Error: Call to a member function format() on bool in MYINSTALL.com/modules/Project/Project.php:625
Stack trace:
#0 MYINSTALL.com/modules/AOW_Actions/actions/actionCreateRecord.php(410): Project->save(false)
#1 MYINSTALL.com/modules/AOW_Actions/actions/actionModifyRecord.php(126): actionCreateRecord->set_record(Object(Project), Object(Project), Array, true)
#2 MYINSTALL.com/modules/AOW_WorkFlow/AOW_WorkFlow.php(1027): actionModifyRecord->run_action(Object(Project), Array, true)
#3 MYINSTALL.com/modules/AOW_WorkFlow/AOW_WorkFlow.php(231): AOW_WorkFlow->run_actions(Object(Project), true)
#4 MYINSTALL.com/include/utils/LogicHook.php(261): AOW_WorkFlow->run_bean_flows(Object(Project), 'after_save', '')
#5 MYINSTALL.com/include/utils/LogicHook.php(202): LogicHook->process_hooks(Array, 'after_save', '')
#6 MYINSTALL.com/data/SugarBean.php(3185): LogicHook->call_custom_logic('Project', 'after_save', '')
#7 MYINSTALL.com/data/SugarBean.php(2432): SugarBean->call_custom_logic('after_save', '')
#8 MYINSTALL.com/modules/Project/Project.php(436): SugarBean->save(false)
#9 MYINSTALL.com/modules/Project/Save.php(112): Project->save(false)
#10 MYINSTALL.com/include/MVC/View/SugarView.php(824): include_once('/home/pablostev...')
#11 MYINSTALL.com/include/MVC/View/views/view.classic.php(72): SugarView->includeClassicFile('modules/Project...')
#12 MYINSTALL.com/include/MVC/View/SugarView.php(210): ViewClassic->display()
#13 MYINSTALL.com/include/MVC/Controller/SugarController.php(432): SugarView->process()
#14 MYINSTALL.com/include/MVC/Controller/SugarController.php(363): SugarController->processView()
#15 MYINSTALL.com/include/MVC/SugarApplication.php(101): SugarController->execute()
#16 MYINSTALL.com/index.php(52): SugarApplication->execute()
#17 {main}
  thrown in MYINSTALL.com/modules/Project/Project.php on line 625

Upon further investigation line 625:
$start = $startdate->format('Y-m-d');
$start_date is null after first iteration causing it to return Boolean false instead of the date.

Expected Behavior

The function should iterate through the loop and populate the $start_date with the start date of the task.

Actual Behavior

What actually happens is after the first loop, the $enddate_array[] is re-inialized causing it to be empty and thus causing the rest of the function to fail because a Boolean value false cannot be converted to a date.

Possible Fix

I've reviewed this recent update.
9aff707

Where:

$enddate_array = [];
is supposed to be inserted at line 330, but it's actually inserted on line 613
commenting it out at line 613 solves the problem and it works as expected.
Adding it back at line 330 causes no issues.

Steps to Reproduce

  1. Create a project
  2. Add a template with MORE than one task
  3. Save the Project
  4. 500 error

Context

This bug prevents projects from being created from templates.

Your Environment

  • SuiteCRM Version used: 7.14.2
  • Browser name and version (e.g. Chrome Version 51.0.2704.63 (64-bit)): Chrome
  • Environment name and version (e.g. MySQL, PHP 7): PHP 8.1
  • Operating System and version (e.g Ubuntu 16.04): Centos 7
@pstevens71
Copy link
Contributor Author

pstevens71 commented Jan 19, 2024

Here's the PR to fix this:

#10322

@johnM2401 johnM2401 added Type: Bug Bugs within the core SuiteCRM codebase Status:Fix Proposed A issue that has a PR related to it that provides a possible resolution Priority:Important Issues & PRs that are important; broken functions, errors - there are workarounds Area:Projects Issues & PRs related to all things regarding to the Projects Module labels Jan 22, 2024
jack7anderson7 pushed a commit to pstevens71/SuiteCRM that referenced this issue Jan 23, 2024
jack7anderson7 pushed a commit to pstevens71/SuiteCRM that referenced this issue Feb 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area:Projects Issues & PRs related to all things regarding to the Projects Module Priority:Important Issues & PRs that are important; broken functions, errors - there are workarounds Status:Fix Proposed A issue that has a PR related to it that provides a possible resolution Type: Bug Bugs within the core SuiteCRM codebase
Projects
None yet
Development

No branches or pull requests

2 participants