Vox Populi(x) forum

Alexandria Book Library => Errori (Bugs) => Topic started by: iberan on 29 November 2018, 23:34:06

Title: Unable delete any item from books list after upgraded Joomla to 3.9.1
Post by: 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/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.

Title: Re: Unable delete any item from books list after upgraded Joomla to 3.9.1
Post by: iberan on 30 November 2018, 07:25:54
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.
Title: Re: Unable delete any item from books list after upgraded Joomla to 3.9.1
Post by: federica on 30 November 2018, 17:08:18
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".
Title: Re: Unable delete any item from books list after upgraded Joomla to 3.9.1
Post by: iberan on 30 November 2018, 22:07:46
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!
Title: Re: Unable delete any item from books list after upgraded Joomla to 3.9.1
Post by: federica on 02 December 2018, 12:03:49
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!