{"action":"created","issue":{"url":"https://api.github.com/repos/joomla/joomla-cms/issues/3190","labels_url":"https://api.github.com/repos/joomla/joomla-cms/issues/3190/labels{/name}","comments_url":"https://api.github.com/repos/joomla/joomla-cms/issues/3190/comments","events_url":"https://api.github.com/repos/joomla/joomla-cms/issues/3190/events","html_url":"https://github.com/joomla/joomla-cms/pull/3190","id":28355504,"number":3190,"title":"[#33348] fix JModelAdmin::publish()","user":{"login":"itbra","id":2728569,"avatar_url":"https://avatars.githubusercontent.com/u/2728569?v=3","gravatar_id":"","url":"https://api.github.com/users/itbra","html_url":"https://github.com/itbra","followers_url":"https://api.github.com/users/itbra/followers","following_url":"https://api.github.com/users/itbra/following{/other_user}","gists_url":"https://api.github.com/users/itbra/gists{/gist_id}","starred_url":"https://api.github.com/users/itbra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/itbra/subscriptions","organizations_url":"https://api.github.com/users/itbra/orgs","repos_url":"https://api.github.com/users/itbra/repos","events_url":"https://api.github.com/users/itbra/events{/privacy}","received_events_url":"https://api.github.com/users/itbra/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/joomla/joomla-cms/labels/PR-staging","name":"PR-staging","color":"c7def8"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2014-02-26T18:11:41Z","updated_at":"2015-05-06T05:46:20Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/joomla/joomla-cms/pulls/3190","html_url":"https://github.com/joomla/joomla-cms/pull/3190","diff_url":"https://github.com/joomla/joomla-cms/pull/3190.diff","patch_url":"https://github.com/joomla/joomla-cms/pull/3190.patch"},"body":"Fixing issue described in [bug #33348](http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_id=8103&tracker_item_id=33348), related to JModelAdmin (libraries/legacy/model/admin.php)\r\n\r\nWhen trying to publish an item, the related table might be(en) checked out by another user. Thus, publishing will fail silently, since the table is going to try to check in only if is not checked out at all or if the user trying to check it in equals the one having checked it out. If they mismatch nothing is stated to the user trying to change its state, which is no good. So i added a check for this circumstance."},"comment":{"url":"https://api.github.com/repos/joomla/joomla-cms/issues/comments/99331008","html_url":"https://github.com/joomla/joomla-cms/pull/3190#issuecomment-99331008","issue_url":"https://api.github.com/repos/joomla/joomla-cms/issues/3190","id":99331008,"user":{"login":"roland-d","id":359377,"avatar_url":"https://avatars.githubusercontent.com/u/359377?v=3","gravatar_id":"","url":"https://api.github.com/users/roland-d","html_url":"https://github.com/roland-d","followers_url":"https://api.github.com/users/roland-d/followers","following_url":"https://api.github.com/users/roland-d/following{/other_user}","gists_url":"https://api.github.com/users/roland-d/gists{/gist_id}","starred_url":"https://api.github.com/users/roland-d/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/roland-d/subscriptions","organizations_url":"https://api.github.com/users/roland-d/orgs","repos_url":"https://api.github.com/users/roland-d/repos","events_url":"https://api.github.com/users/roland-d/events{/privacy}","received_events_url":"https://api.github.com/users/roland-d/received_events","type":"User","site_admin":false},"created_at":"2015-05-06T05:46:20Z","updated_at":"2015-05-06T05:46:20Z","body":"@itbra I agree with your comment that the checked out status should be taken into account of the reorder/saveorder actions.\r\n\r\nHowever I think we should fix it a little higher up in the chain. If you look at JTable::published() we have the checked out check there as well. This code:\r\n```php\r\n// Determine if there is checkin support for the table.\r\nif (property_exists($this, 'checked_out') || property_exists($this, 'checked_out_time'))\r\n{\r\n\t$query->where('(' . $this->getColumnAlias('checked_out') . ' = 0 OR ' . $this->getColumnAlias('checked_out') . ' = ' . (int) $userId . ')');\r\n\t$checkin = true;\r\n}\r\nelse\r\n{\r\n\t$checkin = false;\r\n}\r\n```\r\n\r\nNot sure if we can/should wrap this into a method of it's own. You are setting 2 values here and it is only a single if/else block. Using this block in the existing methods might be just as effective as you don't have to juggle with parameters and return values.\r\n\r\nThat is my idea."}}