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

Can not save transition of workflow for extension without workflow plugins #44447

Open
softarius opened this issue Nov 13, 2024 · 3 comments
Open

Comments

@softarius
Copy link
Contributor

Steps to reproduce the issue

Go index.php?option=com_workflow&view=workflows&extension=com_contact
Create and save new Workflow
Click Transitions and create new transitions
Type name of transition and try click Save or Save & Close

Expected result

Saved transition

Actual result

Save failed with the following error ... "options" .. "cms_workflow_transitions" .. NOT NULL DETAIL

System information (as much as possible)

Joomla 5.2.1
PHP 8.1
Postgresql

Additional comments

I fixed it just

ALTER TABLE #__workflow_transitions
  ALTER COLUMN options SET DEFAULT '{}';
@richard67
Copy link
Member

richard67 commented Nov 13, 2024

I fixed it just

ALTER TABLE #__workflow_transitions
ALTER COLUMN options SET DEFAULT '{}';

@softarius This will casue an SQL error on MySQL 8 as on MySQL 8, columns with TEXT data types (TINYTEXT, TEXT, MEDIUMTEXT, and LONGTEXT) are not allowed to have a default value. See https://dev.mysql.com/doc/refman/8.0/en/blob.html :

BLOB and TEXT columns cannot have DEFAULT values.

See also PR #27937 .

P.S.: I know, your issue and your fix are for PostgreSQL. But we want to have consistent data structures on all kinds of databases so data can be ported, that's why we also don't use default values on TEXT columns in PostgreSQL anymore.

@softarius
Copy link
Contributor Author

Well, whath about this patch?

diff --git "a/www/administrator/components/com_workflow/src/Model/TransitionModel.php" "b/www/administrator/components/com_workflow/src/Model/TransitionModel.php"
index a1db4c04..d3ce79ef 100644
--- "a/www/administrator/components/com_workflow/src/Model/TransitionModel.php"
+++ "b/www/administrator/components/com_workflow/src/Model/TransitionModel.php"
@@ -177,7 +177,9 @@ class TransitionModel extends AdminModel
 
             $data['published'] = 0;
         }
-
+        if (!key_exists('options', $data) || !$data['options']) {
+            $data['options'] = '{}';
+        }
         return parent::save($data);
     }
 

@richard67
Copy link
Member

@bembelimen Could you have a look on this issue and check the fix proposed in the previous comment?

@Hackwar Hackwar added the bug label Nov 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants