mirror of
https://github.com/SuiteCRM/SuiteCRM.git
synced 2026-03-02 19:16:58 -05:00
Bug - When uploading the file, the correct file name is not set, while setting permissions in logichook - after_relationship_add #4136
Labels
No labels
Area: API
Area: Campaigns
Area: Cases
Area: Clean Up
Area: Clean Up: Performance
Area: Dashlets
Area: Databases
Area: Developer Tools
Area: Elasticsearch
Area: Elasticsearch
Area: Emails
Area: Emails:Campaigns
Area: Emails:Cases
Area: Emails:Compose
Area: Emails:Config
Area: Emails:Templates
Area: Environment
Area: Installation
Area: Language
Area: Mobile
Area: Module
Area: PDFs
Area: PHP8
Area: Reports
Area: Studio
Area: Styling
Area: Upgrading
Area: Workflow
Area:Activity Stream
Area:Calls
Area:Import
Area:Projects
Area:Search
Area:Surveys
Area:Themes
Area:Users
Branch:Hotfix
Good First Issue
Hacktoberfest
Help Wanted
PR:Community Contribution
PR:Type:Enhancement
Priority:Critical
Priority:Important
Priority:Moderate
Severity: Major
Severity: Minor
Severity: Moderate
Status: Requires Code Review
Status: Requires Updates
Status: Stale
Status: Team Investigating
Status:Assessed
Status:Fix Proposed
Status:Needs Assessed
Status:Requires Automated Tests
Type: Bug
Type:Deprecated
Type:Discussion
Type:Duplicate
Type:Invalid
Type:Question
Type:Suggestion
Type:Suggestion
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/SuiteCRM-SuiteCRM#4136
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Ortman123 on GitHub (Nov 24, 2019).
Issue
In the AOS_Contracts module, I created logic_hook after_relationship_add to set permissions for attached documents. When the document was created in the AOS_Contrats module in the documents subpanel, an error appears when trying to check its content.
If the file is created in the Documents module and then add a link to the Contract than is ok.
Expected Behavior
changing the file name to valid or document_revision_id in the database
Actual Behavior
Error in suitecrm.log:
[1b191896-0b35-c7bb-f09a-5b18c84cf2f1][FATAL] Mysqli_query failed.
[1b191896-0b35-c7bb-f09a-5b18c84cf2f1][FATAL] Query Failed: INSERT INTO documents_cstm (id_c ,add_view_sec_1_c ) VALUES ('3a3108bc-bdc5-fcca-dd05-5e14bc83acd6' ,'^^' ): MySQL error 1062: Duplicate entry '3a3108bc-bdc5-fcca-dd05-5e14bc83acd6' for key 'PRIMARY'
[1b191896-0b35-c7bb-f09a-5b18c84cf2f1][FATAL] Mysqli_query failed.
[1b191896-0b35-c7bb-f09a-5b18c84cf2f1][FATAL] Error inserting into table: documents: Query Failed: INSERT INTO documents (id,date_entered,date_modified,modified_user_id,created_by,description,deleted,assigned_user_id,document_name,doc_id,doc_type,doc_url,active_date,exp_date,category_id,status_id,document_revision_id,is_template) VALUES ('3a3108bc-bdc5-fcca-dd05-5e14bc83acd6','2020-01-07 17:15:10','2020-01-07 17:15:10','1b191896-0b35-c7bb-f09a-5b18c84cf2f1','1b191896-0b35-c7bb-f09a-5b18c84cf2f1','',0,'1b191896-0b35-c7bb-f09a-5b18c84cf2f1','test30','','Sugar','','2020-01-07',NULL,'contracts','Active','22e4a3d1-9870-4555-79c9-5e14bcb265b6',0): MySQL error 1062: Duplicate entry '3a3108bc-bdc5-fcca-dd05-5e14bc83acd6' for key 'PRIMARY'
[1b191896-0b35-c7bb-f09a-5b18c84cf2f1][FATAL] Exception handling in /var/www/html/SuiteCRM/include/MVC/Controller/SugarController.php:400
[1b191896-0b35-c7bb-f09a-5b18c84cf2f1][FATAL] Exception in Controller: Database Error. Details were recorded in the SuiteCRM log.
[1b191896-0b35-c7bb-f09a-5b18c84cf2f1][FATAL] backtrace:
#0 /var/www/html/SuiteCRM/include/database/DBManager.php(353): sugar_die('Database Err...')
#1 /var/www/html/SuiteCRM/include/database/DBManager.php(328): DBManager->registerError('Error inserting...', 'Error inserting...', true)
#2 /var/www/html/SuiteCRM/include/database/MysqliManager.php(179): DBManager->checkError('Error inserting...', true)
#3 /var/www/html/SuiteCRM/include/database/DBManager.php(519): MysqliManager->query('INSERT INTO doc...', true, 'Error inserting...')
#4 /var/www/html/SuiteCRM/data/SugarBean.php(2411): DBManager->insert(Object(Document))
#5 /var/www/html/SuiteCRM/include/SugarObjects/templates/file/File.php(98): SugarBean->save(false)
#6 /var/www/html/SuiteCRM/modules/Documents/Document.php(219): File->save(false)
Error in apache after upload files: "PHP Warning: rename (upload / 8fcd69c1-5550-4556-e64d-5ddad04c3859, upload / b7972d35-162c-e430-5b17-5ddad0cf3020): No such file or directory in /var/www/html/SuiteCRM-7.11.10/include /UploadStream.php on line 214, referer: https://xxx.xxx.xxx.xxx/index.php?action=ajaxui"
Invalid "document_revision_id" is visible in the database, manual file name change is required.
Possible Fix
Steps to Reproduce
Context
It is not possible to simultaneously upload the file and set securitygroups permissions.
Your Environment
@samus-aran commented on GitHub (Jul 28, 2020):
I have a feeling this is expected behaviour to be honest. You are saving in an after relationship add with adding a relationship. The thing that is throwing me is your SQL error saying it's a duplicate document. There must be some loop somewhere to be kicking that off.
@serhiisamko091184 commented on GitHub (Mar 14, 2024):
Hello, @Ortman123
The issue has been marked as stale because there has been no recent activity. It will be closed if no further activity occurs.
Thanks for your contributions.
Regards,
Serhii
@serhiisamko091184 commented on GitHub (Apr 8, 2024):
Hey @Ortman123
Closing this issue due to inactivity.
Thank you.
Regards,
Serhii