[BUG]: JCB Items "Checked Out" #1194

Open
opened 2024-12-04 00:57:31 +00:00 by mwweb · 6 comments

What Happened?

I noticed with my dev site I've been working on, and installed a fresh install of Joomla 5.1.1, installed JCB 5.0.3, and JCB rows in tables are checked out according to System --> Global Checkin. Even components that I create using JCB, and install, show as records as checked out as well.

Steps to reproduce the Bug

Install Joomla 5.x, install JCB 5.0.3, navigate to System --> Global Checkin. At last count there we 673 JCB items checked out, and are unable to check back in.

Which Joomla version are you compiling in?

5.2.2

Which PHP version are you compiling in?

8.2.21

Which Joomla versions are you targeting?

5.x

Which PHP version are you targeting?

8.2+

Which Web server is JCB running on?

Apache/2.4.59 (Debian)

Which Relational Database is JCB running on?

11.4.2-MariaDB-ubu2404

Which OS is JCB running on?

Ubuntu 22.04.4 LTS

Which JCB version are you using?

v5.0.3

Where in JCB did this issue occur?

Installation of a component, Installation JCB pkg

On which browsers did you encounter the issue?

Firefox

Additional Comments

Looking at Joomla tables, checked_out is set to NULL, default NULL. When an item is checked out, it looks like the item is checked out with the Joomla user ID from the user table. When the user closes (checks in) the item, the checked_out field reverts to NULL.

In JCB the checked_out field correctly checks out by the Joomla user, but when the item is checked in, the checked_out field does not revert to NULL, but instead reverts to 0.

Manually changing checked_out from 0 to null in the DB clears the "issue" and no longer shows the item as checked out.

### What Happened? I noticed with my dev site I've been working on, and installed a fresh install of Joomla 5.1.1, installed JCB 5.0.3, and JCB rows in tables are checked out according to System --> Global Checkin. Even components that I create using JCB, and install, show as records as checked out as well. ### Steps to reproduce the Bug Install Joomla 5.x, install JCB 5.0.3, navigate to System --> Global Checkin. At last count there we 673 JCB items checked out, and are unable to check back in. ### Which Joomla version are you compiling in? 5.2.2 ### Which PHP version are you compiling in? 8.2.21 ### Which Joomla versions are you targeting? 5.x ### Which PHP version are you targeting? 8.2+ ### Which Web server is JCB running on? Apache/2.4.59 (Debian) ### Which Relational Database is JCB running on? 11.4.2-MariaDB-ubu2404 ### Which OS is JCB running on? Ubuntu 22.04.4 LTS ### Which JCB version are you using? v5.0.3 ### Where in JCB did this issue occur? Installation of a component, Installation JCB pkg ### On which browsers did you encounter the issue? Firefox ### Additional Comments Looking at Joomla tables, checked_out is set to NULL, default NULL. When an item is checked out, it looks like the item is checked out with the Joomla user ID from the user table. When the user closes (checks in) the item, the checked_out field reverts to NULL. In JCB the checked_out field correctly checks out by the Joomla user, but when the item is checked in, the checked_out field does not revert to NULL, but instead reverts to 0. Manually changing checked_out from 0 to null in the DB clears the "issue" and no longer shows the item as checked out.
mwweb added the
Bug
label 2024-12-04 00:57:31 +00:00
mwweb changed title from [BUG]: JCB Fields "Checked Out" to [BUG]: JCB Items "Checked Out" 2024-12-04 00:57:49 +00:00
Owner

Thanks for your detailed explanation of the issue—it’s very helpful in pinpointing the problem.

After reviewing the current JCB behavior and Joomla's conventions, I noticed that JCB sets the checked_out field to 0 as the default and reverts to 0 upon check-in. However, Joomla’s expected behavior is for the checked_out field to revert to NULL when an item is checked in as you pointed out.

I will add the fix to this in the next update, and then bump this issue again for testing 👍

Thanks for your detailed explanation of the issue—it’s very helpful in pinpointing the problem. After reviewing the current JCB behavior and Joomla's conventions, I noticed that JCB sets the `checked_out` field to `0` as the default and reverts to `0` upon check-in. However, Joomla’s expected behavior is for the `checked_out` field to revert to `NULL` when an item is checked in as you pointed out. I will add the fix to this in the next update, and then bump this issue again for testing 👍
Owner

JCB v5.0.4-beta2 has now been updated to fix this issue.

JCB [v5.0.4-beta2](https://git.vdm.dev/joomla/pkg-component-builder/archive/v5.0.4-beta2.zip) has now been updated to fix this issue.
Author

I tested on a fresh install and it works. However, it appears that if upgrading an existing install of JCB, example have JCB 5.0.3 installed, and install 5.0.4-beta2, you will have to go through each DB table, update the field default value to null, then run an sql query to update the value in each row.

If the tables were updated to default=NULL, then Joomla checkin could check everything in with the push of a button.

I tested on a fresh install and it works. However, it appears that if upgrading an existing install of JCB, example have JCB 5.0.3 installed, and install 5.0.4-beta2, you will have to go through each DB table, update the field default value to null, then run an sql query to update the value in each row. If the tables were updated to default=NULL, then Joomla checkin could check everything in with the push of a button.
Owner

you will have to go through each DB table, update the field default value to null

If the tables were updated to default=NULL

I am not sure what you mean whit this statement, since this is exactly what we did in 5.0.4-beta2.

Look here is the code:

In the base table.
Here we act on this setting in the schema base checker.

This means it should happen during update of the JCB component automatically, if not I will need some help from your side... I will need more debugging information. Since we do not get the same issue, and would need to understand why it does not happen on your side.

> you will have to go through each DB table, update the field default value to null > If the tables were updated to default=NULL I am not sure what you mean whit this statement, since this **is exactly** what we did in 5.0.4-beta2. Look here is the code: In the [base table](https://git.vdm.dev/joomla/Component-Builder/src/commit/418624b63e2efe348eca9fd1860e6dd925c2670b/libraries/vendor_jcb/VDM.Joomla/src/Abstraction/BaseTable.php#L112). Here we act on this setting in the [schema base checker](https://git.vdm.dev/joomla/Component-Builder/src/commit/418624b63e2efe348eca9fd1860e6dd925c2670b/libraries/vendor_jcb/VDM.Joomla/src/Abstraction/Schema.php#L476). This means it should happen during update of the JCB component automatically, if not I will need some help from your side... I will need more debugging information. Since we do not get the same issue, and would need to understand why it does not happen on your side.
Author

I just tested, by creating a new Joomla Container in Octojoom for J!5.2.3. I then installed JCB 5.0.3.

I checked the DB and checked_out in JCB fields was Null Yes, Default 0.

After that, I installed JCB 5.1.0-rc1, and after install those fields appear to be unchanged. I have checked several fields.

I just tested, by creating a new Joomla Container in Octojoom for J!5.2.3. I then installed JCB 5.0.3. I checked the DB and checked_out in JCB fields was Null Yes, Default 0. After that, I installed JCB 5.1.0-rc1, and after install those fields appear to be unchanged. I have checked several fields.
Owner

Can you give me the generated mysql and BaseTable.php (for Joomla 5)? here is what I get.. see install zip.

`checked_out` int unsigned,

The more, if I check the table file that runs an update (checking the table schema) here is that file... see that basetable zip.

'checked_out' => [
	'name' => 'checked_out',
	'label' => NULL,
	'type' => NULL,
	'title' => false,
	'list' => NULL,
	'store' => NULL,
	'tab_name' => NULL,
	'db' => [
		'type' => 'INT unsigned',
		'null_switch' => 'NULL',
		'key' => true,
		'key_name' => 'checkout'
	]
]

These are the only two file I know that effect the database during the installation and both these do not set the field default to 0

Can you give me the generated mysql and BaseTable.php (for Joomla 5)? here is what I get.. see install zip. ``` `checked_out` int unsigned, ``` The more, if I check the table file that runs an update (checking the table schema) here is that file... see that basetable zip. ``` 'checked_out' => [ 'name' => 'checked_out', 'label' => NULL, 'type' => NULL, 'title' => false, 'list' => NULL, 'store' => NULL, 'tab_name' => NULL, 'db' => [ 'type' => 'INT unsigned', 'null_switch' => 'NULL', 'key' => true, 'key_name' => 'checkout' ] ] ``` These are the only two file I know that effect the database during the installation and both these do not set the field default to `0`
Sign in to join this conversation.
No Milestone
No project
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: joomla/Component-Builder#1194
No description provided.