Default is true and check entity if the objet is entity assign
May be overloaded if needed
public canCreateItem ( ) : booleen | ||
return | booleen |
function canCreateItem() { // From Ticket Document Tab => check right to add followup. if (isset($this->fields['tickets_id']) && $this->fields['tickets_id'] > 0) { $ticket = new Ticket(); if ($ticket->getFromDB($this->fields['tickets_id'])) { return $ticket->canAddFollowups(); } } if (Session::haveRight('document', 'w')) { return parent::canCreateItem(); } return false; }
function canCreateItem() { if (isset($this->input['itemtype']) && isset($this->input['items_id'])) { if ($item = getItemForItemtype($this->input['itemtype'])) { if ($item->canAddItem('Document')) { return true; } } } // From Ticket Document Tab => check right to add followup. if (isset($this->fields['tickets_id']) && $this->fields['tickets_id'] > 0) { $ticket = new Ticket(); if ($ticket->getFromDB($this->fields['tickets_id'])) { return $ticket->canAddFollowups(); } } if (Session::haveRight('document', 'w')) { return parent::canCreateItem(); } return false; }
/** * Special case: a private bookmark has entities_id==-1 => we cannot check it * @see CommonDBTM::canCreateItem() * * @since version 0.85 **/ function canCreateItem() { if ($this->fields['is_private'] == 1 && $this->fields['users_id'] == Session::getLoginUserID()) { return true; } return parent::canCreateItem(); }