Author Topic: Unable delete any item from books list after upgraded Joomla to 3.9.1  (Read 155 times)

Offline iberan

  • Coccinella
  • *
  • Posts: 3
  • Karma: +0/-0
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:

Code: [Select]
// 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:

Code: [Select]

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

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

I hope it helps someone.


Offline iberan

  • Coccinella
  • *
  • Posts: 3
  • Karma: +0/-0
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:

Code: [Select]
// 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:

Code: [Select]

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

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

I hope it helps someone.

Offline federica

  • Amministratore
  • Delfino
  • *****
  • Posts: 980
  • Karma: +1/-0
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.
http://www.antivirushelp.it
stacca la spina!

Offline iberan

  • Coccinella
  • *
  • Posts: 3
  • Karma: +0/-0
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:

Code: [Select]
KEY `idx_idauth` (`idtag`)
to this:

Code: [Select]
KEY `idx_idtag` (`idtag`)
Have a nice December!

Offline federica

  • Amministratore
  • Delfino
  • *****
  • Posts: 980
  • Karma: +1/-0
Ok I agree to keep "state" field.

Quote
But I propose you to fix a little "copy-paste" bug in the install.sql
Sure!  :-[ Horrible error!
« Last Edit: 02 December 2018, 12:06:07 by federica »
Al mondo ci sono 10 tipi di persone, quelli che hanno capito il codice binario e quelli che non l'hanno capito.
http://www.antivirushelp.it
stacca la spina!