aljawaid / AddressBook

A dedicated Address Book for projects and tasks in Kanboard. Add custom properties to standardise a relationship between tasks and people or organisations.
MIT License
9 stars 2 forks source link

Undefined Index for Delete Property Button #2

Closed aljawaid closed 1 year ago

aljawaid commented 1 year ago

In Kanboard, why do I get undefined index for this code whenever I click the button?

[php7:notice] PHP Notice:  Trying to access array offset on value of type null in /var/www/.../public_html/app/Helper/LayoutHelper.php on line 90
[php7:notice] PHP Notice:  Undefined index: project in /var/www/.../public_html/app/Helper/LayoutHelper.php on line 91

I click this in a button:

<a href="<?= $this->url->href('ContactsItemsController', 'confirm', array('item_id' => $item['id'], 'plugin' => 'AddressBook'), false, '', false) ?>" class="btn btn-ab-delete js-modal-medium" title="<?=t('Delete Property') ?>">
<i class="fa fa-trash-o" aria-hidden="true"></i> <?= t('Delete') ?>
</a>

I read that isset is a solution but if using isset is the solution, where do I place it? I can't figure it out.

I tried:

<a href="<?= $this->url->href('ContactsItemsController', 'confirm', array('item_id' => isset($item['id']), 'plugin' => 'AddressBook'), false, '', false) ?>" class="btn btn-ab-delete js-modal-medium" title="<?=t('Delete Property') ?>">
<i class="fa fa-trash-o" aria-hidden="true"></i> <?= t('Delete') ?>
</a>

But that never worked. Also, it is suggesting project in the error, and there is no mention of project in the code. The function of the actual code works fine.

Line 90-91 that the error is referring to is the elseif part of the below function:

public function project($template, array $params, $sidebar = 'project/sidebar')
    {
        if (empty($params['title'])) {
            $params['title'] = $params['project']['name'];
        } elseif ($params['project']['name'] !== $params['title']) {
            $params['title'] = $params['project']['name'].' &gt; '.$params['title'];
        }

        return $this->subLayout('project/layout', $sidebar, $template, $params);
    }