Exemple #1
0
/**
 * Add or replace the attachment on a Note.
 *
 * @param String $session -- Session ID returned by a previous call to login.
 * @param Binary $note -- The flie contents of the attachment.
 * @return Array 'id' -- The ID of the new note or -1 on error
 *               'error' -- The SOAP error if any.
 */
function set_note_attachment($session, $note)
{
    $error = new SoapError();
    if (!validate_authenticated($session)) {
        $error->set_error('invalid_login');
        return array('id' => -1, 'error' => $error->get_soap_array());
    }
    require_once 'modules/Notes/NoteSoap.php';
    $ns = new NoteSoap();
    return array('id' => $ns->saveFile($note), 'error' => $error->get_soap_array());
}
function portal_set_note_attachment($session, $note)
{
    $error = new SoapError();
    if (!portal_validate_authenticated($session)) {
        $error->set_error('invalid_session');
        return array('id' => '-1', 'error' => $error->get_soap_array());
    }
    if ($_SESSION['type'] == 'lead' || !isset($_SESSION['viewable']['Notes'][$note['id']])) {
        $error->set_error('no_access');
        return array('id' => -1, 'error' => $error->get_soap_array());
    }
    require_once 'modules/Notes/NoteSoap.php';
    $ns = new NoteSoap();
    $id = $ns->saveFile($note, true);
    return array('id' => $id, 'error' => $error->get_soap_array());
}