Unable delete any item from books list after upgraded Joomla to 3.9.1

Started by iberan, 29 November 2018, 23:34:06

Previous topic - Next topic
A financial contribution is greatly appreciated as a support, to help us to keep live the project.
If you like this project you can donate some piece of BitCoin to this address: bc1qy5tgq6tvrckac2a57unxvqcnxamrvhduve9sj9

iberan

Experienced this strange surprise after upgraded Joomla to 3.9.1: you can't use some important actions (ie. publish/unpublish, delete items) in books list.

After a couple of days I'd localize the reason: there is a new getColumnAlias() method in /libraries/sec/MVC/Model/AdminModel.php core file at #1065:


// Prune items that are already at the given state

if ($table->get($table->getColumnAlias('published'), $value) == $value)

{
unset($pks[$i]);

continue;

}

}


Resolved via Joomla Documentation Wiki (https://docs.joomla.org/Column_alias) you may enter setColumnAlias() method at the beginning of /administrator/components/com_abook/tables/book.php:


class AbookTableBook extends JTable
{
public function __construct(&$db)
        {
        parent::__construct('#__ibfolktrack', 'id', $db);

$this->setColumnAlias('published', 'state');
        }
.
.
.


I hope it helps someone.


A financial contribution is greatly appreciated as a support, to help us to keep live the project.
If you like this project you can donate some piece of BitCoin to this address: bc1qy5tgq6tvrckac2a57unxvqcnxamrvhduve9sj9

iberan

Quote from: iberan on 29 November 2018, 23:34:06
Experienced this strange surprise after upgraded Joomla to 3.9.1: you can't use some important actions (ie. publish/unpublish, delete items) in books list.

After a couple of days I'd localize the reason: there is a new getColumnAlias() method in /libraries/src/MVC/Model/AdminModel.php core file at #1065:


// Prune items that are already at the given state

if ($table->get($table->getColumnAlias('published'), $value) == $value)

{
unset($pks[$i]);

continue;

}

}


Resolved via Joomla Documentation Wiki (https://docs.joomla.org/Column_alias) you may enter setColumnAlias() method at the beginning of /administrator/components/com_abook/tables/book.php:


class AbookTableBook extends JTable
{
public function __construct(&$db)
        {
        parent::__construct('#__ibfolktrack', 'id', $db);

$this->setColumnAlias('published', 'state');
       }
.
.
.


I hope it helps someone.

federica

Hi iberan,
thank you very much!!! I will apply this fix in the next version.

In your opinion is it better I rename "state" field in both database and code?
In joomla documentation it is unrecommended to use "state" field but in #__content table there is "state" field instead of "published".
Al mondo ci sono 10 tipi di persone, quelli che hanno capito il codice binario e quelli che non l'hanno capito.
[url=http://www.antivirushelp.it]http://www.antivirushelp.it[/url]
[url=http://www.disconnessi.org]stacca la spina![/url]

iberan

Hi federica,

You are welcome, I respect your work!

As I think it is more than enough if you make this fix setColumnAlias() and no need to rename state to published. There are a lot of third party components with state field.

But I propose you to fix a little "copy-paste" bug in the install.sql at #82.

Please change this:

KEY `idx_idauth` (`idtag`)

to this:

KEY `idx_idtag` (`idtag`)

Have a nice December!

A financial contribution is greatly appreciated as a support, to help us to keep live the project.
If you like this project you can donate some piece of BitCoin to this address: bc1qy5tgq6tvrckac2a57unxvqcnxamrvhduve9sj9

federica

Ok I agree to keep "state" field.

QuoteBut I propose you to fix a little "copy-paste" bug in the install.sql
Sure!  :-[ Horrible error!
Al mondo ci sono 10 tipi di persone, quelli che hanno capito il codice binario e quelli che non l'hanno capito.
[url=http://www.antivirushelp.it]http://www.antivirushelp.it[/url]
[url=http://www.disconnessi.org]stacca la spina![/url]