Exemplo n.º 1
0
 /**
  * Add or replace the attachment on a Note.
  * Optionally you can set the relationship of this note to Accounts/Contacts and so on by setting related_module_id, related_module_name
  *
  * @param String $session -- Session ID returned by a previous call to login.
  * @param Array 'note' -- Array String 'id' -- The ID of the Note containing the attachment
  *                              String 'filename' -- The file name of the attachment
  *                              Binary 'file' -- The binary contents of the file.
  * 								String 'related_module_id' -- module id to which this note to related to
  * 								String 'related_module_name' - module name to which this note to related to
  *
  * @return Array 'id' -- String - The ID of the Note
  * @exception 'SoapFault' -- The SOAP error, if any
  */
 function set_note_attachment($session, $note)
 {
     $GLOBALS['log']->info('Begin: SugarWebServiceImpl->set_note_attachment');
     $error = new SoapError();
     $module_name = '';
     $module_access = '';
     $module_id = '';
     if (!empty($note['related_module_id']) && !empty($note['related_module_name'])) {
         $module_name = $note['related_module_name'];
         $module_id = $note['related_module_id'];
         $module_access = 'read';
     }
     if (!self::$helperObject->checkSessionAndModuleAccess($session, 'invalid_session', $module_name, $module_access, 'no_access', $error)) {
         $GLOBALS['log']->info('End: SugarWebServiceImpl->set_note_attachment');
         return;
     }
     // if
     require_once 'modules/Notes/NoteSoap.php';
     $ns = new NoteSoap();
     $GLOBALS['log']->info('End: SugarWebServiceImpl->set_note_attachment');
     return array('id' => $ns->newSaveFile($note));
 }
/**
 * Add or replace the attachment on a Note. 
 * Optionally you can set the relationship of this note to Accounts/Contacts and so on by setting related_module_id, related_module_name
 *
 * @param String $session -- Session ID returned by a previous call to login.
 * @param Array 'note' -- Array String 'id' -- The ID of the Note containing the attachment
 *                              String 'filename' -- The file name of the attachment
 *                              Binary 'file' -- The binary contents of the file.
 * 								String 'related_module_id' -- module id to which this note to related to
 * 								String 'related_module_name' - module name to which this note to related to
 * 
 * @return Array 'id' -- The ID of the Note
 * @exception 'SoapFault' -- The SOAP error, if any
 */
function new_set_note_attachment($session, $note)
{
    $error = new SoapError();
    $module_name = '';
    $module_access = '';
    $module_id = '';
    if (!empty($note['related_module_id']) && !empty($note['related_module_name'])) {
        $module_name = $note['related_module_name'];
        $module_id = $note['related_module_id'];
        $module_access = 'read';
    }
    if (!checkSessionAndModuleAccess($session, 'invalid_session', $module_name, $module_access, 'no_access', $error)) {
        return;
    }
    // if
    require_once 'modules/Notes/NoteSoap.php';
    $ns = new NoteSoap();
    return array('id' => $ns->newSaveFile($note));
}