public function deleteAttachment($nb_attachment) : bool
    {
        $retval = false;
        $nb_attachment_id = nb_getMixedValue($nb_attachment, NABU_ICONTACT_PROSPECT_ATTACHMENT_FIELD_ID);

        if (is_numeric($nb_attachment_id)) {
            $nb_attachment = $this->nb_attachment_list->getItem($nb_attachment_id);
            if ($nb_attachment->getIContactProspectId() == $this->getId()) {
                $nb_attachment->deleteFile();
                $this->nb_attachment_list->removeItem($nb_attachment);
                $nb_attachment->delete();

                $retval = true;
            }
        }

        return $retval;
    }
public function deleteAttachment($nb_attachment) : bool
    {
        $retval = false;
        $nb_attachment_id = nb_getMixedValue($nb_attachment, NABU_ICONTACT_PROSPECT_ATTACHMENT_FIELD_ID);

        if (is_numeric($nb_attachment_id)) {
            $nb_attachment = $this->nb_attachment_list->getItem($nb_attachment_id);
            if ($nb_attachment->getIContactProspectId() == $this->getId()) {
                $nb_attachment->deleteFile();
                $this->nb_attachment_list->removeItem($nb_attachment);
                $nb_attachment->delete();

                $retval = true;
            }
        }

        return $retval;
    }
public function deleteAttachment ( $ nb_attachment ) : bool { $ retval = false ; $ nb_attachment_id = nb_getMixedValue ( $ nb_attachment , NABU_ICONTACT_PROSPECT_ATTACHMENT_FIELD_ID ) ; if ( is_numeric ( $ nb_attachment_id ) ) { $ nb_attachment = $ this -> nb_attachment_list -> getItem ( $ nb_attachment_id ) ; if ( $ nb_attachment -> getIContactProspectId ( ) == $ this -> getId ( ) ) { $ nb_attachment -> deleteFile ( ) ; $ this -> nb_attachment_list -> removeItem ( $ nb_attachment ) ; $ nb_attachment -> delete ( ) ; $ retval = true ; } } return $ retval ; }
Delete an Attachment from the list if exists.
@param mixed $nb_attachment A CNabuDataObject containing a field named nb_icontact_prospect_attachment_id
or a valid Id.
@return bool Returns true if the Attachment exists and was deleted.
@throws ENabuIContactException Raises an exception if something happens while delete
the attachment in the storage.
Delete an Attachment from the list if exists .