Editor 1.4.1 delete row error

Editor 1.4.1 delete row error

allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

Hi all,

This is a general notice to let you know about a bug in Editor 1.4.1 that effects non-joined tables (i.e. no leftJoin()). Due to a bug in the software it is impossible to delete rows in such tables - the row will appear to be deleted on the client-side but will not be removed form the database.

This will be addressed in Editor 1.4.2 which will be released as an emergency fix on Friday 10th April.

In the mean time, if you wish to fix it directly, in the Editor.php file locate the private method _remove_table and replace it with:

    function _remove_table ( $table, $ids, $pkey=null )
    {
        if ( $pkey === null ) {
            $pkey = $this->_pkey;
        }

        // Check there is a field which has a set option for this table
        $count = 0;

        foreach ($this->_fields as $field) {
            if ( strpos( $field->dbField(), '.') === false || (
                    $this->_part( $field->dbField(), 'table' ) === $table &&
                    $field->set() !== Field::SET_NONE
                )
            ) {
                $count++;
            }
        }

        if ( $count > 0 ) {
            $this->_db
                ->query( 'delete' )
                ->table( $table )
                ->or_where( $pkey, $ids )
                ->exec();
        }
    }

Please accept my apologies for this error creeping through to a production release.

Regards,
Allan

Replies

This discussion has been closed.